Skip to content

Commit 01cd706

Browse files
committed
chore(tests): creating rootless machine e2e test fixed
Signed-off-by: Tamara Babalova <[email protected]>
1 parent e4e43b3 commit 01cd706

File tree

2 files changed

+23
-19
lines changed

2 files changed

+23
-19
lines changed

tests/playwright/src/model/pages/create-machine-page.ts

+18-16
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**********************************************************************
2-
* Copyright (C) 2023 Red Hat, Inc.
2+
* Copyright (C) 2024 Red Hat, Inc.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -25,9 +25,7 @@ import { ResourcesPage } from './resources-page';
2525
export class CreateMachinePage extends BasePage {
2626
readonly heading: Locator;
2727
readonly machineNameBox: Locator;
28-
readonly cpuSlider: Locator;
29-
readonly memorySlider: Locator;
30-
readonly diskSlider: Locator;
28+
readonly podmanMachineConfiguration: Locator;
3129
readonly imagePathBox: Locator;
3230
readonly browseImagesButton: Locator;
3331
readonly rootPriviledgesCheckbox: Locator;
@@ -39,35 +37,39 @@ export class CreateMachinePage extends BasePage {
3937
constructor(page: Page) {
4038
super(page);
4139
this.heading = this.page.getByRole('heading', { name: 'Create Podman Machine' });
42-
this.machineNameBox = this.page.getByRole('textbox', { name: 'Name' });
43-
this.cpuSlider = this.page.getByRole('slider', { name: 'CPU(s)' });
44-
this.memorySlider = this.page.getByRole('slider', { name: 'Memory' });
45-
this.diskSlider = this.page.getByRole('slider', { name: 'Disk size' });
40+
this.podmanMachineConfiguration = this.page.getByRole('form', { name: 'Properties Information' });
41+
42+
this.machineNameBox = this.podmanMachineConfiguration.getByRole('textbox', { name: 'Name' });
4643
this.imagePathBox = this.page.getByRole('textbox', { name: 'Image Path (Optional) ' });
4744
this.browseImagesButton = this.page.getByRole('button', { name: 'button-Image Path (Optional)' });
48-
this.rootPriviledgesCheckbox = this.page.getByRole('checkbox', { name: 'Machine with root priviledges' });
45+
this.rootPriviledgesCheckbox = this.podmanMachineConfiguration
46+
.getByRole('checkbox', { name: 'Machine with root privileges' })
47+
.locator('..');
4948
this.userModeNetworkingCheckbox = this.page.getByRole('checkbox', {
5049
name: 'User mode networking (traffic relayed by a user process). See [documentation](https://docs.podman.io/en/latest/markdown/podman-machine-init.1.html#user-mode-networking).',
5150
});
5251
this.startNowCheckbox = this.page.getByRole('checkbox', { name: 'Start the machine now' });
53-
this.closeButton = this.page.getByRole('button', { name: 'Close page' });
54-
this.createMachineButton = this.page.getByRole('button', { name: 'Create Pod' });
52+
this.closeButton = this.page.getByRole('button', { name: 'Close' });
53+
this.createMachineButton = this.page.getByRole('button', { name: 'Create' });
5554
}
5655

5756
async createMachine(machineName: string, isRootless: boolean): Promise<ResourcesPage> {
58-
//can be extended
57+
await playExpect(this.podmanMachineConfiguration).toBeVisible();
5958
await this.machineNameBox.fill(machineName);
59+
6060
if (!isRootless) {
61-
await this.rootPriviledgesCheckbox.uncheck();
62-
playExpect(this.rootPriviledgesCheckbox.isChecked()).toBeFalsy();
61+
await playExpect(this.rootPriviledgesCheckbox).toBeVisible();
62+
const upperElement = this.rootPriviledgesCheckbox.locator('..');
63+
const clickableCheckbox = upperElement.getByText('Enable');
64+
await clickableCheckbox.click();
6365
}
6466

6567
await this.createMachineButton.click();
6668

67-
const successfulCreationMessage = this.page.getByLabel('Successful operation');
69+
const successfulCreationMessage = this.page.getByText('Successful operation');
6870
const goBackToResourcesButton = this.page.getByRole('button', { name: 'Go back to resources' });
6971

70-
await playExpect(successfulCreationMessage).toBeVisible({ timeout: 50000 });
72+
await playExpect(successfulCreationMessage).toBeVisible({ timeout: 100000 });
7173
await playExpect(goBackToResourcesButton).toBeVisible();
7274
await goBackToResourcesButton.click();
7375

tests/playwright/src/specs/podman-machine-rootless.spec.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ describe.skipIf(os.platform() === 'linux')('Rootless Podman machine Verification
6868
await createMachinePage.createMachine(PODMAN_MACHINE_NAME, false);
6969

7070
const machineBox = new ResourcesPodmanConnections(page, PODMAN_MACHINE_NAME);
71-
const connectionStatus = await machineBox.machineConnectionStatus.allTextContents();
72-
playExpect(connectionStatus[0] === 'RUNNING').toBeTruthy();
73-
});
71+
const connectionStatusLabel = await machineBox.machineConnectionStatus
72+
.getByLabel('Connection Status Label')
73+
.textContent();
74+
playExpect(connectionStatusLabel === 'RUNNING').toBeTruthy();
75+
}, 150000);
7476
});

0 commit comments

Comments
 (0)