-
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
71 additions
and
62 deletions.
There are no files selected for viewing
118 changes: 62 additions & 56 deletions
118
test/reporter-cucumber-html/check-report/specs/failing-step.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,71 @@ | ||
import { expect } from '@playwright/test'; | ||
import { test } from '../fixtures'; | ||
|
||
test.use({ featureUri: 'failing-step/error.feature' }); | ||
test.describe('error', () => { | ||
test.use({ featureUri: 'failing-step/error.feature' }); | ||
|
||
test('error in step', async ({ scenario }) => { | ||
await expect(scenario.getSteps()).toContainText([ | ||
'Givenstep with page', // prettier-ignore | ||
'Givenfailing step', | ||
'WhenAction 1', | ||
'screenshotDownload trace', | ||
]); | ||
await expect(scenario.getSteps('passed')).toHaveCount(1); | ||
await expect(scenario.getSteps('failed')).toHaveCount(1); | ||
await expect(scenario.getSteps('skipped')).toHaveCount(1); | ||
await expect(scenario.getErrors()).toContainText(['expect(true).toBe(false)']); | ||
}); | ||
test('error in step', async ({ scenario }) => { | ||
await expect(scenario.getSteps()).toContainText([ | ||
'Givenstep with page', // prettier-ignore | ||
'Givenfailing step', | ||
'WhenAction 1', | ||
'screenshotDownload trace', | ||
]); | ||
await expect(scenario.getSteps('passed')).toHaveCount(1); | ||
await expect(scenario.getSteps('failed')).toHaveCount(1); | ||
await expect(scenario.getSteps('skipped')).toHaveCount(1); | ||
await expect(scenario.getErrors()).toContainText(['expect(true).toBe(false)']); | ||
}); | ||
|
||
test('timeout in step', async ({ scenario }) => { | ||
await expect(scenario.getSteps()).toContainText([ | ||
'Givenstep with page', // prettier-ignore | ||
'Giventimeouted step', | ||
'WhenAction 1', | ||
'screenshot', | ||
// don't check 'Download trace' as it is attached to 'timeouted step' in pw 1.42 / 1.43 | ||
// '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/]); | ||
}); | ||
test('failing match snapshot', async ({ scenario }) => { | ||
await expect(scenario.getSteps()).toContainText([ | ||
'Whenstep with page', | ||
'Thenerror in match snapshot', | ||
]); | ||
await expect(scenario.getAttachments()).toHaveText([ | ||
'error-in-step-failing-match-snapshot-1-expected.txtbla-bla', | ||
'error-in-step-failing-match-snapshot-1-actual.txtExample Domain', | ||
'screenshot', | ||
]); | ||
await expect(scenario.getSteps('passed')).toHaveCount(1); | ||
await expect(scenario.getSteps('failed')).toHaveCount(1); | ||
await expect(scenario.getSteps('skipped')).toHaveCount(0); | ||
await expect(scenario.getErrors()).toContainText(['toMatchSnapshot']); | ||
}); | ||
|
||
test('failing match snapshot', async ({ scenario }) => { | ||
await expect(scenario.getSteps()).toContainText([ | ||
'Whenstep with page', | ||
'Thenerror in match snapshot', | ||
]); | ||
await expect(scenario.getAttachments()).toHaveText([ | ||
'error-in-step-failing-match-snapshot-1-expected.txtbla-bla', | ||
'error-in-step-failing-match-snapshot-1-actual.txtExample Domain', | ||
'screenshot', | ||
]); | ||
await expect(scenario.getSteps('passed')).toHaveCount(1); | ||
await expect(scenario.getSteps('failed')).toHaveCount(1); | ||
await expect(scenario.getSteps('skipped')).toHaveCount(0); | ||
await expect(scenario.getErrors()).toContainText(['toMatchSnapshot']); | ||
test('soft assertions', async ({ scenario }) => { | ||
await expect(scenario.getSteps()).toHaveText([ | ||
/Givenfailing soft assertion "foo"/, | ||
'AndAction 1', | ||
/Andfailing soft assertion "bar"/, | ||
'AndAction 2', | ||
// not 'screenshot', b/c no page | ||
// 'screenshot', | ||
'Download trace', | ||
]); | ||
await expect(scenario.getSteps('passed')).toHaveCount(2); | ||
await expect(scenario.getSteps('failed')).toHaveCount(2); | ||
await expect(scenario.getSteps('skipped')).toHaveCount(0); | ||
await expect(scenario.getErrors()).toContainText([ | ||
'Expected: "foo" Received: "xxx"', | ||
'Expected: "bar" Received: "xxx"', | ||
]); | ||
}); | ||
}); | ||
|
||
test('soft assertions', async ({ scenario }) => { | ||
await expect(scenario.getSteps()).toHaveText([ | ||
/Givenfailing soft assertion "foo"/, | ||
'AndAction 1', | ||
/Andfailing soft assertion "bar"/, | ||
'AndAction 2', | ||
// not 'screenshot', b/c no page | ||
// 'screenshot', | ||
'Download trace', | ||
]); | ||
await expect(scenario.getSteps('passed')).toHaveCount(2); | ||
await expect(scenario.getSteps('failed')).toHaveCount(2); | ||
await expect(scenario.getSteps('skipped')).toHaveCount(0); | ||
await expect(scenario.getErrors()).toContainText([ | ||
'Expected: "foo" Received: "xxx"', | ||
'Expected: "bar" Received: "xxx"', | ||
]); | ||
test.describe('timeout', () => { | ||
test.use({ featureUri: 'failing-step/timeout.feature' }); | ||
|
||
test('timeout in step', async ({ scenario }) => { | ||
await expect(scenario.getSteps()).toContainText([ | ||
'Givenstep with page', // prettier-ignore | ||
'Giventimeouted step', | ||
'WhenAction 1', | ||
'screenshot', | ||
// don't check 'Download trace' as it is attached to 'timeouted step' in pw 1.42 / 1.43 | ||
// '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/]); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
test/reporter-cucumber-html/features/failing-step/timeout.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Feature: timeout-in-step | ||
|
||
Scenario: timeout in step | ||
Given step with page | ||
Given timeouted step | ||
When Action 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters