From 641cdb2842b81a7bf6fd770e58f4921dee0978dc Mon Sep 17 00:00:00 2001 From: Dmitrii Gridnev Date: Tue, 30 Jul 2024 12:37:22 +0200 Subject: [PATCH 1/4] fix: return the ability to add the QaseID to the test name This allows using the standard playwright mechanism to filter the tests being run. --- qase-playwright/changelog.md | 7 +++++++ qase-playwright/package.json | 2 +- qase-playwright/src/playwright.ts | 2 +- qase-playwright/src/reporter.ts | 10 +++++++++- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/qase-playwright/changelog.md b/qase-playwright/changelog.md index 3110b368..925beb62 100644 --- a/qase-playwright/changelog.md +++ b/qase-playwright/changelog.md @@ -1,3 +1,10 @@ +# playwright-qase-reporter@2.0.7 + +## 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. + # playwright-qase-reporter@2.0.6 ## What's new diff --git a/qase-playwright/package.json b/qase-playwright/package.json index f1e84a5e..e7bf041d 100644 --- a/qase-playwright/package.json +++ b/qase-playwright/package.json @@ -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", diff --git a/qase-playwright/src/playwright.ts b/qase-playwright/src/playwright.ts index 283f5a3a..6120180e 100644 --- a/qase-playwright/src/playwright.ts +++ b/qase-playwright/src/playwright.ts @@ -53,7 +53,7 @@ export const qase = ( PlaywrightQaseReporter.addIds(ids, name); - return `${name}`; + return `${name} (Qase ID: ${caseIds.join(',')})`; }; /** diff --git a/qase-playwright/src/reporter.ts b/qase-playwright/src/reporter.ts index 52281f4d..b24d58d6 100644 --- a/qase-playwright/src/reporter.ts +++ b/qase-playwright/src/reporter.ts @@ -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()) { @@ -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; + } } From 186b7fa0901a54f9a7e9f7e943cfc8c4a5b7f284 Mon Sep 17 00:00:00 2001 From: Dmitrii Gridnev Date: Wed, 31 Jul 2024 09:37:42 +0200 Subject: [PATCH 2/4] fix: ability to add the QaseID to the test name Fix the issue where QaseID was not assigned to the test. --- qase-playwright/package.json | 2 +- qase-playwright/src/reporter.ts | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/qase-playwright/package.json b/qase-playwright/package.json index e7bf041d..d0af5744 100644 --- a/qase-playwright/package.json +++ b/qase-playwright/package.json @@ -1,6 +1,6 @@ { "name": "playwright-qase-reporter", - "version": "2.0.7", + "version": "2.0.8", "description": "Qase TMS Playwright Reporter", "main": "./dist/index.js", "types": "./dist/index.d.ts", diff --git a/qase-playwright/src/reporter.ts b/qase-playwright/src/reporter.ts index b24d58d6..4d7c4565 100644 --- a/qase-playwright/src/reporter.ts +++ b/qase-playwright/src/reporter.ts @@ -349,6 +349,8 @@ export class PlaywrightQaseReporter implements Reporter { message += error.message; } + const testTitle = this.removeQaseIdsFromTitle(test.title); + const testResult: TestResultType = { attachments: testCaseMetadata.attachments, author: null, @@ -383,7 +385,7 @@ export class PlaywrightQaseReporter implements Reporter { signature: '', steps: this.transformSteps(result.steps, null), testops_id: null, - title: testCaseMetadata.title === '' ? this.removeQaseIdsFromTitle(test.title) : testCaseMetadata.title, + title: testCaseMetadata.title === '' ? testTitle : testCaseMetadata.title, }; if (this.reporter.isCaptureLogs()) { @@ -399,7 +401,7 @@ export class PlaywrightQaseReporter implements Reporter { if (testCaseMetadata.ids.length > 0) { testResult.testops_id = testCaseMetadata.ids; } else { - const ids = PlaywrightQaseReporter.qaseIds.get(test.title) ?? null; + const ids = PlaywrightQaseReporter.qaseIds.get(testTitle) ?? null; testResult.testops_id = ids; if (ids) { const path = `${test.location.file}:${test.location.line}:${test.location.column}`; @@ -477,10 +479,15 @@ export class PlaywrightQaseReporter implements Reporter { return signature; } + /** + * @param {string} title + * @returns {string} + * @private + */ private removeQaseIdsFromTitle(title: string): string { const matches = title.match(/\(Qase ID: ([0-9,]+)\)$/i); if (matches) { - return title.replace(matches[0], ''); + return title.replace(matches[0], '').trimEnd(); } return title; } From d6ef392ce4fb829d64a64f74ff960066028dbe1e Mon Sep 17 00:00:00 2001 From: Dmitrii Gridnev Date: Thu, 1 Aug 2024 13:24:17 +0200 Subject: [PATCH 3/4] fix: uploading results with the same name Fixed the problem when tests have the same name and different QaseIDs. They were uploaded into the Qase with an incorrect QaseID. --- qase-playwright/changelog.md | 7 +++++++ qase-playwright/package.json | 2 +- qase-playwright/src/playwright.ts | 6 ++++-- qase-playwright/src/reporter.ts | 2 +- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/qase-playwright/changelog.md b/qase-playwright/changelog.md index 925beb62..4233f871 100644 --- a/qase-playwright/changelog.md +++ b/qase-playwright/changelog.md @@ -1,3 +1,10 @@ +# playwright-qase-reporter@2.0.9 + +## What's new + +Fixed the problem when tests have the same name and different QaseIDs. +They were uploaded into the Qase with an incorrect QaseID. + # playwright-qase-reporter@2.0.7 ## What's new diff --git a/qase-playwright/package.json b/qase-playwright/package.json index d0af5744..1418dc0c 100644 --- a/qase-playwright/package.json +++ b/qase-playwright/package.json @@ -1,6 +1,6 @@ { "name": "playwright-qase-reporter", - "version": "2.0.8", + "version": "2.0.9", "description": "Qase TMS Playwright Reporter", "main": "./dist/index.js", "types": "./dist/index.d.ts", diff --git a/qase-playwright/src/playwright.ts b/qase-playwright/src/playwright.ts index 6120180e..fb7d5d2e 100644 --- a/qase-playwright/src/playwright.ts +++ b/qase-playwright/src/playwright.ts @@ -51,9 +51,11 @@ export const qase = ( console.log(`qase: qase ID ${id} should be a number`); } - PlaywrightQaseReporter.addIds(ids, name); + const newName = `${name} (Qase ID: ${caseIds.join(',')})`; - return `${name} (Qase ID: ${caseIds.join(',')})`; + PlaywrightQaseReporter.addIds(ids, newName); + + return newName; }; /** diff --git a/qase-playwright/src/reporter.ts b/qase-playwright/src/reporter.ts index 4d7c4565..0fafe46a 100644 --- a/qase-playwright/src/reporter.ts +++ b/qase-playwright/src/reporter.ts @@ -401,7 +401,7 @@ export class PlaywrightQaseReporter implements Reporter { if (testCaseMetadata.ids.length > 0) { testResult.testops_id = testCaseMetadata.ids; } else { - const ids = PlaywrightQaseReporter.qaseIds.get(testTitle) ?? null; + const ids = PlaywrightQaseReporter.qaseIds.get(test.title) ?? null; testResult.testops_id = ids; if (ids) { const path = `${test.location.file}:${test.location.line}:${test.location.column}`; From 189e667e6de789d7e78db6f3cdfd7503aef19232 Mon Sep 17 00:00:00 2001 From: Dmitrii Gridnev Date: Mon, 12 Aug 2024 11:26:28 +0200 Subject: [PATCH 4/4] bump versions Minor release of the Cypress reporter --- qase-cypress/changelog.md | 6 ++++++ qase-cypress/package.json | 4 ++-- qase-javascript-commons/changelog.md | 6 ++++++ qase-javascript-commons/package.json | 2 +- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/qase-cypress/changelog.md b/qase-cypress/changelog.md index 347f9e38..65e960f2 100644 --- a/qase-cypress/changelog.md +++ b/qase-cypress/changelog.md @@ -1,3 +1,9 @@ +# cypress-qase-reporter@2.1.0 + +## What's new + +Minor release of the Cypress reporter package + # cypress-qase-reporter@2.1.0-beta.3 ## What's new diff --git a/qase-cypress/package.json b/qase-cypress/package.json index 67106bbe..14d63866 100644 --- a/qase-cypress/package.json +++ b/qase-cypress/package.json @@ -1,6 +1,6 @@ { "name": "cypress-qase-reporter", - "version": "2.1.0-beta.3", + "version": "2.1.0", "description": "Qase Cypress Reporter", "homepage": "https://github.com/qase-tms/qase-javascript", "sideEffects": false, @@ -46,7 +46,7 @@ "author": "Qase Team ", "license": "Apache-2.0", "dependencies": { - "qase-javascript-commons": "~2.1.0-beta.1", + "qase-javascript-commons": "~2.1.0", "uuid": "^9.0.1" }, "peerDependencies": { diff --git a/qase-javascript-commons/changelog.md b/qase-javascript-commons/changelog.md index daeb87c2..fa352234 100644 --- a/qase-javascript-commons/changelog.md +++ b/qase-javascript-commons/changelog.md @@ -1,3 +1,9 @@ +# qase-javascript-commons@2.1.0 + +## What's new + +Minor release of the commons package + # qase-javascript-commons@2.1.0-beta.1 ## What's new diff --git a/qase-javascript-commons/package.json b/qase-javascript-commons/package.json index f0a66170..5a79bdfd 100644 --- a/qase-javascript-commons/package.json +++ b/qase-javascript-commons/package.json @@ -1,6 +1,6 @@ { "name": "qase-javascript-commons", - "version": "2.1.0-beta.1", + "version": "2.1.0", "description": "Qase JS Reporters", "main": "./dist/index.js", "types": "./dist/index.d.ts",