Skip to content

Commit f11e6ab

Browse files
committed
chore(test): improve robustness of the rh login workflow via browser
Signed-off-by: Ondrej Dockal <odockal@redhat.com>
1 parent f4abe0e commit f11e6ab

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

tests/src/sso-extension.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,9 +232,10 @@ test.describe.serial('Red Hat Authentication extension verification', () => {
232232
await chromiumPage.close();
233233
});
234234

235-
test('User signed in status is propagated into Podman Desktop', async ({ page, navigationBar }) => {
235+
test('User signed in status is propagated into Podman Desktop', async ({ page, navigationBar, runner }) => {
236236
// activate Podman Desktop again
237237
await page.bringToFront();
238+
await runner.screenshot('back-in-pd.png');
238239
// verify the Signed in user
239240
const settingsBar = await navigationBar.openSettings();
240241
await settingsBar.openTabPage(AuthenticationPage);

tests/src/utility/auth-utils.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,18 @@ export async function findPageWithTitleInBrowser(browser: Browser, expectedTitle
5454
await input.fill(username);
5555
const nextButton = page.getByRole('button', { name: 'Next' });
5656
await nextButton.click();
57+
// after next is clicked, a wait is necessary
58+
// we might get a page with providers to choose from
59+
// button - Log in with company single sign-on OR
60+
// button - Log in with Red Hat account
61+
const buttonRHAccount = page.getByRole('button', { name: 'Log in with Red Hat account' });
62+
// we might get to the password immediately
63+
try {
64+
await playExpect(buttonRHAccount).toBeVisible({ timeout: 5000 });
65+
await buttonRHAccount.click();
66+
} catch (error: unknown) {
67+
console.log(`Error: ${error}, while evaluating Log in with RH acc. button, continue...`);
68+
}
5769
const passInput = page.getByRole('textbox', { name: 'Password' });
5870
await playExpect(passInput).toBeVisible();
5971
await passInput.fill(pass);

0 commit comments

Comments
 (0)