From f5756b538e64aeace3951a2b65f857fa54e14db6 Mon Sep 17 00:00:00 2001 From: Ondrej Dockal Date: Wed, 4 Sep 2024 10:08:29 +0200 Subject: [PATCH 01/16] chore(ci): add required test job to check another job's run result Signed-off-by: Ondrej Dockal --- .github/workflows/test-required.yaml | 60 ++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .github/workflows/test-required.yaml diff --git a/.github/workflows/test-required.yaml b/.github/workflows/test-required.yaml new file mode 100644 index 0000000000000..09142acb08c6f --- /dev/null +++ b/.github/workflows/test-required.yaml @@ -0,0 +1,60 @@ +# +# Copyright (C) 2023-2024 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +name: Test Evaluate required + +on: + push: + branches: [main] + + workflow_dispatch: + inputs: + skip: + default: false + description: 'Skip first job' + type: boolean + required: true + fail: + default: false + description: 'Fail first job' + type: boolean + required: true + +jobs: + first_job: + name: Run tests + runs-on: ubuntu-22.04 + if: ${{ inputs.skip == false }} + steps: + - name: Run the test yeah + run: | + [ "${{ inputs.fail }}" = "true" ] && echo "TESTS PASSED" || echo "Tests FAILED" && exit 1 + + second_job: + name: Evaluate first job + runs-on: ubuntu-22.04 + needs: first_job + if: | + always() + steps: + - name: Echo the results + run: | + echo "Job result: ${{ needs.first_job.result }}" + if [ ${{ needs.first_job.result == 'failure' }} ]; then + echo "Marking failed..." + exit 1 + fi From ec71728e0b2dd4ac16c107542e9ce48301bc1c31 Mon Sep 17 00:00:00 2001 From: Ondrej Dockal Date: Thu, 29 Aug 2024 16:59:16 +0200 Subject: [PATCH 02/16] chore(tests): add podman desktop update e2e test with workflow Signed-off-by: Ondrej Dockal --- .github/workflows/e2e-main.yaml | 4 +- .github/workflows/pr-check.yaml | 59 ++++++++++ package.json | 2 + .../src/lib/statusbar/StatusBar.svelte | 4 +- .../src/model/workbench/status-bar.ts | 18 ++- .../specs/installation/update-install.spec.ts | 104 ++++++++++++++++++ tests/playwright/src/utility/operations.ts | 3 +- 7 files changed, 188 insertions(+), 6 deletions(-) create mode 100644 tests/playwright/src/specs/installation/update-install.spec.ts diff --git a/.github/workflows/e2e-main.yaml b/.github/workflows/e2e-main.yaml index 2acf5b47182da..227266ff0455e 100644 --- a/.github/workflows/e2e-main.yaml +++ b/.github/workflows/e2e-main.yaml @@ -41,7 +41,7 @@ on: jobs: e2e-tests: - name: Run E2E tests + name: Run All E2E tests runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 @@ -85,7 +85,7 @@ jobs: - name: Execute pnpm run: pnpm install - - name: Run All E2E tests + - name: Run E2E tests env: PODMANDESKTOP_CI_BOT_TOKEN: ${{ secrets.PODMANDESKTOP_CI_BOT_TOKEN }} TEST_PODMAN_MACHINE: 'true' diff --git a/.github/workflows/pr-check.yaml b/.github/workflows/pr-check.yaml index 106ace0375d8d..3aa9d2fdc7fdc 100644 --- a/.github/workflows/pr-check.yaml +++ b/.github/workflows/pr-check.yaml @@ -324,3 +324,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 1d0018eb9ccf8..b2bfefc36d936 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,8 @@ "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/pod-smoke.spec.ts", + "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' -- 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/packages/renderer/src/lib/statusbar/StatusBar.svelte b/packages/renderer/src/lib/statusbar/StatusBar.svelte index fec9993047fe2..2960b245786bc 100644 --- a/packages/renderer/src/lib/statusbar/StatusBar.svelte +++ b/packages/renderer/src/lib/statusbar/StatusBar.svelte @@ -48,7 +48,9 @@ onMount(async () => {
+ class="flex justify-between px-1 bg-[var(--pd-statusbar-bg)] text-[var(--pd-statusbar-text)] text-sm space-x-2 z-40" + role="contentinfo" + aria-label="Status Bar">
{#each leftEntries as entry} diff --git a/tests/playwright/src/model/workbench/status-bar.ts b/tests/playwright/src/model/workbench/status-bar.ts index 8bf499f6708b8..5277fa5648748 100644 --- a/tests/playwright/src/model/workbench/status-bar.ts +++ b/tests/playwright/src/model/workbench/status-bar.ts @@ -22,15 +22,29 @@ import { handleConfirmationDialog } from '../../utility/operations'; import { BasePage } from '../pages/base-page'; export class StatusBar extends BasePage { + readonly content: Locator; readonly kindInstallationButton: Locator; readonly kubernetesContext: Locator; + readonly versionButton: Locator; + readonly updateButtonTitle: Locator; + readonly shareYourFeedbackButton: Locator; + readonly troubleshootingButton: Locator; + readonly tasksButton: Locator; + readonly helpButton: Locator; constructor(page: Page) { super(page); - this.kindInstallationButton = this.page.getByTitle( + this.content = page.getByRole('contentinfo', { name: 'Status Bar' }); + this.kindInstallationButton = this.content.getByTitle( 'Kind not found on your system, click to download and install it', ); - this.kubernetesContext = this.page.getByTitle('Current Kubernetes Context'); + this.kubernetesContext = this.content.getByTitle('Current Kubernetes Context'); + this.versionButton = this.content.getByRole('button', { name: /^v\d+\.\d+\.\d+(-\w+)?$/ }); + this.updateButtonTitle = this.content.getByRole('button').and(this.content.getByTitle('Update available')); + this.shareYourFeedbackButton = this.content.getByRole('button').and(this.content.getByTitle('Share your feedback')); + this.troubleshootingButton = this.content.getByRole('button').and(this.content.getByTitle('Troubleshooting')); + this.tasksButton = this.content.getByRole('button').and(this.content.getByTitle('Tasks')); + this.helpButton = this.content.getByRole('button').and(this.content.getByTitle('Help')); } public async installKindCLI(): Promise { diff --git a/tests/playwright/src/specs/installation/update-install.spec.ts b/tests/playwright/src/specs/installation/update-install.spec.ts new file mode 100644 index 0000000000000..404046453299a --- /dev/null +++ b/tests/playwright/src/specs/installation/update-install.spec.ts @@ -0,0 +1,104 @@ +/********************************************************************** + * Copyright (C) 2023-2024 Red Hat, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ***********************************************************************/ + +import type { Locator, Page } from '@playwright/test'; +import { expect as playExpect, test } from '@playwright/test'; + +import { WelcomePage } from '../../model/pages/welcome-page'; +import { StatusBar } from '../../model/workbench/status-bar'; +import { PodmanDesktopRunner } from '../../runner/podman-desktop-runner'; +import { handleConfirmationDialog } from '../../utility/operations'; + +let pdRunner: PodmanDesktopRunner; +let page: Page; +let statusBar: StatusBar; +let updateAvailableDialog: Locator; +let updateDialog: Locator; +let updateDownloadedDialog: Locator; +const performUpdate = process.env.UPDATE_PODMAN_DESKTOP ? process.env.UPDATE_PODMAN_DESKTOP : false; + +test.beforeAll(async () => { + pdRunner = new PodmanDesktopRunner(); + page = await pdRunner.start(); + pdRunner.setVideoAndTraceName('update-e2e'); + + 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 }); +}); + +test.afterAll(async () => { + await pdRunner.close(); +}); + +test.describe('Podman Desktop Update Installation', () => { + test.describe('Update Podman Desktop', () => { + test('Update is offered automatically on startup', async () => { + await playExpect(updateAvailableDialog).toBeVisible(); + const updateNowButton = updateAvailableDialog.getByRole('button', { name: 'Update Now' }); + await playExpect(updateNowButton).toBeVisible(); + const doNotshowButton = updateAvailableDialog.getByRole('button', { name: 'Do not show again' }); + await playExpect(doNotshowButton).toBeVisible(); + const cancelButton = updateAvailableDialog.getByRole('button', { name: 'Cancel' }); + 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 () => { + await playExpect(statusBar.content).toBeVisible(); + await playExpect(statusBar.versionButton).toBeVisible(); + }); + + 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 Available now', false, '', 'Cancel'); + }); + + 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' }); + await playExpect(updateNowButton).toBeVisible(); + await updateNowButton.click(); + await playExpect(updateAvailableDialog).not.toBeVisible(); + }); + + 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', true, 'OK', 'Cancel'); + }); + + 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({ timeout: 120000 }); + // some buttons + await handleConfirmationDialog(page, 'Update Downloaded', false, 'Restart', 'Cancel'); + }); + }); +}); diff --git a/tests/playwright/src/utility/operations.ts b/tests/playwright/src/utility/operations.ts index 372f85c8b02ec..8d7a3604c5dd8 100644 --- a/tests/playwright/src/utility/operations.ts +++ b/tests/playwright/src/utility/operations.ts @@ -160,10 +160,11 @@ export async function handleConfirmationDialog( ): Promise { // wait for dialog to appear using waitFor const dialog = page.getByRole('dialog', { name: dialogTitle, exact: true }); - await dialog.waitFor({ state: 'visible', timeout: 3000 }); + await playExpect(dialog).toBeVisible(); const button = confirm ? dialog.getByRole('button', { name: confirmationButton }) : dialog.getByRole('button', { name: cancelButton }); + await playExpect(button).toBeEnabled(); await button.click(); } From 3cefaea9d51cda49e4e0e747533c88bc0f477d67 Mon Sep 17 00:00:00 2001 From: Ondrej Dockal Date: Tue, 3 Sep 2024 13:21:35 +0200 Subject: [PATCH 03/16] chore(tests): redo test.describe grouping Signed-off-by: Ondrej Dockal --- .../specs/installation/update-install.spec.ts | 95 +++++++++---------- 1 file changed, 46 insertions(+), 49 deletions(-) diff --git a/tests/playwright/src/specs/installation/update-install.spec.ts b/tests/playwright/src/specs/installation/update-install.spec.ts index 404046453299a..7c8af51494b1e 100644 --- a/tests/playwright/src/specs/installation/update-install.spec.ts +++ b/tests/playwright/src/specs/installation/update-install.spec.ts @@ -47,58 +47,55 @@ test.afterAll(async () => { await pdRunner.close(); }); -test.describe('Podman Desktop Update Installation', () => { - test.describe('Update Podman Desktop', () => { - test('Update is offered automatically on startup', async () => { - await playExpect(updateAvailableDialog).toBeVisible(); - const updateNowButton = updateAvailableDialog.getByRole('button', { name: 'Update Now' }); - await playExpect(updateNowButton).toBeVisible(); - const doNotshowButton = updateAvailableDialog.getByRole('button', { name: 'Do not show again' }); - await playExpect(doNotshowButton).toBeVisible(); - const cancelButton = updateAvailableDialog.getByRole('button', { name: 'Cancel' }); - 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 () => { - await playExpect(statusBar.content).toBeVisible(); - await playExpect(statusBar.versionButton).toBeVisible(); - }); +test.describe.serial('Podman Desktop Update Update installation offering', () => { + test('Update is offered automatically on startup', async () => { + await playExpect(updateAvailableDialog).toBeVisible(); + const updateNowButton = updateAvailableDialog.getByRole('button', { name: 'Update Now' }); + await playExpect(updateNowButton).toBeVisible(); + const doNotshowButton = updateAvailableDialog.getByRole('button', { name: 'Do not show again' }); + await playExpect(doNotshowButton).toBeVisible(); + const cancelButton = updateAvailableDialog.getByRole('button', { name: 'Cancel' }); + 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('User initiated update option is available', async () => { - await playExpect(statusBar.updateButtonTitle).toHaveText(await statusBar.versionButton.innerText()); - await statusBar.updateButtonTitle.click(); - await handleConfirmationDialog(page, 'Update Available now', false, '', 'Cancel'); - }); + test('Version button is visible', async () => { + await playExpect(statusBar.content).toBeVisible(); + await playExpect(statusBar.versionButton).toBeVisible(); + }); - 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' }); - await playExpect(updateNowButton).toBeVisible(); - await updateNowButton.click(); - await playExpect(updateAvailableDialog).not.toBeVisible(); - }); + 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 Available now', false, '', 'Cancel'); + }); +}); +test.describe.serial('Podman Desktop Update installation can be performed', () => { + test.skip(!performUpdate, 'Update test does not run as UPDATE_PODMAN_DESKTOP env. var. is not set'); + test('Update can be initiated', async () => { + await statusBar.updateButtonTitle.click(); + await playExpect(updateAvailableDialog).toBeVisible(); + const updateNowButton = updateAvailableDialog.getByRole('button', { name: 'Update now' }); + await playExpect(updateNowButton).toBeVisible(); + await updateNowButton.click(); + await playExpect(updateAvailableDialog).not.toBeVisible(); + }); - 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', true, 'OK', 'Cancel'); - }); + test('Update is in progress', async () => { + await statusBar.updateButtonTitle.click(); + await playExpect(updateDialog).toBeVisible(); + await handleConfirmationDialog(page, 'Update', true, 'OK', 'Cancel'); + }); - 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({ timeout: 120000 }); - // some buttons - await handleConfirmationDialog(page, 'Update Downloaded', false, 'Restart', 'Cancel'); - }); + test('Update is performed and restart offered', async () => { + test.setTimeout(150000); + // now it takes some time to perform, in case of failure, PD gets closed + await playExpect(updateDownloadedDialog).toBeVisible({ timeout: 120000 }); + // some buttons + await handleConfirmationDialog(page, 'Update Downloaded', false, 'Restart', 'Cancel'); }); }); From cbc3d580c2fb8acd438d8bae000668777b5ce14a Mon Sep 17 00:00:00 2001 From: Ondrej Dockal Date: Tue, 3 Sep 2024 14:25:24 +0200 Subject: [PATCH 04/16] chore(ci): run pr check on dependabot only, add e2e update test after merge Signed-off-by: Ondrej Dockal --- .github/workflows/e2e-main.yaml | 66 +++++++++++++++++++++++++++++++++ .github/workflows/pr-check.yaml | 1 + 2 files changed, 67 insertions(+) diff --git a/.github/workflows/e2e-main.yaml b/.github/workflows/e2e-main.yaml index 227266ff0455e..98ab27a055d86 100644 --- a/.github/workflows/e2e-main.yaml +++ b/.github/workflows/e2e-main.yaml @@ -100,3 +100,69 @@ 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 + with: + repository: ${{ github.event.inputs.organization }}/${{ github.event.inputs.repositoryName }} + ref: ${{ github.event.inputs.branch }} + if: github.event_name == 'workflow_dispatch' + + - uses: actions/checkout@v4 + if: github.event_name == 'push' + + - 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/.github/workflows/pr-check.yaml b/.github/workflows/pr-check.yaml index 3aa9d2fdc7fdc..5f7426ee77ff1 100644 --- a/.github/workflows/pr-check.yaml +++ b/.github/workflows/pr-check.yaml @@ -327,6 +327,7 @@ jobs: win-update-e2e-test: name: win update e2e tests + if: github.actor == 'dependabot[bot]' runs-on: ${{ matrix.os }} timeout-minutes: 40 strategy: From e65f32bcaeb498623f2182d4cb62ce284c053d33 Mon Sep 17 00:00:00 2001 From: Ondrej Dockal Date: Wed, 4 Sep 2024 11:03:35 +0200 Subject: [PATCH 05/16] chore(ci): enable required check for skipped win-update-e2e-test Signed-off-by: Ondrej Dockal --- .github/workflows/pr-check.yaml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/.github/workflows/pr-check.yaml b/.github/workflows/pr-check.yaml index 5f7426ee77ff1..2ceb143172cb9 100644 --- a/.github/workflows/pr-check.yaml +++ b/.github/workflows/pr-check.yaml @@ -384,3 +384,20 @@ jobs: ./tests/output/ ./tests/**/output/junit*.xml !./tests/**/traces/raw + + update-e2e-test: + name: evaluate win update e2e test + runs-on: ubuntu-22.04 + needs: win-update-e2e-test + if: | + always() + steps: + - name: Evaluate the Windows Update test results + run: | + echo "Windows updater result: ${{ needs.win-update-e2e-test.result }}" + if [ "${{ needs.win-update-e2e-test.result }}" = "failure" ]; then + echo "Windows udpater test failed..." + exit 1 + else + echo "Windows updater test succeeded or was skipped..." + fi From 30cf69f6b19f6d0c8ef928a862c0051556b167cb Mon Sep 17 00:00:00 2001 From: Ondrej Dockal Date: Thu, 5 Sep 2024 12:44:16 +0200 Subject: [PATCH 06/16] chore(tests): rewrite e2e update test according to pw fixtures Signed-off-by: Ondrej Dockal --- .../specs/installation/update-install.spec.ts | 41 ++++++++----------- tests/playwright/src/utility/fixtures.ts | 6 +++ 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/tests/playwright/src/specs/installation/update-install.spec.ts b/tests/playwright/src/specs/installation/update-install.spec.ts index 7c8af51494b1e..4fed60b4c490f 100644 --- a/tests/playwright/src/specs/installation/update-install.spec.ts +++ b/tests/playwright/src/specs/installation/update-install.spec.ts @@ -16,39 +16,33 @@ * SPDX-License-Identifier: Apache-2.0 ***********************************************************************/ -import type { Locator, Page } from '@playwright/test'; -import { expect as playExpect, test } from '@playwright/test'; +import type { Locator } from '@playwright/test'; -import { WelcomePage } from '../../model/pages/welcome-page'; -import { StatusBar } from '../../model/workbench/status-bar'; -import { PodmanDesktopRunner } from '../../runner/podman-desktop-runner'; +import type { StatusBar } from '../../model/workbench/status-bar'; +import { expect as playExpect, test } from '../../utility/fixtures'; import { handleConfirmationDialog } from '../../utility/operations'; -let pdRunner: PodmanDesktopRunner; -let page: Page; -let statusBar: StatusBar; +let sBar: StatusBar; let updateAvailableDialog: Locator; let updateDialog: Locator; let updateDownloadedDialog: Locator; const performUpdate = process.env.UPDATE_PODMAN_DESKTOP ? process.env.UPDATE_PODMAN_DESKTOP : false; -test.beforeAll(async () => { - pdRunner = new PodmanDesktopRunner(); - page = await pdRunner.start(); +test.beforeAll(async ({ pdRunner, page, statusBar }) => { pdRunner.setVideoAndTraceName('update-e2e'); - statusBar = new StatusBar(page); + sBar = statusBar; 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 }); }); -test.afterAll(async () => { +test.afterAll(async ({ pdRunner }) => { await pdRunner.close(); }); test.describe.serial('Podman Desktop Update Update installation offering', () => { - test('Update is offered automatically on startup', async () => { + test('Update is offered automatically on startup', async ({ welcomePage }) => { await playExpect(updateAvailableDialog).toBeVisible(); const updateNowButton = updateAvailableDialog.getByRole('button', { name: 'Update Now' }); await playExpect(updateNowButton).toBeVisible(); @@ -59,25 +53,24 @@ test.describe.serial('Podman Desktop Update Update installation offering', () => 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 () => { - await playExpect(statusBar.content).toBeVisible(); - await playExpect(statusBar.versionButton).toBeVisible(); + await playExpect(sBar.content).toBeVisible(); + await playExpect(sBar.versionButton).toBeVisible(); }); - test('User initiated update option is available', async () => { - await playExpect(statusBar.updateButtonTitle).toHaveText(await statusBar.versionButton.innerText()); - await statusBar.updateButtonTitle.click(); + test('User initiated update option is available', async ({ page }) => { + await playExpect(sBar.updateButtonTitle).toHaveText(await sBar.versionButton.innerText()); + await sBar.updateButtonTitle.click(); await handleConfirmationDialog(page, 'Update Available now', false, '', 'Cancel'); }); }); test.describe.serial('Podman Desktop Update installation can be performed', () => { test.skip(!performUpdate, 'Update test does not run as UPDATE_PODMAN_DESKTOP env. var. is not set'); test('Update can be initiated', async () => { - await statusBar.updateButtonTitle.click(); + await sBar.updateButtonTitle.click(); await playExpect(updateAvailableDialog).toBeVisible(); const updateNowButton = updateAvailableDialog.getByRole('button', { name: 'Update now' }); await playExpect(updateNowButton).toBeVisible(); @@ -85,13 +78,13 @@ test.describe.serial('Podman Desktop Update installation can be performed', () = await playExpect(updateAvailableDialog).not.toBeVisible(); }); - test('Update is in progress', async () => { - await statusBar.updateButtonTitle.click(); + test('Update is in progress', async ({ page }) => { + await sBar.updateButtonTitle.click(); await playExpect(updateDialog).toBeVisible(); await handleConfirmationDialog(page, 'Update', true, 'OK', 'Cancel'); }); - test('Update is performed and restart offered', async () => { + test('Update is performed and restart offered', async ({ page }) => { test.setTimeout(150000); // now it takes some time to perform, in case of failure, PD gets closed await playExpect(updateDownloadedDialog).toBeVisible({ timeout: 120000 }); diff --git a/tests/playwright/src/utility/fixtures.ts b/tests/playwright/src/utility/fixtures.ts index 5ba707a3b0d68..1680c1eef4ce4 100644 --- a/tests/playwright/src/utility/fixtures.ts +++ b/tests/playwright/src/utility/fixtures.ts @@ -23,12 +23,14 @@ import { WelcomePage } from '../model/pages/welcome-page'; import { NavigationBar } from '../model/workbench/navigation'; import { Runner } from '../runner/podman-desktop-runner'; import { RunnerOptions } from '../runner/runner-options'; +import { StatusBar } from '../model/workbench/status-bar'; export type TestFixtures = { runner: Runner; navigationBar: NavigationBar; welcomePage: WelcomePage; page: Page; + statusBar: StatusBar; }; export type FixtureOptions = { @@ -52,5 +54,9 @@ export const test = base.extend({ const welcomePage = new WelcomePage(page); await use(welcomePage); }, + statusBar: async ({ page }, use) => { + const statusBar = new StatusBar(page); + await use(statusBar); + }, }); export { expect } from '@playwright/test'; From f23da2a8c3f45f23fd4a333c31d4a572b65240ee Mon Sep 17 00:00:00 2001 From: Ondrej Dockal Date: Thu, 5 Sep 2024 12:57:12 +0200 Subject: [PATCH 07/16] chore(ci): adjust update e2e to runs on pnpm-lock.yaml change and when area/update label is added Signed-off-by: Ondrej Dockal --- .github/workflows/pr-check.yaml | 31 ++++++++++++-- .github/workflows/test-required.yaml | 60 ---------------------------- 2 files changed, 28 insertions(+), 63 deletions(-) delete mode 100644 .github/workflows/test-required.yaml diff --git a/.github/workflows/pr-check.yaml b/.github/workflows/pr-check.yaml index 2ceb143172cb9..0f5457e29097e 100644 --- a/.github/workflows/pr-check.yaml +++ b/.github/workflows/pr-check.yaml @@ -17,7 +17,9 @@ name: pr-check -on: [pull_request] +on: + pull_request: + types: [labeled, synchronize, opened, reopened] jobs: windows: @@ -325,9 +327,32 @@ jobs: ./tests/**/output/junit*.xml !./tests/**/traces/raw + detect_pnpm_changes: + name: Detect pnpm lock file changes + runs-on: ubuntu-latest + outputs: + pnpm_lock_changed: ${{ steps.pnpm_changed.outputs.PNPM_LOCK_CHANGED }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 2 + + - name: Evaluate changes in files + id: pnpm_changed + run: | + git fetch origin ${{ github.event.pull_request.base.ref }} + git diff --name-only origin/${{ github.event.pull_request.base.ref }} HEAD > changes.txt + if grep -q 'pnpm-lock.yaml' changes.txt; then + echo "PNPM_LOCK_CHANGED=true" >> $GITHUB_OUTPUT + else + echo "PNPM_LOCK_CHANGED=false" >> $GITHUB_OUTPUT + fi + win-update-e2e-test: name: win update e2e tests - if: github.actor == 'dependabot[bot]' + needs: detect_pnpm_changes + if: contains(github.event.pull_request.labels.*.name, 'area/update') || needs.detect_pnpm_changes.outputs.pnpm_lock_changed == 'true' runs-on: ${{ matrix.os }} timeout-minutes: 40 strategy: @@ -386,7 +411,7 @@ jobs: !./tests/**/traces/raw update-e2e-test: - name: evaluate win update e2e test + name: update E2E test ${{ needs.win-update-e2e-test.result == 'skipped' && '(skipped)' || '(executed)' }} runs-on: ubuntu-22.04 needs: win-update-e2e-test if: | diff --git a/.github/workflows/test-required.yaml b/.github/workflows/test-required.yaml deleted file mode 100644 index 09142acb08c6f..0000000000000 --- a/.github/workflows/test-required.yaml +++ /dev/null @@ -1,60 +0,0 @@ -# -# Copyright (C) 2023-2024 Red Hat, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# SPDX-License-Identifier: Apache-2.0 - -name: Test Evaluate required - -on: - push: - branches: [main] - - workflow_dispatch: - inputs: - skip: - default: false - description: 'Skip first job' - type: boolean - required: true - fail: - default: false - description: 'Fail first job' - type: boolean - required: true - -jobs: - first_job: - name: Run tests - runs-on: ubuntu-22.04 - if: ${{ inputs.skip == false }} - steps: - - name: Run the test yeah - run: | - [ "${{ inputs.fail }}" = "true" ] && echo "TESTS PASSED" || echo "Tests FAILED" && exit 1 - - second_job: - name: Evaluate first job - runs-on: ubuntu-22.04 - needs: first_job - if: | - always() - steps: - - name: Echo the results - run: | - echo "Job result: ${{ needs.first_job.result }}" - if [ ${{ needs.first_job.result == 'failure' }} ]; then - echo "Marking failed..." - exit 1 - fi From 91a637fd02f5273c584406d6775c8ee766989515 Mon Sep 17 00:00:00 2001 From: Ondrej Dockal Date: Thu, 5 Sep 2024 17:25:11 +0200 Subject: [PATCH 08/16] chore(ci): add individual pr check file for update e2e test Signed-off-by: Ondrej Dockal --- .github/workflows/pr-check-update-e2e.yaml | 125 +++++++++++++++++++++ .github/workflows/pr-check.yaml | 4 +- 2 files changed, 126 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/pr-check-update-e2e.yaml diff --git a/.github/workflows/pr-check-update-e2e.yaml b/.github/workflows/pr-check-update-e2e.yaml new file mode 100644 index 0000000000000..7f77b675f46d5 --- /dev/null +++ b/.github/workflows/pr-check-update-e2e.yaml @@ -0,0 +1,125 @@ +# +# Copyright (C) 2024 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +name: pr-check-update-e2e + +on: + pull_request: + paths: + - 'pnpm-lock.yaml' + types: [labeled, synchronize, opened, reopened] + +jobs: + detect_pnpm_changes: + name: Detect pnpm lock file changes + runs-on: ubuntu-latest + outputs: + pnpm_lock_changed: ${{ steps.pnpm_changed.outputs.PNPM_LOCK_CHANGED }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 2 + + - name: Evaluate changes in files + id: pnpm_changed + run: | + git fetch origin ${{ github.event.pull_request.base.ref }} + git diff --name-only origin/${{ github.event.pull_request.base.ref }} HEAD > changes.txt + if grep -q 'pnpm-lock.yaml' changes.txt; then + echo "PNPM_LOCK_CHANGED=true" >> $GITHUB_OUTPUT + else + echo "PNPM_LOCK_CHANGED=false" >> $GITHUB_OUTPUT + fi + + run-update-e2e-test: + name: win update e2e tests + needs: detect_pnpm_changes + if: contains(github.event.pull_request.labels.*.name, 'area/update') || needs.detect_pnpm_changes.outputs.pnpm_lock_changed == 'true' + 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: ${{ matrix.os }}-update-e2e-test + path: | + ./tests/**/output/ + ./tests/**/output/junit*.xml + !./tests/**/traces/raw + + update-e2e-test: + name: update E2E test + runs-on: ubuntu-22.04 + needs: run-update-e2e-test + if: | + always() + steps: + - name: Evaluate the Windows Update test results + run: | + echo "Windows updater result: ${{ needs.run-update-e2e-test.result }}" + if [ "${{ needs.run-update-e2e-test.result }}" = "failure" ]; then + echo "Windows udpater test failed..." + exit 1 + else + echo "Windows updater test succeeded or was skipped..." + fi diff --git a/.github/workflows/pr-check.yaml b/.github/workflows/pr-check.yaml index 0f5457e29097e..3389b4068f4fc 100644 --- a/.github/workflows/pr-check.yaml +++ b/.github/workflows/pr-check.yaml @@ -17,9 +17,7 @@ name: pr-check -on: - pull_request: - types: [labeled, synchronize, opened, reopened] +on: [pull_request] jobs: windows: From 9292e2da2ae43306ab0f30934ba7cc1a522a9787 Mon Sep 17 00:00:00 2001 From: Ondrej Dockal Date: Thu, 5 Sep 2024 19:04:35 +0200 Subject: [PATCH 09/16] chore(ci): allow to run update e2e job on label added on pr Signed-off-by: Ondrej Dockal --- .github/workflows/pr-check-update-e2e.yaml | 1 + .github/workflows/pr-check.yaml | 100 ------------------ .../specs/installation/update-install.spec.ts | 8 +- 3 files changed, 5 insertions(+), 104 deletions(-) diff --git a/.github/workflows/pr-check-update-e2e.yaml b/.github/workflows/pr-check-update-e2e.yaml index 7f77b675f46d5..70d95946fd7b1 100644 --- a/.github/workflows/pr-check-update-e2e.yaml +++ b/.github/workflows/pr-check-update-e2e.yaml @@ -20,6 +20,7 @@ name: pr-check-update-e2e on: pull_request: paths: + - '**' - 'pnpm-lock.yaml' types: [labeled, synchronize, opened, reopened] diff --git a/.github/workflows/pr-check.yaml b/.github/workflows/pr-check.yaml index 3389b4068f4fc..106ace0375d8d 100644 --- a/.github/workflows/pr-check.yaml +++ b/.github/workflows/pr-check.yaml @@ -324,103 +324,3 @@ jobs: ./tests/output/ ./tests/**/output/junit*.xml !./tests/**/traces/raw - - detect_pnpm_changes: - name: Detect pnpm lock file changes - runs-on: ubuntu-latest - outputs: - pnpm_lock_changed: ${{ steps.pnpm_changed.outputs.PNPM_LOCK_CHANGED }} - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - fetch-depth: 2 - - - name: Evaluate changes in files - id: pnpm_changed - run: | - git fetch origin ${{ github.event.pull_request.base.ref }} - git diff --name-only origin/${{ github.event.pull_request.base.ref }} HEAD > changes.txt - if grep -q 'pnpm-lock.yaml' changes.txt; then - echo "PNPM_LOCK_CHANGED=true" >> $GITHUB_OUTPUT - else - echo "PNPM_LOCK_CHANGED=false" >> $GITHUB_OUTPUT - fi - - win-update-e2e-test: - name: win update e2e tests - needs: detect_pnpm_changes - if: contains(github.event.pull_request.labels.*.name, 'area/update') || needs.detect_pnpm_changes.outputs.pnpm_lock_changed == 'true' - 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 - - update-e2e-test: - name: update E2E test ${{ needs.win-update-e2e-test.result == 'skipped' && '(skipped)' || '(executed)' }} - runs-on: ubuntu-22.04 - needs: win-update-e2e-test - if: | - always() - steps: - - name: Evaluate the Windows Update test results - run: | - echo "Windows updater result: ${{ needs.win-update-e2e-test.result }}" - if [ "${{ needs.win-update-e2e-test.result }}" = "failure" ]; then - echo "Windows udpater test failed..." - exit 1 - else - echo "Windows updater test succeeded or was skipped..." - fi diff --git a/tests/playwright/src/specs/installation/update-install.spec.ts b/tests/playwright/src/specs/installation/update-install.spec.ts index 4fed60b4c490f..cbd38f7592176 100644 --- a/tests/playwright/src/specs/installation/update-install.spec.ts +++ b/tests/playwright/src/specs/installation/update-install.spec.ts @@ -28,8 +28,8 @@ let updateDialog: Locator; let updateDownloadedDialog: Locator; const performUpdate = process.env.UPDATE_PODMAN_DESKTOP ? process.env.UPDATE_PODMAN_DESKTOP : false; -test.beforeAll(async ({ pdRunner, page, statusBar }) => { - pdRunner.setVideoAndTraceName('update-e2e'); +test.beforeAll(async ({ runner, page, statusBar }) => { + runner.setVideoAndTraceName('update-e2e'); sBar = statusBar; updateAvailableDialog = page.getByRole('dialog', { name: 'Update Available now' }); @@ -37,8 +37,8 @@ test.beforeAll(async ({ pdRunner, page, statusBar }) => { updateDownloadedDialog = page.getByRole('dialog', { name: 'Update Downloaded', exact: true }); }); -test.afterAll(async ({ pdRunner }) => { - await pdRunner.close(); +test.afterAll(async ({ runner }) => { + await runner.close(); }); test.describe.serial('Podman Desktop Update Update installation offering', () => { From bf439e3c79f2c07b853ee79a084f8d6bc8182be2 Mon Sep 17 00:00:00 2001 From: Ondrej Dockal Date: Fri, 6 Sep 2024 06:25:34 +0200 Subject: [PATCH 10/16] chore(ci): remove unnecessary filtering for pnpm-lock.yaml Signed-off-by: Ondrej Dockal --- .github/workflows/pr-check-update-e2e.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/pr-check-update-e2e.yaml b/.github/workflows/pr-check-update-e2e.yaml index 70d95946fd7b1..54af1c611585b 100644 --- a/.github/workflows/pr-check-update-e2e.yaml +++ b/.github/workflows/pr-check-update-e2e.yaml @@ -21,7 +21,6 @@ on: pull_request: paths: - '**' - - 'pnpm-lock.yaml' types: [labeled, synchronize, opened, reopened] jobs: From 7f8568d93cbf6ea28a0ddd03fcd13845c45bcb20 Mon Sep 17 00:00:00 2001 From: Ondrej Dockal Date: Fri, 6 Sep 2024 06:31:37 +0200 Subject: [PATCH 11/16] chore(ci): stick to simple job not matrix for now Signed-off-by: Ondrej Dockal --- .github/workflows/pr-check-update-e2e.yaml | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/.github/workflows/pr-check-update-e2e.yaml b/.github/workflows/pr-check-update-e2e.yaml index 54af1c611585b..0b60ef5146254 100644 --- a/.github/workflows/pr-check-update-e2e.yaml +++ b/.github/workflows/pr-check-update-e2e.yaml @@ -26,7 +26,7 @@ on: jobs: detect_pnpm_changes: name: Detect pnpm lock file changes - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 outputs: pnpm_lock_changed: ${{ steps.pnpm_changed.outputs.PNPM_LOCK_CHANGED }} steps: @@ -50,12 +50,8 @@ jobs: name: win update e2e tests needs: detect_pnpm_changes if: contains(github.event.pull_request.labels.*.name, 'area/update') || needs.detect_pnpm_changes.outputs.pnpm_lock_changed == 'true' - runs-on: ${{ matrix.os }} - timeout-minutes: 40 - strategy: - fail-fast: false - matrix: - os: [windows-2022] + runs-on: windows-2022 + timeout-minutes: 60 steps: - uses: actions/checkout@v4 @@ -76,7 +72,6 @@ jobs: 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 @@ -101,7 +96,7 @@ jobs: - uses: actions/upload-artifact@v4 if: always() with: - name: ${{ matrix.os }}-update-e2e-test + name: win-update-e2e-test path: | ./tests/**/output/ ./tests/**/output/junit*.xml From a6d9ed4b936b895f399cb71fe6b8d831061451ed Mon Sep 17 00:00:00 2001 From: Ondrej Dockal Date: Fri, 6 Sep 2024 07:02:36 +0200 Subject: [PATCH 12/16] fix: fix linter problem Signed-off-by: Ondrej Dockal --- tests/playwright/src/utility/fixtures.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/playwright/src/utility/fixtures.ts b/tests/playwright/src/utility/fixtures.ts index 1680c1eef4ce4..ad5c20a83a0d5 100644 --- a/tests/playwright/src/utility/fixtures.ts +++ b/tests/playwright/src/utility/fixtures.ts @@ -21,9 +21,9 @@ import { test as base } from '@playwright/test'; import { WelcomePage } from '../model/pages/welcome-page'; import { NavigationBar } from '../model/workbench/navigation'; +import { StatusBar } from '../model/workbench/status-bar'; import { Runner } from '../runner/podman-desktop-runner'; import { RunnerOptions } from '../runner/runner-options'; -import { StatusBar } from '../model/workbench/status-bar'; export type TestFixtures = { runner: Runner; From 25307c77775cd8d7b9ed9da96f2727b68bc48493 Mon Sep 17 00:00:00 2001 From: Ondrej Dockal Date: Mon, 9 Sep 2024 12:29:03 +0200 Subject: [PATCH 13/16] chore(ci): runs pr check on label change, remove paths Signed-off-by: Ondrej Dockal --- .github/workflows/pr-check-update-e2e.yaml | 120 --------------------- .github/workflows/pr-check.yaml | 101 ++++++++++++++++- 2 files changed, 99 insertions(+), 122 deletions(-) delete mode 100644 .github/workflows/pr-check-update-e2e.yaml diff --git a/.github/workflows/pr-check-update-e2e.yaml b/.github/workflows/pr-check-update-e2e.yaml deleted file mode 100644 index 0b60ef5146254..0000000000000 --- a/.github/workflows/pr-check-update-e2e.yaml +++ /dev/null @@ -1,120 +0,0 @@ -# -# Copyright (C) 2024 Red Hat, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# SPDX-License-Identifier: Apache-2.0 - -name: pr-check-update-e2e - -on: - pull_request: - paths: - - '**' - types: [labeled, synchronize, opened, reopened] - -jobs: - detect_pnpm_changes: - name: Detect pnpm lock file changes - runs-on: ubuntu-24.04 - outputs: - pnpm_lock_changed: ${{ steps.pnpm_changed.outputs.PNPM_LOCK_CHANGED }} - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - fetch-depth: 2 - - - name: Evaluate changes in files - id: pnpm_changed - run: | - git fetch origin ${{ github.event.pull_request.base.ref }} - git diff --name-only origin/${{ github.event.pull_request.base.ref }} HEAD > changes.txt - if grep -q 'pnpm-lock.yaml' changes.txt; then - echo "PNPM_LOCK_CHANGED=true" >> $GITHUB_OUTPUT - else - echo "PNPM_LOCK_CHANGED=false" >> $GITHUB_OUTPUT - fi - - run-update-e2e-test: - name: win update e2e tests - needs: detect_pnpm_changes - if: contains(github.event.pull_request.labels.*.name, 'area/update') || needs.detect_pnpm_changes.outputs.pnpm_lock_changed == 'true' - runs-on: windows-2022 - timeout-minutes: 60 - 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 - 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: win-update-e2e-test - path: | - ./tests/**/output/ - ./tests/**/output/junit*.xml - !./tests/**/traces/raw - - update-e2e-test: - name: update E2E test - runs-on: ubuntu-22.04 - needs: run-update-e2e-test - if: | - always() - steps: - - name: Evaluate the Windows Update test results - run: | - echo "Windows updater result: ${{ needs.run-update-e2e-test.result }}" - if [ "${{ needs.run-update-e2e-test.result }}" = "failure" ]; then - echo "Windows udpater test failed..." - exit 1 - else - echo "Windows updater test succeeded or was skipped..." - fi diff --git a/.github/workflows/pr-check.yaml b/.github/workflows/pr-check.yaml index 106ace0375d8d..03f5de62080b1 100644 --- a/.github/workflows/pr-check.yaml +++ b/.github/workflows/pr-check.yaml @@ -1,5 +1,5 @@ # -# Copyright (C) 2022 Red Hat, Inc. +# Copyright (C) 2022-2024 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,7 +17,9 @@ name: pr-check -on: [pull_request] +on: + pull_request: + types: [labeled, synchronize, opened, reopened] jobs: windows: @@ -324,3 +326,98 @@ jobs: ./tests/output/ ./tests/**/output/junit*.xml !./tests/**/traces/raw + + detect_pnpm_changes: + name: Detect pnpm lock file changes + runs-on: ubuntu-24.04 + outputs: + pnpm_lock_changed: ${{ steps.pnpm_changed.outputs.PNPM_LOCK_CHANGED }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 2 + + - name: Evaluate changes in files + id: pnpm_changed + run: | + git fetch origin ${{ github.event.pull_request.base.ref }} + git diff --name-only origin/${{ github.event.pull_request.base.ref }} HEAD > changes.txt + if grep -q 'pnpm-lock.yaml' changes.txt; then + echo "PNPM_LOCK_CHANGED=true" >> $GITHUB_OUTPUT + else + echo "PNPM_LOCK_CHANGED=false" >> $GITHUB_OUTPUT + fi + + run-update-e2e-test: + name: win update e2e tests + needs: detect_pnpm_changes + if: contains(github.event.pull_request.labels.*.name, 'area/update') || needs.detect_pnpm_changes.outputs.pnpm_lock_changed == 'true' + runs-on: windows-2022 + timeout-minutes: 60 + 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 + 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: win-update-e2e-test + path: | + ./tests/**/output/ + ./tests/**/output/junit*.xml + !./tests/**/traces/raw + + update-e2e-test: + name: update E2E test + runs-on: ubuntu-22.04 + needs: run-update-e2e-test + if: | + always() + steps: + - name: Evaluate the Windows Update test results + run: | + echo "Windows updater result: ${{ needs.run-update-e2e-test.result }}" + if [ "${{ needs.run-update-e2e-test.result }}" = "failure" ]; then + echo "Windows udpater test failed..." + exit 1 + else + echo "Windows updater test succeeded or was skipped..." + fi \ No newline at end of file From 1be9b77a658a46e3117e9306ba8a77145a917dee Mon Sep 17 00:00:00 2001 From: Ondrej Dockal Date: Mon, 9 Sep 2024 13:40:15 +0200 Subject: [PATCH 14/16] chore(ci): include pr-check to be trigger for new test Signed-off-by: Ondrej Dockal --- .github/workflows/pr-check.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr-check.yaml b/.github/workflows/pr-check.yaml index 03f5de62080b1..a8121411b923f 100644 --- a/.github/workflows/pr-check.yaml +++ b/.github/workflows/pr-check.yaml @@ -328,7 +328,7 @@ jobs: !./tests/**/traces/raw detect_pnpm_changes: - name: Detect pnpm lock file changes + name: Detect pnpm lock or pr-check files changes runs-on: ubuntu-24.04 outputs: pnpm_lock_changed: ${{ steps.pnpm_changed.outputs.PNPM_LOCK_CHANGED }} @@ -338,12 +338,12 @@ jobs: with: fetch-depth: 2 - - name: Evaluate changes in files + - name: Evaluate changes in files id: pnpm_changed run: | git fetch origin ${{ github.event.pull_request.base.ref }} git diff --name-only origin/${{ github.event.pull_request.base.ref }} HEAD > changes.txt - if grep -q 'pnpm-lock.yaml' changes.txt; then + if grep -q -e 'pnpm-lock.yaml' -e 'pr-check.yaml' changes.txt; then echo "PNPM_LOCK_CHANGED=true" >> $GITHUB_OUTPUT else echo "PNPM_LOCK_CHANGED=false" >> $GITHUB_OUTPUT @@ -420,4 +420,4 @@ jobs: exit 1 else echo "Windows updater test succeeded or was skipped..." - fi \ No newline at end of file + fi From b9005edb1b22eee34ed7a68f0d8d8b651e2d20fc Mon Sep 17 00:00:00 2001 From: Ondrej Dockal Date: Mon, 9 Sep 2024 14:36:06 +0200 Subject: [PATCH 15/16] chore(ci): switch to latest ubuntu 24.04 with update e2e test Signed-off-by: Ondrej Dockal --- .github/workflows/pr-check.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-check.yaml b/.github/workflows/pr-check.yaml index a8121411b923f..5666f884301e1 100644 --- a/.github/workflows/pr-check.yaml +++ b/.github/workflows/pr-check.yaml @@ -407,7 +407,7 @@ jobs: update-e2e-test: name: update E2E test - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 needs: run-update-e2e-test if: | always() From 8e1e66854b8954d61c91b0ce8ece2326c356ac31 Mon Sep 17 00:00:00 2001 From: Ondrej Dockal Date: Mon, 9 Sep 2024 14:37:19 +0200 Subject: [PATCH 16/16] fix: right copyright in spec file Signed-off-by: Ondrej Dockal --- tests/playwright/src/specs/installation/update-install.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/playwright/src/specs/installation/update-install.spec.ts b/tests/playwright/src/specs/installation/update-install.spec.ts index cbd38f7592176..1520a95532a54 100644 --- a/tests/playwright/src/specs/installation/update-install.spec.ts +++ b/tests/playwright/src/specs/installation/update-install.spec.ts @@ -1,5 +1,5 @@ /********************************************************************** - * Copyright (C) 2023-2024 Red Hat, Inc. + * Copyright (C) 2024 Red Hat, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License.