Skip to content

Commit 04918ae

Browse files
committed
testing
1 parent 3805a72 commit 04918ae

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

test/quicklink.spec.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ mainSuite('should prefetch in-viewport links correctly (UMD)', async context =>
3535
responseURLs.push(resp.url());
3636
});
3737
await context.page.goto(`${server}/test-basic-usage.html`);
38-
await sleep();
38+
await context.page.waitForNetworkIdle();
3939
assert.instance(responseURLs, Array);
4040
assert.ok(responseURLs.includes(`${server}/1.html`));
4141
assert.ok(responseURLs.includes(`${server}/2.html`));
@@ -49,7 +49,7 @@ mainSuite('should prefetch in-viewport links correctly (ES Modules)', async cont
4949
responseURLs.push(resp.url());
5050
});
5151
await context.page.goto(`${server}/test-es-modules.html`);
52-
await sleep();
52+
await context.page.waitForNetworkIdle();
5353
assert.instance(responseURLs, Array);
5454
assert.ok(responseURLs.includes(`${server}/1.html`));
5555
assert.ok(responseURLs.includes(`${server}/2.html`));
@@ -70,7 +70,7 @@ mainSuite('should prefetch in-viewport links that scroll into view correctly (UM
7070
await context.page.evaluate(_ => {
7171
window.scrollBy(0, window.innerHeight);
7272
});
73-
await sleep();
73+
await context.page.waitForNetworkIdle();
7474
assert.instance(responseURLs, Array);
7575
assert.ok(responseURLs.includes(`${server}/1.html`));
7676
assert.ok(responseURLs.includes(`${server}/2.html`));
@@ -84,7 +84,7 @@ mainSuite('should prefetch in-viewport links from a custom DOM source', async co
8484
responseURLs.push(resp.url());
8585
});
8686
await context.page.goto(`${server}/test-custom-dom-source.html`);
87-
await sleep();
87+
await context.page.waitForNetworkIdle();
8888
assert.instance(responseURLs, Array);
8989
assert.ok(responseURLs.includes(`${server}/main.css`));
9090
});
@@ -95,7 +95,7 @@ mainSuite('should prefetch in-viewport links from NodeList', async context => {
9595
responseURLs.push(resp.url());
9696
});
9797
await context.page.goto(`${server}/test-node-list.html`);
98-
await sleep();
98+
await context.page.waitForNetworkIdle();
9999
assert.instance(responseURLs, Array);
100100
assert.ok(responseURLs.includes(`${server}/2.html`));
101101
assert.ok(responseURLs.includes(`${server}/3.html`));
@@ -107,7 +107,7 @@ mainSuite('should only prefetch links if allowed in origins list', async context
107107
responseURLs.push(resp.url());
108108
});
109109
await context.page.goto(`${server}/test-allow-origin.html`);
110-
await sleep(1000);
110+
await context.page.waitForNetworkIdle();
111111
assert.instance(responseURLs, Array);
112112

113113
// => origins: ['github.githubassets.com']
@@ -122,7 +122,7 @@ mainSuite('should prefetch all links when allowing all origins', async context =
122122
responseURLs.push(resp.url());
123123
});
124124
await context.page.goto(`${server}/test-allow-origin-all.html`);
125-
await sleep();
125+
await context.page.waitForNetworkIdle();
126126
assert.instance(responseURLs, Array);
127127

128128
// => origins: true
@@ -139,7 +139,7 @@ mainSuite('should only prefetch links of same origin (default)', async context =
139139
responseURLs.push(resp.url());
140140
});
141141
await context.page.goto(`${server}/test-same-origin.html`);
142-
await sleep();
142+
await context.page.waitForNetworkIdle();
143143
assert.instance(responseURLs, Array);
144144

145145
// => origins: [location.hostname] (default)
@@ -154,7 +154,7 @@ mainSuite('should only prefetch links after ignore patterns allowed it', async c
154154
responseURLs.push(resp.url());
155155
});
156156
await context.page.goto(`${server}/test-ignore-basic.html`);
157-
await sleep();
157+
await context.page.waitForNetworkIdle();
158158
assert.instance(responseURLs, Array);
159159

160160
// => origins: [location.hostname] (default)
@@ -173,7 +173,7 @@ mainSuite('should only prefetch links after ignore patterns allowed it (multiple
173173
responseURLs.push(resp.url());
174174
});
175175
await context.page.goto(`${server}/test-ignore-multiple.html`);
176-
await sleep();
176+
await context.page.waitForNetworkIdle();
177177
assert.instance(responseURLs, Array);
178178

179179
// => origins: true (all)
@@ -193,7 +193,7 @@ mainSuite('should accept a single URL to prefetch()', async context => {
193193
responseURLs.push(resp.url());
194194
});
195195
await context.page.goto(`${server}/test-prefetch-single.html`);
196-
await sleep();
196+
await context.page.waitForNetworkIdle();
197197
assert.instance(responseURLs, Array);
198198
assert.ok(responseURLs.includes(`${server}/2.html`));
199199
});
@@ -204,7 +204,7 @@ mainSuite('should accept multiple URLs to prefetch()', async context => {
204204
responseURLs.push(resp.url());
205205
});
206206
await context.page.goto(`${server}/test-prefetch-multiple.html`);
207-
await sleep();
207+
await context.page.waitForNetworkIdle();
208208

209209
// don't care about first 3 URLs (markup)
210210
const ours = responseURLs.slice(3);
@@ -221,7 +221,7 @@ mainSuite('should not prefetch() the same URL repeatedly', async context => {
221221
responseURLs.push(resp.url());
222222
});
223223
await context.page.goto(`${server}/test-prefetch-duplicate.html`);
224-
await sleep();
224+
await context.page.waitForNetworkIdle();
225225

226226
// don't care about first 3 URLs (markup)
227227
const ours = responseURLs.slice(3);
@@ -237,7 +237,7 @@ mainSuite.skip('should not call the same URL repeatedly (shared)', async context
237237
responseURLs.push(resp.url());
238238
});
239239
await context.page.goto(`${server}/test-prefetch-duplicate-shared.html`);
240-
await sleep();
240+
await context.page.waitForNetworkIdle();
241241

242242
// count occurrences of our link
243243
const target = responseURLs.filter(x => x === `${server}/2.html`);
@@ -250,7 +250,7 @@ mainSuite('should not exceed the `limit` total', async context => {
250250
responseURLs.push(resp.url());
251251
});
252252
await context.page.goto(`${server}/test-limit.html`);
253-
await sleep();
253+
await context.page.waitForNetworkIdle();
254254

255255
// don't care about first 3 URLs (markup)
256256
const ours = responseURLs.slice(3);
@@ -297,7 +297,7 @@ mainSuite('should prefetch using a custom function to build the URL', async cont
297297
});
298298

299299
await context.page.goto(`${server}/test-custom-href-function.html`);
300-
await sleep();
300+
await context.page.waitForNetworkIdle();
301301

302302
// don't care about first 3 URLs (markup)
303303
const ours = responseURLs.slice(3);
@@ -313,7 +313,7 @@ mainSuite('should delay prefetch for in-viewport links correctly (UMD)', async c
313313
responseURLs.push(resp.url());
314314
});
315315
await context.page.goto(`${server}/test-delay.html`);
316-
await sleep();
316+
await context.page.waitForNetworkIdle();
317317
assert.instance(responseURLs, Array);
318318
assert.ok(responseURLs.includes(`${server}/1.html`));
319319
assert.ok(responseURLs.includes(`${server}/2.html`));
@@ -345,7 +345,7 @@ mainSuite('should consider threshold option before prefetching (UMD)', async con
345345
width: 1000,
346346
height: 800,
347347
});
348-
await sleep();
348+
await context.page.waitForNetworkIdle();
349349
assert.instance(responseURLs, Array);
350350
assert.ok(responseURLs.includes(`${server}/1.html`));
351351
assert.ok(responseURLs.includes(`${server}/2.html`));

0 commit comments

Comments
 (0)