mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
chore(test): reorder describes in coverage spec (#7032)
This commit is contained in:
parent
4152383c2c
commit
138ddc3641
@ -240,6 +240,22 @@ describe('Coverage specs', function () {
|
|||||||
const coverage = await page.coverage.stopCSSCoverage();
|
const coverage = await page.coverage.stopCSSCoverage();
|
||||||
expect(coverage.length).toBe(0);
|
expect(coverage.length).toBe(0);
|
||||||
});
|
});
|
||||||
|
it('should work with a recently loaded stylesheet', async () => {
|
||||||
|
const { page, server } = getTestState();
|
||||||
|
|
||||||
|
await page.coverage.startCSSCoverage();
|
||||||
|
await page.evaluate<(url: string) => Promise<void>>(async (url) => {
|
||||||
|
document.body.textContent = 'hello, world';
|
||||||
|
|
||||||
|
const link = document.createElement('link');
|
||||||
|
link.rel = 'stylesheet';
|
||||||
|
link.href = url;
|
||||||
|
document.head.appendChild(link);
|
||||||
|
await new Promise((x) => (link.onload = x));
|
||||||
|
}, server.PREFIX + '/csscoverage/stylesheet1.css');
|
||||||
|
const coverage = await page.coverage.stopCSSCoverage();
|
||||||
|
expect(coverage.length).toBe(1);
|
||||||
|
});
|
||||||
describe('resetOnNavigation', function () {
|
describe('resetOnNavigation', function () {
|
||||||
it('should report stylesheets across navigations', async () => {
|
it('should report stylesheets across navigations', async () => {
|
||||||
const { page, server } = getTestState();
|
const { page, server } = getTestState();
|
||||||
@ -260,21 +276,5 @@ describe('Coverage specs', function () {
|
|||||||
expect(coverage.length).toBe(0);
|
expect(coverage.length).toBe(0);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
it('should work with a recently loaded stylesheet', async () => {
|
|
||||||
const { page, server } = getTestState();
|
|
||||||
|
|
||||||
await page.coverage.startCSSCoverage();
|
|
||||||
await page.evaluate<(url: string) => Promise<void>>(async (url) => {
|
|
||||||
document.body.textContent = 'hello, world';
|
|
||||||
|
|
||||||
const link = document.createElement('link');
|
|
||||||
link.rel = 'stylesheet';
|
|
||||||
link.href = url;
|
|
||||||
document.head.appendChild(link);
|
|
||||||
await new Promise((x) => (link.onload = x));
|
|
||||||
}, server.PREFIX + '/csscoverage/stylesheet1.css');
|
|
||||||
const coverage = await page.coverage.stopCSSCoverage();
|
|
||||||
expect(coverage.length).toBe(1);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user