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.
This commit is contained in:
Joel Einbinder 2018-10-12 13:49:59 -07:00 committed by Andrey Lushnikov
parent a04dedcaf8
commit 0fd3bfb986

View File

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