Playwright: Add check for admin access popup
The admin access popup is different for passwordless user and a user with a password. This checks what popup got rendered and based on that acts to get administrative access.
This commit is contained in:
parent
38458810a0
commit
72aed71662
1 changed files with 17 additions and 1 deletions
|
|
@ -51,7 +51,23 @@ const loginCockpit = async (page: Page, user: string, password: string) => {
|
|||
// cockpit-image-builder needs superuser
|
||||
await page.getByRole('button', { name: 'Log in' }).click();
|
||||
await page.getByRole('button', { name: 'Limited access' }).click();
|
||||
await page.getByText('Close').click();
|
||||
|
||||
// different popup opens based on type of account (can be passwordless)
|
||||
const authenticateButton = page.getByRole('button', { name: 'Authenticate' });
|
||||
const closeButton = page.getByText('Close');
|
||||
await expect(authenticateButton.or(closeButton)).toBeVisible();
|
||||
|
||||
if (await authenticateButton.isVisible()) {
|
||||
// with password
|
||||
await page.getByRole('textbox', { name: 'Password' }).fill(password);
|
||||
await authenticateButton.click();
|
||||
}
|
||||
if (await closeButton.isVisible()) {
|
||||
// passwordless
|
||||
await closeButton.click();
|
||||
}
|
||||
|
||||
// expect to have administrative access
|
||||
await page.getByRole('button', { name: 'Administrative access' });
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue