Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
qase-reporters: support a new logic of commons
Browse files Browse the repository at this point in the history
Support a new logic of the qase-javascript-commons package.
Dmitrii Gridnev committed Apr 4, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 130c462 commit b77dbe2
Showing 6 changed files with 11 additions and 28 deletions.
2 changes: 1 addition & 1 deletion qase-cucumberjs/src/reporter.ts
Original file line number Diff line number Diff line change
@@ -255,7 +255,7 @@ export class CucumberQaseReporter extends Formatter {
run_id: null,
signature: '',
steps: [],
testops_id: info.caseIds[0] ?? null,
testops_id: info.caseIds.length > 0 ? info.caseIds : null,
id: tcs.id,
title: info.name,
// suiteTitle: info.lastAstNodeId && this.scenarios[info.lastAstNodeId],
2 changes: 1 addition & 1 deletion qase-cypress/src/reporter.ts
Original file line number Diff line number Diff line change
@@ -183,7 +183,7 @@ export class CypressQaseReporter extends reporters.Base {
stacktrace: test.err?.stack ?? null,
thread: null,
},
testops_id: ids[0] ?? null,
testops_id: ids.length > 0 ? ids : null,
title: test.title,
// suiteTitle: test.parent?.titlePath(),
};
3 changes: 2 additions & 1 deletion qase-jest/src/reporter.ts
Original file line number Diff line number Diff line change
@@ -110,6 +110,7 @@ export class JestQaseReporter implements Reporter {
error.stack = failureMessages.join('\n\n');
}

const ids = JestQaseReporter.getCaseId(title);
this.reporter.addTestResult({
attachments: [],
author: null,
@@ -129,7 +130,7 @@ export class JestQaseReporter implements Reporter {
run_id: null,
signature: '',
steps: [],
testops_id: JestQaseReporter.getCaseId(title)[0] ?? null,
testops_id: ids.length > 0 ? ids : null,
id: uuidv4(),
title: title,
// suiteTitle: ancestorTitles,
4 changes: 2 additions & 2 deletions qase-newman/src/reporter.ts
Original file line number Diff line number Diff line change
@@ -124,7 +124,7 @@ export class NewmanQaseReporter {
(_err: Error | undefined, exec: NewmanRunExecution) => {
const { item } = exec;
// const parent = item.parent();

const ids = NewmanQaseReporter.getCaseIds(item.events);
this.pendingResultMap.set(item.id, {
attachments: [],
author: null,
@@ -144,7 +144,7 @@ export class NewmanQaseReporter {
run_id: null,
signature: '',
steps: [],
testops_id: NewmanQaseReporter.getCaseIds(item.events)[0] ?? null,
testops_id: ids.length > 0 ? ids : null,
id: item.id,
title: item.name,
// suiteTitle: parent ? NewmanQaseReporter.getParentTitles(parent) : [],
25 changes: 3 additions & 22 deletions qase-playwright/src/reporter.ts
Original file line number Diff line number Diff line change
@@ -275,32 +275,13 @@ export class PlaywrightQaseReporter implements Reporter {
title: testCaseMetadata.title === '' ? test.title : testCaseMetadata.title,
};

let ids: number[];
if (testCaseMetadata.ids.length > 0) {
ids = testCaseMetadata.ids;
testResult.testops_id = testCaseMetadata.ids;
} else {
ids = PlaywrightQaseReporter.qaseIds.get(test.title) ?? [];
testResult.testops_id = PlaywrightQaseReporter.qaseIds.get(test.title) ?? null;
}

if (ids.length == 0) {
this.reporter.addTestResult(testResult);
return;
}

// if we have multiple ids, we need to create multiple test results and set duration to 0 for all but the first one
let firstCase = true;
for (const id of ids) {
const testResultCopy = { ...testResult };
testResultCopy.testops_id = id;
testResultCopy.id = uuidv4();

if (!firstCase) {
testResultCopy.execution.duration = 0;
}
firstCase = false;

this.reporter.addTestResult(testResultCopy);
}
this.reporter.addTestResult(testResult);
}

/**
3 changes: 2 additions & 1 deletion qase-testcafe/src/reporter.ts
Original file line number Diff line number Diff line change
@@ -179,6 +179,7 @@ export class TestcafeQaseReporter {
meta: Record<string, string>,
) => {
const error = TestcafeQaseReporter.transformErrors(testRunInfo.errs);
const ids = TestcafeQaseReporter.getCaseId(meta);
this.reporter.addTestResult({
author: null,
execution: {
@@ -198,7 +199,7 @@ export class TestcafeQaseReporter {
signature: '',
steps: [],
id: uuidv4(),
testops_id: TestcafeQaseReporter.getCaseId(meta)[0] ?? null,
testops_id: ids.length > 0 ? ids : null,
title: title,
// suiteTitle: testRunInfo.fixture.name,
attachments: TestcafeQaseReporter.transformAttachments(

0 comments on commit b77dbe2

Please sign in to comment.