Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(tests): run eslint on tests #3638

Merged
merged 1 commit into from
Aug 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ src/server/webkit/protocol.ts
/electron-types.d.ts
utils/generate_types/overrides.d.ts
utils/generate_types/test/test.ts
/test/
node_modules/
browser_patches/*/checkout/
packages/**/*.d.ts
output/
34 changes: 17 additions & 17 deletions test/accessibility.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ it('should work', async function({page}) {
expect(await page.accessibility.snapshot()).toEqual(golden);
});

it('should work with regular text', async({page}) => {
it('should work with regular text', async ({page}) => {
await page.setContent(`<div>Hello World</div>`);
const snapshot = await page.accessibility.snapshot();
expect(snapshot.children[0]).toEqual({
Expand All @@ -87,31 +87,31 @@ it('should work with regular text', async({page}) => {
});
});

it('roledescription', async({page}) => {
it('roledescription', async ({page}) => {
await page.setContent('<div tabIndex=-1 aria-roledescription="foo">Hi</div>');
const snapshot = await page.accessibility.snapshot();
expect(snapshot.children[0].roledescription).toEqual('foo');
});

it('orientation', async({page}) => {
it('orientation', async ({page}) => {
await page.setContent('<a href="" role="slider" aria-orientation="vertical">11</a>');
const snapshot = await page.accessibility.snapshot();
expect(snapshot.children[0].orientation).toEqual('vertical');
});

it('autocomplete', async({page}) => {
it('autocomplete', async ({page}) => {
await page.setContent('<div role="textbox" aria-autocomplete="list">hi</div>');
const snapshot = await page.accessibility.snapshot();
expect(snapshot.children[0].autocomplete).toEqual('list');
});

it('multiselectable', async({page}) => {
it('multiselectable', async ({page}) => {
await page.setContent('<div role="grid" tabIndex=-1 aria-multiselectable=true>hey</div>');
const snapshot = await page.accessibility.snapshot();
expect(snapshot.children[0].multiselectable).toEqual(true);
});

it('keyshortcuts', async({page}) => {
it('keyshortcuts', async ({page}) => {
await page.setContent('<div role="grid" tabIndex=-1 aria-keyshortcuts="foo">hey</div>');
const snapshot = await page.accessibility.snapshot();
expect(snapshot.children[0].keyshortcuts).toEqual('foo');
Expand Down Expand Up @@ -204,12 +204,12 @@ it.skip(options.FIREFOX || options.WEBKIT)('plain text field with role should no
// WebKit rich text accessibility is iffy
await page.setContent(`
<div contenteditable="plaintext-only" role='textbox'>Edit this image:<img src="fakeimage.png" alt="my fake image"></div>`);
const snapshot = await page.accessibility.snapshot();
expect(snapshot.children[0]).toEqual({
role: 'textbox',
name: '',
value: 'Edit this image:'
});
const snapshot = await page.accessibility.snapshot();
expect(snapshot.children[0]).toEqual({
role: 'textbox',
name: '',
value: 'Edit this image:'
});
});

it.skip(options.FIREFOX || options.WEBKIT)('plain text field without role should not have content', async function({page}) {
Expand Down Expand Up @@ -289,7 +289,7 @@ it('checkbox without label should not have children', async function({page}) {
expect(snapshot.children[0]).toEqual(golden);
});

it('should work a button', async({page}) => {
it('should work a button', async ({page}) => {
await page.setContent(`<button>My Button</button>`);

const button = await page.$('button');
Expand All @@ -299,7 +299,7 @@ it('should work a button', async({page}) => {
});
});

it('should work an input', async({page}) => {
it('should work an input', async ({page}) => {
await page.setContent(`<input title="My Input" value="My Value">`);

const input = await page.$('input');
Expand All @@ -310,7 +310,7 @@ it('should work an input', async({page}) => {
});
});

it('should work on a menu', async({page}) => {
it('should work on a menu', async ({page}) => {
await page.setContent(`
<div role="menu" title="My Menu">
<div role="menuitem">First Item</div>
Expand All @@ -331,14 +331,14 @@ it('should work on a menu', async({page}) => {
});
});

it('should return null when the element is no longer in DOM', async({page}) => {
it('should return null when the element is no longer in DOM', async ({page}) => {
await page.setContent(`<button>My Button</button>`);
const button = await page.$('button');
await page.$eval('button', button => button.remove());
expect(await page.accessibility.snapshot({root: button})).toEqual(null);
});

it('should show uninteresting nodes', async({page}) => {
it('should show uninteresting nodes', async ({page}) => {
await page.setContent(`
<div id="root" role="textbox">
<div>
Expand Down
26 changes: 13 additions & 13 deletions test/autowaiting-basic.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
import { options } from './playwright.fixtures';

it('should await navigation when clicking anchor', async({page, server}) => {
it('should await navigation when clicking anchor', async ({page, server}) => {
const messages = [];
server.setRoute('/empty.html', async (req, res) => {
messages.push('route');
Expand All @@ -33,7 +33,7 @@ it('should await navigation when clicking anchor', async({page, server}) => {
expect(messages.join('|')).toBe('route|navigated|click');
});

it('should await cross-process navigation when clicking anchor', async({page, server}) => {
it('should await cross-process navigation when clicking anchor', async ({page, server}) => {
const messages = [];
server.setRoute('/empty.html', async (req, res) => {
messages.push('route');
Expand All @@ -50,7 +50,7 @@ it('should await cross-process navigation when clicking anchor', async({page, se
expect(messages.join('|')).toBe('route|navigated|click');
});

it('should await form-get on click', async({page, server}) => {
it('should await form-get on click', async ({page, server}) => {
const messages = [];
server.setRoute('/empty.html?foo=bar', async (req, res) => {
messages.push('route');
Expand All @@ -71,7 +71,7 @@ it('should await form-get on click', async({page, server}) => {
expect(messages.join('|')).toBe('route|navigated|click');
});

it('should await form-post on click', async({page, server}) => {
it('should await form-post on click', async ({page, server}) => {
const messages = [];
server.setRoute('/empty.html', async (req, res) => {
messages.push('route');
Expand All @@ -92,7 +92,7 @@ it('should await form-post on click', async({page, server}) => {
expect(messages.join('|')).toBe('route|navigated|click');
});

it('should await navigation when assigning location', async({page, server}) => {
it('should await navigation when assigning location', async ({page, server}) => {
const messages = [];
server.setRoute('/empty.html', async (req, res) => {
messages.push('route');
Expand All @@ -106,7 +106,7 @@ it('should await navigation when assigning location', async({page, server}) => {
expect(messages.join('|')).toBe('route|navigated|evaluate');
});

it('should await navigation when assigning location twice', async({page, server}) => {
it('should await navigation when assigning location twice', async ({page, server}) => {
const messages = [];
server.setRoute('/empty.html?cancel', async (req, res) => { res.end('done'); });
server.setRoute('/empty.html?override', async (req, res) => { messages.push('routeoverride'); res.end('done'); });
Expand All @@ -118,7 +118,7 @@ it('should await navigation when assigning location twice', async({page, server}
expect(messages.join('|')).toBe('routeoverride|evaluate');
});

it('should await navigation when evaluating reload', async({page, server}) => {
it('should await navigation when evaluating reload', async ({page, server}) => {
const messages = [];
await page.goto(server.EMPTY_PAGE);
server.setRoute('/empty.html', async (req, res) => {
Expand All @@ -134,7 +134,7 @@ it('should await navigation when evaluating reload', async({page, server}) => {
expect(messages.join('|')).toBe('route|navigated|evaluate');
});

it('should await navigating specified target', async({page, server}) => {
it('should await navigating specified target', async ({page, server}) => {
const messages = [];
server.setRoute('/empty.html', async (req, res) => {
messages.push('route');
Expand All @@ -155,19 +155,19 @@ it('should await navigating specified target', async({page, server}) => {
expect(messages.join('|')).toBe('route|navigated|click');
});

it('should work with noWaitAfter: true', async({page, server}) => {
it('should work with noWaitAfter: true', async ({page, server}) => {
server.setRoute('/empty.html', async () => {});
await page.setContent(`<a href="${server.EMPTY_PAGE}">empty.html</a>`);
await page.click('a', { noWaitAfter: true });
});

it('should work with dblclick noWaitAfter: true', async({page, server}) => {
it('should work with dblclick noWaitAfter: true', async ({page, server}) => {
server.setRoute('/empty.html', async () => {});
await page.setContent(`<a href="${server.EMPTY_PAGE}">empty.html</a>`);
await page.dblclick('a', { noWaitAfter: true });
});

it('should work with waitForLoadState(load)', async({page, server}) => {
it('should work with waitForLoadState(load)', async ({page, server}) => {
const messages = [];
server.setRoute('/empty.html', async (req, res) => {
messages.push('route');
Expand All @@ -183,7 +183,7 @@ it('should work with waitForLoadState(load)', async({page, server}) => {
expect(messages.join('|')).toBe('route|domcontentloaded|clickload');
});

it('should work with goto following click', async({page, server}) => {
it('should work with goto following click', async ({page, server}) => {
server.setRoute('/login.html', async (req, res) => {
res.setHeader('Content-Type', 'text/html');
res.end(`You are logged in`);
Expand All @@ -200,7 +200,7 @@ it('should work with goto following click', async({page, server}) => {
await page.goto(server.EMPTY_PAGE);
});

it.skip(options.WIRE)('should report navigation in the log when clicking anchor', async({page, server}) => {
it.skip(options.WIRE)('should report navigation in the log when clicking anchor', async ({page, server}) => {
await page.setContent(`<a href="${server.PREFIX + '/frames/one-frame.html'}">click me</a>`);
const __testHookAfterPointerAction = () => new Promise(f => setTimeout(f, 6000));
const error = await page.click('a', { timeout: 5000, __testHookAfterPointerAction } as any).catch(e => e);
Expand Down
26 changes: 13 additions & 13 deletions test/autowaiting-no-hang.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,33 +16,33 @@
*/
import './playwright.fixtures';

it('clicking on links which do not commit navigation', async({page, server, httpsServer}) => {
it('clicking on links which do not commit navigation', async ({page, server, httpsServer}) => {
await page.goto(server.EMPTY_PAGE);
await page.setContent(`<a href='${httpsServer.EMPTY_PAGE}'>foobar</a>`);
await page.click('a');
});

it('calling window.stop async', async({page, server}) => {
it('calling window.stop async', async ({page, server}) => {
server.setRoute('/empty.html', async (req, res) => {});
await page.evaluate((url) => {
window.location.href = url;
setTimeout(() => window.stop(), 100);
}, server.EMPTY_PAGE);
await page.evaluate(url => {
window.location.href = url;
setTimeout(() => window.stop(), 100);
}, server.EMPTY_PAGE);
});

it('calling window.stop sync', async({page, server}) => {
await page.evaluate((url) => {
window.location.href = url;
window.stop();
}, server.EMPTY_PAGE);
it('calling window.stop sync', async ({page, server}) => {
await page.evaluate(url => {
window.location.href = url;
window.stop();
}, server.EMPTY_PAGE);
});

it('assigning location to about:blank', async({page, server}) => {
it('assigning location to about:blank', async ({page, server}) => {
await page.goto(server.EMPTY_PAGE);
await page.evaluate(`window.location.href = "about:blank";`);
});

it('assigning location to about:blank after non-about:blank', async({page, server}) => {
it('assigning location to about:blank after non-about:blank', async ({page, server}) => {
server.setRoute('/empty.html', async (req, res) => {});
await page.evaluate(`
window.location.href = "${server.EMPTY_PAGE}";
Expand Down
Loading