DEV: Fix flaky fast edit keyboard shortcut QUnit test (#24425)

Why this change?

The test has been flaky on CI with the following assertion failing:

```
not ok 302 Firefox 115.0 - [899 ms] - Browser Id 5 - Acceptance: Fast Edit: Works with keyboard shortcut
    ---
        actual: >
            Element #fast-edit-input does not exist
        expected: >
            Element #fast-edit-input exists
```

The hypothesis here is that we are triggering the `E` keypress event
before the `.quote-button` menu has appeared. When that happens, we will
end up opening the composer instead of triggering the fast edit editor.
This commit is contained in:
Alan Guo Xiang Tan 2023-11-17 08:31:39 +08:00 committed by GitHub
parent e0ef88abca
commit 7c1a4e32a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -45,6 +45,9 @@ acceptance("Fast Edit", function (needs) {
const textNode = query("#post_1 .cooked p").childNodes[0];
await selectText(textNode, 9);
assert.dom(".quote-button").exists();
await triggerKeyEvent(document, "keypress", "E");
assert.dom("#fast-edit-input").exists();
@ -60,7 +63,11 @@ acceptance("Fast Edit", function (needs) {
// Closing
await selectText(textNode, 9);
assert.dom(".quote-button").exists();
await triggerKeyEvent(document, "keypress", "E");
assert.dom("#fast-edit-input").exists();
await triggerKeyEvent("#fast-edit-input", "keydown", "Escape");