UNPKG

7.82 kBTypeScriptView Raw
1import { CloudFunction, EventContext } from "../cloud-functions";
2/** Handle events related to Test Lab test matrices. */
3export declare function testMatrix(): TestMatrixBuilder;
4/** Builder used to create Cloud Functions for Test Lab test matrices events. */
5export declare class TestMatrixBuilder {
6 private triggerResource;
7 private options;
8 /** Handle a TestMatrix that reached a final test state. */
9 onComplete(handler: (testMatrix: TestMatrix, context: EventContext) => PromiseLike<any> | any): CloudFunction<TestMatrix>;
10}
11/** TestMatrix captures details about a test run. */
12export declare class TestMatrix {
13 /** Unique id set by the service. */
14 testMatrixId: string;
15 /** When this test matrix was initially created (ISO8601 timestamp). */
16 createTime: string;
17 /** Indicates the current progress of the test matrix */
18 state: TestState;
19 /**
20 * The overall outcome of the test matrix run. Only set when the test matrix
21 * state is FINISHED.
22 */
23 outcomeSummary?: OutcomeSummary;
24 /** For 'INVALID' matrices only, describes why the matrix is invalid. */
25 invalidMatrixDetails?: InvalidMatrixDetails;
26 /** Where the results for the matrix are located. */
27 resultStorage: ResultStorage;
28 /** Information about the client which invoked the test. */
29 clientInfo: ClientInfo;
30}
31/** Information about the client which invoked the test. */
32export declare class ClientInfo {
33 /** Client name, e.g. 'gcloud'. */
34 name: string;
35 /** Map of detailed information about the client which invoked the test. */
36 details: {
37 [key: string]: string;
38 };
39}
40/** Locations where the test results are stored. */
41export declare class ResultStorage {
42 /** A storage location within Google Cloud Storage (GCS) for the test artifacts. */
43 gcsPath?: string;
44 /** Id of the ToolResults History containing these results. */
45 toolResultsHistoryId?: string;
46 /**
47 * Id of the ToolResults execution that the detailed TestMatrix results are
48 * written to.
49 */
50 toolResultsExecutionId?: string;
51 /** URL to test results in Firebase Console. */
52 resultsUrl?: string;
53}
54/**
55 * The detailed reason that a Matrix was deemed INVALID.
56 *
57 * @remarks
58 * Possible values:
59 *
60 * - `DETAILS_UNAVAILABLE`: The matrix is INVALID, but there are no further details available.
61 *
62 * - `MALFORMED_APK`: The input app APK could not be parsed.
63 *
64 * - `MALFORMED_TEST_APK`: The input test APK could not be parsed.
65 *
66 * - `NO_MANIFEST`: The AndroidManifest.xml could not be found.
67 *
68 * - `NO_PACKAGE_NAME`: The APK manifest does not declare a package name.
69 *
70 * - `INVALID_PACKAGE_NAME`: The APK application ID is invalid.
71 *
72 * - `TEST_SAME_AS_APP`: The test package and app package are the same.
73 *
74 * - `NO_INSTRUMENTATION`: The test apk does not declare an instrumentation.
75 *
76 * - `NO_SIGNATURE`: The input app apk does not have a signature.
77 *
78 * - `INSTRUMENTATION_ORCHESTRATOR_INCOMPATIBLE`: The test runner class specified by
79 * user or in the test APK`s manifest file is not compatible with Android Test Orchestrator.
80 *
81 * - `NO_TEST_RUNNER_CLASS`: The test APK does not contain the test runner class
82 * specified by user or in the manifest file.
83 *
84 * - `NO_LAUNCHER_ACTIVITY`: A main launcher activity could not be found.
85 *
86 * - `FORBIDDEN_PERMISSIONS`: The app declares one or more permissions that are
87 * not allowed.
88 *
89 * - `INVALID_ROBO_DIRECTIVES`: There is a conflict in the provided
90 * robo_directives.
91 *
92 * - `INVALID_RESOURCE_NAME`: There is at least one invalid resource name in the
93 * provided robo directives.
94 *
95 * - `INVALID_DIRECTIVE_ACTION`: Invalid definition of action in the robo
96 * directives, e.g. a click or ignore action includes an input text field.
97 *
98 * - `TEST_LOOP_INTENT_FILTER_NOT_FOUND`: There is no test loop intent filter,
99 * or the one that is given is not formatted correctly.
100 *
101 * - `SCENARIO_LABEL_NOT_DECLARED`: The request contains a scenario label that
102 * was not declared in the manifest.
103 *
104 * - `SCENARIO_LABEL_MALFORMED`: There was an error when parsing a label value.
105 *
106 * - `SCENARIO_NOT_DECLARED`: The request contains a scenario number that was
107 * not declared in the manifest.
108 *
109 * - `DEVICE_ADMIN_RECEIVER`: Device administrator applications are not allowed.
110 *
111 * - `MALFORMED_XC_TEST_ZIP`: The zipped XCTest was malformed. The zip did not ]
112 * contain a single .xctestrun file and the contents of the
113 * DerivedData/Build/Products directory.
114 *
115 * - `BUILT_FOR_IOS_SIMULATOR`: The zipped XCTest was built for the iOS
116 * simulator rather than for a physical device.
117 *
118 * - `NO_TESTS_IN_XC_TEST_ZIP`: The .xctestrun file did not specify any test
119 * targets.
120 *
121 * - `USE_DESTINATION_ARTIFACTS`: One or more of the test targets defined in the
122 * .xctestrun file specifies "UseDestinationArtifacts", which is disallowed.
123 *
124 * - `TEST_NOT_APP_HOSTED`: XC tests which run on physical devices must have
125 * "IsAppHostedTestBundle" == "true" in the xctestrun file.
126 *
127 * - `PLIST_CANNOT_BE_PARSED`: An Info.plist file in the XCTest zip could not be
128 * parsed.
129 *
130 * - `NO_CODE_APK`: APK contains no code.
131 *
132 * - `INVALID_INPUT_APK`: Either the provided input APK path was malformed, the
133 * APK file does not exist, or the user does not have permission to access the
134 * APK file.
135 *
136 * - `INVALID_APK_PREVIEW_SDK`: APK is built for a preview SDK which is
137 * unsupported.
138 */
139export type InvalidMatrixDetails = "DETAILS_UNAVAILABLE" | "MALFORMED_APK" | "MALFORMED_TEST_APK" | "NO_MANIFEST" | "NO_PACKAGE_NAME" | "INVALID_PACKAGE_NAME" | "TEST_SAME_AS_APP" | "NO_INSTRUMENTATION" | "NO_SIGNATURE" | "INSTRUMENTATION_ORCHESTRATOR_INCOMPATIBLE" | "NO_TEST_RUNNER_CLASS" | "NO_LAUNCHER_ACTIVITY" | "FORBIDDEN_PERMISSIONS" | "INVALID_ROBO_DIRECTIVES" | "INVALID_RESOURCE_NAME" | "INVALID_DIRECTIVE_ACTION" | "TEST_LOOP_INTENT_FILTER_NOT_FOUND" | "SCENARIO_LABEL_NOT_DECLARED" | "SCENARIO_LABEL_MALFORMED" | "SCENARIO_NOT_DECLARED" | "DEVICE_ADMIN_RECEIVER" | "MALFORMED_XC_TEST_ZIP" | "BUILT_FOR_IOS_SIMULATOR" | "NO_TESTS_IN_XC_TEST_ZIP" | "USE_DESTINATION_ARTIFACTS" | "TEST_NOT_APP_HOSTED" | "PLIST_CANNOT_BE_PARSED" | "NO_CODE_APK" | "INVALID_INPUT_APK" | "INVALID_APK_PREVIEW_SDK";
140/**
141 * The state (i.e. progress) of a TestMatrix.
142 *
143 * @remarks
144 * Possible values:
145 *
146 * - `VALIDATING`: The matrix is being validated.
147 *
148 * - `PENDING`: The matrix is waiting for resources to become available.
149 *
150 * - `FINISHED`: The matrix has terminated normally. This means that the matrix
151 * level processing completed normally, but individual executions may be in an
152 * ERROR state.
153 *
154 * - `ERROR`: The matrix has stopped because it encountered an infrastructure
155 * failure.
156 *
157 * - `INVALID`: The matrix was not run because the provided inputs are not
158 * valid. E.g. the input file is not of the expected type, or is
159 * malformed/corrupt.
160 */
161export type TestState = "VALIDATING" | "PENDING" | "FINISHED" | "ERROR" | "INVALID";
162/**
163 * Outcome summary for a finished TestMatrix.
164 *
165 * @remarks
166 * Possible values:
167 *
168 * - `SUCCESS`: The test matrix run was successful, for instance:
169 * - All the test cases passed.
170 * - Robo did not detect a crash of the application under test.
171 *
172 * - `FAILURE`: The test run failed, for instance:
173 * - One or more test cases failed.
174 * - A test timed out.
175 * - The application under test crashed.
176 *
177 * - `INCONCLUSIVE`: Something unexpected happened. The run should still be
178 * considered unsuccessful but this is likely a transient problem and
179 * re-running the test might be successful.
180 *
181 * - `SKIPPED`: All tests were skipped, for instance:
182 * - All device configurations were incompatible.
183 */
184export type OutcomeSummary = "SUCCESS" | "FAILURE" | "INCONCLUSIVE" | "SKIPPED";