Skip to content

Commit 5de0231

Browse files
committed
fixup: reduce test flakiness
1 parent b4e59a2 commit 5de0231

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

test/oidc-test-provider.ts

+10-1
Original file line numberDiff line numberDiff line change
@@ -335,10 +335,18 @@ export async function functioningAuthCodeBrowserFlow({
335335
await ensureValue(browser, 'input[name="login"]', 'testuser');
336336
await ensureValue(browser, 'input[name="password"]', 'testpassword');
337337
await browser.$('button[type="submit"]').click();
338+
const idpUrl = await browser.getUrl();
338339

339340
await waitForTitle(browser, 'Authorize');
340341
await browser.$('button[type="submit"][autofocus]').click();
341-
await waitForLocalhostRedirect(browser);
342+
343+
// Cannot use `waitForLocalhostRedirect` because we already started on localhost
344+
await browser.waitUntil(async () => {
345+
return (
346+
new URL((await browser?.getUrl()) ?? 'http://nonexistent').host !==
347+
new URL(idpUrl).host
348+
);
349+
});
342350
} catch (err: unknown) {
343351
await dumpHtml(browser);
344352
throw err;
@@ -385,6 +393,7 @@ export async function functioningDeviceAuthBrowserFlow({
385393

386394
await waitForTitle(browser, 'Authorize');
387395
await browser.$('button[type="submit"][autofocus]').click();
396+
await waitForTitle(browser, 'Sign-in Success');
388397
} catch (err: unknown) {
389398
await dumpHtml(browser);
390399
throw err;

0 commit comments

Comments
 (0)