Skip to content

Commit

Permalink
chore(tests): generalize connection handling dialog
Browse files Browse the repository at this point in the history
Signed-off-by: xbabalov <[email protected]>
  • Loading branch information
xbabalov committed Sep 24, 2024
1 parent 042e682 commit 6d40db5
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions tests/playwright/src/model/pages/create-machine-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,22 @@ export class CreateMachinePage extends BasePage {
const successfulCreationMessage = this.page.getByText('Successful operation');
const goBackToResourcesButton = this.page.getByRole('button', { name: 'Go back to resources' });

await this.handleConnectionDialog(machineName, setAsDefault);

await playExpect(successfulCreationMessage).toBeVisible({ timeout: 10_000 });
await playExpect(successfulCreationMessage).toBeVisible({ timeout: 60_000 });
await playExpect(goBackToResourcesButton).toBeVisible();
await goBackToResourcesButton.click();

try {
await this.handleConnectionDialog(machineName, setAsDefault);
} catch (error) {
console.log('No handing dialog displayed', error);
}

await goBackToResourcesButton.click();
return new ResourcesPage(this.page);
}

async handleConnectionDialog(machineName: string, setAsDefault: boolean): Promise<void> {
const connectionDialog = this.page.getByRole('dialog', { name: 'Podman' });
await playExpect(connectionDialog).toBeVisible({ timeout: 60_000 });
await playExpect(connectionDialog).toBeVisible({ timeout: 10_000 });

const dialogMessage = connectionDialog.getByLabel('Dialog Message');
await playExpect(dialogMessage).toHaveText(
Expand Down

0 comments on commit 6d40db5

Please sign in to comment.