From ea033dbb3eae1bc1d42b30b3ede2eb73d69dde64 Mon Sep 17 00:00:00 2001 From: pengoosedev <73521518+pengoosedev@users.noreply.github.com> Date: Mon, 14 Oct 2024 20:51:51 +0900 Subject: [PATCH] test: remove duplicated test(fail.only) --- tests/playwright-test/hooks.spec.ts | 109 ---------------------------- 1 file changed, 109 deletions(-) diff --git a/tests/playwright-test/hooks.spec.ts b/tests/playwright-test/hooks.spec.ts index b9e99b6dd5..60a8700b82 100644 --- a/tests/playwright-test/hooks.spec.ts +++ b/tests/playwright-test/hooks.spec.ts @@ -920,112 +920,3 @@ test('afterAll should be run for test.skip', async ({ runInlineTest }) => { 'afterAll2', ]); }); - -test('should respect test.fail.only in beforeEach failure', async ({ runInlineTest }) => { - const report = await runInlineTest({ - 'a.test.js': ` - import { test, expect } from '@playwright/test'; - test.beforeEach(async ({}) => { - console.log('beforeEach1'); - }); - test.beforeEach(async ({}) => { - console.log('beforeEach2'); - throw new Error('beforeEach2'); - }); - test.afterEach(async ({}) => { - console.log('afterEach'); - }); - test.fail.only('one', async ({}) => { - console.log('test'); - }); - test('two', async ({}) => { - console.log('test two'); - }); - `, - }); - expect(report.output).toContain('beforeEach1\nbeforeEach2\nafterEach'); - expect(report.results[0].error.message).toContain('beforeEach2'); - expect(report.passed).toBe(1); - expect(report.failed).toBe(0); -}); - -test('should respect test.fail.only in afterAll exception', async ({ runInlineTest }) => { - const result = await runInlineTest({ - 'a.test.js': ` - import { test, expect } from '@playwright/test'; - test.afterAll(() => { - throw new Error('From the afterAll'); - }); - test.fail.only('passed', () => { - console.log('test body'); - }); - test('skipped', () => { - console.log('should not run'); - }); - `, - }); - expect(result.exitCode).toBe(0); - expect(result.passed).toBe(1); - expect(result.failed).toBe(0); - expect(result.output).toContain('test body'); - expect(result.output).not.toContain('should not run'); -}); - - -test('should run beforeAll and afterAll hooks with test.fail.only', async ({ runInlineTest }) => { - const result = await runInlineTest({ - 'hooks-fail-only.spec.ts': ` - import { test, expect } from '@playwright/test'; - test.beforeAll(() => { - console.log('\\n%%beforeAll'); - }); - test.afterAll(() => { - console.log('\\n%%afterAll'); - }); - test.fail.only('failing test', () => { - console.log('\\n%%test body'); - expect(1).toBe(2); - }); - test('skipped test', () => { - console.log('\\n%%should not run'); - }); - `, - }); - expect(result.exitCode).toBe(0); - expect(result.passed).toBe(1); - expect(result.failed).toBe(0); - expect(result.outputLines).toEqual([ - 'beforeAll', - 'test body', - 'afterAll', - ]); - expect(result.output).not.toContain('should not run'); -}); - -test('test.fail.only with failing beforeEach should still prevent test and run afterEach', async ({ runInlineTest }) => { - const result = await runInlineTest({ - 'a.test.js': ` - import { test, expect } from '@playwright/test'; - - test.beforeEach(async () => { - console.log('beforeEach'); - throw new Error('beforeEach failure'); - }); - - test.afterEach(async () => { - console.log('afterEach'); - }); - - test.fail.only('failing test', async () => { - console.log('test body'); - expect(1 + 1).toBe(3); - }); - `, - }); - - expect(result.exitCode).toBe(0); - expect(result.passed).toBe(1); - expect(result.failed).toBe(0); - expect(result.output).toContain('beforeEach\nafterEach'); - expect(result.output).not.toContain('test body'); -}); \ No newline at end of file