mirror of
https://github.com/microsoft/playwright.git
synced 2024-10-27 21:58:52 +03:00
test: add focus traversal test (#2141)
This commit is contained in:
parent
7a8dd2c361
commit
755ef11691
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "playwright-core",
|
||||
"version": "0.17.0-post",
|
||||
"version": "1.0.0-post",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
@ -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');
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user