Skip to content

Commit

Permalink
fix: return the ability to add the QaseID to the test name
Browse files Browse the repository at this point in the history
This allows using the standard playwright mechanism to filter the tests being run.
  • Loading branch information
gibiw authored and NickVolynkin committed Jul 30, 2024
1 parent 6813245 commit 054ac49
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
7 changes: 7 additions & 0 deletions qase-playwright/changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# [email protected]

## What's new

Returned the ability to add the QaseID to the test name.
This allows using the standard playwright mechanism to filter the tests being run.

# [email protected]

## What's new
Expand Down
2 changes: 1 addition & 1 deletion qase-playwright/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "playwright-qase-reporter",
"version": "2.0.6",
"version": "2.0.7",
"description": "Qase TMS Playwright Reporter",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion qase-playwright/src/playwright.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const qase = (

PlaywrightQaseReporter.addIds(ids, name);

return `${name}`;
return `${name} (Qase ID: ${caseIds.join(',')})`;
};

/**
Expand Down
10 changes: 9 additions & 1 deletion qase-playwright/src/reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ export class PlaywrightQaseReporter implements Reporter {
signature: '',
steps: this.transformSteps(result.steps, null),
testops_id: null,
title: testCaseMetadata.title === '' ? test.title : testCaseMetadata.title,
title: testCaseMetadata.title === '' ? this.removeQaseIdsFromTitle(test.title) : testCaseMetadata.title,
};

if (this.reporter.isCaptureLogs()) {
Expand Down Expand Up @@ -476,4 +476,12 @@ export class PlaywrightQaseReporter implements Reporter {

return signature;
}

private removeQaseIdsFromTitle(title: string): string {
const matches = title.match(/\(Qase ID: ([0-9,]+)\)$/i);
if (matches) {
return title.replace(matches[0], '');
}
return title;
}
}

0 comments on commit 054ac49

Please sign in to comment.