@uuv/playwright 3.37.0 → 3.38.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.
|
@@ -302,7 +302,6 @@ async function click(world, role, name) {
|
|
|
302
302
|
});
|
|
303
303
|
await (0, test_1.expect)(byRole).toHaveCount(1, { timeout: await getTimeout(world) });
|
|
304
304
|
await byRole.click();
|
|
305
|
-
await world.page.waitForLoadState();
|
|
306
305
|
await deleteCookieByName(world, COOKIE_NAME.SELECTED_ELEMENT);
|
|
307
306
|
});
|
|
308
307
|
}
|
|
@@ -11,11 +11,13 @@
|
|
|
11
11
|
* understanding English or French.
|
|
12
12
|
*/
|
|
13
13
|
import { UUVCliOptions, UUVCliRunner } from "@uuv/runner-commons";
|
|
14
|
+
import cp from "child_process";
|
|
14
15
|
export declare class UUVCliPlaywrightRunner implements UUVCliRunner {
|
|
15
16
|
projectDir: any;
|
|
16
17
|
private tempDir;
|
|
17
18
|
name: string;
|
|
18
19
|
defaultBrowser: string;
|
|
20
|
+
watchProcess?: cp.ChildProcess | null;
|
|
19
21
|
constructor(projectDir: any, tempDir: any);
|
|
20
22
|
getCurrentVersion(): string;
|
|
21
23
|
prepare(options: Partial<UUVCliOptions>): Promise<void>;
|
|
@@ -26,5 +28,6 @@ export declare class UUVCliPlaywrightRunner implements UUVCliRunner {
|
|
|
26
28
|
private runPlaywright;
|
|
27
29
|
private buildCommand;
|
|
28
30
|
private executeSystemCommand;
|
|
31
|
+
private cleanup;
|
|
29
32
|
}
|
|
30
|
-
export declare function executePreprocessor(projectDir: string):
|
|
33
|
+
export declare function executePreprocessor(projectDir: string): boolean;
|
|
@@ -61,6 +61,7 @@ class UUVCliPlaywrightRunner {
|
|
|
61
61
|
tempDir;
|
|
62
62
|
name = "Playwright";
|
|
63
63
|
defaultBrowser = "chrome";
|
|
64
|
+
watchProcess;
|
|
64
65
|
constructor(projectDir, tempDir) {
|
|
65
66
|
this.projectDir = projectDir;
|
|
66
67
|
this.tempDir = tempDir;
|
|
@@ -72,9 +73,14 @@ class UUVCliPlaywrightRunner {
|
|
|
72
73
|
return JSON.parse(pJsonStr).version;
|
|
73
74
|
}
|
|
74
75
|
async prepare(options) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
try {
|
|
77
|
+
console.log("running preprocessor...");
|
|
78
|
+
this.executeSystemCommand(`npx bddgen -c ${this.projectDir}/playwright.config.ts`);
|
|
79
|
+
console.log("preprocessor executed\n");
|
|
80
|
+
}
|
|
81
|
+
catch (e) {
|
|
82
|
+
console.warn(chalk_1.default.redBright("An error occured during preprocessor, please be sure to use existing step definitions"));
|
|
83
|
+
}
|
|
78
84
|
this.setEnvironmentVariables(options);
|
|
79
85
|
}
|
|
80
86
|
setEnvironmentVariables(options) {
|
|
@@ -95,7 +101,20 @@ class UUVCliPlaywrightRunner {
|
|
|
95
101
|
this.runPlaywright(options);
|
|
96
102
|
}
|
|
97
103
|
executeOpenCommand(options) {
|
|
98
|
-
child_process_1.default.fork(path_1.default.join(__dirname, "watch-test-files"), [this.tempDir, this.projectDir]);
|
|
104
|
+
this.watchProcess = child_process_1.default.fork(path_1.default.join(__dirname, "watch-test-files"), [this.tempDir, this.projectDir]);
|
|
105
|
+
process.on("exit", () => this.cleanup(this.watchProcess));
|
|
106
|
+
process.on("SIGINT", () => {
|
|
107
|
+
this.cleanup(this.watchProcess);
|
|
108
|
+
process.exit();
|
|
109
|
+
});
|
|
110
|
+
process.on("SIGTERM", () => {
|
|
111
|
+
this.cleanup(this.watchProcess);
|
|
112
|
+
process.exit();
|
|
113
|
+
});
|
|
114
|
+
process.on("uncaughtException", (err) => {
|
|
115
|
+
this.cleanup(this.watchProcess);
|
|
116
|
+
throw err;
|
|
117
|
+
});
|
|
99
118
|
this.runPlaywright(options);
|
|
100
119
|
}
|
|
101
120
|
getTargetTestFileForPlaywright(targetTestFile) {
|
|
@@ -145,6 +164,14 @@ class UUVCliPlaywrightRunner {
|
|
|
145
164
|
executeSystemCommand(command) {
|
|
146
165
|
executeSystemCommandHelper(command);
|
|
147
166
|
}
|
|
167
|
+
cleanup(watchProcess) {
|
|
168
|
+
if (watchProcess) {
|
|
169
|
+
console.log("Stopping file watcher...");
|
|
170
|
+
watchProcess.kill();
|
|
171
|
+
console.log("File watcher stopped");
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
;
|
|
148
175
|
}
|
|
149
176
|
exports.UUVCliPlaywrightRunner = UUVCliPlaywrightRunner;
|
|
150
177
|
function executeSystemCommandHelper(command) {
|
|
@@ -153,6 +180,13 @@ function executeSystemCommandHelper(command) {
|
|
|
153
180
|
}
|
|
154
181
|
function executePreprocessor(projectDir) {
|
|
155
182
|
console.log("running preprocessor...");
|
|
156
|
-
|
|
157
|
-
|
|
183
|
+
try {
|
|
184
|
+
executeSystemCommandHelper(`npx bddgen -c ${projectDir}/playwright.config.ts`);
|
|
185
|
+
console.log("preprocessor executed\n");
|
|
186
|
+
return true;
|
|
187
|
+
}
|
|
188
|
+
catch (e) {
|
|
189
|
+
console.warn(chalk_1.default.redBright("An error occured during preprocessor, please be sure to use existing step definitions"));
|
|
190
|
+
return false;
|
|
191
|
+
}
|
|
158
192
|
}
|
|
@@ -29,18 +29,21 @@ chokidar_1.default.watch(`${projectDir}/e2e`, {
|
|
|
29
29
|
ignoreInitial: true,
|
|
30
30
|
ignored: (path, stats) => !!stats && stats.isFile() && !path.endsWith(".feature")
|
|
31
31
|
})
|
|
32
|
-
.on("change",
|
|
32
|
+
.on("change", path => {
|
|
33
33
|
console.log(chalk_1.default.yellowBright("\nRefreshing test files..."));
|
|
34
|
-
(0, runner_playwright_1.executePreprocessor)(projectDir)
|
|
35
|
-
|
|
34
|
+
if ((0, runner_playwright_1.executePreprocessor)(projectDir)) {
|
|
35
|
+
console.log(chalk_1.default.yellowBright(`Test file ${path} refreshed\n`));
|
|
36
|
+
}
|
|
36
37
|
})
|
|
37
38
|
.on("add", path => {
|
|
38
39
|
console.log(chalk_1.default.yellowBright(`\nFile ${path} has been added`));
|
|
39
|
-
(0, runner_playwright_1.executePreprocessor)(projectDir)
|
|
40
|
-
|
|
40
|
+
if ((0, runner_playwright_1.executePreprocessor)(projectDir)) {
|
|
41
|
+
console.log(chalk_1.default.yellowBright(`Test file ${path} refreshed\n`));
|
|
42
|
+
}
|
|
41
43
|
})
|
|
42
44
|
.on("unlink", path => {
|
|
43
45
|
console.log(chalk_1.default.yellowBright(`\nFile ${path} has been removed`));
|
|
44
|
-
(0, runner_playwright_1.executePreprocessor)(projectDir)
|
|
45
|
-
|
|
46
|
+
if ((0, runner_playwright_1.executePreprocessor)(projectDir)) {
|
|
47
|
+
console.log(chalk_1.default.yellowBright(`Test file ${path} refreshed\n`));
|
|
48
|
+
}
|
|
46
49
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uuv/playwright",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.38.0",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"author": "Louis Fredice NJAKO MOLOM (https://github.com/luifr10) & Stanley SERVICAL (https://github.com/stanlee974)",
|
|
6
6
|
"description": "A solution to facilitate the writing and execution of E2E tests understandable by any human being using cucumber(BDD) and playwright",
|