mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
test: verify closing last page does not close connection (#12095)
Co-authored-by: Nikolay Vitkov <34244704+Lightning00Blade@users.noreply.github.com>
This commit is contained in:
parent
9b7b443f9e
commit
a1c527df96
@ -6,7 +6,7 @@
|
||||
|
||||
import expect from 'expect';
|
||||
|
||||
import {getTestState, setupTestBrowserHooks} from './mocha-utils.js';
|
||||
import {getTestState, launch, setupTestBrowserHooks} from './mocha-utils.js';
|
||||
|
||||
describe('Browser specs', function () {
|
||||
setupTestBrowserHooks();
|
||||
@ -64,6 +64,23 @@ describe('Browser specs', function () {
|
||||
expect(remoteBrowser.process()).toBe(null);
|
||||
await remoteBrowser.disconnect();
|
||||
});
|
||||
it('should keep connected after the last page is closed', async () => {
|
||||
const {browser, close} = await launch({}, {createContext: false});
|
||||
try {
|
||||
const pages = await browser.pages();
|
||||
await Promise.all(
|
||||
pages.map(page => {
|
||||
return page.close();
|
||||
})
|
||||
);
|
||||
// Verify the browser is still connected.
|
||||
expect(browser.connected).toBe(true);
|
||||
// Verify the browser can open a new page.
|
||||
await browser.newPage();
|
||||
} finally {
|
||||
await close();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe('Browser.isConnected', () => {
|
||||
|
Loading…
Reference in New Issue
Block a user