DEV: Try fix keyboard shortcut acceptance tests (PR #13576)

Page was not scrolled to top so buttons were not in viewport, so they were being hidden.

await scrollTo() helper does not seem to work, so using jquery instead

GitHub

jQuery doesn’t have any secret sauce :stuck_out_tongue: You should be able to replace it with:

    query("#ember-testing-container").pageYOffset = 0;

(per: jquery/offset.js at a684e6ba836f7c553968d7d026ed7941e1a612d8 · jquery/jquery · GitHub)

@CvX I know that jQuery doesn’t have some secret sauce ;). But when I was using document.getElementById(“X”).scrollTop = 0 it just wasn’t working still. But I will try your suggestion here and see!

(Just a correction: query() won’t work here since the element is not inside #ember-testing)

I should note that historically, keyboard shortcuts are amongst the most difficult things to test. Often I think it’s easier to delete the flakey test if it’s keyboard based than actually fix it, as the trade off of effort/resiliance is questionable.

I should note that historically, keyboard shortcuts are amongst the most difficult things to test. Often I think it’s easier to delete the flakey test if it’s keyboard based than actually fix it, as the trade off of effort/resiliance is questionable.

Yeah I see what you are saying, at the same time we had a regression in core with these shortcuts because we had no tests to catch it :frowning: Also the flakiness here is mainly caused by the behaviour of the Dismiss X buttons, because the top one only shows if the bottom one is out of the viewport, which is caused by the viewport in the test being scrolled to the bottom for whatever zany reason.

If these tests flake more after this merge, I will remove them.

@CvX can you please look again, I removed the satan’s library ( jQuery :stuck_out_tongue: )

    document.getElementById("ember-testing-container").scrollTop = 0;

There’s no Promise to await :slightly_smiling_face:

    document.getElementById("ember-testing-container").scrollTop = 0;
    document.getElementById("ember-testing-container").scrollTop = 0;

(I’m making all three comments in case you want click-to-commit :stuck_out_tongue_closed_eyes:)