mirror of
https://github.com/podman-desktop/podman-desktop
synced 2026-05-24 10:18:53 +00:00
chore(test): check test suite wide for failures (#8611)
* chore(test): check suite wide for failures before deleting traces
This commit is contained in:
parent
4ebb4bed5c
commit
56a39ffa5b
3 changed files with 11 additions and 5 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue