Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

test: run "should remove temp dir on process.exit" on windows (#13568)

Dmitry Gozman022f83d3b477
diff --git a/tests/library/signals.spec.ts b/tests/library/signals.spec.ts
index 931b87e885..96c520ab95 100644
--- a/tests/library/signals.spec.ts
+++ b/tests/library/signals.spec.ts
@@ -32,6 +32,18 @@ test('should close the browser when the node process closes', async ({ startRemo
expect(await remoteServer.childExitCode()).toBe(isWindows ? 1 : 0);
});
+test('should remove temp dir on process.exit', async ({ startRemoteServer, server }, testInfo) => {
+ const file = testInfo.outputPath('exit.file');
+ const remoteServer = await startRemoteServer({ url: server.EMPTY_PAGE, exitOnFile: file });
+ const tempDir = await remoteServer.out('tempDir');
+ const before = fs.existsSync(tempDir);
+ fs.writeFileSync(file, 'data', 'utf-8');
+ expect(await remoteServer.childExitCode()).toBe(42);
+ const after = fs.existsSync(tempDir);
+ expect(before).toBe(true);
+ expect(after).toBe(false);
+});
+
test.describe('signals', () => {
test.skip(({ platform }) => platform === 'win32');
@@ -96,18 +108,6 @@ test.describe('signals', () => {
expect(after).toBe(false);
});
- test('should remove temp dir on process.exit', async ({ startRemoteServer, server }, testInfo) => {
- const file = testInfo.outputPath('exit.file');
- const remoteServer = await startRemoteServer({ url: server.EMPTY_PAGE, exitOnFile: file });
- const tempDir = await remoteServer.out('tempDir');
- const before = fs.existsSync(tempDir);
- fs.writeFileSync(file, 'data', 'utf-8');
- expect(await remoteServer.childExitCode()).toBe(42);
- const after = fs.existsSync(tempDir);
- expect(before).toBe(true);
- expect(after).toBe(false);
- });
-
test('should kill the browser on SIGINT + SIGTERM', async ({ startRemoteServer, server }) => {
const remoteServer = await startRemoteServer({ stallOnClose: true, url: server.EMPTY_PAGE });
process.kill(remoteServer.child().pid, 'SIGINT');