Skip to content

Improve deteriminism of simulateDrag

Paul Slaughter requested to merge ps-fix-simulate-drag into master

What does this MR do and why?

This MR addresses an issue identified in this comment where tests using the simulateDrag helper were very flaky.

  • Instead of using setTimeout let's use requestAnimationFrame.
  • Let's also wait a frame between moving and finishing.

Screenshots or screen recordings

Screencast_2021-11-24_20_19_42

How to set up and validate locally

  1. Either on .com or locally, go to an issues board page which has 3 or more issues in the first list.

  2. Remove the export function part of the simulate_drag.js. Copy and paste the simulate_drag.js contents into a browser console (see demo)

  3. Run the following in the browser console:

    simulateDrag({
      scrollable: document.querySelector('body'),
      duration: 1000,
      performDrop: true,
      extraHeight: 0,
      from: {
        el: document.querySelectorAll('.board-list')[0],
        index: 0,
      },
      to: {
        el: document.querySelectorAll('.board-list')[0],
        index: 2
      }
    });

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Paul Slaughter

Merge request reports