Wait podman startup (#7485)

* chore(test): wait for podman machine startup
This commit is contained in:
Vladimir Lazar 2024-06-06 11:27:07 +03:00 committed by GitHub
parent 46a70e4852
commit a614c8d0c8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 25 additions and 3 deletions

View file

@ -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 {

View file

@ -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 () => {

View file

@ -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(

View file

@ -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);
});

View file

@ -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);
});

View file

@ -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<RunnerTestContext>(async ctx => {

View file

@ -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<boolean>,
until: boolean,
@ -111,3 +116,10 @@ export async function executeWithTimeout(
return result;
});
}
export async function waitForPodmanMachineStartup(page: Page, timeoutOut = 10000): Promise<void> {
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 });
}