Skip to content

Commit 9280037

Browse files
authored
chore(test): add blank lines (#3303)
1 parent b03b4a5 commit 9280037

23 files changed

+183
-0
lines changed

test/browsercontext-add-cookies.spec.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ it('should work', async({context, page, server}) => {
2626
}]);
2727
expect(await page.evaluate(() => document.cookie)).toEqual('password=123456');
2828
});
29+
2930
it('should roundtrip cookie', async({context, page, server}) => {
3031
await page.goto(server.EMPTY_PAGE);
3132
// @see https://en.wikipedia.org/wiki/Year_2038_problem
@@ -42,6 +43,7 @@ it('should roundtrip cookie', async({context, page, server}) => {
4243
await context.addCookies(cookies);
4344
expect(await context.cookies()).toEqual(cookies);
4445
});
46+
4547
it('should send cookie header', async({server, context}) => {
4648
let cookie = '';
4749
server.setRoute('/empty.html', (req, res) => {
@@ -53,6 +55,7 @@ it('should send cookie header', async({server, context}) => {
5355
await page.goto(server.EMPTY_PAGE);
5456
expect(cookie).toBe('cookie=value');
5557
});
58+
5659
it('should isolate cookies in browser contexts', async({context, server, browser}) => {
5760
const anotherContext = await browser.newContext();
5861
await context.addCookies([{url: server.EMPTY_PAGE, name: 'isolatecookie', value: 'page1value'}]);
@@ -68,6 +71,7 @@ it('should isolate cookies in browser contexts', async({context, server, browser
6871
expect(cookies2[0].value).toBe('page2value');
6972
await anotherContext.close();
7073
});
74+
7175
it('should isolate session cookies', async({context, server, browser}) => {
7276
server.setRoute('/setcookie.html', (req, res) => {
7377
res.setHeader('Set-Cookie', 'session=value');
@@ -93,6 +97,7 @@ it('should isolate session cookies', async({context, server, browser}) => {
9397
await context2.close();
9498
}
9599
});
100+
96101
it('should isolate persistent cookies', async({context, server, browser}) => {
97102
server.setRoute('/setcookie.html', (req, res) => {
98103
res.setHeader('Set-Cookie', 'persistent=persistent-value; max-age=3600');
@@ -112,6 +117,7 @@ it('should isolate persistent cookies', async({context, server, browser}) => {
112117
expect(cookies2.length).toBe(0);
113118
await context2.close();
114119
});
120+
115121
it('should isolate send cookie header', async({server, context, browser}) => {
116122
let cookie = [];
117123
server.setRoute('/empty.html', (req, res) => {
@@ -132,6 +138,7 @@ it('should isolate send cookie header', async({server, context, browser}) => {
132138
await context.close();
133139
}
134140
});
141+
135142
it.slow()('should isolate cookies between launches', async({browserType, server, defaultBrowserOptions}) => {
136143
const browser1 = await browserType.launch(defaultBrowserOptions);
137144
const context1 = await browser1.newContext();
@@ -144,6 +151,7 @@ it.slow()('should isolate cookies between launches', async({browserType, server,
144151
expect(cookies.length).toBe(0);
145152
await browser2.close();
146153
});
154+
147155
it('should set multiple cookies', async({context, page, server}) => {
148156
await page.goto(server.EMPTY_PAGE);
149157
await context.addCookies([{
@@ -163,6 +171,7 @@ it('should set multiple cookies', async({context, page, server}) => {
163171
'multiple-2=bar',
164172
]);
165173
});
174+
166175
it('should have |expires| set to |-1| for session cookies', async({context, server}) => {
167176
await context.addCookies([{
168177
url: server.EMPTY_PAGE,
@@ -172,6 +181,7 @@ it('should have |expires| set to |-1| for session cookies', async({context, serv
172181
const cookies = await context.cookies();
173182
expect(cookies[0].expires).toBe(-1);
174183
});
184+
175185
it('should set cookie with reasonable defaults', async({context, server}) => {
176186
await context.addCookies([{
177187
url: server.EMPTY_PAGE,
@@ -190,6 +200,7 @@ it('should set cookie with reasonable defaults', async({context, server}) => {
190200
sameSite: 'None',
191201
}]);
192202
});
203+
193204
it('should set a cookie with a path', async({context, page, server}) => {
194205
await page.goto(server.PREFIX + '/grid.html');
195206
await context.addCookies([{
@@ -214,6 +225,7 @@ it('should set a cookie with a path', async({context, page, server}) => {
214225
await page.goto(server.PREFIX + '/grid.html');
215226
expect(await page.evaluate('document.cookie')).toBe('gridcookie=GRID');
216227
});
228+
217229
it('should not set a cookie with blank page URL', async function({context, server}) {
218230
let error = null;
219231
try {
@@ -228,6 +240,7 @@ it('should not set a cookie with blank page URL', async function({context, serve
228240
`Blank page can not have cookie "example-cookie-blank"`
229241
);
230242
});
243+
231244
it('should not set a cookie on a data URL page', async function({context}) {
232245
let error = null;
233246
try {
@@ -237,6 +250,7 @@ it('should not set a cookie on a data URL page', async function({context}) {
237250
}
238251
expect(error.message).toContain('Data URL page can not have cookie "example-cookie"');
239252
});
253+
240254
it('should default to setting secure cookie for HTTPS websites', async({context, page, server}) => {
241255
await page.goto(server.EMPTY_PAGE);
242256
const SECURE_URL = 'https://example.com';
@@ -248,6 +262,7 @@ it('should default to setting secure cookie for HTTPS websites', async({context,
248262
const [cookie] = await context.cookies(SECURE_URL);
249263
expect(cookie.secure).toBe(true);
250264
});
265+
251266
it('should be able to set unsecure cookie for HTTP website', async({context, page, server}) => {
252267
await page.goto(server.EMPTY_PAGE);
253268
const HTTP_URL = 'http://example.com';
@@ -259,6 +274,7 @@ it('should be able to set unsecure cookie for HTTP website', async({context, pag
259274
const [cookie] = await context.cookies(HTTP_URL);
260275
expect(cookie.secure).toBe(false);
261276
});
277+
262278
it('should set a cookie on a different domain', async({context, page, server}) => {
263279
await page.goto(server.EMPTY_PAGE);
264280
await context.addCookies([{
@@ -278,6 +294,7 @@ it('should set a cookie on a different domain', async({context, page, server}) =
278294
sameSite: 'None',
279295
}]);
280296
});
297+
281298
it('should set cookies for a frame', async({context, page, server}) => {
282299
await page.goto(server.EMPTY_PAGE);
283300
await context.addCookies([
@@ -295,6 +312,7 @@ it('should set cookies for a frame', async({context, page, server}) => {
295312

296313
expect(await page.frames()[1].evaluate('document.cookie')).toBe('frame-cookie=value');
297314
});
315+
298316
it('should(not) block third party cookies', async({context, page, server}) => {
299317
await page.goto(server.EMPTY_PAGE);
300318
await page.evaluate(src => {

test/browsercontext-page-event.spec.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ it('should fire page lifecycle events', async function({browser, server}) {
158158
]);
159159
await context.close();
160160
});
161+
161162
it.fail(WEBKIT)('should work with Shift-clicking', async({browser, server}) => {
162163
// WebKit: Shift+Click does not open a new window.
163164
const context = await browser.newContext();
@@ -171,6 +172,7 @@ it.fail(WEBKIT)('should work with Shift-clicking', async({browser, server}) => {
171172
expect(await popup.opener()).toBe(null);
172173
await context.close();
173174
});
175+
174176
it.fail(WEBKIT || FFOX)('should work with Ctrl-clicking', async({browser, server}) => {
175177
// Firefox: reports an opener in this case.
176178
// WebKit: Ctrl+Click does not open a new tab.

test/downloads-path.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ it('should delete downloads when context closes', async({downloadsBrowser, downl
9999
expect(fs.existsSync(path)).toBeFalsy();
100100

101101
});
102+
102103
it('should report downloads in downloadsPath folder', async({downloadsBrowser, downloadsPath, server}) => {
103104
const page = await downloadsBrowser.newPage({ acceptDownloads: true });
104105
await page.setContent(`<a href="${server.PREFIX}/download">download</a>`);

test/elementhandle-bounding-box.spec.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ it.fail(FFOX && !HEADLESS)('should work', async ({ page, server }) => {
2525
const box = await elementHandle.boundingBox();
2626
expect(box).toEqual({ x: 100, y: 50, width: 50, height: 50 });
2727
});
28+
2829
it('should handle nested frames', async ({ page, server }) => {
2930
await page.setViewportSize({ width: 500, height: 500 });
3031
await page.goto(server.PREFIX + '/frames/nested-frames.html');
@@ -33,11 +34,13 @@ it('should handle nested frames', async ({ page, server }) => {
3334
const box = await elementHandle.boundingBox();
3435
expect(box).toEqual({ x: 24, y: 224, width: 268, height: 18 });
3536
});
37+
3638
it('should return null for invisible elements', async ({ page, server }) => {
3739
await page.setContent('<div style="display:none">hi</div>');
3840
const element = await page.$('div');
3941
expect(await element.boundingBox()).toBe(null);
4042
});
43+
4144
it('should force a layout', async ({ page, server }) => {
4245
await page.setViewportSize({ width: 500, height: 500 });
4346
await page.setContent('<div style="width: 100px; height: 100px">hello</div>');
@@ -46,6 +49,7 @@ it('should force a layout', async ({ page, server }) => {
4649
const box = await elementHandle.boundingBox();
4750
expect(box).toEqual({ x: 8, y: 8, width: 100, height: 200 });
4851
});
52+
4953
it('should work with SVG nodes', async ({ page, server }) => {
5054
await page.setContent(`
5155
<svg xmlns="http://www.w3.org/2000/svg" width="500" height="500">
@@ -60,6 +64,7 @@ it('should work with SVG nodes', async ({ page, server }) => {
6064
}, element);
6165
expect(pwBoundingBox).toEqual(webBoundingBox);
6266
});
67+
6368
it.skip(FFOX)('should work with page scale', async ({ browser, server }) => {
6469
const context = await browser.newContext({ viewport: { width: 400, height: 400, isMobile: true } });
6570
const page = await context.newPage();
@@ -80,6 +85,7 @@ it.skip(FFOX)('should work with page scale', async ({ browser, server }) => {
8085
expect(Math.round(box.height * 100)).toBe(20 * 100);
8186
await context.close();
8287
});
88+
8389
it('should work when inline box child is outside of viewport', async ({ page, server }) => {
8490
await page.setContent(`
8591
<style>

test/elementhandle-click.spec.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,25 +24,29 @@ it('should work', async ({ page, server }) => {
2424
await button.click();
2525
expect(await page.evaluate(() => result)).toBe('Clicked');
2626
});
27+
2728
it('should work with Node removed', async ({ page, server }) => {
2829
await page.goto(server.PREFIX + '/input/button.html');
2930
await page.evaluate(() => delete window['Node']);
3031
const button = await page.$('button');
3132
await button.click();
3233
expect(await page.evaluate(() => result)).toBe('Clicked');
3334
});
35+
3436
it('should work for Shadow DOM v1', async ({ page, server }) => {
3537
await page.goto(server.PREFIX + '/shadow.html');
3638
const buttonHandle = await page.evaluateHandle(() => button);
3739
await buttonHandle.click();
3840
expect(await page.evaluate(() => clicked)).toBe(true);
3941
});
42+
4043
it('should work for TextNodes', async ({ page, server }) => {
4144
await page.goto(server.PREFIX + '/input/button.html');
4245
const buttonTextNode = await page.evaluateHandle(() => document.querySelector('button').firstChild);
4346
await buttonTextNode.click();
4447
expect(await page.evaluate(() => result)).toBe('Clicked');
4548
});
49+
4650
it('should throw for detached nodes', async ({ page, server }) => {
4751
await page.goto(server.PREFIX + '/input/button.html');
4852
const button = await page.$('button');
@@ -51,26 +55,30 @@ it('should throw for detached nodes', async ({ page, server }) => {
5155
await button.click().catch(err => error = err);
5256
expect(error.message).toContain('Element is not attached to the DOM');
5357
});
58+
5459
it('should throw for hidden nodes with force', async ({ page, server }) => {
5560
await page.goto(server.PREFIX + '/input/button.html');
5661
const button = await page.$('button');
5762
await page.evaluate(button => button.style.display = 'none', button);
5863
const error = await button.click({ force: true }).catch(err => err);
5964
expect(error.message).toContain('Element is not visible');
6065
});
66+
6167
it('should throw for recursively hidden nodes with force', async ({ page, server }) => {
6268
await page.goto(server.PREFIX + '/input/button.html');
6369
const button = await page.$('button');
6470
await page.evaluate(button => button.parentElement.style.display = 'none', button);
6571
const error = await button.click({ force: true }).catch(err => err);
6672
expect(error.message).toContain('Element is not visible');
6773
});
74+
6875
it('should throw for <br> elements with force', async ({ page, server }) => {
6976
await page.setContent('hello<br>goodbye');
7077
const br = await page.$('br');
7178
const error = await br.click({ force: true }).catch(err => err);
7279
expect(error.message).toContain('Element is outside of the viewport');
7380
});
81+
7482
it('should double click the button', async ({ page, server }) => {
7583
await page.goto(server.PREFIX + '/input/button.html');
7684
await page.evaluate(() => {

test/elementhandle-content-frame.spec.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,27 +25,31 @@ it('should work', async ({ page, server }) => {
2525
const frame = await elementHandle.contentFrame();
2626
expect(frame).toBe(page.frames()[1]);
2727
});
28+
2829
it('should work for cross-process iframes', async ({ page, server }) => {
2930
await page.goto(server.EMPTY_PAGE);
3031
await utils.attachFrame(page, 'frame1', server.CROSS_PROCESS_PREFIX + '/empty.html');
3132
const elementHandle = await page.$('#frame1');
3233
const frame = await elementHandle.contentFrame();
3334
expect(frame).toBe(page.frames()[1]);
3435
});
36+
3537
it('should work for cross-frame evaluations', async ({ page, server }) => {
3638
await page.goto(server.EMPTY_PAGE);
3739
await utils.attachFrame(page, 'frame1', server.EMPTY_PAGE);
3840
const frame = page.frames()[1];
3941
const elementHandle = await frame.evaluateHandle(() => window.top.document.querySelector('#frame1'));
4042
expect(await elementHandle.contentFrame()).toBe(frame);
4143
});
44+
4245
it('should return null for non-iframes', async ({ page, server }) => {
4346
await page.goto(server.EMPTY_PAGE);
4447
await utils.attachFrame(page, 'frame1', server.EMPTY_PAGE);
4548
const frame = page.frames()[1];
4649
const elementHandle = await frame.evaluateHandle(() => document.body);
4750
expect(await elementHandle.contentFrame()).toBe(null);
4851
});
52+
4953
it('should return null for document.documentElement', async ({ page, server }) => {
5054
await page.goto(server.EMPTY_PAGE);
5155
await utils.attachFrame(page, 'frame1', server.EMPTY_PAGE);

test/elementhandle-convenience.spec.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ it('should have a nice preview', async ({ page, server }) => {
3030
expect(String(text)).toBe('JSHandle@#text=Text,↵more text');
3131
expect(String(check)).toBe('JSHandle@<input checked id="check" foo="bar"" type="checkbox"/>');
3232
});
33+
3334
it('getAttribute should work', async ({ page, server }) => {
3435
await page.goto(`${server.PREFIX}/dom.html`);
3536
const handle = await page.$('#outer');
@@ -38,18 +39,21 @@ it('getAttribute should work', async ({ page, server }) => {
3839
expect(await page.getAttribute('#outer', 'name')).toBe('value');
3940
expect(await page.getAttribute('#outer', 'foo')).toBe(null);
4041
});
42+
4143
it('innerHTML should work', async ({ page, server }) => {
4244
await page.goto(`${server.PREFIX}/dom.html`);
4345
const handle = await page.$('#outer');
4446
expect(await handle.innerHTML()).toBe('<div id="inner">Text,\nmore text</div>');
4547
expect(await page.innerHTML('#outer')).toBe('<div id="inner">Text,\nmore text</div>');
4648
});
49+
4750
it('innerText should work', async ({ page, server }) => {
4851
await page.goto(`${server.PREFIX}/dom.html`);
4952
const handle = await page.$('#inner');
5053
expect(await handle.innerText()).toBe('Text, more text');
5154
expect(await page.innerText('#inner')).toBe('Text, more text');
5255
});
56+
5357
it('innerText should throw', async ({ page, server }) => {
5458
await page.setContent(`<svg>text</svg>`);
5559
const error1 = await page.innerText('svg').catch(e => e);
@@ -58,12 +62,14 @@ it('innerText should throw', async ({ page, server }) => {
5862
const error2 = await handle.innerText().catch(e => e);
5963
expect(error2.message).toContain('Not an HTMLElement');
6064
});
65+
6166
it('textContent should work', async ({ page, server }) => {
6267
await page.goto(`${server.PREFIX}/dom.html`);
6368
const handle = await page.$('#inner');
6469
expect(await handle.textContent()).toBe('Text,\nmore text');
6570
expect(await page.textContent('#inner')).toBe('Text,\nmore text');
6671
});
72+
6773
it('textContent should be atomic', async ({ playwright, page }) => {
6874
const createDummySelector = () => ({
6975
create(root, target) { },
@@ -86,6 +92,7 @@ it('textContent should be atomic', async ({ playwright, page }) => {
8692
expect(tc).toBe('Hello');
8793
expect(await page.evaluate(() => document.querySelector('div').textContent)).toBe('modified');
8894
});
95+
8996
it('innerText should be atomic', async ({ playwright, page }) => {
9097
const createDummySelector = () => ({
9198
create(root, target) { },
@@ -108,6 +115,7 @@ it('innerText should be atomic', async ({ playwright, page }) => {
108115
expect(tc).toBe('Hello');
109116
expect(await page.evaluate(() => document.querySelector('div').innerText)).toBe('modified');
110117
});
118+
111119
it('innerHTML should be atomic', async ({ playwright, page }) => {
112120
const createDummySelector = () => ({
113121
create(root, target) { },
@@ -130,6 +138,7 @@ it('innerHTML should be atomic', async ({ playwright, page }) => {
130138
expect(tc).toBe('Hello<span>world</span>');
131139
expect(await page.evaluate(() => document.querySelector('div').innerHTML)).toBe('modified');
132140
});
141+
133142
it('getAttribute should be atomic', async ({ playwright, page }) => {
134143
const createDummySelector = () => ({
135144
create(root, target) { },

0 commit comments

Comments
 (0)