chore(test): reorder describes in coverage spec (#7032)

This commit is contained in:
Darío Kondratiuk 2021-04-06 06:30:55 -03:00 committed by GitHub
parent 4152383c2c
commit 138ddc3641
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);
});
}); });
}); });