Resolve Flaky test: spec/features/broadcast_messages_spec.rb
What does this MR do and why?
Fix and unquarantine flaky tests in #391406 (closed) and #390900 (closed). And modify the test generally to be less flaky.
I think the root cause for these two flaky tests is clicking the close button before JS finishes loading. Similar problem and solution shown here: !61208 (merged). So the original solution which waits the cookie to be set is removed.
Capybara screenshots in original flaky tests issues does not match test cases: showing sign_in
page while tests were visiting explore_projects
page. We suspect this may due to some buggy behaviors from Capybara, so sign_in
methods are replaced with less flaky gitlab_sign_in
.
How to set up and validate locally
To replicate flaky spec, make the following local changes without modifying the spec:
diff --git a/app/assets/javascripts/main.js b/app/assets/javascripts/main.js
index fd002e29afc9..4cc03d31d1fa 100644
--- a/app/assets/javascripts/main.js
+++ b/app/assets/javascripts/main.js
@@ -98,7 +98,7 @@ function deferredInitialisation() {
initLogoAnimation();
initServicePingConsent();
initUserPopovers();
- initBroadcastNotifications();
+ setTimeout(initBroadcastNotifications, 500);
initPersistentUserCallouts();
initDefaultTrackers();
initSidebarTracking();
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #390900 (closed)