-
Notifications
You must be signed in to change notification settings - Fork 296
Commit
Signed-off-by: Ondrej Dockal <[email protected]>
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 GitHub Actions / linter, formatters and unit tests / windows-2022
|
||
import { expect as playExpect } from '@playwright/test'; | ||
Check failure on line 20 in tests/playwright/src/specs/installation/update-install.spec.ts GitHub Actions / linter, formatters and unit tests / windows-2022
Check failure on line 20 in tests/playwright/src/specs/installation/update-install.spec.ts GitHub Actions / linter, formatters and unit tests / ubuntu-24.04
|
||
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 GitHub Actions / linter, formatters and unit tests / windows-2022
Check failure on line 21 in tests/playwright/src/specs/installation/update-install.spec.ts GitHub Actions / linter, formatters and unit tests / ubuntu-24.04
|
||
|
||
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<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 GitHub Actions / linter, formatters and unit tests / windows-2022
Check failure on line 52 in tests/playwright/src/specs/installation/update-install.spec.ts GitHub Actions / linter, formatters and unit tests / windows-2022
Check failure on line 52 in tests/playwright/src/specs/installation/update-install.spec.ts GitHub Actions / linter, formatters and unit tests / ubuntu-24.04
|
||
test.describe('Update Podman Desktop', async () => { | ||
Check failure on line 53 in tests/playwright/src/specs/installation/update-install.spec.ts GitHub Actions / linter, formatters and unit tests / windows-2022
Check failure on line 53 in tests/playwright/src/specs/installation/update-install.spec.ts GitHub Actions / linter, formatters and unit tests / windows-2022
Check failure on line 53 in tests/playwright/src/specs/installation/update-install.spec.ts GitHub Actions / linter, formatters and unit tests / ubuntu-24.04
|
||
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'); | ||
}); | ||
|