add tests that dont depend on changed files

This commit is contained in:
Simon Knott 2024-07-23 17:03:34 +02:00
parent bc96c8b68c
commit 4355c7f8cf
No known key found for this signature in database
GPG key ID: 8CEDC00028084AEC

View file

@ -131,6 +131,10 @@ test('should understand dependency structure', async ({ runInlineTest, git, writ
import { test, expect } from '@playwright/test';
import { answer, question } from './utils';
test('fails', () => { expect(question).toBe(answer); });
`,
'c.spec.ts': `
import { test, expect } from '@playwright/test';
test('fails', () => { expect(1).toBe(2); });
`,
'utils.ts': `
export * from './answer';
@ -159,6 +163,7 @@ test('should understand dependency structure', async ({ runInlineTest, git, writ
expect(result.passed).toBe(0);
expect(result.output).toContain('a.spec.ts');
expect(result.output).toContain('b.spec.ts');
expect(result.output).not.toContain('c.spec.ts');
});
test('should support watch mode', async ({ git, writeFiles, runWatchTest }) => {
@ -236,6 +241,14 @@ test('should suppport component tests', async ({ runInlineTest, git, writeFiles
await expect(component).toHaveText('Button');
});
`,
'src/button3.test.tsx': `
import { test, expect } from '@playwright/experimental-ct-react';
test('pass', async ({ mount }) => {
const component = await mount(<p>Hello World</p>);
await expect(component).toHaveText('Hello World');
});
`,
});
git(`add .`);
@ -265,6 +278,7 @@ test('should suppport component tests', async ({ runInlineTest, git, writeFiles
expect(result2.passed).toBe(0);
expect(result2.output).toContain('button2.test.tsx');
expect(result2.output).not.toContain('button.test.tsx');
expect(result2.output).not.toContain('button3.test.tsx');
git(`commit -am "update button2 test"`);