summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Eastwood <contact@ericeastwood.com>2018-06-14 21:31:54 -0500
committerEric Eastwood <contact@ericeastwood.com>2018-06-14 21:31:54 -0500
commita1d0a16bfbef8654684bca828505632bcfaaaeba (patch)
tree7c5e9a1185f343ce603f049fca85c75a6815f23b
parent69966fcb8d19f0ce219a498efb2855902a2895b1 (diff)
downloadgitlab-ce-fix-flakey-groups-filter-list-specs.tar.gz
Fix flakey time-senstive group filter specsfix-flakey-groups-filter-list-specs
This passed previously because the filtered group search is debounced by 0.5s. The test cleared the input, entered `group1`, cleared the input, entered nothing, and the all of groups are still listed because of the 0.5s debounce hasn't triggered and the test passes before anything is actually filtered. Even if we assert that the list is filtered before clearing the input, the test still fails because the nature of the `fill_in 'filter', with: ""` method is that ["if you're setting the value to "", no keys are ever actually sent, hence no [`input`] event"](https://github.com/teamcapybara/capybara/issues/203#issuecomment-557281) and we never filter back to everything in the list. So the solution is two-fold, add in the assertions that the list is actually filtered after each step. Then use a method that fills the input with proper events fired.
-rw-r--r--spec/features/dashboard/groups_list_spec.rb4
-rw-r--r--spec/features/explore/groups_list_spec.rb4
2 files changed, 8 insertions, 0 deletions
diff --git a/spec/features/dashboard/groups_list_spec.rb b/spec/features/dashboard/groups_list_spec.rb
index ed47f7ed390..29280bd6e06 100644
--- a/spec/features/dashboard/groups_list_spec.rb
+++ b/spec/features/dashboard/groups_list_spec.rb
@@ -65,7 +65,11 @@ feature 'Dashboard Groups page', :js do
fill_in 'filter', with: group.name
wait_for_requests
+ expect(page).to have_content(group.name)
+ expect(page).not_to have_content(nested_group.parent.name)
+
fill_in 'filter', with: ''
+ page.find('[name="filter"]').send_keys(:enter)
wait_for_requests
expect(page).to have_content(group.name)
diff --git a/spec/features/explore/groups_list_spec.rb b/spec/features/explore/groups_list_spec.rb
index 801a33979ff..ad02b454aee 100644
--- a/spec/features/explore/groups_list_spec.rb
+++ b/spec/features/explore/groups_list_spec.rb
@@ -35,7 +35,11 @@ describe 'Explore Groups page', :js do
fill_in 'filter', with: group.name
wait_for_requests
+ expect(page).to have_content(group.full_name)
+ expect(page).not_to have_content(public_group.full_name)
+
fill_in 'filter', with: ""
+ page.find('[name="filter"]').send_keys(:enter)
wait_for_requests
expect(page).to have_content(group.full_name)