test: deflake flaky tests on linux (#44383)

This commit is contained in:
John Kleinschmidt 2024-10-24 20:47:17 -04:00 committed by GitHub
parent a0f51d816e
commit 57920e7747
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 6 deletions

View file

@ -942,12 +942,11 @@ describe('BrowserWindow module', () => {
'did-frame-navigate',
'did-navigate'
];
const allEvents = Promise.all(navigationEvents.map(event =>
const allEvents = Promise.all(expectedEventOrder.map(event =>
once(w.webContents, event).then(() => firedEvents.push(event))
));
const timeout = setTimeout(1000);
w.loadURL(url);
await Promise.race([allEvents, timeout]);
await allEvents;
expect(firedEvents).to.deep.equal(expectedEventOrder);
});