Skip to content

Commit 779c01d

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

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/playwright/src/utility/operations.ts

+21
Original file line numberDiff line numberDiff line change
@@ -207,11 +207,32 @@ 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 handleResetDefaultConnectionDialog(page);
210211
} else {
211212
console.log(`Podman machine [${machineVisibleName}] not present, skipping deletion.`);
212213
}
213214
}
214215

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

0 commit comments

Comments
 (0)