diff --git a/test/coverage.spec.ts b/test/coverage.spec.ts index d3aa3bf2258..b2a8730f0dd 100644 --- a/test/coverage.spec.ts +++ b/test/coverage.spec.ts @@ -240,6 +240,22 @@ describe('Coverage specs', function () { const coverage = await page.coverage.stopCSSCoverage(); 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>(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 () { it('should report stylesheets across navigations', async () => { const { page, server } = getTestState(); @@ -260,21 +276,5 @@ describe('Coverage specs', function () { 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>(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); - }); }); });