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

This commit is contained in:
Dmitry Gozman 2020-03-11 14:33:55 -07:00 committed by GitHub
parent 5d4fdd050a
commit 823fffaa65
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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