fix: wait for WebDriver BiDi browser to close gracefully (#11636)

This commit is contained in:
Alex Rudenko 2024-01-05 11:00:59 +01:00 committed by GitHub
parent e8b501de6f
commit cc3aeeb6ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 7 deletions

View File

@ -16,6 +16,13 @@ import {
computeExecutablePath,
} from '@puppeteer/browsers';
import {
firstValueFrom,
from,
map,
race,
timer,
} from '../../third_party/rxjs/rxjs.js';
import type {Browser, BrowserCloseCallback} from '../api/Browser.js';
import {CdpBrowser} from '../cdp/Browser.js';
import {Connection} from '../cdp/Connection.js';
@ -236,7 +243,17 @@ export abstract class ProductLauncher {
await browserProcess.close();
}
} else {
await browserProcess.close();
// Wait for a possible graceful shutdown.
await firstValueFrom(
race(
from(browserProcess.hasClosed()),
timer(5000).pipe(
map(() => {
return from(browserProcess.close());
})
)
)
);
}
}

View File

@ -2293,12 +2293,6 @@
"parameters": ["firefox", "webDriverBiDi"],
"expectations": ["SKIP"]
},
{
"testIdPattern": "[launcher.spec] Launcher specs Puppeteer Puppeteer.launch userDataDir option should restore state",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["firefox", "webDriverBiDi"],
"expectations": ["SKIP"]
},
{
"testIdPattern": "[locator.spec] Locator Locator.click should work with a OOPIF",
"platforms": ["darwin", "linux", "win32"],