Skip to content

Commit e2057fb

Browse files
chore(test): run eslint on tests (microsoft#3638)
1 parent 6ffdd4d commit e2057fb

File tree

122 files changed

+1334
-1345
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+1334
-1345
lines changed

.eslintignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ src/server/webkit/protocol.ts
1111
/electron-types.d.ts
1212
utils/generate_types/overrides.d.ts
1313
utils/generate_types/test/test.ts
14-
/test/
1514
node_modules/
1615
browser_patches/*/checkout/
1716
packages/**/*.d.ts
17+
output/

test/accessibility.spec.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ it('should work', async function({page}) {
7878
expect(await page.accessibility.snapshot()).toEqual(golden);
7979
});
8080

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

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

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

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

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

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

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

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

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

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

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

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

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

341-
it('should show uninteresting nodes', async({page}) => {
341+
it('should show uninteresting nodes', async ({page}) => {
342342
await page.setContent(`
343343
<div id="root" role="textbox">
344344
<div>

test/autowaiting-basic.spec.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*/
1717
import { options } from './playwright.fixtures';
1818

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

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

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

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

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

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

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

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

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

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

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

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

203-
it.skip(options.WIRE)('should report navigation in the log when clicking anchor', async({page, server}) => {
203+
it.skip(options.WIRE)('should report navigation in the log when clicking anchor', async ({page, server}) => {
204204
await page.setContent(`<a href="${server.PREFIX + '/frames/one-frame.html'}">click me</a>`);
205205
const __testHookAfterPointerAction = () => new Promise(f => setTimeout(f, 6000));
206206
const error = await page.click('a', { timeout: 5000, __testHookAfterPointerAction } as any).catch(e => e);

test/autowaiting-no-hang.spec.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,33 +16,33 @@
1616
*/
1717
import './playwright.fixtures';
1818

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

25-
it('calling window.stop async', async({page, server}) => {
25+
it('calling window.stop async', async ({page, server}) => {
2626
server.setRoute('/empty.html', async (req, res) => {});
27-
await page.evaluate((url) => {
28-
window.location.href = url;
29-
setTimeout(() => window.stop(), 100);
30-
}, server.EMPTY_PAGE);
27+
await page.evaluate(url => {
28+
window.location.href = url;
29+
setTimeout(() => window.stop(), 100);
30+
}, server.EMPTY_PAGE);
3131
});
3232

33-
it('calling window.stop sync', async({page, server}) => {
34-
await page.evaluate((url) => {
35-
window.location.href = url;
36-
window.stop();
37-
}, server.EMPTY_PAGE);
33+
it('calling window.stop sync', async ({page, server}) => {
34+
await page.evaluate(url => {
35+
window.location.href = url;
36+
window.stop();
37+
}, server.EMPTY_PAGE);
3838
});
3939

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

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

0 commit comments

Comments
 (0)