From 823fffaa65265aee0a398ea529f156b0ccc2cd33 Mon Sep 17 00:00:00 2001 From: Dmitry Gozman Date: Wed, 11 Mar 2020 14:33:55 -0700 Subject: [PATCH] test: declare setInterval click test as undefined behavior (#1343) --- test/click.spec.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/test/click.spec.js b/test/click.spec.js index ff41951b75..e1ec17cff0 100644 --- a/test/click.spec.js +++ b/test/click.spec.js @@ -507,12 +507,8 @@ module.exports.describe = function({testRunner, expect, playwright, FFOX, CHROMI await page.click('button'); expect(await page.evaluate('window.clicked')).toBe(true); }); - it.fail(true)('should fail to click a button animated via CSS animations and setInterval', async({page}) => { + it('should fail to click a button animated via CSS animations and setInterval', async({page}) => { // This test has a setInterval that consistently animates a button. - // It checks that we detect the button to be continuously animating, and never try to click it. - // This test exposes two issues: - // - Chromium headless does not issue rafs between first and second animateLeft() calls. - // - Chromium and WebKit keep element bounds the same when for 2 frames when changing left to a new value. const buttonSize = 10; const containerWidth = 500; const transition = 100; @@ -546,12 +542,19 @@ module.exports.describe = function({testRunner, expect, playwright, FFOX, CHROMI window.setInterval(animateLeft, transition); animateLeft(); }, transition); + + // Ideally, we we detect the button to be continuously animating, and timeout waiting for it to stop. + // That does not happen though: + // - Chromium headless does not issue rafs between first and second animateLeft() calls. + // - Chromium and WebKit keep element bounds the same when for 2 frames when changing left to a new value. + // This test currently documents our flaky behavior, because it's unclear whether we could + // guarantee timeout. const error1 = await page.click('button', { timeout: 250 }).catch(e => e); - expect(await page.evaluate('window.clicked')).toBe(0); - expect(error1.message).toContain('timeout 250ms exceeded'); + if (error1) + expect(error1.message).toContain('timeout 250ms exceeded'); const error2 = await page.click('button', { timeout: 250 }).catch(e => e); - expect(await page.evaluate('window.clicked')).toBe(0); - expect(error2.message).toContain('timeout 250ms exceeded'); + if (error2) + expect(error2.message).toContain('timeout 250ms exceeded'); }); });