From 0fd3bfb986f1673e1665a3f5fcc70b5f1900fa32 Mon Sep 17 00:00:00 2001 From: Joel Einbinder Date: Fri, 12 Oct 2018 13:49:59 -0700 Subject: [PATCH] test(CSSCoverage): failing test when a stylesheet was recently added (#3400) If nobody forces a layout, CSS coverage is inconsistent. This causes some flakes on the bots. The test in this PR fails 90% of the time on my local machine. --- test/coverage.spec.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/coverage.spec.js b/test/coverage.spec.js index 0e354e08..67fac609 100644 --- a/test/coverage.spec.js +++ b/test/coverage.spec.js @@ -189,5 +189,19 @@ module.exports.addTests = function({testRunner, expect}) { expect(coverage.length).toBe(0); }); }); + xit('should work with a recently loaded stylesheet', async function({page, server}) { + await page.coverage.startCSSCoverage(); + await page.evaluate(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); + }); }); };