diff --git a/package-lock.json b/package-lock.json index 491b3264..93cef696 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15185,11 +15185,11 @@ }, "qase-cucumberjs": { "name": "cucumberjs-qase-reporter", - "version": "2.0.0", + "version": "2.0.1", "license": "Apache-2.0", "dependencies": { "@cucumber/messages": "^22.0.0", - "qase-javascript-commons": "^2.0.0-beta.8" + "qase-javascript-commons": "^2.2.0" }, "devDependencies": { "@jest/globals": "^29.5.0", @@ -15206,10 +15206,10 @@ }, "qase-cypress": { "name": "cypress-qase-reporter", - "version": "2.1.0", + "version": "2.1.1", "license": "Apache-2.0", "dependencies": { - "qase-javascript-commons": "~2.1.0", + "qase-javascript-commons": "~2.2.0", "uuid": "^9.0.1" }, "devDependencies": { @@ -15229,7 +15229,7 @@ } }, "qase-javascript-commons": { - "version": "2.1.3", + "version": "2.2.0", "license": "Apache-2.0", "dependencies": { "ajv": "^8.12.0", @@ -15241,7 +15241,7 @@ "lodash.merge": "^4.6.2", "lodash.mergewith": "^4.6.2", "mime-types": "^2.1.33", - "qaseio": "~2.2.0", + "qaseio": "~2.3.0", "strip-ansi": "^6.0.1", "uuid": "^9.0.0" }, @@ -15279,22 +15279,11 @@ "follow-redirects": "^1.14.0" } }, - "qase-javascript-commons/node_modules/qaseio": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/qaseio/-/qaseio-2.2.0.tgz", - "integrity": "sha512-Nsk7Li4H0OspSBxCGVkWVB9rkl9PDd9qEUChFDBSPJhRBHORWCGXnXeJofgGW7qDCgLSgwGp4ctIkEe2GM7v9Q==", - "dependencies": { - "axios": "^0.28.0", - "axios-retry": "^3.5.0" - }, - "engines": { - "node": ">=14" - } - }, "qase-javascript-commons/node_modules/qaseio/node_modules/axios": { "version": "0.28.1", "resolved": "https://registry.npmjs.org/axios/-/axios-0.28.1.tgz", "integrity": "sha512-iUcGA5a7p0mVb4Gm/sy+FSECNkPFT4y7wt6OM/CDpO/OnNCvSs3PoMG8ibrC9jRoGYU0gUK5pXVC4NPXq6lHRQ==", + "extraneous": true, "dependencies": { "follow-redirects": "^1.15.0", "form-data": "^4.0.0", @@ -15303,12 +15292,12 @@ }, "qase-jest": { "name": "jest-qase-reporter", - "version": "2.0.1", + "version": "2.0.2", "license": "Apache-2.0", "dependencies": { "lodash.get": "^4.4.2", "lodash.has": "^4.5.2", - "qase-javascript-commons": "^2.0.0", + "qase-javascript-commons": "~2.2.0", "uuid": "^9.0.0" }, "devDependencies": { @@ -15330,12 +15319,12 @@ }, "qase-mocha": { "name": "mocha-qase-reporter", - "version": "1.0.0-beta.2", + "version": "1.0.0-beta.3", "license": "Apache-2.0", "dependencies": { "deasync-promise": "^1.0.1", "mocha": "^10.2.0", - "qase-javascript-commons": "^2.0.0", + "qase-javascript-commons": "~2.2.0", "uuid": "^9.0.1" }, "devDependencies": { @@ -15364,10 +15353,10 @@ }, "qase-newman": { "name": "newman-reporter-qase", - "version": "2.0.0", + "version": "2.0.1", "license": "Apache-2.0", "dependencies": { - "qase-javascript-commons": "^2.0.9", + "qase-javascript-commons": "~2.2.0", "semver": "^7.5.1" }, "devDependencies": { @@ -15388,11 +15377,11 @@ }, "qase-playwright": { "name": "playwright-qase-reporter", - "version": "2.0.10", + "version": "2.0.11", "license": "Apache-2.0", "dependencies": { "chalk": "^4.1.2", - "qase-javascript-commons": "~2.1.1", + "qase-javascript-commons": "~2.2.0", "uuid": "^9.0.0" }, "devDependencies": { @@ -15410,10 +15399,10 @@ }, "qase-testcafe": { "name": "testcafe-reporter-qase", - "version": "2.0.0", + "version": "2.0.1", "license": "Apache-2.0", "dependencies": { - "qase-javascript-commons": "^2.0.9", + "qase-javascript-commons": "~2.2.0", "uuid": "^9.0.0" }, "devDependencies": { @@ -15431,14 +15420,14 @@ }, "qase-wdio": { "name": "wdio-qase-reporter", - "version": "1.0.0-beta.1", + "version": "1.0.0-beta.2", "license": "Apache-2.0", "dependencies": { "@types/node": "^20.1.0", "@wdio/reporter": "^8.39.0", "@wdio/types": "^8.39.0", "csv-stringify": "^6.0.4", - "qase-javascript-commons": "~2.1.2", + "qase-javascript-commons": "~2.2.0", "strip-ansi": "^7.1.0", "uuid": "^9.0.1" }, @@ -15465,6 +15454,27 @@ "url": "https://github.com/chalk/ansi-regex?sponsor=1" } }, + "qase-wdio/node_modules/qase-javascript-commons/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "extraneous": true, + "engines": { + "node": ">=8" + } + }, + "qase-wdio/node_modules/qase-javascript-commons/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "extraneous": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "qase-wdio/node_modules/strip-ansi": { "version": "7.1.0", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", diff --git a/qase-cucumberjs/package.json b/qase-cucumberjs/package.json index 9924c5e1..3e8ded13 100644 --- a/qase-cucumberjs/package.json +++ b/qase-cucumberjs/package.json @@ -1,6 +1,6 @@ { "name": "cucumberjs-qase-reporter", - "version": "2.0.0", + "version": "2.0.1", "description": "Qase TMS CucumberJS Reporter", "homepage": "https://github.com/qase-tms/qase-javascript", "main": "./dist/index.js", @@ -40,7 +40,7 @@ "license": "Apache-2.0", "dependencies": { "@cucumber/messages": "^22.0.0", - "qase-javascript-commons": "^2.0.0-beta.8" + "qase-javascript-commons": "^2.2.0" }, "peerDependencies": { "@cucumber/cucumber": ">=7.0.0" diff --git a/qase-cucumberjs/src/storage.ts b/qase-cucumberjs/src/storage.ts index bfcc1639..6bb9882c 100644 --- a/qase-cucumberjs/src/storage.ts +++ b/qase-cucumberjs/src/storage.ts @@ -232,6 +232,7 @@ export class Storage { message: null, muted: false, params: {}, + group_params: {}, relations: relations, run_id: null, signature: this.getSignature(pickle, metadata.ids), diff --git a/qase-cypress/package.json b/qase-cypress/package.json index 14d63866..7bf505c1 100644 --- a/qase-cypress/package.json +++ b/qase-cypress/package.json @@ -1,6 +1,6 @@ { "name": "cypress-qase-reporter", - "version": "2.1.0", + "version": "2.1.1", "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", + "qase-javascript-commons": "~2.2.0", "uuid": "^9.0.1" }, "peerDependencies": { diff --git a/qase-cypress/src/reporter.ts b/qase-cypress/src/reporter.ts index 2babb63b..18b5657a 100644 --- a/qase-cypress/src/reporter.ts +++ b/qase-cypress/src/reporter.ts @@ -196,6 +196,7 @@ export class CypressQaseReporter extends reporters.Base { message: test.err?.message ?? null, muted: false, params: {}, + group_params: {}, relations: relations, run_id: null, signature: this.getSignature(test, ids), diff --git a/qase-javascript-commons/package.json b/qase-javascript-commons/package.json index 9ab96f5a..164a3a50 100644 --- a/qase-javascript-commons/package.json +++ b/qase-javascript-commons/package.json @@ -1,6 +1,6 @@ { "name": "qase-javascript-commons", - "version": "2.1.3", + "version": "2.2.0", "description": "Qase JS Reporters", "main": "./dist/index.js", "types": "./dist/index.d.ts", @@ -33,7 +33,7 @@ "lodash.merge": "^4.6.2", "lodash.mergewith": "^4.6.2", "mime-types": "^2.1.33", - "qaseio": "~2.2.0", + "qaseio": "~2.3.0", "strip-ansi": "^6.0.1", "uuid": "^9.0.0" }, diff --git a/qase-javascript-commons/src/models/test-result.ts b/qase-javascript-commons/src/models/test-result.ts index efdc5514..5ef172b2 100644 --- a/qase-javascript-commons/src/models/test-result.ts +++ b/qase-javascript-commons/src/models/test-result.ts @@ -13,6 +13,7 @@ export class TestResultType { attachments: Attachment[]; steps: TestStepType[]; params: Record; + group_params: Record; author: string | null; relations: Relation | null; muted: boolean; @@ -29,6 +30,7 @@ export class TestResultType { this.attachments = []; this.steps = []; this.params = {}; + this.group_params = {}; this.author = null; this.relations = null; this.muted = false; diff --git a/qase-javascript-commons/src/reporters/testops-reporter.ts b/qase-javascript-commons/src/reporters/testops-reporter.ts index 6e6ad907..58d79ff2 100644 --- a/qase-javascript-commons/src/reporters/testops-reporter.ts +++ b/qase-javascript-commons/src/reporters/testops-reporter.ts @@ -36,22 +36,22 @@ import { StateManager } from '../state/state'; const defaultChunkSize = 200; -export type TestOpsRunType = { +export interface TestOpsRunType { id?: number | undefined; title: string; description: string; complete?: boolean | undefined; -}; +} -export type TestOpsPlanType = { +export interface TestOpsPlanType { id?: number | undefined; -}; +} -export type TestOpsBatchType = { +export interface TestOpsBatchType { size?: number | undefined; } -export type TestOpsOptionsType = { +export interface TestOpsOptionsType { project: string; uploadAttachments?: boolean | undefined; run: TestOpsRunType; @@ -59,7 +59,7 @@ export type TestOpsOptionsType = { batch?: TestOpsBatchType; defect?: boolean | undefined; useV2?: boolean | undefined; -}; +} /** * @class TestOpsReporter @@ -401,11 +401,38 @@ export class TestOpsReporter extends AbstractReporter { const attachments = await this.uploadAttachments(result.attachments); const steps = await this.transformStepsV1(result.steps, result.title); + const param: Record = {}; + + for (const key in result.params) { + const value = result.params[key]; + if (!value) { + continue; + } + param[key] = value; + } + + const group_params: string[][] = []; + + const keys = Object.keys(result.group_params); + if (keys.length > 0) { + group_params.push(keys); + } + + for (const key in result.group_params) { + const value = result.group_params[key]; + if (!value) { + continue; + } + param[key] = value; + } + + const resultCreate: ResultCreate = { attachments: attachments, comment: result.message, defect: this.defect, - param: result.params, + param: param, + param_groups: group_params, stacktrace: result.execution.stacktrace, start_time: result.execution.start_time ? result.execution.start_time | 0 : null, status: result.execution.status, @@ -422,7 +449,7 @@ export class TestOpsReporter extends AbstractReporter { const rootSuite = this.rootSuite ? `${this.rootSuite}\t` : ''; resultCreate.case = { title: result.title, - suite_title: result.relations?.suite ? `${rootSuite}${result.relations?.suite?.data.map((suite) => suite.title).join('\t')}` : rootSuite, + suite_title: result.relations?.suite ? `${rootSuite}${result.relations.suite.data.map((suite) => suite.title).join('\t')}` : rootSuite, description: result.fields['description'] ?? null, postconditions: result.fields['postconditions'] ?? null, preconditions: result.fields['preconditions'] ?? null, diff --git a/qase-jest/package.json b/qase-jest/package.json index 62735a27..8dd8ba24 100644 --- a/qase-jest/package.json +++ b/qase-jest/package.json @@ -1,6 +1,6 @@ { "name": "jest-qase-reporter", - "version": "2.0.1", + "version": "2.0.2", "description": "Qase TMS Jest Reporter", "main": "./dist/index.js", "types": "./dist/index.d.ts", @@ -45,7 +45,7 @@ "dependencies": { "lodash.get": "^4.4.2", "lodash.has": "^4.5.2", - "qase-javascript-commons": "^2.0.0", + "qase-javascript-commons": "~2.2.0", "uuid": "^9.0.0" }, "devDependencies": { diff --git a/qase-jest/src/reporter.ts b/qase-jest/src/reporter.ts index 5aa8c01e..a339da7e 100644 --- a/qase-jest/src/reporter.ts +++ b/qase-jest/src/reporter.ts @@ -133,6 +133,7 @@ export class JestQaseReporter implements Reporter { message: error?.message ?? null, muted: false, params: {}, + group_params: {}, relations: this.getRelations(filePath, ancestorTitles), run_id: null, signature: this.getSignature(filePath, fullName, ids), diff --git a/qase-mocha/changelog.md b/qase-mocha/changelog.md index ece20759..8c6cadf9 100644 --- a/qase-mocha/changelog.md +++ b/qase-mocha/changelog.md @@ -1,3 +1,16 @@ +# qase-mocha@1.0.0-beta.3 + +## What's new + +Support group parameters for test cases. You can specify the group parameters in the test case using the following format: + +```ts + it('test', () => { + this.groupParameters({ param1: 'value1', param2: 'value2' }); + expect(true).to.equal(true); + }); +``` + # qase-mocha@1.0.0-beta.2 ## What's new diff --git a/qase-mocha/package.json b/qase-mocha/package.json index 16d1add7..a0afd47b 100644 --- a/qase-mocha/package.json +++ b/qase-mocha/package.json @@ -1,6 +1,6 @@ { "name": "mocha-qase-reporter", - "version": "1.0.0-beta.2", + "version": "1.0.0-beta.3", "description": "Mocha Cypress Reporter", "homepage": "https://github.com/qase-tms/qase-javascript", "sideEffects": false, @@ -42,7 +42,7 @@ "dependencies": { "mocha": "^10.2.0", "deasync-promise": "^1.0.1", - "qase-javascript-commons": "^2.0.0", + "qase-javascript-commons": "~2.2.0", "uuid": "^9.0.1" }, "devDependencies": { diff --git a/qase-mocha/src/reporter.ts b/qase-mocha/src/reporter.ts index 33673ef7..21241e23 100644 --- a/qase-mocha/src/reporter.ts +++ b/qase-mocha/src/reporter.ts @@ -103,6 +103,7 @@ export class MochaQaseReporter extends reporters.Base { ctx.qaseId = this.qaseId; ctx.title = this.title; ctx.parameters = this.parameters; + ctx.groupParameters = this.groupParameters; ctx.fields = this.fields; ctx.suite = this.suite; ctx.ignore = this.ignore; @@ -151,6 +152,7 @@ export class MochaQaseReporter extends reporters.Base { message: message ?? null, muted: false, params: this.metadata.parameters ?? {}, + group_params: this.metadata.groupParameters ?? {}, relations: relations, run_id: null, signature: this.getSignature(test, ids), @@ -267,6 +269,14 @@ export class MochaQaseReporter extends reporters.Base { this.metadata.parameters = stringRecord; }; + groupParameters = (values: Record) => { + const stringRecord: Record = {}; + for (const [key, value] of Object.entries(values)) { + stringRecord[String(key)] = String(value); + } + this.metadata.groupParameters = stringRecord; + }; + fields = (values: Record) => { const stringRecord: Record = {}; for (const [key, value] of Object.entries(values)) { diff --git a/qase-mocha/src/types.ts b/qase-mocha/src/types.ts index 81437b25..01882e53 100644 --- a/qase-mocha/src/types.ts +++ b/qase-mocha/src/types.ts @@ -24,6 +24,8 @@ export interface Methods { parameters(values: Record): void; + groupParameters(values: Record): void; + fields(values: Record): void; suite(name: string): void; @@ -42,6 +44,7 @@ export class Metadata { title?: string; fields?: Record; parameters?: Record; + groupParameters?: Record; ignore?: boolean; suite?: string; comment?: string; @@ -93,6 +96,7 @@ export class Metadata { this.title = ''; this.fields = {}; this.parameters = {}; + this.groupParameters = {}; this.ignore = false; this.suite = ''; this.comment = ''; diff --git a/qase-newman/package.json b/qase-newman/package.json index da18e6c9..07675a91 100644 --- a/qase-newman/package.json +++ b/qase-newman/package.json @@ -1,6 +1,6 @@ { "name": "newman-reporter-qase", - "version": "2.0.0", + "version": "2.0.1", "description": "Qase TMS Newman Reporter", "main": "./dist/index.js", "types": "./dist/index.d.ts", @@ -39,7 +39,7 @@ "author": "Qase Team ", "license": "Apache-2.0", "dependencies": { - "qase-javascript-commons": "^2.0.9", + "qase-javascript-commons": "~2.2.0", "semver": "^7.5.1" }, "devDependencies": { diff --git a/qase-newman/src/reporter.ts b/qase-newman/src/reporter.ts index 40230f1c..3058bd77 100644 --- a/qase-newman/src/reporter.ts +++ b/qase-newman/src/reporter.ts @@ -158,6 +158,7 @@ export class NewmanQaseReporter { message: null, muted: false, params: {}, + group_params: {}, relations: relation, run_id: null, signature: this.getSignature(suites, item.name, ids), diff --git a/qase-playwright/changelog.md b/qase-playwright/changelog.md index 7e13a861..19618030 100644 --- a/qase-playwright/changelog.md +++ b/qase-playwright/changelog.md @@ -1,3 +1,16 @@ +# playwright-qase-reporter@2.0.11 + +## What's new + +Support group parameters for test cases. You can specify the group parameters in the test case using the following format: + +```ts + test('test', () => { + qase.groupParameters({ 'param01': 'value01', 'param02': 'value02' }); + expect(true).toBe(true); + }); +``` + # playwright-qase-reporter@2.0.10 ## What's new diff --git a/qase-playwright/package.json b/qase-playwright/package.json index 54f49ef6..7f33ce17 100644 --- a/qase-playwright/package.json +++ b/qase-playwright/package.json @@ -1,6 +1,6 @@ { "name": "playwright-qase-reporter", - "version": "2.0.10", + "version": "2.0.11", "description": "Qase TMS Playwright Reporter", "main": "./dist/index.js", "types": "./dist/index.d.ts", @@ -44,7 +44,7 @@ "license": "Apache-2.0", "dependencies": { "chalk": "^4.1.2", - "qase-javascript-commons": "~2.1.1", + "qase-javascript-commons": "~2.2.0", "uuid": "^9.0.0" }, "peerDependencies": { diff --git a/qase-playwright/src/playwright.ts b/qase-playwright/src/playwright.ts index fb7d5d2e..457c2e18 100644 --- a/qase-playwright/src/playwright.ts +++ b/qase-playwright/src/playwright.ts @@ -12,6 +12,7 @@ export interface MetadataMessage { title?: string; fields?: Record; parameters?: Record; + groupParams?: Record; ignore?: boolean; suite?: string; comment?: string; @@ -130,12 +131,37 @@ qase.parameters = function(values: Record) { for (const [key, value] of Object.entries(values)) { stringRecord[String(key)] = String(value); } + addMetadata({ parameters: stringRecord, }); return this; }; +/** + * Set group parameters for the test case. + * All parameters will be grouped as a single entity. + * @param {Record[]} values + * @example + * for (const value of values) { + * test('test', async ({ page }) => { + * qase.groupParameters({ 'parameter': value }); + * await page.goto('https://example.com'); + * }); + * ) + */ +qase.groupParameters = function(values: Record) { + const stringRecord: Record = {}; + for (const [key, value] of Object.entries(values)) { + stringRecord[String(key)] = String(value); + } + + addMetadata({ + groupParams: stringRecord, + }); + return this; +}; + /** * Attach a file to the test case or the step * @param attach diff --git a/qase-playwright/src/reporter.ts b/qase-playwright/src/reporter.ts index 0a00affd..c2a4e40a 100644 --- a/qase-playwright/src/reporter.ts +++ b/qase-playwright/src/reporter.ts @@ -29,6 +29,7 @@ interface TestCaseMetadata { title: string; fields: Record; parameters: Record; + groupParams: Record; attachments: Attachment[]; ignore: boolean; suite: string; @@ -99,6 +100,7 @@ export class PlaywrightQaseReporter implements Reporter { title: '', fields: {}, parameters: {}, + groupParams: {}, attachments: [], ignore: false, suite: '', @@ -144,6 +146,10 @@ export class PlaywrightQaseReporter implements Reporter { metadata.comment = message.comment; } + if (message.groupParams) { + metadata.groupParams = message.groupParams; + } + continue; } @@ -369,6 +375,7 @@ export class PlaywrightQaseReporter implements Reporter { message: message, muted: false, params: testCaseMetadata.parameters, + group_params: testCaseMetadata.groupParams, relations: { suite: { data: suites.filter((suite) => { diff --git a/qase-testcafe/changelog.md b/qase-testcafe/changelog.md index e8eb3854..34b3befd 100644 --- a/qase-testcafe/changelog.md +++ b/qase-testcafe/changelog.md @@ -1,3 +1,19 @@ +# qase-testcafe@2.0.1 + +## What's new + +Support group parameters for test cases. You can specify the group parameters in the test case using the following format: + +```ts +const q = qase.groupParameters({ 'param01': 'value01', 'param02': 'value02' }).create(); +test.meta({ ...q })( + 'test', + async (t) => { + await t; + }, +); +``` + # qase-testcafe@2.0.0 ## What's new diff --git a/qase-testcafe/package.json b/qase-testcafe/package.json index 76522a4a..613e928d 100644 --- a/qase-testcafe/package.json +++ b/qase-testcafe/package.json @@ -1,6 +1,6 @@ { "name": "testcafe-reporter-qase", - "version": "2.0.0", + "version": "2.0.1", "description": "Qase TMS TestCafe Reporter", "main": "./dist/index.js", "types": "./dist/index.d.ts", @@ -40,7 +40,7 @@ "author": "Qase Team ", "license": "Apache-2.0", "dependencies": { - "qase-javascript-commons": "^2.0.9", + "qase-javascript-commons": "~2.2.0", "uuid": "^9.0.0" }, "peerDependencies": { diff --git a/qase-testcafe/src/qase.ts b/qase-testcafe/src/qase.ts index a2489fa6..c811c085 100644 --- a/qase-testcafe/src/qase.ts +++ b/qase-testcafe/src/qase.ts @@ -4,6 +4,7 @@ export class qase { private static _qaseTitle = ''; private static _qaseFields = ''; private static _qaseParameters = ''; + private static _qaseGroupParameters = ''; /** * Set a Qase ID for the test case @@ -65,6 +66,21 @@ export class qase { return this; }; + /** + * Set a group parameters for the test case + * Don't forget to call `create` method after setting all the necessary parameters + * @param {Record} values + * @example + * const q = qase.group_parameters({ 'severity': 'high', 'priority': 'medium' }).create(); + * test.meta(q)('Test case title', async t => { ... }); + * or + * test.meta({userField: 123, ...q})('Test case title', async t => { ... }); + */ + public static group_parameters = (values: Record) => { + this._qaseGroupParameters = this.toNormalizeRecord(values); + return this; + }; + /** * Create a Qase metadata * Call this method after setting all the necessary parameters @@ -80,12 +96,14 @@ export class qase { QaseTitle: this._qaseTitle, QaseFields: this._qaseFields, QaseParameters: this._qaseParameters, + QaseGroupParameters: this._qaseGroupParameters, }; this._qaseID = ''; this._qaseTitle = ''; this._qaseFields = ''; this._qaseParameters = ''; + this._qaseGroupParameters = ''; return meta; }; diff --git a/qase-testcafe/src/reporter.ts b/qase-testcafe/src/reporter.ts index dbfe23ab..1886eca5 100644 --- a/qase-testcafe/src/reporter.ts +++ b/qase-testcafe/src/reporter.ts @@ -51,6 +51,7 @@ enum metadataEnum { title = 'QaseTitle', fields = 'QaseFields', parameters = 'QaseParameters', + groupParameters = 'QaseGroupParameters', oldID = 'CID', } @@ -59,6 +60,7 @@ interface MetadataType { [metadataEnum.title]: string | undefined; [metadataEnum.fields]: Record; [metadataEnum.parameters]: Record; + [metadataEnum.groupParameters]: Record; } export interface TestRunInfoType { @@ -199,6 +201,7 @@ export class TestcafeQaseReporter { message: error.message, muted: false, params: metadata[metadataEnum.parameters], + group_params: metadata[metadataEnum.groupParameters], relations: { suite: { data: [ @@ -234,6 +237,7 @@ export class TestcafeQaseReporter { QaseTitle: undefined, QaseFields: {}, QaseParameters: {}, + QaseGroupParameters: {}, }; if (meta[metadataEnum.oldID] !== undefined && meta[metadataEnum.oldID] !== '') { diff --git a/qase-wdio/changelog.md b/qase-wdio/changelog.md index 85953e0a..01b011b2 100644 --- a/qase-wdio/changelog.md +++ b/qase-wdio/changelog.md @@ -1,3 +1,17 @@ +# qase-wdio@1.0.0-beta.2 + +## What's new + +Support group parameters for test cases. You can specify the group parameters in the test case using the following +format: + +```ts + it('test', () => { + qase.groupParameters({ 'param01': 'value01', 'param02': 'value02' }); + expect(true).to.equal(true); +}); +``` + # qase-wdio@1.0.0-beta.1 ## What's new diff --git a/qase-wdio/package.json b/qase-wdio/package.json index 6b347eaf..db421b35 100644 --- a/qase-wdio/package.json +++ b/qase-wdio/package.json @@ -1,6 +1,6 @@ { "name": "wdio-qase-reporter", - "version": "1.0.0-beta.1", + "version": "1.0.0-beta.2", "description": "Qase WebDriverIO Reporter", "homepage": "https://github.com/qase-tms/qase-javascript", "sideEffects": false, @@ -32,7 +32,7 @@ "author": "Qase Team ", "license": "Apache-2.0", "dependencies": { - "qase-javascript-commons": "~2.1.2", + "qase-javascript-commons": "~2.2.0", "uuid": "^9.0.1", "@types/node": "^20.1.0", "@wdio/reporter": "^8.39.0", diff --git a/qase-wdio/src/events.ts b/qase-wdio/src/events.ts index 0b877e03..f20d99f3 100644 --- a/qase-wdio/src/events.ts +++ b/qase-wdio/src/events.ts @@ -5,6 +5,7 @@ export const events = { addSuite: 'qase:suite', addIgnore: 'qase:ignore', addParameters: 'qase:parameters', + addGroupParameters: 'qase:groupParameters', addAttachment: 'qase:attachment', startStep: 'qase:startStep', endStep: 'qase:endStep', diff --git a/qase-wdio/src/reporter.ts b/qase-wdio/src/reporter.ts index 41457b69..fe7413b1 100644 --- a/qase-wdio/src/reporter.ts +++ b/qase-wdio/src/reporter.ts @@ -336,6 +336,7 @@ export default class WDIOQaseReporter extends WDIOReporter { process.on(events.addFields, this.addFields.bind(this)); process.on(events.addSuite, this.addSuite.bind(this)); process.on(events.addParameters, this.addParameters.bind(this)); + process.on(events.addGroupParameters, this.addGroupParameters.bind(this)); process.on(events.addAttachment, this.addAttachment.bind(this)); process.on(events.addIgnore, this.ignore.bind(this)); process.on(events.addStep, this.addStep.bind(this)); @@ -391,6 +392,20 @@ export default class WDIOQaseReporter extends WDIOReporter { curTest.params = stringRecord; } + addGroupParameters({ records }: AddRecordsEventArgs) { + const curTest = this.storage.getCurrentTest(); + if (!curTest) { + return; + } + + const stringRecord: Record = {}; + for (const [key, value] of Object.entries(records)) { + stringRecord[String(key)] = String(value); + } + + curTest.group_params = stringRecord; + } + addFields({ records }: AddRecordsEventArgs) { const curTest = this.storage.getCurrentTest(); if (!curTest) { diff --git a/qase-wdio/src/wdio.ts b/qase-wdio/src/wdio.ts index 96fe065e..a6b9b642 100644 --- a/qase-wdio/src/wdio.ts +++ b/qase-wdio/src/wdio.ts @@ -44,6 +44,17 @@ export class qase { return this; } + /** + * Assign group parameters to test + * @name groupParameters + * @param {Record} values + */ + public static groupParameters(values: Record) { + sendEvent(events.addGroupParameters, { records: values }); + + return this; + } + /** * Assign fields to test * @name fields