From eb44e260a97eaf58aaa96e40e448ea1f327a0018 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dar=C3=ADo=20Kondratiuk?= Date: Thu, 1 Aug 2019 21:08:29 -0300 Subject: [PATCH] test: add page.bringToFront test (#4778) Test `page.bringToFront` in headful. --- test/headful.spec.js | 20 ++++++++++++++++++++ test/test.js | 1 - 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/test/headful.spec.js b/test/headful.spec.js index a35a11e12eb..b1d999784ab 100644 --- a/test/headful.spec.js +++ b/test/headful.spec.js @@ -117,5 +117,25 @@ module.exports.addTests = function({testRunner, expect, puppeteer, defaultBrowse await browser.close(); }); }); + + describe('Page.bringToFront', function() { + it('should work', async() => { + const browser = await puppeteer.launch(headfulOptions); + const page1 = await browser.newPage(); + const page2 = await browser.newPage(); + + await page1.bringToFront(); + expect(await page1.evaluate(() => document.visibilityState)).toBe('visible'); + expect(await page2.evaluate(() => document.visibilityState)).toBe('hidden'); + + await page2.bringToFront(); + expect(await page1.evaluate(() => document.visibilityState)).toBe('hidden'); + expect(await page2.evaluate(() => document.visibilityState)).toBe('visible'); + + await page1.close(); + await page2.close(); + await browser.close(); + }); + }); }; diff --git a/test/test.js b/test/test.js index fc3e1b64618..c9ee901dee5 100644 --- a/test/test.js +++ b/test/test.js @@ -73,7 +73,6 @@ beforeEach(async({server, httpsServer}) => { }); const CHROMIUM_NO_COVERAGE = new Set([ - 'page.bringToFront', ]); if (process.env.BROWSER === 'firefox') {