diff --git a/.github/workflows/pr-check.yaml b/.github/workflows/pr-check.yaml index 486ee08c5e509..93418205b2905 100644 --- a/.github/workflows/pr-check.yaml +++ b/.github/workflows/pr-check.yaml @@ -253,3 +253,62 @@ jobs: ./tests/output/ ./tests/**/output/junit*.xml !./tests/**/traces/raw + + win-update-e2e-test: + name: win update e2e tests + runs-on: ${{ matrix.os }} + timeout-minutes: 40 + strategy: + fail-fast: false + matrix: + os: [windows-2022] + steps: + - uses: actions/checkout@v4 + + - uses: pnpm/action-setup@v4 + name: Install pnpm + with: + run_install: false + + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'pnpm' + + - name: Execute pnpm + run: pnpm install + + - name: Execute PNPM + run: pnpm install --frozen-lockfile + + - name: Adjust/Downgrade local podman desktop version Windows + if: ${{ matrix.os=='windows-2022'}} + run: | + $version="1.0.0" + jq --arg version "$version" '.version = $version' package.json | Out-File -FilePath package.json_tmp + Move-Item -Path package.json_tmp -Destination package.json -Force + + - name: Build Podman Desktop locally with electron updater included + env: + ELECTRON_ENABLE_INSPECT: true + run: | + pnpm compile:current --win nsis + $path=('./dist/win-unpacked/Podman Desktop.exe' | resolve-path).ProviderPath + echo $path + echo ("PODMAN_DESKTOP_BINARY=" + $path) >> $env:GITHUB_ENV + + - name: Run E2E Update test + env: + UPDATE_PODMAN_DESKTOP: true + run: | + echo "${{ env.PODMAN_DESKTOP_BINARY }}" + pnpm test:e2e:update:run + + - uses: actions/upload-artifact@v4 + if: always() + with: + name: update-e2e-test + path: | + ./tests/output/ + ./tests/**/output/junit*.xml + !./tests/**/traces/raw diff --git a/package.json b/package.json index f3ee6f6e884a9..e363b4dcbe285 100644 --- a/package.json +++ b/package.json @@ -40,17 +40,13 @@ "test:e2e:build": "cross-env NODE_ENV=development MODE=development DEBUG=pw:browser npm run build", "test:e2e:run": "xvfb-maybe --auto-servernum --server-args='-screen 0 1280x960x24' -- npx playwright test tests/playwright/src/specs/", "test:e2e:smoke": "npm run test:e2e:build && npm run test:e2e:smoke:run", -<<<<<<< HEAD "test:e2e:smoke:run": "xvfb-maybe --auto-servernum --server-args='-screen 0 1280x960x24' -- npx playwright test tests/playwright/src/specs/ -g @smoke", "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:smoke:run": "xvfb-maybe --auto-servernum --server-args='-screen 0 1280x960x24' -- vitest run tests/playwright/src/specs/update*.spec.ts --pool=threads --poolOptions.threads.singleThread --poolOptions.threads.isolate --no-file-parallelism", "test:e2e:update": "npm run test:e2e:build && npm run test:e2e:update:run", - "test:e2e:update:run": "xvfb-maybe --auto-servernum --server-args='-screen 0 1280x960x24' -- vitest run tests/playwright/src/specs/installation/update-install.spec.ts --pool=threads --poolOptions.threads.singleThread --poolOptions.threads.isolate --no-file-parallelism", ->>>>>>> daa8e9689f (chore(tests): add podman desktop update e2e test) + "test:e2e:update:run": "xvfb-maybe --auto-servernum --server-args='-screen 0 1280x960x24' -- npx playwright test tests/playwright/src/specs/installation/update-install.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/specs/installation/update-install.spec.ts b/tests/playwright/src/specs/installation/update-install.spec.ts index 04a9b448b14fa..e12d8a9216ed2 100644 --- a/tests/playwright/src/specs/installation/update-install.spec.ts +++ b/tests/playwright/src/specs/installation/update-install.spec.ts @@ -18,14 +18,13 @@ import type { Locator, Page } from '@playwright/test'; import { expect as playExpect } from '@playwright/test'; -import { afterAll, beforeAll, beforeEach, describe, test } from 'vitest'; +import { test } from '@playwright/test'; -import { handleConfirmationDialog } from '/@/utility/operations'; +import { handleConfirmationDialog } from '../../utility/operations'; import { WelcomePage } from '../../model/pages/welcome-page'; import { StatusBar } from '../../model/workbench/status-bar'; import { PodmanDesktopRunner } from '../../runner/podman-desktop-runner'; -import type { RunnerTestContext } from '../../testContext/runner-test-context'; let pdRunner: PodmanDesktopRunner; let page: Page; @@ -35,30 +34,24 @@ let updateDialog: Locator; let updateDownloadedDialog: Locator; const performUpdate = process.env.UPDATE_PODMAN_DESKTOP ? process.env.UPDATE_PODMAN_DESKTOP : false; -beforeAll(async () => { +test.beforeAll(async () => { pdRunner = new PodmanDesktopRunner(); page = await pdRunner.start(); pdRunner.setVideoAndTraceName('update-e2e'); - const welcomePage = new WelcomePage(page); - await welcomePage.handleWelcomePage(true); statusBar = new StatusBar(page); updateAvailableDialog = page.getByRole('dialog', { name: 'Update Available now' }); updateDialog = page.getByRole('dialog', { name: 'Update', exact: true }); updateDownloadedDialog = page.getByRole('dialog', { name: 'Update Downloaded', exact: true }); }); -afterAll(async () => { +test.afterAll(async () => { await pdRunner.close(); }); -beforeEach(async ctx => { - ctx.pdRunner = pdRunner; -}); - -describe('Podman Desktop Update Installation', async () => { - describe('Update Podman Desktop', async () => { - test.skip('update is offered automatically on startup', async () => { +test.describe('Podman Desktop Update Installation', async () => { + test.describe('Update Podman Desktop', async () => { + test('update is offered automatically on startup', async () => { await playExpect(updateAvailableDialog).toBeVisible(); const updateNowButton = updateAvailableDialog.getByRole('button', { name: 'Update Now' }); await playExpect(updateNowButton).toBeVisible(); @@ -68,6 +61,9 @@ describe('Podman Desktop Update Installation', async () => { await playExpect(cancelButton).toBeVisible(); await cancelButton.click(); await playExpect(updateAvailableDialog).not.toBeVisible(); + // handle welcome page now + const welcomePage = new WelcomePage(page); + await welcomePage.handleWelcomePage(true); }); test('version button is visible', async () => { @@ -78,27 +74,31 @@ describe('Podman Desktop Update Installation', async () => { test('user initiated update option is available', async () => { await playExpect(statusBar.updateButtonTitle).toHaveText(await statusBar.versionButton.innerText()); await statusBar.updateButtonTitle.click(); - await handleConfirmationDialog(page, 'Update', false, '', 'Cancel'); + await handleConfirmationDialog(page, 'Update Available now', false, '', 'Cancel'); }); - test.runIf(performUpdate)('update can be initiated', async () => { + test('update can be initiated', async () => { + test.skip(!performUpdate, 'Update test does not run as UPDATE_PODMAN_DESKTOP env. var. is not set'); await statusBar.updateButtonTitle.click(); await playExpect(updateAvailableDialog).toBeVisible(); - const updateNowButton = updateAvailableDialog.getByRole('button', { name: 'Update Now' }); + const updateNowButton = updateAvailableDialog.getByRole('button', { name: 'Update now' }); await playExpect(updateNowButton).toBeVisible(); await updateNowButton.click(); await playExpect(updateAvailableDialog).not.toBeVisible(); }); - test.runIf(performUpdate)('update is in progress', async () => { + test('update is in progress', async () => { + test.skip(!performUpdate, 'Update test does not run as UPDATE_PODMAN_DESKTOP env. var. is not set'); await statusBar.updateButtonTitle.click(); await playExpect(updateDialog).toBeVisible(); - await handleConfirmationDialog(page, 'Update', false, undefined, 'Cancel'); + await handleConfirmationDialog(page, 'Update', true, 'OK', 'Cancel'); }); - test.runIf(performUpdate)('update is performed and restart offered', async () => { + test('update is performed and restart offered', async () => { + test.skip(!performUpdate, 'Update test does not run as UPDATE_PODMAN_DESKTOP env. var. is not set'); + test.setTimeout(150000); // now it takes some time to perform, in case of failure, PD gets closed - await playExpect(updateDownloadedDialog).toBeVisible(); + await playExpect(updateDownloadedDialog).toBeVisible({timeout: 120000}); // some buttons await handleConfirmationDialog(page, 'Update Downloaded', false, 'Restart', 'Cancel'); });