diff --git a/package.json b/package.json index d0bc5b1308a..da5978274d1 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "test:e2e:extension": "npm run test:e2e:build && npm run test:e2e:extension:run", "test:e2e:extension:run": "xvfb-maybe --auto-servernum --server-args='-screen 0 1280x960x24' -- npx playwright test tests/playwright/src/specs/extension-installation.spec.ts", "test:e2e:pw": "npm run test:e2e:build && npm run test:e2e:pw:run", - "test:e2e:pw:run": "xvfb-maybe --auto-servernum --server-args='-screen 0 1280x960x24' -- npx playwright test tests/playwright/src/specs/container-smoke.spec.ts", + "test:e2e:pw:run": "xvfb-maybe --auto-servernum --server-args='-screen 0 1280x960x24' -- npx playwright test tests/playwright/src/specs/pod-smoke.spec.ts", "test:e2e:copy": "cp ../podman-desktop-extension-bootc/tests/src/bootc-extension.spec.ts tests/src/", "test:main": "vitest run -r packages/main --passWithNoTests --coverage", "test:preload": "vitest run -r packages/preload --passWithNoTests --coverage", diff --git a/tests/playwright/src/model/pages/extension-details-page.ts b/tests/playwright/src/model/pages/extension-details-page.ts index da4660f614f..7d6ac4e58fd 100644 --- a/tests/playwright/src/model/pages/extension-details-page.ts +++ b/tests/playwright/src/model/pages/extension-details-page.ts @@ -45,7 +45,7 @@ export class ExtensionDetailsPage extends BasePage { if ((await this.status.innerText()) === 'DISABLED') return this; await this.disableButton.click(); - await playExpect(this.status).toHaveText('DISABLED'); + await playExpect(this.status).toHaveText('DISABLED', { timeout: 30000 }); return this; } @@ -53,7 +53,7 @@ export class ExtensionDetailsPage extends BasePage { if ((await this.status.innerText()) === 'ACTIVE') return this; await this.enableButton.click(); - await playExpect(this.status).toHaveText('ACTIVE'); + await playExpect(this.status).toHaveText('ACTIVE', { timeout: 30000 }); return this; } diff --git a/tests/playwright/src/specs/container-smoke.spec.ts b/tests/playwright/src/specs/container-smoke.spec.ts index 269b48d498c..d9d4c4883aa 100644 --- a/tests/playwright/src/specs/container-smoke.spec.ts +++ b/tests/playwright/src/specs/container-smoke.spec.ts @@ -226,7 +226,7 @@ test.describe.serial('Verification of container creation workflow @smoke', () => const containersPage = await containers.deleteContainer(containerToRun); await playExpect(containersPage.heading).toBeVisible(); await playExpect - .poll(async () => await containersPage.containerExists(containerToRun), { timeout: 15000 }) + .poll(async () => await containersPage.containerExists(containerToRun), { timeout: 30000 }) .toBeFalsy(); }); diff --git a/tests/playwright/src/specs/deploy-to-kubernetes.spec.ts b/tests/playwright/src/specs/deploy-to-kubernetes.spec.ts index 0307a812d92..40c48591102 100644 --- a/tests/playwright/src/specs/deploy-to-kubernetes.spec.ts +++ b/tests/playwright/src/specs/deploy-to-kubernetes.spec.ts @@ -44,7 +44,7 @@ const skipKindInstallation = process.env.SKIP_KIND_INSTALL ? process.env.SKIP_KI test.beforeAll(async ({ runner, welcomePage, page }) => { test.setTimeout(250000); - runner.setVideoAndTraceName('kind-e2e'); + runner.setVideoAndTraceName('deploy-to-k8s-e2e'); await welcomePage.handleWelcomePage(true); await waitForPodmanMachineStartup(page); diff --git a/tests/playwright/src/specs/pod-smoke.spec.ts b/tests/playwright/src/specs/pod-smoke.spec.ts index f000310839e..15b4e6e670d 100644 --- a/tests/playwright/src/specs/pod-smoke.spec.ts +++ b/tests/playwright/src/specs/pod-smoke.spec.ts @@ -38,6 +38,7 @@ const isMac = os.platform() === 'darwin'; const containerNames = ['container1', 'container2', 'container3']; const podNames = ['pod1', 'pod2', 'pod3']; const containerStartParams: ContainerInteractiveParams = { attachTerminal: false }; +let resetTestData = true; test.skip( !!process.env.GITHUB_ACTIONS && process.env.RUNNER_OS === 'Linux', @@ -54,15 +55,35 @@ test.beforeAll(async ({ runner, welcomePage, page, navigationBar }) => { sendError: false, message: 'Images page is empty, there are no images present', }); + + if (test.info().retry > 0) return; + await deletePod(page, podToRun); await deleteContainer(page, backendContainer); await deleteContainer(page, frontendContainer); }); +test.afterEach(async () => { + // This should always be compared to the final test in the suite, if any test is added after this one, this also should be updated + if (test.info().title.includes('Pruning pods')) { + resetTestData = true; + return; + } + + if (test.info().status !== test.info().expectedStatus) { + resetTestData = false; + return; + } + + resetTestData = true; +}); + test.afterAll(async ({ page, runner }) => { test.setTimeout(120000); try { + if (!resetTestData) return; + for (const pod of podNames) { await deletePod(page, pod); } @@ -241,7 +262,7 @@ test.describe.serial('Verification of pod creation workflow @smoke', () => { }); test.describe(() => { - test.describe.configure({ retries: 2 }); + test.describe.configure({ retries: 1 }); test('Restarting pod', async ({ navigationBar }) => { const pods = await navigationBar.openPods(); const podDetails = await pods.openPodDetails(podToRun); @@ -252,66 +273,66 @@ test.describe.serial('Verification of pod creation workflow @smoke', () => { await playExpect.poll(async () => await podDetails.getState(), { timeout: 30000 }).toBe(PodState.Running); await playExpect(podDetails.stopButton).toBeVisible(); }); - }); - test('Stopping and starting pod', async ({ navigationBar }) => { - const pods = await navigationBar.openPods(); - const podDetailsPage = await pods.openPodDetails(podToRun); - await podDetailsPage.stopPod(podToRun, true); - await playExpect.poll(async () => await podDetailsPage.getState(), { timeout: 30000 }).toBe(PodState.Exited); - - await podDetailsPage.startPod(true); - await playExpect.poll(async () => await podDetailsPage.getState(), { timeout: 30000 }).toBe(PodState.Running); - await playExpect(podDetailsPage.stopButton).toBeVisible(); - }); - - test('Stopping and deleting pod', async ({ navigationBar }) => { - const pods = await navigationBar.openPods(); - const podDetailsPage = await pods.openPodDetails(podToRun); - await podDetailsPage.stopPod(podToRun, true); - await playExpect.poll(async () => await podDetailsPage.getState(), { timeout: 30000 }).toBe(PodState.Exited); - - await playExpect(podDetailsPage.heading).toContainText(podToRun); - const podsPage = await podDetailsPage.deletePod(); - await playExpect(podsPage.heading).toBeVisible(); - await playExpect.poll(async () => await podsPage.podExists(podToRun), { timeout: 20000 }).toBeFalsy(); - }); - - test('Pruning pods', async ({ page, navigationBar }) => { - test.setTimeout(90000); - - const portsList = [5001, 5002, 5003]; - - for (let i = 0; i < 3; i++) { - const imagesPage = await navigationBar.openImages(); - await playExpect(imagesPage.heading).toBeVisible(); - const imageDetailsPage = await imagesPage.openImageDetails(backendImage); - await playExpect(imageDetailsPage.heading).toContainText(backendImage); - const runImagePage = await imageDetailsPage.openRunImage(); - await playExpect(runImagePage.heading).toContainText(backendImage); - await runImagePage.setCustomPortMapping(`${portsList[i]}:${portsList[i]}`); - const containersPage = await runImagePage.startContainer(containerNames[i], containerStartParams); - await playExpect(containersPage.heading).toBeVisible(); - await playExpect - .poll(async () => containersPage.containerExists(containerNames[i]), { timeout: 15000 }) - .toBeTruthy(); - await containersPage.uncheckAllContainers(); - const createPodPage = await containersPage.openCreatePodPage(Array.of(containerNames[i])); - const podsPage = await createPodPage.createPod(podNames[i]); - await playExpect(podsPage.heading).toBeVisible({ timeout: 60000 }); - await playExpect.poll(async () => await podsPage.podExists(podNames[i]), { timeout: 15000 }).toBeTruthy(); - } - - for (const pod of podNames) { - const podDetailsPage = await new PodsPage(page).openPodDetails(pod); - await podDetailsPage.stopPod(pod, true); + test('Stopping and starting pod', async ({ navigationBar }) => { + const pods = await navigationBar.openPods(); + const podDetailsPage = await pods.openPodDetails(podToRun); + await podDetailsPage.stopPod(podToRun, true); await playExpect.poll(async () => await podDetailsPage.getState(), { timeout: 30000 }).toBe(PodState.Exited); - const podsPage = await navigationBar.openPods(); + await podDetailsPage.startPod(true); + await playExpect.poll(async () => await podDetailsPage.getState(), { timeout: 30000 }).toBe(PodState.Running); + await playExpect(podDetailsPage.stopButton).toBeVisible(); + }); + + test('Stopping and deleting pod', async ({ navigationBar }) => { + const pods = await navigationBar.openPods(); + const podDetailsPage = await pods.openPodDetails(podToRun); + await podDetailsPage.stopPod(podToRun, true); + await playExpect.poll(async () => await podDetailsPage.getState(), { timeout: 30000 }).toBe(PodState.Exited); + + await playExpect(podDetailsPage.heading).toContainText(podToRun); + const podsPage = await podDetailsPage.deletePod(); await playExpect(podsPage.heading).toBeVisible(); - await podsPage.prunePods(); - await playExpect.poll(async () => await podsPage.podExists(pod), { timeout: 15000 }).toBeFalsy(); - } + await playExpect.poll(async () => await podsPage.podExists(podToRun), { timeout: 20000 }).toBeFalsy(); + }); + + test('Pruning pods', async ({ page, navigationBar }) => { + test.setTimeout(90000); + + const portsList = [5001, 5002, 5003]; + + for (let i = 0; i < 3; i++) { + const imagesPage = await navigationBar.openImages(); + await playExpect(imagesPage.heading).toBeVisible(); + const imageDetailsPage = await imagesPage.openImageDetails(backendImage); + await playExpect(imageDetailsPage.heading).toContainText(backendImage); + const runImagePage = await imageDetailsPage.openRunImage(); + await playExpect(runImagePage.heading).toContainText(backendImage); + await runImagePage.setCustomPortMapping(`${portsList[i]}:${portsList[i]}`); + const containersPage = await runImagePage.startContainer(containerNames[i], containerStartParams); + await playExpect(containersPage.heading).toBeVisible(); + await playExpect + .poll(async () => containersPage.containerExists(containerNames[i]), { timeout: 15000 }) + .toBeTruthy(); + await containersPage.uncheckAllContainers(); + const createPodPage = await containersPage.openCreatePodPage(Array.of(containerNames[i])); + const podsPage = await createPodPage.createPod(podNames[i]); + await playExpect(podsPage.heading).toBeVisible({ timeout: 60000 }); + await playExpect.poll(async () => await podsPage.podExists(podNames[i]), { timeout: 15000 }).toBeTruthy(); + } + + for (const pod of podNames) { + const podDetailsPage = await new PodsPage(page).openPodDetails(pod); + await podDetailsPage.stopPod(pod, true); + await playExpect.poll(async () => await podDetailsPage.getState(), { timeout: 30000 }).toBe(PodState.Exited); + + const podsPage = await navigationBar.openPods(); + await playExpect(podsPage.heading).toBeVisible(); + await podsPage.prunePods(); + await playExpect.poll(async () => await podsPage.podExists(pod), { timeout: 15000 }).toBeFalsy(); + } + }); }); async function appRunningOnPort(address: string): Promise { diff --git a/tests/playwright/src/specs/podman-machine-dashboard-onboarding.spec.ts b/tests/playwright/src/specs/podman-machine-dashboard-onboarding.spec.ts index 5de8f843a05..7016a0a3097 100644 --- a/tests/playwright/src/specs/podman-machine-dashboard-onboarding.spec.ts +++ b/tests/playwright/src/specs/podman-machine-dashboard-onboarding.spec.ts @@ -21,7 +21,7 @@ import * as os from 'node:os'; import { expect as playExpect, test } from '../utility/fixtures'; import { deletePodmanMachine } from '../utility/operations'; -const PODMAN_MACHINE_NAME = 'Podman Machine'; +const PODMAN_MACHINE_NAME: string = 'podman-machine-default'; test.skip( os.platform() === 'linux' || process.env.TEST_PODMAN_MACHINE !== 'true', diff --git a/tests/playwright/src/specs/podman-machine-onboarding.spec.ts b/tests/playwright/src/specs/podman-machine-onboarding.spec.ts index 271d715de77..c9549b5c9aa 100644 --- a/tests/playwright/src/specs/podman-machine-onboarding.spec.ts +++ b/tests/playwright/src/specs/podman-machine-onboarding.spec.ts @@ -30,7 +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_MACHINE_NAME: string = 'Podman Machine'; +const PODMAN_MACHINE_NAME: string = 'podman-machine-default'; const RESOURCE_NAME: string = 'podman'; let dashboardPage: DashboardPage; diff --git a/tests/playwright/src/specs/registry-image.spec.ts b/tests/playwright/src/specs/registry-image.spec.ts index 7241404736d..d12476b9c07 100644 --- a/tests/playwright/src/specs/registry-image.spec.ts +++ b/tests/playwright/src/specs/registry-image.spec.ts @@ -66,7 +66,7 @@ test.describe.serial('Pulling image from authenticated registry workflow verific await pullImageButton.click(); await playExpect(errorAlert).toBeVisible({ timeout: 10000 }); - await playExpect(errorAlert).toContainText('Error while pulling image from Podman'); + await playExpect(errorAlert).toContainText('Error while pulling image from podman'); await playExpect(errorAlert).toContainText(fullImageTitle); await playExpect(errorAlert).toContainText('Can also be that the registry requires authentication'); });