diff --git a/test/reporter-cucumber-html/check-report/specs/error-in-after.test.ts b/test/reporter-cucumber-html/check-report/specs/error-in-after.test.ts index b14b5cb5..446f778f 100644 --- a/test/reporter-cucumber-html/check-report/specs/error-in-after.test.ts +++ b/test/reporter-cucumber-html/check-report/specs/error-in-after.test.ts @@ -13,6 +13,7 @@ test.use({ featureUri: 'error-in-after/sample.feature' }); test('error in fixture teardown (no step)', async ({ scenario }) => { await expect(scenario.getSteps()).toContainText([ 'my attachment|before use', + 'Givenstep with page', 'Givenstep that uses fixtureWithErrorInTeardown', 'WhenAction 1', `Hook "fixture: fixtureWithErrorInTeardown" failed: ${normalize('features/error-in-after/fixtures.ts')}:`, @@ -24,7 +25,7 @@ test('error in fixture teardown (no step)', async ({ scenario }) => { 'my attachment|before use', // prettier-ignore 'my attachment|after use', ]); - await expect(scenario.getSteps('passed')).toHaveCount(2); + await expect(scenario.getSteps('passed')).toHaveCount(3); await expect(scenario.getSteps('failed')).toHaveCount(1); await expect(scenario.getSteps('skipped')).toHaveCount(0); await expect(scenario.getErrors()).toContainText(['error in fixture teardown']); @@ -33,6 +34,7 @@ test('error in fixture teardown (no step)', async ({ scenario }) => { test('error in fixture teardown (with step)', async ({ scenario }) => { await expect(scenario.getSteps()).toContainText([ 'my attachment|outside step (before use)', + 'Givenstep with page', 'Givenstep that uses fixtureWithErrorInTeardownStep', 'WhenAction 1', `Hook "step inside fixture" failed: ${normalize('features/error-in-after/fixtures.ts')}:`, @@ -46,7 +48,7 @@ test('error in fixture teardown (with step)', async ({ scenario }) => { 'my attachment|in step', 'my attachment|outside step (after use)', ]); - await expect(scenario.getSteps('passed')).toHaveCount(2); + await expect(scenario.getSteps('passed')).toHaveCount(3); await expect(scenario.getSteps('failed')).toHaveCount(1); await expect(scenario.getSteps('skipped')).toHaveCount(0); await expect(scenario.getErrors()).toContainText(['error in fixture teardown']); diff --git a/test/reporter-cucumber-html/check-report/specs/error-in-step.test.ts b/test/reporter-cucumber-html/check-report/specs/error-in-step.test.ts index 687d4f9b..e5198028 100644 --- a/test/reporter-cucumber-html/check-report/specs/error-in-step.test.ts +++ b/test/reporter-cucumber-html/check-report/specs/error-in-step.test.ts @@ -3,7 +3,7 @@ import { test } from '../fixtures'; test.use({ featureUri: 'error-in-step/sample.feature' }); -test('failing by step assertion', async ({ scenario }) => { +test('error in step', async ({ scenario }) => { await expect(scenario.getSteps()).toContainText([ 'Givenfailing step', // prettier-ignore 'screenshotDownload trace', @@ -13,14 +13,15 @@ test('failing by step assertion', async ({ scenario }) => { ]); }); -test('failing by step timeout', async ({ scenario }) => { +test('timeout in step', async ({ scenario }) => { await expect(scenario.getSteps()).toContainText([ 'GivenAction 0', 'Giventimeouted step', 'WhenAction 1', // not 'screenshot', b/c no page // 'screenshot', - 'Download trace', + // 'Download trace' can be attached to 'timeouted step' (pw 1.43) - is it a bug? + // 'Download trace', ]); // don't check passed/skipped steps counts b/c in different PW versions it's different await expect(scenario.getErrors()).toContainText([/Test timeout of \d+ms exceeded/]); @@ -28,7 +29,7 @@ test('failing by step timeout', async ({ scenario }) => { test('failing match snapshot', async ({ scenario }) => { await expect(scenario.getSteps()).toContainText([ - 'Whenopen page "https://example.com"', + 'Whenopen example.com', 'Thenpage title snapshot matches the golden one', ]); await expect(scenario.getAttachments()).toHaveText([ diff --git a/test/reporter-cucumber-html/features/error-in-after/sample.feature b/test/reporter-cucumber-html/features/error-in-after/sample.feature index 757b0054..b5ecee18 100644 --- a/test/reporter-cucumber-html/features/error-in-after/sample.feature +++ b/test/reporter-cucumber-html/features/error-in-after/sample.feature @@ -1,10 +1,12 @@ Feature: error-in-after Scenario: error in fixture teardown (no step) + Given step with page Given step that uses fixtureWithErrorInTeardown When Action 1 Scenario: error in fixture teardown (with step) + Given step with page Given step that uses fixtureWithErrorInTeardownStep When Action 1 diff --git a/test/reporter-cucumber-html/features/error-in-step/sample.feature b/test/reporter-cucumber-html/features/error-in-step/sample.feature index e0332f3b..8379969b 100644 --- a/test/reporter-cucumber-html/features/error-in-step/sample.feature +++ b/test/reporter-cucumber-html/features/error-in-step/sample.feature @@ -2,10 +2,10 @@ Feature: error-in-step # - Increased timeout b/c this test opens page @timeout:10_000 - Scenario: failing by step assertion + Scenario: error in step Given failing step - Scenario: failing by step timeout + Scenario: timeout in step Given Action 0 Given timeouted step When Action 1 @@ -14,7 +14,7 @@ Feature: error-in-step # - Increased timeout b/c this test opens page @timeout:10_000 Scenario: failing match snapshot - When open page "https://example.com" + When open example.com Then page title snapshot matches the golden one Scenario: soft assertions diff --git a/test/reporter-cucumber-html/features/shared.steps.ts b/test/reporter-cucumber-html/features/shared.steps.ts index 3d5d0007..7729056c 100644 --- a/test/reporter-cucumber-html/features/shared.steps.ts +++ b/test/reporter-cucumber-html/features/shared.steps.ts @@ -11,6 +11,11 @@ Given('failing step', async ({ page }) => { await expect(page.getByText('missing string')).toBeVisible(); }); -When('open page {string}', async ({ page }, url: string) => { - await page.goto(url); +// using 'page' here to have a screenshot in report +When('step with page', async ({ page }) => { + return page; +}); + +When('open example.com', async ({ page }) => { + await page.goto('https://example.com'); });