Skip to content

Commit

Permalink
chore(ci): add pr check job that tests podman desktop update
Browse files Browse the repository at this point in the history
Signed-off-by: Ondrej Dockal <[email protected]>
  • Loading branch information
odockal committed Sep 3, 2024
1 parent 0539538 commit c473930
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 26 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/pr-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 1 addition & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
42 changes: 21 additions & 21 deletions tests/playwright/src/specs/installation/update-install.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@

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

Check failure on line 19 in tests/playwright/src/specs/installation/update-install.spec.ts

View workflow job for this annotation

GitHub Actions / linter, formatters and unit tests / windows-2022

Run autofix to sort these imports!

Check failure on line 19 in tests/playwright/src/specs/installation/update-install.spec.ts

View workflow job for this annotation

GitHub Actions / linter, formatters and unit tests / ubuntu-24.04

Run autofix to sort these imports!
import { expect as playExpect } from '@playwright/test';

Check failure on line 20 in tests/playwright/src/specs/installation/update-install.spec.ts

View workflow job for this annotation

GitHub Actions / linter, formatters and unit tests / windows-2022

'D:\a\podman-desktop\podman-desktop\node_modules\@playwright\test\index.mjs' imported multiple times

Check failure on line 20 in tests/playwright/src/specs/installation/update-install.spec.ts

View workflow job for this annotation

GitHub Actions / linter, formatters and unit tests / ubuntu-24.04

'/home/runner/work/podman-desktop/podman-desktop/node_modules/@playwright/test/index.mjs' imported multiple times
import { afterAll, beforeAll, beforeEach, describe, test } from 'vitest';
import { test } from '@playwright/test';

Check failure on line 21 in tests/playwright/src/specs/installation/update-install.spec.ts

View workflow job for this annotation

GitHub Actions / linter, formatters and unit tests / windows-2022

'D:\a\podman-desktop\podman-desktop\node_modules\@playwright\test\index.mjs' imported multiple times

Check failure on line 21 in tests/playwright/src/specs/installation/update-install.spec.ts

View workflow job for this annotation

GitHub Actions / linter, formatters and unit tests / ubuntu-24.04

'/home/runner/work/podman-desktop/podman-desktop/node_modules/@playwright/test/index.mjs' imported multiple times

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;
Expand All @@ -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<RunnerTestContext>(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 () => {

Check failure on line 52 in tests/playwright/src/specs/installation/update-install.spec.ts

View workflow job for this annotation

GitHub Actions / linter, formatters and unit tests / windows-2022

Promise returned in function argument where a void return was expected

Check failure on line 52 in tests/playwright/src/specs/installation/update-install.spec.ts

View workflow job for this annotation

GitHub Actions / linter, formatters and unit tests / windows-2022

Promise returned in function argument where a void return was expected

Check failure on line 52 in tests/playwright/src/specs/installation/update-install.spec.ts

View workflow job for this annotation

GitHub Actions / linter, formatters and unit tests / ubuntu-24.04

Promise returned in function argument where a void return was expected

Check failure on line 52 in tests/playwright/src/specs/installation/update-install.spec.ts

View workflow job for this annotation

GitHub Actions / linter, formatters and unit tests / ubuntu-24.04

Promise returned in function argument where a void return was expected
test.describe('Update Podman Desktop', async () => {

Check failure on line 53 in tests/playwright/src/specs/installation/update-install.spec.ts

View workflow job for this annotation

GitHub Actions / linter, formatters and unit tests / windows-2022

Promise returned in function argument where a void return was expected

Check failure on line 53 in tests/playwright/src/specs/installation/update-install.spec.ts

View workflow job for this annotation

GitHub Actions / linter, formatters and unit tests / windows-2022

Promise returned in function argument where a void return was expected

Check failure on line 53 in tests/playwright/src/specs/installation/update-install.spec.ts

View workflow job for this annotation

GitHub Actions / linter, formatters and unit tests / ubuntu-24.04

Promise returned in function argument where a void return was expected

Check failure on line 53 in tests/playwright/src/specs/installation/update-install.spec.ts

View workflow job for this annotation

GitHub Actions / linter, formatters and unit tests / ubuntu-24.04

Promise returned in function argument where a void return was expected
test('update is offered automatically on startup', async () => {
await playExpect(updateAvailableDialog).toBeVisible();
const updateNowButton = updateAvailableDialog.getByRole('button', { name: 'Update Now' });
await playExpect(updateNowButton).toBeVisible();
Expand All @@ -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 () => {
Expand All @@ -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');
});
Expand Down

0 comments on commit c473930

Please sign in to comment.