From d6ef392ce4fb829d64a64f74ff960066028dbe1e Mon Sep 17 00:00:00 2001 From: Dmitrii Gridnev Date: Thu, 1 Aug 2024 13:24:17 +0200 Subject: [PATCH] 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}`;