Skip to content

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

test: declare setInterval click test as undefined behavior (#1343)

Dmitry Gozman823fffaa6526
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');
});
});