tests: console-fill idmsa frame test waits for the frame, its form and its click log instead of reading them right after the sign-in hint (race under load)
This commit is contained in:
parent
a8c7f77d87
commit
83c14d3a8e
1 changed files with 8 additions and 1 deletions
|
|
@ -557,7 +557,14 @@ describe.skipIf(!browser)('sign-in and watching (headless, modeled pages on the
|
|||
expect(said.some(m => m.includes('Keep me signed in'))).toBe(true);
|
||||
expect(new URL(b.page.url()).pathname).toBe('/login');
|
||||
expect(await signInPage(b.page)).toBe(true);
|
||||
const frame = b.page.frames().find((f: any) => f.url().startsWith('https://idmsa.apple.com/'));
|
||||
// the hint can come before the idmsa frame has navigated and run _common.js: wait for the frame, its form and
|
||||
// its click log instead of reading them right away (a race on a loaded machine)
|
||||
const idmsa = (f: any) => f.url().startsWith('https://idmsa.apple.com/');
|
||||
await b.page.waitForFunction(() => document.querySelector('iframe') !== null, null, { timeout: scaled(10_000) });
|
||||
let frame: any;
|
||||
for (const end = Date.now() + scaled(10_000); !(frame = b.page.frames().find(idmsa)) && Date.now() < end;) await new Promise(r => setTimeout(r, 50));
|
||||
expect(frame).toBeTruthy();
|
||||
await frame.waitForFunction(() => Array.isArray((window as any).__clicks) && !!document.querySelector('#acc'), null, { timeout: scaled(10_000) });
|
||||
expect(await frame.evaluate(() => (window as any).__clicks)).toEqual([]); // nothing clicked on the sign-in form
|
||||
expect(await frame.locator('#acc').inputValue()).toBe(''); // nothing typed
|
||||
await b.page.evaluate(() => (window as any).__signIn()); // the owner signs in
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue