Skip to content

Commit

Permalink
test: fix reporter data ignored files
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalets committed Dec 4, 2024
1 parent 41b84e2 commit ea2c204
Show file tree
Hide file tree
Showing 4 changed files with 202 additions and 4 deletions.
57 changes: 57 additions & 0 deletions test/reporter-data/expected-reports/report-current.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
Scenario 1
[hook] Before Hooks
[hook] BeforeAll Hooks .features-gen/sample.feature.spec.js:38:6
[test.step] BeforeAll hook features/steps.ts:14:1
[test.step] named BeforeAll hook features/steps.ts:15:1
[hook] BeforeEach Hooks .features-gen/sample.feature.spec.js:40:6
[test.step] named Before hook features/steps.ts:12:1
[test.step] BeforeEach hook features/steps.ts:13:1
[hook] Background .features-gen/sample.feature.spec.js:6:8
[test.step] Given background step .features-gen/sample.feature.spec.js:7:11
[test.step] And Action 00 .features-gen/sample.feature.spec.js:8:11
[test.step] Given I am on home page .features-gen/sample.feature.spec.js:12:11
[pw:api] page.goto(https://example.com) features/pom.ts:11:21
[test.step] And decorator step .features-gen/sample.feature.spec.js:13:11
[test.step] And Action 1 .features-gen/sample.feature.spec.js:14:11
[test.step] When Action 2 .features-gen/sample.feature.spec.js:15:11
[test.step] And Action 3 .features-gen/sample.feature.spec.js:16:11
[test.step] Then Action 4 .features-gen/sample.feature.spec.js:17:11
[test.step] But Action 5 .features-gen/sample.feature.spec.js:18:11
[test.step] * Action 6 .features-gen/sample.feature.spec.js:19:11
[hook] After Hooks
[attach] attach "screenshot"
[hook] AfterEach Hooks .features-gen/sample.feature.spec.js:41:6
[test.step] AfterEach hook features/steps.ts:19:1
[test.step] named After hook features/steps.ts:18:1
[attach] attach "trace"

Example #1
[hook] Before Hooks
[hook] BeforeEach Hooks .features-gen/sample.feature.spec.js:40:6
[test.step] named Before hook features/steps.ts:12:1
[test.step] BeforeEach hook features/steps.ts:13:1
[hook] Background .features-gen/sample.feature.spec.js:6:8
[test.step] Given background step .features-gen/sample.feature.spec.js:7:11
[test.step] And Action 00 .features-gen/sample.feature.spec.js:8:11
[test.step] Given Action 44 .features-gen/sample.feature.spec.js:25:13
[hook] After Hooks
[hook] AfterEach Hooks .features-gen/sample.feature.spec.js:41:6
[test.step] AfterEach hook features/steps.ts:19:1
[test.step] named After hook features/steps.ts:18:1
[attach] attach "trace"

Example #2
[hook] Before Hooks
[hook] BeforeEach Hooks .features-gen/sample.feature.spec.js:40:6
[test.step] named Before hook features/steps.ts:12:1
[test.step] BeforeEach hook features/steps.ts:13:1
[hook] Background .features-gen/sample.feature.spec.js:6:8
[test.step] Given background step .features-gen/sample.feature.spec.js:7:11
[test.step] And Action 00 .features-gen/sample.feature.spec.js:8:11
[test.step] Given Action 55 .features-gen/sample.feature.spec.js:29:13
[hook] After Hooks
[hook] AfterEach Hooks .features-gen/sample.feature.spec.js:41:6
[test.step] AfterEach hook features/steps.ts:19:1
[test.step] named After hook features/steps.ts:18:1
[hook] AfterAll Hooks .features-gen/sample.feature.spec.js:39:6
[attach] attach "trace"
69 changes: 69 additions & 0 deletions test/reporter-data/expected-reports/report-till-1.42.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
Scenario 1
[hook] Before Hooks
[hook] BeforeAll Hooks .features-gen/sample.feature.spec.js:38:6
[test.step] BeforeAll hook features/steps.ts:14:1
[test.step] named BeforeAll hook features/steps.ts:15:1
[attach] attach "trace"
[hook] BeforeEach Hooks .features-gen/sample.feature.spec.js:40:6
[fixture] fixture: $afterEach
[fixture] fixture: $beforeEach
[test.step] named Before hook features/steps.ts:12:1
[test.step] BeforeEach hook features/steps.ts:13:1
[hook] Background .features-gen/sample.feature.spec.js:6:8
[test.step] Given background step .features-gen/sample.feature.spec.js:7:11
[test.step] And Action 00 .features-gen/sample.feature.spec.js:8:11
[test.step] Given I am on home page .features-gen/sample.feature.spec.js:12:11
[pw:api] page.goto(https://example.com) features/pom.ts:11:21
[test.step] And decorator step .features-gen/sample.feature.spec.js:13:11
[test.step] And Action 1 .features-gen/sample.feature.spec.js:14:11
[test.step] When Action 2 .features-gen/sample.feature.spec.js:15:11
[test.step] And Action 3 .features-gen/sample.feature.spec.js:16:11
[test.step] Then Action 4 .features-gen/sample.feature.spec.js:17:11
[test.step] But Action 5 .features-gen/sample.feature.spec.js:18:11
[test.step] * Action 6 .features-gen/sample.feature.spec.js:19:11
[hook] After Hooks
[attach] attach "screenshot"
[hook] AfterEach Hooks .features-gen/sample.feature.spec.js:41:6
[fixture] fixture: $beforeEach
[fixture] fixture: $afterEach
[test.step] AfterEach hook features/steps.ts:19:1
[test.step] named After hook features/steps.ts:18:1

Example #1
[hook] Before Hooks
[hook] BeforeEach Hooks .features-gen/sample.feature.spec.js:40:6
[fixture] fixture: $afterEach
[fixture] fixture: $beforeEach
[test.step] named Before hook features/steps.ts:12:1
[test.step] BeforeEach hook features/steps.ts:13:1
[hook] Background .features-gen/sample.feature.spec.js:6:8
[test.step] Given background step .features-gen/sample.feature.spec.js:7:11
[test.step] And Action 00 .features-gen/sample.feature.spec.js:8:11
[test.step] Given Action 44 .features-gen/sample.feature.spec.js:25:13
[hook] After Hooks
[hook] AfterEach Hooks .features-gen/sample.feature.spec.js:41:6
[fixture] fixture: $beforeEach
[fixture] fixture: $afterEach
[test.step] AfterEach hook features/steps.ts:19:1
[test.step] named After hook features/steps.ts:18:1
[attach] attach "trace"

Example #2
[hook] Before Hooks
[hook] BeforeEach Hooks .features-gen/sample.feature.spec.js:40:6
[fixture] fixture: $afterEach
[fixture] fixture: $beforeEach
[test.step] named Before hook features/steps.ts:12:1
[test.step] BeforeEach hook features/steps.ts:13:1
[hook] Background .features-gen/sample.feature.spec.js:6:8
[test.step] Given background step .features-gen/sample.feature.spec.js:7:11
[test.step] And Action 00 .features-gen/sample.feature.spec.js:8:11
[test.step] Given Action 55 .features-gen/sample.feature.spec.js:29:13
[hook] After Hooks
[hook] AfterEach Hooks .features-gen/sample.feature.spec.js:41:6
[fixture] fixture: $beforeEach
[fixture] fixture: $afterEach
[test.step] AfterEach hook features/steps.ts:19:1
[test.step] named After hook features/steps.ts:18:1
[attach] attach "trace"
[hook] AfterAll Hooks .features-gen/sample.feature.spec.js:39:6
69 changes: 69 additions & 0 deletions test/reporter-data/expected-reports/report-till-1.46.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
Scenario 1
[hook] Before Hooks
[hook] BeforeAll Hooks .features-gen/sample.feature.spec.js:38:6
[test.step] BeforeAll hook features/steps.ts:14:1
[test.step] named BeforeAll hook features/steps.ts:15:1
[hook] BeforeEach Hooks .features-gen/sample.feature.spec.js:40:6
[fixture] fixture: $afterEach
[fixture] fixture: $beforeEach
[test.step] named Before hook features/steps.ts:12:1
[test.step] BeforeEach hook features/steps.ts:13:1
[hook] Background .features-gen/sample.feature.spec.js:6:8
[test.step] Given background step .features-gen/sample.feature.spec.js:7:11
[test.step] And Action 00 .features-gen/sample.feature.spec.js:8:11
[test.step] Given I am on home page .features-gen/sample.feature.spec.js:12:11
[pw:api] page.goto(https://example.com) features/pom.ts:11:21
[test.step] And decorator step .features-gen/sample.feature.spec.js:13:11
[test.step] And Action 1 .features-gen/sample.feature.spec.js:14:11
[test.step] When Action 2 .features-gen/sample.feature.spec.js:15:11
[test.step] And Action 3 .features-gen/sample.feature.spec.js:16:11
[test.step] Then Action 4 .features-gen/sample.feature.spec.js:17:11
[test.step] But Action 5 .features-gen/sample.feature.spec.js:18:11
[test.step] * Action 6 .features-gen/sample.feature.spec.js:19:11
[hook] After Hooks
[attach] attach "screenshot"
[hook] AfterEach Hooks .features-gen/sample.feature.spec.js:41:6
[fixture] fixture: $beforeEach
[fixture] fixture: $afterEach
[test.step] AfterEach hook features/steps.ts:19:1
[test.step] named After hook features/steps.ts:18:1
[attach] attach "trace"

Example #1
[hook] Before Hooks
[hook] BeforeEach Hooks .features-gen/sample.feature.spec.js:40:6
[fixture] fixture: $afterEach
[fixture] fixture: $beforeEach
[test.step] named Before hook features/steps.ts:12:1
[test.step] BeforeEach hook features/steps.ts:13:1
[hook] Background .features-gen/sample.feature.spec.js:6:8
[test.step] Given background step .features-gen/sample.feature.spec.js:7:11
[test.step] And Action 00 .features-gen/sample.feature.spec.js:8:11
[test.step] Given Action 44 .features-gen/sample.feature.spec.js:25:13
[hook] After Hooks
[hook] AfterEach Hooks .features-gen/sample.feature.spec.js:41:6
[fixture] fixture: $beforeEach
[fixture] fixture: $afterEach
[test.step] AfterEach hook features/steps.ts:19:1
[test.step] named After hook features/steps.ts:18:1
[attach] attach "trace"

Example #2
[hook] Before Hooks
[hook] BeforeEach Hooks .features-gen/sample.feature.spec.js:40:6
[fixture] fixture: $afterEach
[fixture] fixture: $beforeEach
[test.step] named Before hook features/steps.ts:12:1
[test.step] BeforeEach hook features/steps.ts:13:1
[hook] Background .features-gen/sample.feature.spec.js:6:8
[test.step] Given background step .features-gen/sample.feature.spec.js:7:11
[test.step] And Action 00 .features-gen/sample.feature.spec.js:8:11
[test.step] Given Action 55 .features-gen/sample.feature.spec.js:29:13
[hook] After Hooks
[hook] AfterEach Hooks .features-gen/sample.feature.spec.js:41:6
[fixture] fixture: $beforeEach
[fixture] fixture: $afterEach
[test.step] AfterEach hook features/steps.ts:19:1
[test.step] named After hook features/steps.ts:18:1
[hook] AfterAll Hooks .features-gen/sample.feature.spec.js:39:6
[attach] attach "trace"
11 changes: 7 additions & 4 deletions test/reporter-data/test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ const testDir = new TestDir(import.meta);

// Since PW 1.46 there is a 'box' option for the fixture, that hides it from the report.
// Till Pw 1.41 first trace was attached to BeforeAll hooks, not to top level test.steps.
const expectedDir =
playwrightVersion < '1.42' ? 'till-1.41' : playwrightVersion < '1.46' ? 'till-1.45' : 'current';
const expectedReportPath = `expected-reports/${expectedDir}/report.txt`;
const expectedReportName =
playwrightVersion < '1.42'
? 'report-till-1.42.txt'
: playwrightVersion < '1.46'
? 'report-till-1.46.txt'
: 'report-current.txt';

test(testDir.name, () => {
testDir.clearDir('actual-reports');
Expand All @@ -23,7 +26,7 @@ test(testDir.name, () => {
});

function checkStepsTree() {
const expectedTree = testDir.getFileContents(expectedReportPath);
const expectedTree = testDir.getFileContents(`expected-reports/${expectedReportName}`);
const actualTree = testDir.getFileContents('actual-reports/report.txt');
expect(actualTree).toEqual(expectedTree);
}

0 comments on commit ea2c204

Please sign in to comment.