Skip to content

Commit

Permalink
chore(test): fix tests on windows (#8918)
Browse files Browse the repository at this point in the history
* chore(test): fix tests on windows
Signed-off-by: Vladimir Lazar <[email protected]>

* chore(tests): address core view comments
Signed-off-by: Vladimir Lazar <[email protected]>

* chore(tests): increase some timeouts for robustness on cicd
Signed-off-by: Vladimir Lazar <[email protected]>
  • Loading branch information
cbr7 authored Sep 17, 2024
1 parent 208b2a0 commit 81c9391
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 24 deletions.
2 changes: 2 additions & 0 deletions tests/playwright/src/specs/podman-machine-onboarding.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { expect as playExpect, test } from '../utility/fixtures';
import { deletePodmanMachine } from '../utility/operations';

const PODMAN_MACHINE_STARTUP_TIMEOUT: number = 360_000;
const PODMAN_FULL_STARTUP_TIMEOUT = PODMAN_MACHINE_STARTUP_TIMEOUT + 30000;
const PODMAN_MACHINE_NAME: string = 'podman-machine-default';
const RESOURCE_NAME: string = 'podman';

Expand Down Expand Up @@ -128,6 +129,7 @@ test.describe.serial('Podman Machine verification', () => {
test.skip(process.env.TEST_PODMAN_MACHINE !== 'true');

test('Create a default Podman machine', async () => {
test.setTimeout(PODMAN_FULL_STARTUP_TIMEOUT);
await podmanOnboardingPage.podmanMachineCreateButton.click();
await playExpect(podmanOnboardingPage.podmanMachineShowLogsButton).toBeVisible();
await podmanOnboardingPage.podmanMachineShowLogsButton.click();
Expand Down
33 changes: 14 additions & 19 deletions tests/playwright/src/specs/podman-machine-tests.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@

import * as os from 'node:os';

import type { Page } from '@playwright/test';

import { PodmanMachineDetails } from '../model/pages/podman-machine-details-page';
import { PodmanOnboardingPage } from '../model/pages/podman-onboarding-page';
import { ResourceConnectionCardPage } from '../model/pages/resource-connection-card-page';
import { ResourcesPage } from '../model/pages/resources-page';
import { expect as playExpect, test } from '../utility/fixtures';
import { deletePodmanMachine } from '../utility/operations';
import { deletePodmanMachine, handleConfirmationDialog } from '../utility/operations';
import { isWindows } from '../utility/platform';
import { waitForPodmanMachineStartup } from '../utility/wait';

const DEFAULT_PODMAN_MACHINE = 'Podman Machine';
Expand Down Expand Up @@ -76,7 +75,7 @@ test.describe.serial(`Podman machine switching validation `, () => {
});

test('Create rootless podman machine', async ({ page, navigationBar }) => {
test.setTimeout(120000);
test.setTimeout(150000);

const dashboard = await navigationBar.openDashboard();
await playExpect(dashboard.heading).toBeVisible();
Expand All @@ -102,7 +101,7 @@ test.describe.serial(`Podman machine switching validation `, () => {
await playExpect(podmanMachineCreatePage.podmanMachineStartAfterCreationCheckbox).not.toBeChecked();

await podmanMachineCreatePage.podmanMachineCreateButton.click();
await playExpect(podmanMachineCreatePage.goBackButton).toBeEnabled({ timeout: 100000 });
await playExpect(podmanMachineCreatePage.goBackButton).toBeEnabled({ timeout: 120000 });
await podmanMachineCreatePage.goBackButton.click();

await playExpect(resourcesPage.heading).toBeVisible();
Expand All @@ -115,7 +114,7 @@ test.describe.serial(`Podman machine switching validation `, () => {
ROOTLESS_PODMAN_MACHINE_VISIBLE,
);

await playExpect(resourcesPodmanConnections.resourceElementDetailsButton).toBeVisible();
await playExpect(resourcesPodmanConnections.resourceElementDetailsButton).toBeVisible({ timeout: 30000 });
await resourcesPodmanConnections.resourceElementDetailsButton.click();

const podmanMachineDetails = new PodmanMachineDetails(page, ROOTLESS_PODMAN_MACHINE);
Expand All @@ -126,8 +125,8 @@ test.describe.serial(`Podman machine switching validation `, () => {
await podmanMachineDetails.podmanMachineStartButton.click();
await playExpect(podmanMachineDetails.podmanMachineStatus).toHaveText('RUNNING', { timeout: 50_000 });

await handlePopupDialog(page, 'Yes');
await handlePopupDialog(page, 'OK');
await handleConfirmationDialog(page, 'Podman', true, 'Yes');
await handleConfirmationDialog(page, 'Podman', true, 'OK');
});

test('Stop rootless podman machine', async ({ page }) => {
Expand Down Expand Up @@ -159,20 +158,16 @@ test.describe.serial(`Podman machine switching validation `, () => {
await playExpect(podmanMachineDetails.podmanMachineStartButton).toBeEnabled();
await podmanMachineDetails.podmanMachineStartButton.click();
await playExpect(podmanMachineDetails.podmanMachineStatus).toHaveText('RUNNING', { timeout: 50_000 });
await handlePopupDialog(page, 'Yes');
await handlePopupDialog(page, 'OK');
await handleConfirmationDialog(page, 'Podman', true, 'Yes');
await handleConfirmationDialog(page, 'Podman', true, 'OK');
});

test('Clean up rootless podman machine', async ({ page }) => {
await deletePodmanMachine(page, ROOTLESS_PODMAN_MACHINE_VISIBLE);
});

async function handlePopupDialog(page: Page, action: string): Promise<void> {
const dialog = page.getByRole('dialog', { name: 'Podman', exact: true });
await playExpect(dialog).toBeVisible();

const clickOnButton = dialog.getByRole('button', { name: action, exact: true });
await playExpect(clickOnButton).toBeEnabled();
await clickOnButton.click();
}
if (isWindows) {
await handleConfirmationDialog(page, 'Podman', true, 'Yes');
await handleConfirmationDialog(page, 'Podman', true, 'OK');
}
});
});
7 changes: 2 additions & 5 deletions tests/playwright/src/specs/registry-image.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,8 @@ test.describe.serial('Pulling image from authenticated registry workflow verific
const errorAlert = page.getByLabel('Error Message Content');

const pullImagePage = await imagesPage.openPullImage();
const imageNameInput = pullImagePage.page.getByLabel('imageName');
const pullImageButton = pullImagePage.page.getByRole('button', { name: 'Pull' });

await imageNameInput.fill(fullImageTitle);
await pullImageButton.click();
await pullImagePage.imageNameInput.fill(fullImageTitle);
await pullImagePage.pullImageButton.click();

await playExpect(errorAlert).toBeVisible({ timeout: 10000 });
await playExpect(errorAlert).toContainText('Error while pulling image from');
Expand Down

0 comments on commit 81c9391

Please sign in to comment.