UNPKG

4.35 kBTypeScriptView Raw
1import { CloudEvent, CloudFunction } from "../core";
2import { EventHandlerOptions } from "../options";
3/** Possible test states for a test matrix. */
4export type TestState =
5/** The default value. This value is used if the state is omitted. */
6"TEST_STATE_UNSPECIFIED"
7/** The test matrix is being validated. */
8 | "VALIDATING"
9/** The test matrix is waiting for resources to become available. */
10 | "PENDING"
11/** The test matrix has completed normally. */
12 | "FINISHED"
13/** The test matrix has completed because of an infrastructure failure. */
14 | "ERROR"
15/** The test matrix was not run because the provided inputs are not valid. */
16 | "INVALID";
17/** Outcome summary for a finished test matrix. */
18export type OutcomeSummary =
19/** The default value. This value is used if the state is omitted. */
20"OUTCOME_SUMMARY_UNSPECIFIED"
21/**
22 * The test matrix run was successful, for instance:
23 * - All test cases passed.
24 * - No crash of the application under test was detected.
25 */
26 | "SUCCESS"
27/**
28 * A run failed, for instance:
29 * - One or more test case failed.
30 * - A test timed out.
31 * - The application under test crashed.
32 */
33 | "FAILURE"
34/**
35 * Something unexpected happened. The test run should still be considered
36 * unsuccessful but this is likely a transient problem and re-running the
37 * test might be successful.
38 */
39 | "INCONCLUSIVE"
40/** All tests were skipped. */
41 | "SKIPPED";
42/** Locations where test results are stored. */
43export interface ResultStorage {
44 /**
45 * Tool Results history resource containing test results. Format is
46 * `projects/{project_id}/histories/{history_id}`.
47 * See https://firebase.google.com/docs/test-lab/reference/toolresults/rest
48 * for more information.
49 */
50 toolResultsHistory: string;
51 /**
52 * Tool Results execution resource containing test results. Format is
53 * `projects/{project_id}/histories/{history_id}/executions/{execution_id}`.
54 * Optional, can be omitted in erroneous test states.
55 * See https://firebase.google.com/docs/test-lab/reference/toolresults/rest
56 * for more information.
57 */
58 toolResultsExecution: string;
59 /** URI to the test results in the Firebase Web Console. */
60 resultsUri: string;
61 /**
62 * Location in Google Cloud Storage where test results are written to.
63 * In the form "gs://bucket/path/to/somewhere".
64 */
65 gcsPath: string;
66}
67/** Information about the client which invoked the test. */
68export interface ClientInfo {
69 /** Client name, such as "gcloud". */
70 client: string;
71 /** Map of detailed information about the client. */
72 details: Record<string, string>;
73}
74/** The data within all Firebase test matrix completed events. */
75export interface TestMatrixCompletedData {
76 /** Time the test matrix was created. */
77 createTime: string;
78 /** State of the test matrix. */
79 state: TestState;
80 /**
81 * Code that describes why the test matrix is considered invalid. Only set for
82 * matrices in the INVALID state.
83 */
84 invalidMatrixDetails: string;
85 /** Outcome summary of the test matrix. */
86 outcomeSummary: OutcomeSummary;
87 /** Locations where test results are stored. */
88 resultStorage: ResultStorage;
89 /** Information provided by the client that created the test matrix. */
90 clientInfo: ClientInfo;
91 /** ID of the test matrix this event belongs to. */
92 testMatrixId: string;
93}
94/**
95 * Event handler which triggers when a Firebase test matrix completes.
96 *
97 * @param handler - Event handler which is run every time a Firebase test matrix completes.
98 * @returns A Cloud Function that you can export and deploy.
99 * @alpha
100 */
101export declare function onTestMatrixCompleted(handler: (event: CloudEvent<TestMatrixCompletedData>) => any | Promise<any>): CloudFunction<CloudEvent<TestMatrixCompletedData>>;
102/**
103 * Event handler which triggers when a Firebase test matrix completes.
104 *
105 * @param opts - Options that can be set on an individual event-handling function.
106 * @param handler - Event handler which is run every time a Firebase test matrix completes.
107 * @returns A Cloud Function that you can export and deploy.
108 * @alpha
109 */
110export declare function onTestMatrixCompleted(opts: EventHandlerOptions, handler: (event: CloudEvent<TestMatrixCompletedData>) => any | Promise<any>): CloudFunction<CloudEvent<TestMatrixCompletedData>>;