Skip to content

Commit

Permalink
fix: issue with duplicate test runs
Browse files Browse the repository at this point in the history
Now, the reporter will correctly handle the test runs and will not create
  duplicate test runs in the Qase TMS.
  • Loading branch information
gibiw committed Sep 3, 2024
1 parent 90952b3 commit fb9d0de
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 2 deletions.
32 changes: 32 additions & 0 deletions qase-wdio/src/hooks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { ConfigLoader, QaseReporter } from 'qase-javascript-commons';

export async function beforeRunHook() {
const configLoader = new ConfigLoader();
const config = configLoader.load();

// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
const reporter = QaseReporter.getInstance({
...config,
frameworkPackage: 'wdio',
frameworkName: 'wdio',
reporterName: 'wdio-qase-reporter',
});

// eslint-disable-next-line @typescript-eslint/no-unsafe-call
await reporter.startTestRunAsync();
}

export async function afterRunHook() {
const configLoader = new ConfigLoader();
const config = configLoader.load();

// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
const reporter = QaseReporter.getInstance({
...config,
frameworkPackage: 'wdio',
frameworkName: 'wdio',
reporterName: 'wdio-qase-reporter',
});

await reporter.complete();
}
1 change: 1 addition & 0 deletions qase-wdio/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import WDIOQaseReporter from './reporter.js';

export * from './wdio';
export * from './hooks';
export default WDIOQaseReporter;
4 changes: 2 additions & 2 deletions qase-wdio/src/reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export default class WDIOQaseReporter extends WDIOReporter {

override onRunnerStart(runner: RunnerStats) {
this._isMultiremote = runner.isMultiremote;
this.reporter.startTestRun();
// this.reporter.startTestRun();
this.isSync = false;
}

Expand Down Expand Up @@ -186,7 +186,7 @@ export default class WDIOQaseReporter extends WDIOReporter {
}

override async onRunnerEnd(_: RunnerStats) {
await this.reporter.publish();
await this.reporter.sendResults();
this.isSync = true;
}

Expand Down

0 comments on commit fb9d0de

Please sign in to comment.