diff options
author | Stan Hu <stanhu@gmail.com> | 2019-05-09 18:15:42 +0000 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-05-09 18:15:42 +0000 |
commit | 89a4f78b942bdb52d555378a7f6a399cfed1a5f1 (patch) | |
tree | 5c6b1c67ade98f97f950f467dab4f29a502922e6 /spec | |
parent | c333500b36214d1c8b4dcee8c87bc4373b9391e1 (diff) | |
parent | d030a54e507583a3a1bbf74f96e951e5d03be301 (diff) | |
download | gitlab-ce-89a4f78b942bdb52d555378a7f6a399cfed1a5f1.tar.gz |
Merge branch '61635-flaky-spec-dashboard-user_filters_projects_spec' into 'master'
Resolve "Flaky spec: "Dashboard > User filters projects with search bar Sorting Sorting by Stars sorts the project list" / spec/features/dashboard/user_filters_projects_spec.rb:257"
Closes #61635
See merge request gitlab-org/gitlab-ce!28224
Diffstat (limited to 'spec')
-rw-r--r-- | spec/features/dashboard/user_filters_projects_spec.rb | 56 |
1 files changed, 12 insertions, 44 deletions
diff --git a/spec/features/dashboard/user_filters_projects_spec.rb b/spec/features/dashboard/user_filters_projects_spec.rb index 5b17c49db2d..4410c8f887f 100644 --- a/spec/features/dashboard/user_filters_projects_spec.rb +++ b/spec/features/dashboard/user_filters_projects_spec.rb @@ -151,34 +151,22 @@ describe 'Dashboard > User filters projects' do end describe 'Sorting' do - before do - [ - { name: 'Red ribbon army', created_at: 2.days.ago }, - { name: 'Cell saga', created_at: Time.now }, - { name: 'Frieza saga', created_at: 10.days.ago } - ].each do |item| - project = create(:project, name: item[:name], namespace: user.namespace, created_at: item[:created_at]) - project.add_developer(user) - end + let(:desc_sorted_project_names) { %w[Treasure Victorialand] } + before do user.toggle_star(project) user.toggle_star(project2) user2.toggle_star(project2) end - it 'includes sorting direction' do + it 'has all sorting options', :js do sorting_dropdown = page.find('.filtered-search-block #filtered-search-sorting-dropdown') expect(sorting_dropdown).to have_css '.reverse-sort-btn' - end - - it 'has all sorting options', :js do - sorting_dropdown = page.find('.filtered-search-block #filtered-search-sorting-dropdown') - sorting_option_labels = ['Last updated', 'Created date', 'Name', 'Stars'] sorting_dropdown.click - sorting_option_labels.each do |label| + ['Last updated', 'Created date', 'Name', 'Stars'].each do |label| expect(sorting_dropdown).to have_content(label) end end @@ -194,16 +182,11 @@ describe 'Dashboard > User filters projects' do it 'sorts the project list' do select_dropdown_option '#filtered-search-sorting-dropdown', 'Name' - desc = ['Victorialand', 'Treasure', 'Red ribbon army', 'Frieza saga', 'Cell saga'] - asc = ['Cell saga', 'Frieza saga', 'Red ribbon army', 'Treasure', 'Victorialand'] - - click_sort_direction - - expect_to_see_projects(desc) + expect_to_see_projects(desc_sorted_project_names) click_sort_direction - expect_to_see_projects(asc) + expect_to_see_projects(desc_sorted_project_names.reverse) end end @@ -211,16 +194,11 @@ describe 'Dashboard > User filters projects' do it 'sorts the project list' do select_dropdown_option '#filtered-search-sorting-dropdown', 'Last updated' - desc = ["Frieza saga", "Red ribbon army", "Victorialand", "Treasure", "Cell saga"] - asc = ["Cell saga", "Treasure", "Victorialand", "Red ribbon army", "Frieza saga"] + expect_to_see_projects(desc_sorted_project_names) click_sort_direction - expect_to_see_projects(desc) - - click_sort_direction - - expect_to_see_projects(asc) + expect_to_see_projects(desc_sorted_project_names.reverse) end end @@ -228,16 +206,11 @@ describe 'Dashboard > User filters projects' do it 'sorts the project list' do select_dropdown_option '#filtered-search-sorting-dropdown', 'Created date' - desc = ["Frieza saga", "Red ribbon army", "Victorialand", "Treasure", "Cell saga"] - asc = ["Cell saga", "Treasure", "Victorialand", "Red ribbon army", "Frieza saga"] - - click_sort_direction - - expect_to_see_projects(desc) + expect_to_see_projects(desc_sorted_project_names) click_sort_direction - expect_to_see_projects(asc) + expect_to_see_projects(desc_sorted_project_names.reverse) end end @@ -245,16 +218,11 @@ describe 'Dashboard > User filters projects' do it 'sorts the project list' do select_dropdown_option '#filtered-search-sorting-dropdown', 'Stars' - desc = ["Red ribbon army", "Cell saga", "Frieza saga", "Victorialand", "Treasure"] - asc = ["Treasure", "Victorialand", "Red ribbon army", "Cell saga", "Frieza saga"] - - click_sort_direction - - expect_to_see_projects(desc) + expect_to_see_projects(desc_sorted_project_names) click_sort_direction - expect_to_see_projects(asc) + expect_to_see_projects(desc_sorted_project_names.reverse) end end end |