diff --git a/qase-wdio/src/hooks.ts b/qase-wdio/src/hooks.ts new file mode 100644 index 00000000..b0333d80 --- /dev/null +++ b/qase-wdio/src/hooks.ts @@ -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(); +} diff --git a/qase-wdio/src/index.ts b/qase-wdio/src/index.ts index a6ecef51..dd143ee0 100644 --- a/qase-wdio/src/index.ts +++ b/qase-wdio/src/index.ts @@ -1,4 +1,5 @@ import WDIOQaseReporter from './reporter.js'; export * from './wdio'; +export * from './hooks'; export default WDIOQaseReporter; diff --git a/qase-wdio/src/reporter.ts b/qase-wdio/src/reporter.ts index 8f614e02..1b495f36 100644 --- a/qase-wdio/src/reporter.ts +++ b/qase-wdio/src/reporter.ts @@ -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; } @@ -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; }