Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

feat(headful): remove bringToFront (#84)

Pavel Feldman2eb653740a15
diff --git a/docs/api.md b/docs/api.md
index e4650eb68c..76669b7414 100644
--- a/docs/api.md
+++ b/docs/api.md
@@ -86,7 +86,6 @@
* [page.addScriptTag(options)](#pageaddscripttagoptions)
* [page.addStyleTag(options)](#pageaddstyletagoptions)
* [page.authenticate(credentials)](#pageauthenticatecredentials)
- * [page.bringToFront()](#pagebringtofront)
* [page.browser()](#pagebrowser)
* [page.browserContext()](#pagebrowsercontext)
* [page.click(selector[, options])](#pageclickselector-options)
@@ -1091,12 +1090,6 @@ Provide credentials for [HTTP authentication](https://developer.mozilla.org/en-U
To disable authentication, pass `null`.
-#### page.bringToFront()
-
-- returns: <[Promise]>
-
-Brings page to front (activates tab).
-
#### page.browser()
- returns: <[Browser]>
diff --git a/src/chromium/Page.ts b/src/chromium/Page.ts
index 7391613023..3f0d46a9e1 100644
--- a/src/chromium/Page.ts
+++ b/src/chromium/Page.ts
@@ -514,10 +514,6 @@ export class Page extends EventEmitter {
return response;
}
- async bringToFront() {
- await this._client.send('Page.bringToFront');
- }
-
async emulate(options: { viewport: Viewport; userAgent: string; }) {
await Promise.all([
this.setViewport(options.viewport),
diff --git a/test/headful.spec.js b/test/headful.spec.js
index a091199766..ef658f02fe 100644
--- a/test/headful.spec.js
+++ b/test/headful.spec.js
@@ -128,25 +128,5 @@ module.exports.addTests = function({testRunner, expect, playwright, defaultBrows
await browser.close();
});
});
-
- describe('Page.bringToFront', function() {
- it('should work', async() => {
- const browser = await playwright.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();
- });
- });
};