add test for it

This commit is contained in:
Simon Knott 2024-09-16 09:23:46 +02:00
parent 0bae7b8b7e
commit 6c7aaa78f6
No known key found for this signature in database
GPG key ID: 8CEDC00028084AEC

View file

@ -812,3 +812,49 @@ test('should run global teardown before exiting', async ({ runWatchTest }) => {
testProcess.write('\x1B');
await testProcess.waitForOutput('running teardown');
});
test('buffer mode', async ({ runWatchTest, writeFiles }) => {
const testProcess = await runWatchTest({
'a.test.ts': `
import { test, expect } from '@playwright/test';
test('passes', () => {});
`,
'b.test.ts': `
import { test, expect } from '@playwright/test';
test('passes in b', () => {});
`,
});
testProcess.clearOutput();
testProcess.write('b');
await testProcess.waitForOutput('Waiting for file changes. Press q to quit');
testProcess.clearOutput();
await writeFiles({
'a.test.ts': `
import { test, expect } from '@playwright/test';
test('passes again', () => {});
`,
});
await testProcess.waitForOutput('1 test file changed:');
await testProcess.waitForOutput('a.test.ts');
testProcess.clearOutput();
await writeFiles({
'b.test.ts': `
import { test, expect } from '@playwright/test';
test('passes in b again', () => {});
`,
});
await testProcess.waitForOutput('2 test files changed:');
await testProcess.waitForOutput('a.test.ts');
await testProcess.waitForOutput('b.test.ts');
testProcess.clearOutput();
testProcess.write('\r\n');
await testProcess.waitForOutput('a.test.ts:3:11 passes');
await testProcess.waitForOutput('b.test.ts:3:11 passes');
});