test: improve handling of browser context on error (#12020)

This commit is contained in:
Alex Rudenko 2024-02-29 10:51:52 +01:00 committed by GitHub
parent bec77d61e6
commit 11a6d7e58d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -225,6 +225,7 @@ describe('Cookie specs', () => {
const {page, server, browser} = await getTestState(); const {page, server, browser} = await getTestState();
const anotherContext = await browser.createBrowserContext(); const anotherContext = await browser.createBrowserContext();
try {
const anotherPage = await anotherContext.newPage(); const anotherPage = await anotherContext.newPage();
await page.goto(server.EMPTY_PAGE); await page.goto(server.EMPTY_PAGE);
@ -241,7 +242,9 @@ describe('Cookie specs', () => {
expect(cookies1[0]!.value).toBe('page1value'); expect(cookies1[0]!.value).toBe('page1value');
expect(cookies2[0]!.name).toBe('page2cookie'); expect(cookies2[0]!.name).toBe('page2cookie');
expect(cookies2[0]!.value).toBe('page2value'); expect(cookies2[0]!.value).toBe('page2value');
} finally {
await anotherContext.close(); await anotherContext.close();
}
}); });
it('should set multiple cookies', async () => { it('should set multiple cookies', async () => {
const {page, server} = await getTestState(); const {page, server} = await getTestState();