A platform for community discussion. Free, open, simple.
DEV: Improve QUnit acceptance assertion for flaky test (#24400)
Alan Guo Xiang Tanc87f74cef36f
diff --git a/app/assets/javascripts/discourse/tests/acceptance/keyboard-shortcuts-test.js b/app/assets/javascripts/discourse/tests/acceptance/keyboard-shortcuts-test.jsindex 7e7babc240d..d0e4e03d3da 100644--- a/app/assets/javascripts/discourse/tests/acceptance/keyboard-shortcuts-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/keyboard-shortcuts-test.js@@ -80,19 +80,30 @@ acceptance("Keyboard Shortcuts - Anonymous Users", function (needs) {`;await triggerKeyEvent(document, "keypress", "J");+assert- .dom(".post-stream .topic-post.selected #post_1")- .exists("first post is selected");+ .dom(".post-stream .topic-post.selected article")+ .hasAttribute("id", "post_1", "first post is selected");await triggerKeyEvent(document, "keypress", "J");+assert- .dom(".post-stream .topic-post.selected #post_4")- .exists("pressing j moves selection to next visible post");+ .dom(".post-stream .topic-post.selected article")+ .hasAttribute(+ "id",+ "post_4",+ "pressing j moves selection to next visible post"+ );await triggerKeyEvent(document, "keypress", "K");+assert- .dom(".post-stream .topic-post.selected #post_1")- .exists("pressing k moves selection to previous visible post");+ .dom(".post-stream .topic-post.selected article")+ .hasAttribute(+ "id",+ "post_1",+ "pressing k moves selection to previous visible post"+ );});});