chore(tests): some fixes for e2e tests (#8792)

* chore(tests): some fixes for e2e tests
Signed-off-by: Vladimir Lazar <vlazar@redhat.com>
This commit is contained in:
Vladimir Lazar 2024-09-08 10:46:32 +03:00 committed by GitHub
parent 9f21abddb8
commit 64c011573a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 86 additions and 65 deletions

View file

@ -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",

View file

@ -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;
}

View file

@ -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();
});

View file

@ -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);

View file

@ -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<boolean> {

View file

@ -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',

View file

@ -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;

View file

@ -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');
});