@@ -506,55 +506,6 @@ describe('Page.click', function() {
506506 await page . click ( 'button' ) ;
507507 expect ( await page . evaluate ( 'window.clicked' ) ) . toBe ( true ) ;
508508 } ) ;
509- it ( 'should fail to click a button animated via CSS animations and setInterval' , async ( { page} ) => {
510- // This test has a setInterval that consistently animates a button.
511- const buttonSize = 10 ;
512- const containerWidth = 500 ;
513- const transition = 100 ;
514- await page . setContent ( `
515- <html>
516- <body>
517- <div style="border: 1px solid black; height: 50px; overflow: auto; width: ${ containerWidth } px;">
518- <button style="border: none; height: ${ buttonSize } px; width: ${ buttonSize } px; transition: left ${ transition } ms linear 0s; left: 0; position: relative" onClick="window.clicked++"></button>
519- </div>
520- </body>
521- <script>
522- window.atLeft = true;
523- const animateLeft = () => {
524- const button = document.querySelector('button');
525- button.style.left = window.atLeft ? '${ containerWidth - buttonSize } px' : '0px';
526- console.log('set ' + button.style.left);
527- window.atLeft = !window.atLeft;
528- };
529- window.clicked = 0;
530- const dump = () => {
531- const button = document.querySelector('button');
532- const clientRect = button.getBoundingClientRect();
533- const rect = { x: clientRect.top, y: clientRect.left, width: clientRect.width, height: clientRect.height };
534- requestAnimationFrame(dump);
535- };
536- dump();
537- </script>
538- </html>
539- ` ) ;
540- await page . evaluate ( transition => {
541- window . setInterval ( animateLeft , transition ) ;
542- animateLeft ( ) ;
543- } , transition ) ;
544-
545- // Ideally, we we detect the button to be continuously animating, and timeout waiting for it to stop.
546- // That does not happen though:
547- // - Chromium headless does not issue rafs between first and second animateLeft() calls.
548- // - Chromium and WebKit keep element bounds the same when for 2 frames when changing left to a new value.
549- // This test currently documents our flaky behavior, because it's unclear whether we could
550- // guarantee timeout.
551- const error1 = await page . click ( 'button' , { timeout : 250 } ) . catch ( e => e ) ;
552- if ( error1 )
553- expect ( error1 . message ) . toContain ( 'timeout exceeded' ) ;
554- const error2 = await page . click ( 'button' , { timeout : 250 } ) . catch ( e => e ) ;
555- if ( error2 )
556- expect ( error2 . message ) . toContain ( 'timeout exceeded' ) ;
557- } ) ;
558509 it ( 'should report nice error when element is detached and force-clicked' , async ( { page, server} ) => {
559510 await page . goto ( server . PREFIX + '/input/animating-button.html' ) ;
560511 await page . evaluate ( ( ) => addButton ( ) ) ;
0 commit comments