Skip to content

Commit 006f9da

Browse files
committed
chore(tests): added reset default connection after machine delete handle
Signed-off-by: xbabalov <[email protected]>
1 parent c30db65 commit 006f9da

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/playwright/src/utility/operations.ts

+22
Original file line numberDiff line numberDiff line change
@@ -207,11 +207,33 @@ export async function deletePodmanMachine(page: Page, machineVisibleName: string
207207
}
208208
await podmanResourceCard.performConnectionAction(ResourceElementActions.Delete);
209209
await playExpect(podmanResourceCard.resourceElement).toBeHidden({ timeout: 30_000 });
210+
await page.waitForTimeout(30000);
211+
await handleResetDefaultConnectionDialog(page);
210212
} else {
211213
console.log(`Podman machine [${machineVisibleName}] not present, skipping deletion.`);
212214
}
213215
}
214216

217+
export async function handleResetDefaultConnectionDialog(page: Page): Promise<void> {
218+
const connectionDialog = page.getByRole('dialog', { name: 'Podman' });
219+
const dialogMessage = connectionDialog.getByText(
220+
new RegExp(
221+
`.* Podman Machine .+ does not match default connection .+ Do you want to update the default connection?`,
222+
),
223+
);
224+
if ((await connectionDialog.isVisible()) && (await dialogMessage.isVisible())) {
225+
const handleButton = connectionDialog.getByRole('button', { name: 'Yes' });
226+
await handleButton.click();
227+
await playExpect(connectionDialog).toBeVisible();
228+
const successDialogMessage = connectionDialog.getByText(
229+
new RegExp(`Podman Machine .+ is now the default machine on the CLI.`),
230+
);
231+
await playExpect(successDialogMessage).toBeVisible();
232+
const okButton = connectionDialog.getByRole('button', { name: 'OK' });
233+
await okButton.click();
234+
}
235+
}
236+
215237
export function checkForFailedTest(result: TaskResult, runner: PodmanDesktopRunner): void {
216238
if (result.errors && result.errors.length > 0) runner.setTestPassed(false);
217239
}

0 commit comments

Comments
 (0)