diff options
Diffstat (limited to 'spec/features')
7 files changed, 15 insertions, 22 deletions
diff --git a/spec/features/dashboard/user_filters_projects_spec.rb b/spec/features/dashboard/user_filters_projects_spec.rb index cb9188cf171..e25da5854ab 100644 --- a/spec/features/dashboard/user_filters_projects_spec.rb +++ b/spec/features/dashboard/user_filters_projects_spec.rb @@ -9,8 +9,6 @@ RSpec.describe 'Dashboard > User filters projects' do let(:project2) { create(:project, name: 'Treasure', namespace: user2.namespace, created_at: 1.second.ago, updated_at: 1.second.ago) } before do - stub_feature_flags(gl_listbox_for_sort_dropdowns: false) - project.add_maintainer(user) sign_in(user) @@ -147,7 +145,14 @@ RSpec.describe 'Dashboard > User filters projects' do end it 'filters any project' do + # Selecting the same option in the `GlListbox` does not emit `select` event + # and that is why URL update won't be triggered. Given that `Any` is a default option + # we need to explicitly switch from some other option (e.g. `Internal`) to `Any` + # to trigger the page update + select_dropdown_option '#filtered-search-visibility-dropdown > .dropdown', 'Internal', '.dropdown-item' + select_dropdown_option '#filtered-search-visibility-dropdown > .dropdown', 'Any', '.dropdown-item' + list = page.all('.projects-list .project-name').map(&:text) expect(list).to contain_exactly("Internal project", "Private project", "Treasure", "Victorialand") diff --git a/spec/features/groups/labels/sort_labels_spec.rb b/spec/features/groups/labels/sort_labels_spec.rb index af4d39bc6fa..9d05703aae6 100644 --- a/spec/features/groups/labels/sort_labels_spec.rb +++ b/spec/features/groups/labels/sort_labels_spec.rb @@ -9,8 +9,6 @@ RSpec.describe 'Sort labels', :js do let!(:label2) { create(:group_label, title: 'Bar', description: 'Fusce consequat', group: group) } before do - stub_feature_flags(gl_listbox_for_sort_dropdowns: false) - group.add_maintainer(user) sign_in(user) @@ -30,7 +28,7 @@ RSpec.describe 'Sort labels', :js do it 'sorts by date' do click_button 'Name' - sort_options = find('ul.dropdown-menu').all('li').collect(&:text) + sort_options = find('ul[role="listbox"]').all('li').collect(&:text) expect(sort_options[0]).to eq('Name') expect(sort_options[1]).to eq('Name, descending') @@ -39,7 +37,7 @@ RSpec.describe 'Sort labels', :js do expect(sort_options[4]).to eq('Updated date') expect(sort_options[5]).to eq('Oldest updated') - click_button 'Name, descending' + find('li', text: 'Name, descending').click # assert default sorting within '.other-labels' do diff --git a/spec/features/groups/milestones_sorting_spec.rb b/spec/features/groups/milestones_sorting_spec.rb index 631aa940270..125bf9ce3a7 100644 --- a/spec/features/groups/milestones_sorting_spec.rb +++ b/spec/features/groups/milestones_sorting_spec.rb @@ -14,7 +14,6 @@ RSpec.describe 'Milestones sorting', :js do let(:user) { create(:group_member, :maintainer, user: create(:user), group: group ).user } before do - stub_feature_flags(gl_listbox_for_sort_dropdowns: false) sign_in(user) end @@ -30,9 +29,9 @@ RSpec.describe 'Milestones sorting', :js do within '[data-testid=milestone_sort_by_dropdown]' do click_button 'Due soon' - expect(find('.gl-new-dropdown-contents').all('.gl-new-dropdown-item-text-wrapper p').map(&:text)).to eq(['Due soon', 'Due later', 'Start soon', 'Start later', 'Name, ascending', 'Name, descending']) + expect(find('ul[role="listbox"]').all('li').map(&:text)).to eq(['Due soon', 'Due later', 'Start soon', 'Start later', 'Name, ascending', 'Name, descending']) - click_button 'Due later' + find('li', text: 'Due later').click expect(page).to have_button('Due later') end diff --git a/spec/features/projects/labels/sort_labels_spec.rb b/spec/features/projects/labels/sort_labels_spec.rb index 6a16f474056..f2f1acd2348 100644 --- a/spec/features/projects/labels/sort_labels_spec.rb +++ b/spec/features/projects/labels/sort_labels_spec.rb @@ -9,8 +9,6 @@ RSpec.describe 'Sort labels', :js do let!(:label2) { create(:label, title: 'Bar', description: 'Fusce consequat', project: project) } before do - stub_feature_flags(gl_listbox_for_sort_dropdowns: false) - project.add_maintainer(user) sign_in(user) @@ -30,7 +28,7 @@ RSpec.describe 'Sort labels', :js do it 'sorts by date' do click_button 'Name' - sort_options = find('ul.dropdown-menu').all('li').collect(&:text) + sort_options = find('ul[role="listbox"]').all('li').collect(&:text) expect(sort_options[0]).to eq('Name') expect(sort_options[1]).to eq('Name, descending') @@ -39,7 +37,7 @@ RSpec.describe 'Sort labels', :js do expect(sort_options[4]).to eq('Updated date') expect(sort_options[5]).to eq('Oldest updated') - click_button 'Name, descending' + find('li', text: 'Name, descending').click # assert default sorting within '.other-labels' do diff --git a/spec/features/projects/milestones/milestones_sorting_spec.rb b/spec/features/projects/milestones/milestones_sorting_spec.rb index 5c379ac1034..5ba4289fd11 100644 --- a/spec/features/projects/milestones/milestones_sorting_spec.rb +++ b/spec/features/projects/milestones/milestones_sorting_spec.rb @@ -21,7 +21,6 @@ RSpec.describe 'Milestones sorting', :js do end before do - stub_feature_flags(gl_listbox_for_sort_dropdowns: false) create(:milestone, start_date: 7.days.from_now, due_date: 10.days.from_now, title: "a", project: project) create(:milestone, start_date: 6.days.from_now, due_date: 11.days.from_now, title: "c", project: project) create(:milestone, start_date: 5.days.from_now, due_date: 12.days.from_now, title: "b", project: project) @@ -43,10 +42,10 @@ RSpec.describe 'Milestones sorting', :js do milestones_for_sort_by.each do |sort_by, expected_milestones| within '[data-testid=milestone_sort_by_dropdown]' do click_button selected_sort_order - milestones = find('.gl-new-dropdown-contents').all('.gl-new-dropdown-item-text-wrapper p').map(&:text) + milestones = find('ul[role="listbox"]').all('li').map(&:text) expect(milestones).to eq(ordered_milestones) - click_button sort_by + find('li', text: sort_by).click expect(page).to have_button(sort_by) end diff --git a/spec/features/projects/user_sorts_projects_spec.rb b/spec/features/projects/user_sorts_projects_spec.rb index 49b9052ed3c..c40f01f3aa1 100644 --- a/spec/features/projects/user_sorts_projects_spec.rb +++ b/spec/features/projects/user_sorts_projects_spec.rb @@ -42,7 +42,6 @@ RSpec.describe 'User sorts projects and order persists' do context "from explore projects", :js do before do - stub_feature_flags(gl_listbox_for_sort_dropdowns: false) sign_in(user) visit(explore_projects_path) find('#sort-projects-dropdown').click @@ -54,7 +53,6 @@ RSpec.describe 'User sorts projects and order persists' do context 'from dashboard projects', :js do before do - stub_feature_flags(gl_listbox_for_sort_dropdowns: false) sign_in(user) visit(dashboard_projects_path) find('#sort-projects-dropdown').click diff --git a/spec/features/projects/wikis_spec.rb b/spec/features/projects/wikis_spec.rb index 8ac17413df3..879ffd2932b 100644 --- a/spec/features/projects/wikis_spec.rb +++ b/spec/features/projects/wikis_spec.rb @@ -3,10 +3,6 @@ require "spec_helper" RSpec.describe 'Project wikis', :js do - before do - stub_feature_flags(gl_listbox_for_sort_dropdowns: false) - end - let_it_be(:user) { create(:user) } let(:wiki) { create(:project_wiki, user: user, project: project) } |