Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
test: add focus traversal test (#2141)
Pavel Feldman755ef116913d
diff --git a/package-lock.json b/package-lock.jsonindex 5bfacf5733..7163d1bc01 100644--- a/package-lock.json+++ b/package-lock.json@@ -1,6 +1,6 @@{"name": "playwright-core",- "version": "0.17.0-post",+ "version": "1.0.0-post","lockfileVersion": 1,"requires": true,"dependencies": {diff --git a/test/focus.spec.js b/test/focus.spec.jsindex 27d89f053a..2333d79092 100644--- a/test/focus.spec.js+++ b/test/focus.spec.js@@ -14,7 +14,7 @@* limitations under the License.*/-const {FFOX, CHROMIUM, WEBKIT} = require('./utils').testOptions(browserType);+const {FFOX, CHROMIUM, LINUX, WEBKIT} = require('./utils').testOptions(browserType);describe('Page.focus', function() {it('should work', async function({page, server}) {@@ -44,4 +44,19 @@ describe('Page.focus', function() {expect(focused).toBe(true);expect(blurred).toBe(true);});+ it.fail(WEBKIT && !LINUX)('should traverse focus', async function({page, server}) {+ await page.setContent(`<input id="i1"><input id="i2">`);+ let focused = false;+ await page.exposeFunction('focusEvent', () => focused = true);+ await page.evaluate(() => i2.addEventListener('focus', focusEvent));++ await page.focus('#i1');+ await page.keyboard.type("First");+ await page.keyboard.press("Tab");+ await page.keyboard.type("Last");++ expect(focused).toBe(true);+ expect(await page.$eval('#i1', e => e.value)).toBe('First');+ expect(await page.$eval('#i2', e => e.value)).toBe('Last');+ });});