test: unflake screenshot test (#3245)

This commit is contained in:
Dmitry Gozman 2020-07-30 16:49:58 -07:00 committed by GitHub
parent 2f95b6e34e
commit 21eafbcdae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -541,7 +541,10 @@ describe.skip(ffheadful)('ElementHandle.screenshot', function() {
await page.setViewportSize({ width: 500, height: 500 });
await page.goto(server.PREFIX + '/grid.html');
const elementHandle = await page.$('.box:nth-of-type(3)');
await elementHandle.evaluate(e => e.classList.add('animation'));
await elementHandle.evaluate(e => {
e.classList.add('animation');
return new Promise(f => requestAnimationFrame(() => requestAnimationFrame(f)));
});
const screenshot = await elementHandle.screenshot();
expect(screenshot).toBeGolden('screenshot-element-bounding-box.png');
});