Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: support new version of qaseio #700

Merged
merged 1 commit into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions qase-javascript-commons/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "qase-javascript-commons",
"version": "2.2.1",
"version": "2.2.2",
"description": "Qase JS Reporters",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down Expand Up @@ -33,7 +33,7 @@
"lodash.merge": "^4.6.2",
"lodash.mergewith": "^4.6.2",
"mime-types": "^2.1.33",
"qaseio": "~2.3.1",
"qaseio": "~2.4.0",
"strip-ansi": "^6.0.1",
"uuid": "^9.0.0"
},
Expand Down
50 changes: 42 additions & 8 deletions qase-javascript-commons/src/reporters/testops-reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,10 @@ export class TestOpsReporter extends AbstractReporter {
public override async addTestResult(result: TestResultType): Promise<void> {
if (result.execution.status === TestStatusEnum.failed) {

if (Array.isArray(result.testops_id)) {
for (const id of result.testops_id) {
this.showLink(id, result.title);
}
} else {
this.showLink(result.testops_id, result.title);
const testOpsIds = Array.isArray(result.testops_id) ? result.testops_id : [result.testops_id];

for (const id of testOpsIds) {
this.showLink(id, result.title);
}
}

Expand Down Expand Up @@ -339,8 +337,17 @@ export class TestOpsReporter extends AbstractReporter {
return;
}

const remainingResults = this.results.slice(this.firstIndex);

if (this.firstIndex < this.results.length) {
await this.publishResults(this.results.slice(this.firstIndex));
if (remainingResults.length <= defaultChunkSize) {
await this.publishResults(remainingResults);
return;
}

for (let i = 0; i < remainingResults.length; i += defaultChunkSize) {
await this.publishResults(remainingResults.slice(i, i + defaultChunkSize));
}
}

// Clear results because we don't need to send them again then we use Cypress reporter
Expand Down Expand Up @@ -376,15 +383,42 @@ export class TestOpsReporter extends AbstractReporter {
const attachments = await this.uploadAttachments(result.attachments);
const steps = await this.transformSteps(result.steps, result.title);

const param: Record<string, string> = {};

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 model = {
title: result.title,
execution: this.getExecution(result.execution),
testops_id: Array.isArray(result.testops_id) ? null : result.testops_id,
attachments: attachments,
steps: steps,
params: result.params,
params: param,
param_groups: group_params,
relations: this.getRelation(result.relations),
message: result.message,
fields: result.fields,
};

this.logger.logDebug(`Transformed result: ${JSON.stringify(model)}`);
Expand Down
Loading