From 4355c7f8cf45bffd452a46f705287f913f9b93f0 Mon Sep 17 00:00:00 2001 From: Simon Knott Date: Tue, 23 Jul 2024 17:03:34 +0200 Subject: [PATCH] add tests that dont depend on changed files --- tests/playwright-test/only-changed.spec.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/playwright-test/only-changed.spec.ts b/tests/playwright-test/only-changed.spec.ts index da0e279d19..45b750cbe4 100644 --- a/tests/playwright-test/only-changed.spec.ts +++ b/tests/playwright-test/only-changed.spec.ts @@ -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(

Hello World

); + 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"`);