tests: fix race condition in codegen tests (#26405)
The console message comes in once the page navigates, not in the `page.setContent()` call below.
This commit is contained in:
parent
167165d179
commit
0bb4dac28f
|
|
@ -109,7 +109,6 @@ class Recorder {
|
|||
async setPageContentAndWait(page: Page, content: string, url: string = 'about:blank', frameCount: number = 1) {
|
||||
let callback;
|
||||
const result = new Promise(f => callback = f);
|
||||
await page.goto(url);
|
||||
let msgCount = 0;
|
||||
const listener = msg => {
|
||||
if (msg.text() === 'Recorder script ready for test') {
|
||||
|
|
@ -121,6 +120,7 @@ class Recorder {
|
|||
}
|
||||
};
|
||||
page.on('console', listener);
|
||||
await page.goto(url);
|
||||
await Promise.all([
|
||||
result,
|
||||
page.setContent(content)
|
||||
|
|
@ -236,4 +236,4 @@ class CLIMock {
|
|||
text() {
|
||||
return stripAnsi(this.process.output);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue