Fix flaky manage_members test
What does this MR do and why?
Wait for requests before reloading the page and checking the results
Related to #384518 (closed)
Screenshots or screen recordings
N/A
How to set up and validate locally
The assumption why this test is flaky is that the underlying API could be slow sometimes. To replicate the flakiness reliably we can add sleep 10
to the API.
We also need to lift the quarantine from tests
diff --git a/ee/spec/features/groups/members/manage_members_spec.rb b/ee/spec/features/groups/members/manage_members_spec.rb
index d69da3a306c8..9de96729a365 100644
--- a/ee/spec/features/groups/members/manage_members_spec.rb
+++ b/ee/spec/features/groups/members/manage_members_spec.rb
@@ -48,7 +48,7 @@
end
shared_examples "shows an overage modal when adding one user with a given role" do |role|
- it "shows a modal and invites them to a group if confirmed", quarantine: "https://gitlab.com/gitlab-org/gitlab/-/issues/382373" do
+ it "shows a modal and invites them to a group if confirmed" do
group.add_owner(user1)
add_user_by_name(user2.name, role)
diff --git a/lib/api/invitations.rb b/lib/api/invitations.rb
index 6aefdf146cfb..e2cff2dbd200 100644
--- a/lib/api/invitations.rb
+++ b/lib/api/invitations.rb
@@ -38,8 +38,9 @@ class Invitations < ::API::Base
authorize_admin_source!(source_type, source)
create_service_params = params.merge(source: source)
-
+ sleep 10
::Members::InviteService.new(current_user, create_service_params).execute
end
desc 'Get a list of group or project invitations viewable by the authenticated user' do
Now when we run we see 11 test that would fail.
bundle exec rspec ee/spec/features/groups/members/manage_members_spec.rb
When we apply wait_for_requests
to shared examples and run the tests again we will only see 4 tests failing. These are the tests checking that no overage modal is shown. If we remove wait_for_all_requests
(added in !104312 (merged)) from the invite_member
helper all the tests will be green.
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.