Skip to content

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

feat(active): emulate active state on webkit (#941)

Pavel Feldmand05feec740fa
diff --git a/package.json b/package.json
index 1483882b14..3479fcffac 100644
--- a/package.json
+++ b/package.json
@@ -10,7 +10,7 @@
"playwright": {
"chromium_revision": "740289",
"firefox_revision": "1028",
- "webkit_revision": "1141"
+ "webkit_revision": "1143"
},
"scripts": {
"ctest": "cross-env BROWSER=chromium node test/test.js",
diff --git a/src/webkit/wkPage.ts b/src/webkit/wkPage.ts
index 2b8ee55719..dc11ae65b6 100644
--- a/src/webkit/wkPage.ts
+++ b/src/webkit/wkPage.ts
@@ -68,6 +68,7 @@ export class WKPage implements PageDelegate {
private async _initializePageProxySession() {
const promises: Promise<any>[] = [
this._pageProxySession.send('Dialog.enable'),
+ this._pageProxySession.send('Emulation.setActiveAndFocused', { active: true }),
this.authenticate(this._page._state.credentials)
];
const contextOptions = this._page.context()._options;
diff --git a/test/emulation.spec.js b/test/emulation.spec.js
index 468b713faf..330592eec9 100644
--- a/test/emulation.spec.js
+++ b/test/emulation.spec.js
@@ -18,7 +18,7 @@
/**
* @type {PageTestSuite}
*/
-module.exports.describe = function({testRunner, expect, playwright, FFOX, CHROMIUM, WEBKIT}) {
+module.exports.describe = function({testRunner, expect, playwright, headless, FFOX, CHROMIUM, WEBKIT}) {
const {describe, xdescribe, fdescribe} = testRunner;
const {it, fit, xit, dit} = testRunner;
const {beforeAll, beforeEach, afterAll, afterEach} = testRunner;
@@ -221,4 +221,9 @@ module.exports.describe = function({testRunner, expect, playwright, FFOX, CHROMI
});
});
+ describe('focus', function() {
+ it.skip(!headless)('should think that it is focused by default', async({page}) => {
+ expect(await page.evaluate('document.hasFocus()')).toBe(true);
+ });
+ });
};