Skip to content

Commit 35d2572

Browse files
committed
chore(tests): number refactoring
Signed-off-by: xbabalov <[email protected]>
1 parent 006f9da commit 35d2572

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -83,14 +83,14 @@ export class CreateMachinePage extends BasePage {
8383
}
8484

8585
await this.createMachineButton.click();
86-
await this.page.waitForTimeout(60000);
86+
await this.page.waitForTimeout(60_000);
8787

8888
const successfulCreationMessage = this.page.getByText('Successful operation');
8989
const goBackToResourcesButton = this.page.getByRole('button', { name: 'Go back to resources' });
9090

9191
await this.handleConnectionDialog(machineName, setAsDefault);
9292

93-
await playExpect(successfulCreationMessage).toBeVisible({ timeout: 10000 });
93+
await playExpect(successfulCreationMessage).toBeVisible({ timeout: 10_000 });
9494
await playExpect(goBackToResourcesButton).toBeVisible();
9595
await goBackToResourcesButton.click();
9696

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,5 @@ describe.skipIf(os.platform() === 'linux')('Rootless Podman machine Verification
6969
const machineBox = new ResourceConnectionCardPage(page, 'podman', MACHINE_VISIBLE_NAME);
7070
const connectionStatusLabel = await machineBox.resourceElementConnectionStatus.textContent();
7171
playExpect(connectionStatusLabel === 'RUNNING').toBeTruthy();
72-
}, 150000);
72+
}, 150_000);
7373
});

tests/playwright/src/utility/operations.ts

+12-12
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export async function deleteContainer(page: Page, name: string): Promise<void> {
5555
// wait for container to disappear
5656
try {
5757
console.log('Waiting for container to get deleted ...');
58-
await playExpect.poll(async () => await containers.getContainerRowByName(name), { timeout: 10000 }).toBeFalsy();
58+
await playExpect.poll(async () => await containers.getContainerRowByName(name), { timeout: 10_000 }).toBeFalsy();
5959
} catch (error) {
6060
if (!(error as Error).message.includes('Page is empty')) {
6161
throw Error(`Error waiting for container '${name}' to get removed, ${error}`);
@@ -77,7 +77,7 @@ export async function deleteImage(page: Page, name: string): Promise<void> {
7777
console.log(`image '${name}' does not exist, skipping...`);
7878
} else {
7979
const deleteButton = row.getByRole('button', { name: 'Delete Image' });
80-
if (await deleteButton.isEnabled({ timeout: 2000 })) {
80+
if (await deleteButton.isEnabled({ timeout: 2_000 })) {
8181
await deleteButton.click();
8282
await handleConfirmationDialog(page);
8383
} else {
@@ -92,7 +92,7 @@ export async function deleteImage(page: Page, name: string): Promise<void> {
9292
const result = await images.getImageRowByName(name);
9393
return !!result;
9494
},
95-
{ timeout: 10000, sendError: false },
95+
{ timeout: 10_000, sendError: false },
9696
);
9797
} catch (error) {
9898
if (!(error as Error).message.includes('Page is empty')) {
@@ -138,7 +138,7 @@ export async function deletePod(page: Page, name: string): Promise<void> {
138138
async () => {
139139
return !!(await pods.getPodRowByName(name));
140140
},
141-
{ timeout: 20000 },
141+
{ timeout: 20_000 },
142142
);
143143
} catch (error) {
144144
if (!(error as Error).message.includes('Page is empty')) {
@@ -158,7 +158,7 @@ export async function handleConfirmationDialog(
158158
): Promise<void> {
159159
// wait for dialog to appear using waitFor
160160
const dialog = page.getByRole('dialog', { name: dialogTitle, exact: true });
161-
await dialog.waitFor({ state: 'visible', timeout: 3000 });
161+
await dialog.waitFor({ state: 'visible', timeout: 3_000 });
162162
const button = confirm
163163
? dialog.getByRole('button', { name: confirmationButton })
164164
: dialog.getByRole('button', { name: cancelButton });
@@ -174,23 +174,23 @@ export async function deletePodmanMachine(page: Page, machineVisibleName: string
174174
const RESOURCE_NAME: string = 'podman';
175175
const navigationBar = new NavigationBar(page);
176176
const dashboardPage = await navigationBar.openDashboard();
177-
await playExpect(dashboardPage.mainPage).toBeVisible({ timeout: 3000 });
177+
await playExpect(dashboardPage.mainPage).toBeVisible({ timeout: 3_000 });
178178
const settingsBar = await navigationBar.openSettings();
179179
const resourcesPage = await settingsBar.openTabPage(ResourcesPage);
180180
await playExpect
181-
.poll(async () => await resourcesPage.resourceCardIsVisible(RESOURCE_NAME), { timeout: 10000 })
181+
.poll(async () => await resourcesPage.resourceCardIsVisible(RESOURCE_NAME), { timeout: 10_000 })
182182
.toBeTruthy();
183183
const podmanResourceCard = new ResourceConnectionCardPage(page, RESOURCE_NAME, machineVisibleName);
184184
await playExpect(podmanResourceCard.providerConnections).toBeVisible({ timeout: 10_000 });
185185
await waitUntil(
186186
async function machineExists() {
187187
return await podmanResourceCard.resourceElement.isVisible();
188188
},
189-
{ timeout: 15000, sendError: false },
189+
{ timeout: 15_000, sendError: false },
190190
);
191191
if (await podmanResourceCard.resourceElement.isVisible()) {
192-
await playExpect(podmanResourceCard.resourceElementConnectionActions).toBeVisible({ timeout: 3000 });
193-
await playExpect(podmanResourceCard.resourceElementConnectionStatus).toBeVisible({ timeout: 3000 });
192+
await playExpect(podmanResourceCard.resourceElementConnectionActions).toBeVisible({ timeout: 3_000 });
193+
await playExpect(podmanResourceCard.resourceElementConnectionStatus).toBeVisible({ timeout: 3_000 });
194194
if ((await podmanResourceCard.resourceElementConnectionStatus.innerText()) === ResourceElementState.Starting) {
195195
console.log('Podman machine is in starting currently, will send stop command via CLI');
196196
execSync(`podman machine stop ${machineVisibleName}`);
@@ -202,12 +202,12 @@ export async function deletePodmanMachine(page: Page, machineVisibleName: string
202202
if ((await podmanResourceCard.resourceElementConnectionStatus.innerText()) === ResourceElementState.Running) {
203203
await podmanResourceCard.performConnectionAction(ResourceElementActions.Stop);
204204
await playExpect(podmanResourceCard.resourceElementConnectionStatus).toHaveText(ResourceElementState.Off, {
205-
timeout: 300_000,
205+
timeout: 150_000,
206206
});
207207
}
208208
await podmanResourceCard.performConnectionAction(ResourceElementActions.Delete);
209209
await playExpect(podmanResourceCard.resourceElement).toBeHidden({ timeout: 30_000 });
210-
await page.waitForTimeout(30000);
210+
await page.waitForTimeout(30_000);
211211
await handleResetDefaultConnectionDialog(page);
212212
} else {
213213
console.log(`Podman machine [${machineVisibleName}] not present, skipping deletion.`);

0 commit comments

Comments
 (0)