test: add page.bringToFront test (#4778)

Test `page.bringToFront` in headful.
This commit is contained in:
Darío Kondratiuk 2019-08-01 21:08:29 -03:00 committed by Andrey Lushnikov
parent f733c334dc
commit eb44e260a9
2 changed files with 20 additions and 1 deletions

View File

@ -117,5 +117,25 @@ module.exports.addTests = function({testRunner, expect, puppeteer, defaultBrowse
await browser.close(); 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();
});
});
}; };

View File

@ -73,7 +73,6 @@ beforeEach(async({server, httpsServer}) => {
}); });
const CHROMIUM_NO_COVERAGE = new Set([ const CHROMIUM_NO_COVERAGE = new Set([
'page.bringToFront',
]); ]);
if (process.env.BROWSER === 'firefox') { if (process.env.BROWSER === 'firefox') {