@empiricalrun/test-run 0.3.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/bin/index.js +9 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/run-all-tests.d.ts +3 -1
- package/dist/run-all-tests.d.ts.map +1 -1
- package/dist/run-all-tests.js +6 -5
- package/dist/run-specific-test.d.ts +1 -1
- package/dist/run-specific-test.d.ts.map +1 -1
- package/dist/run-specific-test.js +5 -4
- package/dist/types/index.d.ts +11 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +12 -0
- package/dist/utils/index.d.ts +7 -3
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +12 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/bin/index.js
CHANGED
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
const commander_1 = require("commander");
|
|
5
5
|
const __1 = require("..");
|
|
6
6
|
const dashboard_1 = require("../dashboard");
|
|
7
|
+
const types_1 = require("../types");
|
|
7
8
|
const utils_1 = require("../utils");
|
|
8
9
|
(async function main() {
|
|
9
10
|
// TODO: add support for suites
|
|
@@ -37,20 +38,24 @@ const utils_1 = require("../utils");
|
|
|
37
38
|
.filter((arg) => !optionsToStrip.includes(arg));
|
|
38
39
|
try {
|
|
39
40
|
let environmentSpecificProjects = [];
|
|
41
|
+
let platform = types_1.Platform.WEB;
|
|
40
42
|
if (process.env.TEST_RUN_ENVIRONMENT) {
|
|
41
43
|
const { environment, build } = await (0, dashboard_1.fetchEnvironmentAndBuild)();
|
|
44
|
+
platform = environment.platform;
|
|
42
45
|
environmentSpecificProjects = environment.playwright_projects;
|
|
43
46
|
await (0, utils_1.downloadBuild)(build);
|
|
47
|
+
process.env.BUILD_URL = build?.build_url;
|
|
44
48
|
}
|
|
45
|
-
const projectFilters = await (0, utils_1.generateProjectFilters)(
|
|
46
|
-
|
|
47
|
-
...environmentSpecificProjects,
|
|
48
|
-
|
|
49
|
+
const projectFilters = await (0, utils_1.generateProjectFilters)({
|
|
50
|
+
platform,
|
|
51
|
+
filteringSets: [...options.project, ...environmentSpecificProjects],
|
|
52
|
+
});
|
|
49
53
|
pwOptions.push(...projectFilters);
|
|
50
54
|
const { hasTestPassed } = await (0, __1.runTest)({
|
|
51
55
|
name: options.name,
|
|
52
56
|
dir: options.dir || "tests",
|
|
53
57
|
pwOptions: pwOptions.join(" "),
|
|
58
|
+
platform,
|
|
54
59
|
});
|
|
55
60
|
if (!hasTestPassed) {
|
|
56
61
|
process.exit(1);
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { TestRunParameters } from "./types";
|
|
|
4
4
|
* @export
|
|
5
5
|
* @param {TestRunParameters} { name, dir, pwOptions }
|
|
6
6
|
*/
|
|
7
|
-
export declare function runTest({ name, dir, pwOptions, }: TestRunParameters): Promise<{
|
|
7
|
+
export declare function runTest({ name, dir, pwOptions, platform, }: TestRunParameters): Promise<{
|
|
8
8
|
hasTestPassed: boolean;
|
|
9
9
|
}>;
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C;;;;GAIG;AACH,wBAAsB,OAAO,CAAC,EAC5B,IAAI,EACJ,GAAG,EACH,SAAS,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C;;;;GAIG;AACH,wBAAsB,OAAO,CAAC,EAC5B,IAAI,EACJ,GAAG,EACH,SAAS,EACT,QAAQ,GACT,EAAE,iBAAiB,GAAG,OAAO,CAAC;IAC7B,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC,CAMD"}
|
package/dist/index.js
CHANGED
|
@@ -8,10 +8,10 @@ const run_specific_test_1 = require("./run-specific-test");
|
|
|
8
8
|
* @export
|
|
9
9
|
* @param {TestRunParameters} { name, dir, pwOptions }
|
|
10
10
|
*/
|
|
11
|
-
async function runTest({ name, dir, pwOptions, }) {
|
|
11
|
+
async function runTest({ name, dir, pwOptions, platform, }) {
|
|
12
12
|
if (name) {
|
|
13
|
-
return await (0, run_specific_test_1.runSpecificTest)({ name, dir, pwOptions });
|
|
13
|
+
return await (0, run_specific_test_1.runSpecificTest)({ name, dir, pwOptions, platform });
|
|
14
14
|
}
|
|
15
|
-
return await (0, run_all_tests_1.runAllTests)({ pwOptions });
|
|
15
|
+
return await (0, run_all_tests_1.runAllTests)({ pwOptions, platform });
|
|
16
16
|
}
|
|
17
17
|
exports.runTest = runTest;
|
package/dist/run-all-tests.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { Platform } from "./types";
|
|
1
2
|
/**
|
|
2
3
|
*
|
|
3
4
|
* @export
|
|
4
5
|
* @param {TestRunParameters} { name, dir, pwOptions }
|
|
5
6
|
*/
|
|
6
|
-
export declare function runAllTests({ pwOptions, }: {
|
|
7
|
+
export declare function runAllTests({ pwOptions, platform, }: {
|
|
7
8
|
pwOptions?: string;
|
|
9
|
+
platform: Platform;
|
|
8
10
|
}): Promise<{
|
|
9
11
|
hasTestPassed: boolean;
|
|
10
12
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-all-tests.d.ts","sourceRoot":"","sources":["../src/run-all-tests.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"run-all-tests.d.ts","sourceRoot":"","sources":["../src/run-all-tests.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAGnC;;;;GAIG;AACH,wBAAsB,WAAW,CAAC,EAChC,SAAS,EACT,QAAQ,GACT,EAAE;IACD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,QAAQ,CAAC;CACpB,GAAG,OAAO,CAAC;IACV,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC,CAoBD"}
|
package/dist/run-all-tests.js
CHANGED
|
@@ -7,15 +7,16 @@ const utils_1 = require("./utils");
|
|
|
7
7
|
* @export
|
|
8
8
|
* @param {TestRunParameters} { name, dir, pwOptions }
|
|
9
9
|
*/
|
|
10
|
-
async function runAllTests({ pwOptions, }) {
|
|
10
|
+
async function runAllTests({ pwOptions, platform, }) {
|
|
11
11
|
let hasTestPassed = true;
|
|
12
12
|
try {
|
|
13
|
+
const testRunner = (0, utils_1.getTestRunner)(platform);
|
|
13
14
|
const env = Object({ ...process.env });
|
|
14
|
-
const
|
|
15
|
-
console.log(
|
|
16
|
-
arr:
|
|
15
|
+
const testRunCmd = `npx ${testRunner} test ${pwOptions}`;
|
|
16
|
+
console.log(`${testRunner} test command:`, testRunCmd, {
|
|
17
|
+
arr: testRunCmd.split(" "),
|
|
17
18
|
});
|
|
18
|
-
await (0, utils_1.cmd)(
|
|
19
|
+
await (0, utils_1.cmd)(testRunCmd.split(" "), {
|
|
19
20
|
env,
|
|
20
21
|
});
|
|
21
22
|
}
|
|
@@ -4,7 +4,7 @@ import { TestRunParameters } from "./types";
|
|
|
4
4
|
* @export
|
|
5
5
|
* @param {TestRunParameters} { name, dir, pwOptions }
|
|
6
6
|
*/
|
|
7
|
-
export declare function runSpecificTest({ name, dir, pwOptions, }: TestRunParameters): Promise<{
|
|
7
|
+
export declare function runSpecificTest({ name, dir, pwOptions, platform, }: TestRunParameters): Promise<{
|
|
8
8
|
hasTestPassed: boolean;
|
|
9
9
|
}>;
|
|
10
10
|
//# sourceMappingURL=run-specific-test.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-specific-test.d.ts","sourceRoot":"","sources":["../src/run-specific-test.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"run-specific-test.d.ts","sourceRoot":"","sources":["../src/run-specific-test.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAY5C;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,EACpC,IAAI,EACJ,GAAG,EACH,SAAS,EACT,QAAQ,GACT,EAAE,iBAAiB,GAAG,OAAO,CAAC;IAC7B,aAAa,EAAE,OAAO,CAAC;CACxB,CAAC,CAsDD"}
|
|
@@ -11,7 +11,7 @@ const utils_1 = require("./utils");
|
|
|
11
11
|
* @export
|
|
12
12
|
* @param {TestRunParameters} { name, dir, pwOptions }
|
|
13
13
|
*/
|
|
14
|
-
async function runSpecificTest({ name, dir, pwOptions, }) {
|
|
14
|
+
async function runSpecificTest({ name, dir, pwOptions, platform, }) {
|
|
15
15
|
const files = await (0, utils_1.getAllFilePaths)(dir);
|
|
16
16
|
let matchingFilePath = "";
|
|
17
17
|
// find the first file that contains the test block
|
|
@@ -48,10 +48,11 @@ async function runSpecificTest({ name, dir, pwOptions, }) {
|
|
|
48
48
|
}
|
|
49
49
|
let hasTestPassed = true;
|
|
50
50
|
try {
|
|
51
|
+
const testRunner = (0, utils_1.getTestRunner)(platform);
|
|
51
52
|
const env = Object({ ...process.env });
|
|
52
|
-
const
|
|
53
|
-
console.log(
|
|
54
|
-
await (0, utils_1.cmd)(
|
|
53
|
+
const testRunCmd = `npx ${testRunner} test ${matchingFilePath} ${pwOptions}`;
|
|
54
|
+
console.log(`${testRunner} test command:`, testRunCmd);
|
|
55
|
+
await (0, utils_1.cmd)(testRunCmd.split(" "), {
|
|
55
56
|
env,
|
|
56
57
|
});
|
|
57
58
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -2,12 +2,14 @@ export type TestRunParameters = {
|
|
|
2
2
|
name: string;
|
|
3
3
|
dir?: string;
|
|
4
4
|
pwOptions?: string;
|
|
5
|
+
platform: Platform;
|
|
5
6
|
};
|
|
6
7
|
export type Environment = {
|
|
7
8
|
id: number;
|
|
8
9
|
project_id: number;
|
|
9
10
|
slug: string;
|
|
10
11
|
playwright_projects: string[];
|
|
12
|
+
platform: Platform;
|
|
11
13
|
};
|
|
12
14
|
export type Build = {
|
|
13
15
|
id: number;
|
|
@@ -16,4 +18,13 @@ export type Build = {
|
|
|
16
18
|
export type PartialPackageJSON = {
|
|
17
19
|
scripts: Record<string, string>;
|
|
18
20
|
};
|
|
21
|
+
export declare enum Platform {
|
|
22
|
+
WEB = "web",
|
|
23
|
+
ANDROID = "android",
|
|
24
|
+
IOS = "ios"
|
|
25
|
+
}
|
|
26
|
+
export declare enum TestFramework {
|
|
27
|
+
PLAYWRIGHT = "playwright",
|
|
28
|
+
APPWRIGHT = "appwright"
|
|
29
|
+
}
|
|
19
30
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,mBAAmB,EAAE,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,QAAQ,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B,QAAQ,EAAE,QAAQ,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,KAAK,GAAG;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC,CAAC;AAEF,oBAAY,QAAQ;IAClB,GAAG,QAAQ;IACX,OAAO,YAAY;IACnB,GAAG,QAAQ;CACZ;AAED,oBAAY,aAAa;IACvB,UAAU,eAAe;IACzB,SAAS,cAAc;CACxB"}
|
package/dist/types/index.js
CHANGED
|
@@ -1,2 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TestFramework = exports.Platform = void 0;
|
|
4
|
+
var Platform;
|
|
5
|
+
(function (Platform) {
|
|
6
|
+
Platform["WEB"] = "web";
|
|
7
|
+
Platform["ANDROID"] = "android";
|
|
8
|
+
Platform["IOS"] = "ios";
|
|
9
|
+
})(Platform || (exports.Platform = Platform = {}));
|
|
10
|
+
var TestFramework;
|
|
11
|
+
(function (TestFramework) {
|
|
12
|
+
TestFramework["PLAYWRIGHT"] = "playwright";
|
|
13
|
+
TestFramework["APPWRIGHT"] = "appwright";
|
|
14
|
+
})(TestFramework || (exports.TestFramework = TestFramework = {}));
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Node, SourceFile } from "ts-morph";
|
|
2
|
-
import { Build } from "../types";
|
|
2
|
+
import { Build, Platform, TestFramework } from "../types";
|
|
3
3
|
export declare function cmd(command: string[], options: {
|
|
4
4
|
env?: Record<string, string>;
|
|
5
5
|
}): Promise<number>;
|
|
@@ -29,9 +29,13 @@ export declare function markTestAsOnly({ sourceFile, parentDescribeNode, testCas
|
|
|
29
29
|
testCaseNode: Node;
|
|
30
30
|
filePath: string;
|
|
31
31
|
}): Promise<void>;
|
|
32
|
-
export declare function getProjectsFromPlaywrightConfig(): Promise<
|
|
32
|
+
export declare function getProjectsFromPlaywrightConfig(platform: Platform): Promise<any>;
|
|
33
33
|
export declare const filterArrayByGlobMatchersSet: (input: string[], globMatcherSets: string[][]) => string[];
|
|
34
|
-
export declare const generateProjectFilters: (filteringSets:
|
|
34
|
+
export declare const generateProjectFilters: ({ platform, filteringSets, }: {
|
|
35
|
+
platform: Platform;
|
|
36
|
+
filteringSets: string[];
|
|
37
|
+
}) => Promise<string[]>;
|
|
35
38
|
export declare function buildRepoName(projectName: string): string;
|
|
36
39
|
export declare const downloadBuild: (build: Build) => Promise<void>;
|
|
40
|
+
export declare const getTestRunner: (platform: Platform) => TestFramework;
|
|
37
41
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,EAAW,UAAU,EAAc,MAAM,UAAU,CAAC;AAGjE,OAAO,EAAE,KAAK,EAAsB,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,IAAI,EAAW,UAAU,EAAc,MAAM,UAAU,CAAC;AAGjE,OAAO,EAAE,KAAK,EAAsB,QAAQ,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9E,wBAAgB,GAAG,CACjB,OAAO,EAAE,MAAM,EAAE,EACjB,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,GACxC,OAAO,CAAC,MAAM,CAAC,CA2BjB;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CACnC,aAAa,GAAE,MAAW,GACzB,OAAO,CAAC,MAAM,EAAE,CAAC,CAqBnB;AAED,wBAAsB,eAAe,CAAC,EACpC,QAAQ,EACR,YAAY,GACb,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;CACtB,GAAG,OAAO,CAAC;IAAE,YAAY,EAAE,IAAI,GAAG,SAAS,CAAC;IAAC,UAAU,EAAE,UAAU,CAAA;CAAE,CAAC,CAatE;AAED,wBAAsB,YAAY,CAAC,EACjC,QAAQ,EACR,YAAY,GACb,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;CACtB,GAAG,OAAO,CAAC,OAAO,CAAC,CAMnB;AAED,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,IAAI,GAAG,SAAS,GACrB,IAAI,GAAG,SAAS,CA2BlB;AAED,wBAAsB,0CAA0C,CAC9D,QAAQ,EAAE,MAAM,oBA+BjB;AAED,wBAAsB,cAAc,CAAC,EACnC,UAAU,EACV,kBAAkB,EAClB,YAAY,EACZ,QAAQ,GACT,EAAE;IACD,UAAU,EAAE,UAAU,CAAC;IACvB,kBAAkB,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC;IACtC,YAAY,EAAE,IAAI,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB,iBAgBA;AAED,wBAAsB,+BAA+B,CAAC,QAAQ,EAAE,QAAQ,gBAevE;AAED,eAAO,MAAM,4BAA4B,UAEhC,MAAM,EAAE,mBAGE,MAAM,EAAE,EAAE,KAC1B,MAAM,EAUR,CAAC;AAEF,eAAO,MAAM,sBAAsB;cAIvB,QAAQ;mBACH,MAAM,EAAE;MACrB,QAAQ,MAAM,EAAE,CAmBnB,CAAC;AAEF,wBAAgB,aAAa,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED,eAAO,MAAM,aAAa,UAAiB,KAAK,KAAG,QAAQ,IAAI,CAW9D,CAAC;AAEF,eAAO,MAAM,aAAa,aAAc,QAAQ,KAAG,aAIlD,CAAC"}
|
package/dist/utils/index.js
CHANGED
|
@@ -3,13 +3,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.downloadBuild = exports.buildRepoName = exports.generateProjectFilters = exports.filterArrayByGlobMatchersSet = exports.getProjectsFromPlaywrightConfig = exports.markTestAsOnly = exports.hasTopLevelDescribeConfigureWithSerialMode = exports.findFirstSerialDescribeBlock = exports.hasTestBlock = exports.getTestCaseNode = exports.getAllFilePaths = exports.cmd = void 0;
|
|
6
|
+
exports.getTestRunner = exports.downloadBuild = exports.buildRepoName = exports.generateProjectFilters = exports.filterArrayByGlobMatchersSet = exports.getProjectsFromPlaywrightConfig = exports.markTestAsOnly = exports.hasTopLevelDescribeConfigureWithSerialMode = exports.findFirstSerialDescribeBlock = exports.hasTestBlock = exports.getTestCaseNode = exports.getAllFilePaths = exports.cmd = void 0;
|
|
7
7
|
const child_process_1 = require("child_process");
|
|
8
8
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
9
9
|
const minimatch_1 = require("minimatch");
|
|
10
10
|
const path_1 = __importDefault(require("path"));
|
|
11
11
|
const ts_morph_1 = require("ts-morph");
|
|
12
12
|
const api_1 = require("tsx/esm/api");
|
|
13
|
+
const types_1 = require("../types");
|
|
13
14
|
function cmd(command, options) {
|
|
14
15
|
let errorLogs = [];
|
|
15
16
|
return new Promise((resolveFunc, rejectFunc) => {
|
|
@@ -159,8 +160,8 @@ async function markTestAsOnly({ sourceFile, parentDescribeNode, testCaseNode, fi
|
|
|
159
160
|
await fs_extra_1.default.writeFile(filePath, updatedTestFileContent, "utf-8");
|
|
160
161
|
}
|
|
161
162
|
exports.markTestAsOnly = markTestAsOnly;
|
|
162
|
-
async function getProjectsFromPlaywrightConfig() {
|
|
163
|
-
const configName = "playwright.config.ts";
|
|
163
|
+
async function getProjectsFromPlaywrightConfig(platform) {
|
|
164
|
+
const configName = platform === types_1.Platform.WEB ? "playwright.config.ts" : "appwright.config.ts";
|
|
164
165
|
const directoryPath = ".";
|
|
165
166
|
const pwFile = path_1.default.resolve(directoryPath, configName);
|
|
166
167
|
try {
|
|
@@ -187,8 +188,8 @@ globMatcherSets) => {
|
|
|
187
188
|
return filteredList;
|
|
188
189
|
};
|
|
189
190
|
exports.filterArrayByGlobMatchersSet = filterArrayByGlobMatchersSet;
|
|
190
|
-
const generateProjectFilters = async (filteringSets) => {
|
|
191
|
-
const projectsDefinedInPwConfig = await getProjectsFromPlaywrightConfig();
|
|
191
|
+
const generateProjectFilters = async ({ platform, filteringSets, }) => {
|
|
192
|
+
const projectsDefinedInPwConfig = await getProjectsFromPlaywrightConfig(platform);
|
|
192
193
|
const filters = filteringSets.map((matchingString) => matchingString.split(","));
|
|
193
194
|
const filteredProjects = (0, exports.filterArrayByGlobMatchersSet)(projectsDefinedInPwConfig, filters);
|
|
194
195
|
if (filteredProjects.length === 0) {
|
|
@@ -214,3 +215,9 @@ const downloadBuild = async (build) => {
|
|
|
214
215
|
}
|
|
215
216
|
};
|
|
216
217
|
exports.downloadBuild = downloadBuild;
|
|
218
|
+
const getTestRunner = (platform) => {
|
|
219
|
+
return platform === types_1.Platform.WEB
|
|
220
|
+
? types_1.TestFramework.PLAYWRIGHT
|
|
221
|
+
: types_1.TestFramework.APPWRIGHT;
|
|
222
|
+
};
|
|
223
|
+
exports.getTestRunner = getTestRunner;
|