Skip to content

Commit

Permalink
tests: add test for page.focus() in Firefox (#3478)
Browse files Browse the repository at this point in the history
  • Loading branch information
mxschmitt committed Aug 17, 2020
1 parent 141a255 commit 59e3326
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion test/page-basic.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ it('should fail with error upon disconnect', async({page, server}) => {
expect(error.message).toContain('Page closed');
});

it('page.ur should work', async({page, server}) => {
it('page.url should work', async({page, server}) => {
expect(page.url()).toBe('about:blank');
await page.goto(server.EMPTY_PAGE);
expect(page.url()).toBe(server.EMPTY_PAGE);
Expand Down Expand Up @@ -242,3 +242,13 @@ it('frame.press should work', async({page, server}) => {
await frame.press('textarea', 'a');
expect(await frame.evaluate(() => document.querySelector('textarea').value)).toBe('a');
});

it.fail(FFOX)('frame.focus should work multiple times', async ({ context, server }) => {
const page1 = await context.newPage()
const page2 = await context.newPage()
for (const page of [page1, page2]) {
await page.setContent(`<button id="foo" onfocus="window.gotFocus=true"></button>`)
await page.focus("#foo")
expect(await page.evaluate(() => !!window['gotFocus'])).toBe(true)
}
});

0 comments on commit 59e3326

Please sign in to comment.