test: close context created in the test (#14719)

This commit is contained in:
Yury Semikhatsky 2022-06-08 14:16:09 -07:00 committed by GitHub
parent 176ab7e48b
commit beb276a2be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -222,7 +222,7 @@ it.describe('screencast', () => {
expect(fs.existsSync(path)).toBeTruthy(); expect(fs.existsSync(path)).toBeTruthy();
}); });
it('saveAs should throw when no video frames', async ({ browser, browserName }, testInfo) => { it('saveAs should throw when no video frames', async ({ browser }, testInfo) => {
const videosPath = testInfo.outputPath(''); const videosPath = testInfo.outputPath('');
const size = { width: 320, height: 240 }; const size = { width: 320, height: 240 };
const context = await browser.newContext({ const context = await browser.newContext({
@ -249,6 +249,7 @@ it.describe('screencast', () => {
// and other browsers are sometimes fast as well. // and other browsers are sometimes fast as well.
if (!fs.existsSync(saveAsPath)) if (!fs.existsSync(saveAsPath))
expect(error.message).toContain('Page did not produce any video frames'); expect(error.message).toContain('Page did not produce any video frames');
await context.close();
}); });
it('should delete video', async ({ browser }, testInfo) => { it('should delete video', async ({ browser }, testInfo) => {