Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

test: unflake screenshot test (#3245)

Dmitry Gozman21eafbcdae6e
diff --git a/test/screenshot.jest.js b/test/screenshot.jest.js
index 17c3a9809d..9ec7be161e 100644
--- a/test/screenshot.jest.js
+++ b/test/screenshot.jest.js
@@ -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');
});