fix: also kill Firefox when temporary profile is used (#8233)
* fix: also kill Firefox when temporary profile is used * fix: use separate tests for Puppeteer.launch should filter out ignored default arguments
This commit is contained in:
parent
95c9f392e2
commit
b6504d7186
@ -164,7 +164,7 @@ export class BrowserRunner {
|
||||
|
||||
close(): Promise<void> {
|
||||
if (this._closed) return Promise.resolve();
|
||||
if (this._isTempUserDataDir && this._product !== 'firefox') {
|
||||
if (this._isTempUserDataDir) {
|
||||
this.kill();
|
||||
} else if (this.connection) {
|
||||
// Attempt to close the browser gracefully
|
||||
|
@ -404,7 +404,7 @@ describe('Launcher specs', function () {
|
||||
await page.close();
|
||||
await browser.close();
|
||||
});
|
||||
it('should filter out ignored default arguments', async () => {
|
||||
itChromeOnly('should filter out ignored default arguments', async () => {
|
||||
const { defaultBrowserOptions, puppeteer } = getTestState();
|
||||
// Make sure we launch with `--enable-automation` by default.
|
||||
const defaultArgs = puppeteer.defaultArgs();
|
||||
@ -423,6 +423,25 @@ describe('Launcher specs', function () {
|
||||
expect(spawnargs.indexOf(defaultArgs[2])).toBe(-1);
|
||||
await browser.close();
|
||||
});
|
||||
itFirefoxOnly('should filter out ignored default arguments', async () => {
|
||||
const { defaultBrowserOptions, puppeteer } = getTestState();
|
||||
|
||||
const defaultArgs = puppeteer.defaultArgs();
|
||||
const browser = await puppeteer.launch(
|
||||
Object.assign({}, defaultBrowserOptions, {
|
||||
// Only the first argument is fixed, others are optional.
|
||||
ignoreDefaultArgs: [defaultArgs[0]],
|
||||
})
|
||||
);
|
||||
const spawnargs = browser.process().spawnargs;
|
||||
if (!spawnargs) {
|
||||
throw new Error('spawnargs not present');
|
||||
}
|
||||
expect(spawnargs.indexOf(defaultArgs[0])).toBe(-1);
|
||||
expect(spawnargs.indexOf(defaultArgs[1])).not.toBe(-1);
|
||||
await browser.close();
|
||||
});
|
||||
|
||||
it('should have default URL when launching browser', async function () {
|
||||
const { defaultBrowserOptions, puppeteer } = getTestState();
|
||||
const browser = await puppeteer.launch(defaultBrowserOptions);
|
||||
|
Loading…
Reference in New Issue
Block a user