diff --git a/tests/playwright/src/runner/podman-desktop-runner.ts b/tests/playwright/src/runner/podman-desktop-runner.ts index 99111f67120..f91327a63aa 100644 --- a/tests/playwright/src/runner/podman-desktop-runner.ts +++ b/tests/playwright/src/runner/podman-desktop-runner.ts @@ -43,6 +43,7 @@ export class PodmanDesktopRunner { private _autoUpdate: boolean; private _autoCheckUpdate: boolean; private _testPassed: boolean; + private _suitePassed: boolean; constructor({ profile = '', @@ -57,7 +58,8 @@ export class PodmanDesktopRunner { this._videoAndTraceName = undefined; this._autoUpdate = autoUpdate; this._autoCheckUpdate = autoCheckUpdate; - this._testPassed = true; + this._testPassed = false; + this._suitePassed = true; // Options setting always needs to be last action in constructor in order to apply settings correctly this._options = this.defaultOptions(); @@ -235,7 +237,7 @@ export class PodmanDesktopRunner { rmSync(rawTracesPath, { recursive: true, force: true, maxRetries: 5 }); } - if (!this._testPassed || !this._videoAndTraceName) return; + if (!this._testPassed || !this._suitePassed || !this._videoAndTraceName) return; if (!process.env.KEEP_TRACES_ON_PASS) { const tracesPath = join(this._testOutput, 'traces', `${this._videoAndTraceName}_trace.zip`); @@ -348,6 +350,10 @@ export class PodmanDesktopRunner { this._testPassed = value; } + public setSuitePassed(value: boolean): void { + this._suitePassed = value; + } + public get options(): object { return this._options; } diff --git a/tests/playwright/src/setupFiles/extended-hooks-utils.ts b/tests/playwright/src/setupFiles/extended-hooks-utils.ts index 140a9a3bdac..12d324a951a 100644 --- a/tests/playwright/src/setupFiles/extended-hooks-utils.ts +++ b/tests/playwright/src/setupFiles/extended-hooks-utils.ts @@ -41,4 +41,5 @@ export async function takeScreenshotHook(runner: PodmanDesktopRunner, taskName: console.log(`Screenshot of the failed test will be saved to: ${fileName}`); await runner.screenshot(`${fileName}.png`); runner.setTestPassed(false); + runner.setSuitePassed(false); } diff --git a/tests/playwright/src/setupFiles/extended-hooks.ts b/tests/playwright/src/setupFiles/extended-hooks.ts index 0c38d2cf507..4d686d28c2b 100644 --- a/tests/playwright/src/setupFiles/extended-hooks.ts +++ b/tests/playwright/src/setupFiles/extended-hooks.ts @@ -16,10 +16,9 @@ * SPDX-License-Identifier: Apache-2.0 ***********************************************************************/ -import { afterEach, beforeEach, onTestFailed, onTestFinished } from 'vitest'; +import { afterEach, beforeEach, onTestFailed } from 'vitest'; import type { RunnerTestContext } from '../testContext/runner-test-context'; -import { checkForFailedTest } from '../utility/operations'; import { takeScreenshotHook } from './extended-hooks-utils'; afterEach(async (context: RunnerTestContext) => { @@ -27,5 +26,5 @@ afterEach(async (context: RunnerTestContext) => { }); beforeEach(async (context: RunnerTestContext) => { - onTestFinished(results => checkForFailedTest(results, context.pdRunner)); + context?.pdRunner?.setTestPassed(true); });