Skip to content

Commit 5515e99

Browse files
Merge pull request #28 from beyond-danube/map-tags-directly-update-pw-version
Map Tags directly update Playwright version (resolves #27)
2 parents de407d0 + e19cf27 commit 5515e99

File tree

5 files changed

+43
-34
lines changed

5 files changed

+43
-34
lines changed

package-lock.json

Lines changed: 29 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"author": "Matthew Thomas",
2121
"license": "MIT",
2222
"devDependencies": {
23-
"@playwright/test": "^1.39.0",
23+
"@playwright/test": "^1.55.0",
2424
"@types/jest": "^29.5.6",
2525
"@types/node": "^20.8.7",
2626
"@typescript-eslint/eslint-plugin": "^6.12.0",

src/generate-report.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ class GenerateCtrfReport implements Reporter {
198198
test.trace = this.extractFailureDetails(testResult).trace
199199
test.snippet = this.extractFailureDetails(testResult).snippet
200200
test.rawStatus = testResult.status
201-
test.tags = this.extractTagsFromTitle(testCase.title)
201+
test.tags = testCase.tags ?? []
202202
test.type = this.reporterConfigOptions.testType ?? 'e2e'
203203
test.filePath = testCase.location.file
204204
test.retries = testResult.retry
@@ -374,12 +374,6 @@ class GenerateCtrfReport implements Reporter {
374374
return pathComponents.join(' > ')
375375
}
376376

377-
extractTagsFromTitle(title: string): string[] {
378-
const tagPattern = /@\w+/g
379-
const tags = title.match(tagPattern)
380-
return tags ?? []
381-
}
382-
383377
extractScreenshotBase64(testResult: TestResult): string | undefined {
384378
const screenshotAttachment = testResult.attachments.find(
385379
(attachment) =>

tests/dummy-suites/failed-test-suite.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,15 @@ export const createFailedTestSuite = (): Suite => {
2929
steps: [],
3030
stdout: [],
3131
stderr: [],
32+
annotations: [],
3233
}
3334

3435
const testCase: TestCase = {
3536
title: 'should validate the expected condition',
3637
id: 'test-id-123',
3738
annotations: [],
39+
tags: [],
40+
type: 'test',
3841
expectedStatus: 'passed',
3942
timeout: 30000,
4043
results: [testResult],
@@ -57,6 +60,8 @@ export const createFailedTestSuite = (): Suite => {
5760
const suite: Suite = {
5861
title: 'Failed Test Suite',
5962
titlePath: () => ['Failed Test Suite'],
63+
entries: () => [testCase],
64+
type: 'project',
6065
location: {
6166
file: 'test-file.spec.ts',
6267
line: 10,

tests/dummy-suites/flaky-test-suite.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export const createFlakyTestSuite = (): Suite => {
3030
steps: [],
3131
stdout: [],
3232
stderr: [],
33+
annotations: [],
3334
}
3435

3536
const testError2: TestError = {
@@ -51,6 +52,7 @@ export const createFlakyTestSuite = (): Suite => {
5152
steps: [],
5253
stdout: [],
5354
stderr: [],
55+
annotations: [],
5456
}
5557

5658
const passedTestResult: TestResult = {
@@ -65,12 +67,15 @@ export const createFlakyTestSuite = (): Suite => {
6567
steps: [],
6668
stdout: [],
6769
stderr: [],
70+
annotations: [],
6871
}
6972

7073
const testCase: TestCase = {
7174
title: 'should validate the expected condition',
7275
id: 'test-id-123',
7376
annotations: [],
77+
tags: [],
78+
type: 'test',
7479
expectedStatus: 'passed',
7580
timeout: 30000,
7681
results: [failedTestResult, failedTestResult2, passedTestResult],
@@ -90,6 +95,8 @@ export const createFlakyTestSuite = (): Suite => {
9095
const suite: Suite = {
9196
title: 'Flaky Test Suite',
9297
titlePath: () => ['Flaky Test Suite'],
98+
entries: () => [testCase],
99+
type: 'project',
93100
location: {
94101
file: 'flaky-test.spec.ts',
95102
line: 10,

0 commit comments

Comments
 (0)