diff --git a/tests/playwright/src/specs/container-smoke.spec.ts b/tests/playwright/src/specs/container-smoke.spec.ts index 1779e7ed29a..29caa73263a 100644 --- a/tests/playwright/src/specs/container-smoke.spec.ts +++ b/tests/playwright/src/specs/container-smoke.spec.ts @@ -29,7 +29,7 @@ import { NavigationBar } from '../model/workbench/navigation'; import { PodmanDesktopRunner } from '../runner/podman-desktop-runner'; import type { RunnerTestContext } from '../testContext/runner-test-context'; import { deleteContainer, deleteImage } from '../utility/operations'; -import { waitUntil, waitWhile } from '../utility/wait'; +import { waitForPodmanMachineStartup, waitUntil, waitWhile } from '../utility/wait'; let pdRunner: PodmanDesktopRunner; let page: Page; @@ -45,6 +45,7 @@ beforeAll(async () => { pdRunner.setVideoAndTraceName('containers-e2e'); const welcomePage = new WelcomePage(page); await welcomePage.handleWelcomePage(true); + await waitForPodmanMachineStartup(page); // wait giving a time to podman desktop to load up let images: ImagesPage; try { diff --git a/tests/playwright/src/specs/image-smoke.spec.ts b/tests/playwright/src/specs/image-smoke.spec.ts index 3d2fe085fec..a92f0a7df3d 100644 --- a/tests/playwright/src/specs/image-smoke.spec.ts +++ b/tests/playwright/src/specs/image-smoke.spec.ts @@ -29,6 +29,7 @@ import { NavigationBar } from '../model/workbench/navigation'; import { PodmanDesktopRunner } from '../runner/podman-desktop-runner'; import type { RunnerTestContext } from '../testContext/runner-test-context'; import { handleConfirmationDialog } from '../utility/operations'; +import { waitForPodmanMachineStartup } from '../utility/wait'; let pdRunner: PodmanDesktopRunner; let page: Page; @@ -43,7 +44,8 @@ beforeAll(async () => { const welcomePage = new WelcomePage(page); await welcomePage.handleWelcomePage(true); - navBar = new NavigationBar(page); // always present on the left side of the page + await waitForPodmanMachineStartup(page); + navBar = new NavigationBar(page); }); afterAll(async () => { diff --git a/tests/playwright/src/specs/pod-smoke.spec.ts b/tests/playwright/src/specs/pod-smoke.spec.ts index bae96d7ed74..9805a95177c 100644 --- a/tests/playwright/src/specs/pod-smoke.spec.ts +++ b/tests/playwright/src/specs/pod-smoke.spec.ts @@ -30,7 +30,7 @@ import { NavigationBar } from '../model/workbench/navigation'; import { PodmanDesktopRunner } from '../runner/podman-desktop-runner'; import type { RunnerTestContext } from '../testContext/runner-test-context'; import { deleteContainer, deleteImage, deletePod } from '../utility/operations'; -import { waitUntil, waitWhile } from '../utility/wait'; +import { waitForPodmanMachineStartup, waitUntil, waitWhile } from '../utility/wait'; let pdRunner: PodmanDesktopRunner; let page: Page; @@ -54,6 +54,7 @@ beforeAll(async () => { pdRunner.setVideoAndTraceName('pods-e2e'); const welcomePage = new WelcomePage(page); await welcomePage.handleWelcomePage(true); + await waitForPodmanMachineStartup(page); // wait giving a time to podman desktop to load up const images = await new NavigationBar(page).openImages(); await waitWhile( diff --git a/tests/playwright/src/specs/registry-image.spec.ts b/tests/playwright/src/specs/registry-image.spec.ts index 0a42cfc063b..ef77024922a 100644 --- a/tests/playwright/src/specs/registry-image.spec.ts +++ b/tests/playwright/src/specs/registry-image.spec.ts @@ -28,6 +28,7 @@ import { PodmanDesktopRunner } from '../runner/podman-desktop-runner'; import { canTestRegistry, setupRegistry } from '../setupFiles/setup-registry'; import type { RunnerTestContext } from '../testContext/runner-test-context'; import { deleteImage, deleteRegistry } from '../utility/operations'; +import { waitForPodmanMachineStartup } from '../utility/wait'; let pdRunner: PodmanDesktopRunner; let page: Page; @@ -51,6 +52,7 @@ beforeAll(async () => { const welcomePage = new WelcomePage(page); await welcomePage.handleWelcomePage(true); + await waitForPodmanMachineStartup(page); navBar = new NavigationBar(page); }); diff --git a/tests/playwright/src/specs/volume-smoke.spec.ts b/tests/playwright/src/specs/volume-smoke.spec.ts index aa6a089cb97..323c9679945 100644 --- a/tests/playwright/src/specs/volume-smoke.spec.ts +++ b/tests/playwright/src/specs/volume-smoke.spec.ts @@ -24,6 +24,7 @@ import { WelcomePage } from '../model/pages/welcome-page'; import { NavigationBar } from '../model/workbench/navigation'; import { PodmanDesktopRunner } from '../runner/podman-desktop-runner'; import type { RunnerTestContext } from '../testContext/runner-test-context'; +import { waitForPodmanMachineStartup } from '../utility/wait'; let pdRunner: PodmanDesktopRunner; let page: Page; @@ -36,6 +37,7 @@ beforeAll(async () => { const welcomePage = new WelcomePage(page); await welcomePage.handleWelcomePage(true); + await waitForPodmanMachineStartup(page); navBar = new NavigationBar(page); }); diff --git a/tests/playwright/src/specs/yaml-smoke.spec.ts b/tests/playwright/src/specs/yaml-smoke.spec.ts index bbee22ab5b2..451bfe09711 100644 --- a/tests/playwright/src/specs/yaml-smoke.spec.ts +++ b/tests/playwright/src/specs/yaml-smoke.spec.ts @@ -27,6 +27,7 @@ import { NavigationBar } from '../model/workbench/navigation'; import { PodmanDesktopRunner } from '../runner/podman-desktop-runner'; import type { RunnerTestContext } from '../testContext/runner-test-context'; import { deleteImage, deletePod } from '../utility/operations'; +import { waitForPodmanMachineStartup } from '../utility/wait'; let pdRunner: PodmanDesktopRunner; let page: Page; @@ -41,6 +42,7 @@ beforeAll(async () => { pdRunner.setVideoAndTraceName('play-yaml-e2e'); await new WelcomePage(page).handleWelcomePage(true); + await waitForPodmanMachineStartup(page); }); beforeEach(async ctx => { diff --git a/tests/playwright/src/utility/wait.ts b/tests/playwright/src/utility/wait.ts index 7fa6c6d4d20..064f9430083 100644 --- a/tests/playwright/src/utility/wait.ts +++ b/tests/playwright/src/utility/wait.ts @@ -16,6 +16,11 @@ * SPDX-License-Identifier: Apache-2.0 ***********************************************************************/ +import type { Page } from '@playwright/test'; +import { expect as playExpect } from '@playwright/test'; + +import { NavigationBar } from '../model/workbench/navigation'; + export async function wait( waitFunction: () => Promise, until: boolean, @@ -111,3 +116,10 @@ export async function executeWithTimeout( return result; }); } + +export async function waitForPodmanMachineStartup(page: Page, timeoutOut = 10000): Promise { + const dashboardPage = await new NavigationBar(page).openDashboard(); + await playExpect(dashboardPage.heading).toBeVisible(); + await playExpect(dashboardPage.podmanStatusLabel).toBeVisible({ timeout: timeoutOut }); + await playExpect(dashboardPage.podmanStatusLabel).toHaveText('RUNNING', { timeout: timeoutOut }); +}