Skip to content

Commit

Permalink
test: add page.bringToFront test (puppeteer#4778)
Browse files Browse the repository at this point in the history
Test `page.bringToFront` in headful.
  • Loading branch information
kblok authored and Roman Fojtik committed Dec 21, 2019
1 parent aec4dfa commit 2662abb
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
20 changes: 20 additions & 0 deletions test/headful.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
});
};

1 change: 0 additions & 1 deletion test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ beforeEach(async({server, httpsServer}) => {
});

const CHROMIUM_NO_COVERAGE = new Set([
'page.bringToFront',
]);

if (process.env.BROWSER === 'firefox') {
Expand Down

0 comments on commit 2662abb

Please sign in to comment.