diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-02 21:09:47 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-02 21:09:47 +0300 |
commit | 0a9b6b99a9bdcacea434501320f1a8d131a33827 (patch) | |
tree | b3fb338cec894837358b82635c90a52f5b8e0c3d /spec/features | |
parent | d944f09d3212ca8aad09b92dbbae7323ee634237 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features')
9 files changed, 38 insertions, 37 deletions
diff --git a/spec/features/admin/users/users_spec.rb b/spec/features/admin/users/users_spec.rb index 975af84969d..07db0750074 100644 --- a/spec/features/admin/users/users_spec.rb +++ b/spec/features/admin/users/users_spec.rb @@ -5,6 +5,7 @@ require 'spec_helper' RSpec.describe 'Admin::Users', feature_category: :user_management do include Spec::Support::Helpers::Features::AdminUsersHelpers include Spec::Support::Helpers::ModalHelpers + include ListboxHelpers let_it_be(:user, reload: true) { create(:omniauth_user, provider: 'twitter', extern_uid: '123456') } let_it_be(:current_user) { create(:admin) } @@ -608,8 +609,8 @@ RSpec.describe 'Admin::Users', feature_category: :user_management do def sort_by(option) page.within('.filtered-search-block') do - find('.gl-dropdown').click - find('.gl-dropdown-item', text: option).click + find('.gl-new-dropdown').click + select_listbox_item(option) end end end diff --git a/spec/features/incidents/incident_timeline_events_spec.rb b/spec/features/incidents/incident_timeline_events_spec.rb index ffab23c58bc..7404ac64cc9 100644 --- a/spec/features/incidents/incident_timeline_events_spec.rb +++ b/spec/features/incidents/incident_timeline_events_spec.rb @@ -3,6 +3,8 @@ require 'spec_helper' RSpec.describe 'Incident timeline events', :js, feature_category: :incident_management do + include ListboxHelpers + let_it_be(:project) { create(:project) } let_it_be(:user) { create(:user, developer_projects: [project]) } let_it_be(:incident) { create(:incident, project: project) } @@ -47,11 +49,7 @@ RSpec.describe 'Incident timeline events', :js, feature_category: :incident_mana # Add event click_button(s_('Incident|Add new timeline event')) - click_button _('Select tags') - page.within '.gl-dropdown-inner' do - expect(page).to have_content(_('Start time')) - page.find('.gl-dropdown-item-text-wrapper', text: _('Start time')).click - end + select_from_listbox('Start time', from: 'Select tags') complete_form('Event note goes here', '07', '25') @@ -64,11 +62,9 @@ RSpec.describe 'Incident timeline events', :js, feature_category: :incident_mana # Edit event trigger_dropdown_action(_('Edit')) - click_button _('Start time') - page.within '.gl-dropdown-inner' do - page.find('.gl-dropdown-item-text-wrapper', text: _('Start time')).click - end + select_from_listbox('Start time', from: 'Start time') + complete_form('Edited event note goes here', '08', '30') page.within '.timeline-event-note' do diff --git a/spec/features/issuables/sorting_list_spec.rb b/spec/features/issuables/sorting_list_spec.rb index b5362267309..9045124cc8c 100644 --- a/spec/features/issuables/sorting_list_spec.rb +++ b/spec/features/issuables/sorting_list_spec.rb @@ -2,6 +2,8 @@ require 'spec_helper' RSpec.describe 'Sort Issuable List', feature_category: :team_planning do + include ListboxHelpers + let(:project) { create(:project, :public) } let(:first_created_issuable) { issuables.order_created_asc.first } @@ -94,8 +96,7 @@ RSpec.describe 'Sort Issuable List', feature_category: :team_planning do it 'supports sorting in asc and desc order' do visit_merge_requests_with_state(project, 'open') - click_button('Created date') - find('.dropdown-item', text: 'Updated date').click + select_from_listbox('Updated date', from: 'Created date') expect(first_merge_request).to include(last_updated_issuable.title) expect(last_merge_request).to include(first_updated_issuable.title) @@ -209,7 +210,7 @@ RSpec.describe 'Sort Issuable List', feature_category: :team_planning do end def selected_sort_order - find('.filter-dropdown-container .dropdown button').text.downcase + find('.filter-dropdown-container .gl-new-dropdown button').text.downcase end def visit_merge_requests_with_state(project, state) diff --git a/spec/features/jira_connect/branches_spec.rb b/spec/features/jira_connect/branches_spec.rb index 8cf07f2ade2..c90c0d2dda9 100644 --- a/spec/features/jira_connect/branches_spec.rb +++ b/spec/features/jira_connect/branches_spec.rb @@ -20,8 +20,8 @@ RSpec.describe 'Create GitLab branches from Jira', :js, feature_category: :integ sign_in(alice) end - def within_dropdown(&block) - within('.dropdown-menu', &block) + def within_project_listbox(&block) + within('#project-select', &block) end it 'select project and branch and submit the form' do @@ -35,16 +35,16 @@ RSpec.describe 'Create GitLab branches from Jira', :js, feature_category: :integ click_on 'Select a project' - within_dropdown do - expect(page).to have_text('Alice / foo') - expect(page).to have_text('Alice / bar') - expect(page).not_to have_text('Bob /') + within_project_listbox do + expect_listbox_item('Alice / foo') + expect_listbox_item('Alice / bar') + expect_no_listbox_item('Bob /') fill_in 'Search', with: 'foo' - expect(page).not_to have_text('Alice / bar') + expect_no_listbox_item('Alice / bar') - find('span', text: 'Alice / foo', match: :first).click + select_listbox_item('Alice / foo') end expect(page).to have_field('Branch name', with: 'ACME-123-my-issue-title') @@ -61,9 +61,9 @@ RSpec.describe 'Create GitLab branches from Jira', :js, feature_category: :integ find('span', text: 'Alice / foo', match: :first).click - within_dropdown do + within_project_listbox do fill_in 'Search', with: '' - find('span', text: 'Alice / bar', match: :first).click + select_listbox_item('Alice / bar') end click_on 'master' diff --git a/spec/features/merge_request/user_creates_merge_request_spec.rb b/spec/features/merge_request/user_creates_merge_request_spec.rb index 6be0eee21fc..97b423f2cc2 100644 --- a/spec/features/merge_request/user_creates_merge_request_spec.rb +++ b/spec/features/merge_request/user_creates_merge_request_spec.rb @@ -4,6 +4,7 @@ require 'spec_helper' RSpec.describe 'User creates a merge request', :js, feature_category: :code_review_workflow do include ProjectForksHelper + include ListboxHelpers shared_examples 'creates a merge request' do specify do @@ -155,7 +156,7 @@ RSpec.describe 'User creates a merge request', :js, feature_category: :code_revi wait_for_requests find('.gl-listbox-search-input').set(project.full_path) - first('.gl-dropdown-item', text: project.full_path).click + select_listbox_item(project.full_path) end def select_branch(selector, branch) @@ -164,6 +165,6 @@ RSpec.describe 'User creates a merge request', :js, feature_category: :code_revi wait_for_requests find('.gl-listbox-search-input').set(branch) - first('.gl-dropdown-item', text: branch).click + select_listbox_item(branch, exact_text: true) end end diff --git a/spec/features/merge_request/user_creates_mr_spec.rb b/spec/features/merge_request/user_creates_mr_spec.rb index cde1b71a7ee..6ee20a08a47 100644 --- a/spec/features/merge_request/user_creates_mr_spec.rb +++ b/spec/features/merge_request/user_creates_mr_spec.rb @@ -61,7 +61,7 @@ RSpec.describe 'Merge request > User creates MR', feature_category: :code_review find('.js-source-project').click find('.gl-listbox-search-input').set('source') - expect(first('.merge-request-select .dropdown-menu')).not_to have_content(source_project.name) + expect(first('.merge-request-select .gl-new-dropdown-panel')).not_to have_content(source_project.name) end end end diff --git a/spec/features/merge_request/user_selects_branches_for_new_mr_spec.rb b/spec/features/merge_request/user_selects_branches_for_new_mr_spec.rb index f79821e9420..0de59ea21c5 100644 --- a/spec/features/merge_request/user_selects_branches_for_new_mr_spec.rb +++ b/spec/features/merge_request/user_selects_branches_for_new_mr_spec.rb @@ -3,13 +3,15 @@ require 'spec_helper' RSpec.describe 'Merge request > User selects branches for new MR', :js, feature_category: :code_review_workflow do + include ListboxHelpers + let(:project) { create(:project, :public, :repository) } let(:user) { project.creator } def select_source_branch(branch_name) find('.js-source-branch', match: :first).click find('.gl-listbox-search-input').native.send_keys branch_name - find('.gl-dropdown-item', text: branch_name, match: :first).click + select_listbox_item(branch_name) end before do @@ -27,7 +29,7 @@ RSpec.describe 'Merge request > User selects branches for new MR', :js, feature_ expect(page).to have_content('Target branch') first('.js-source-branch').click - find('.gl-dropdown-item', match: :first).click + find('.gl-new-dropdown-item', match: :first).click expect(page).to have_content "b83d6e3" end @@ -44,7 +46,7 @@ RSpec.describe 'Merge request > User selects branches for new MR', :js, feature_ first('.js-target-branch').click find('.gl-listbox-search-input').native.send_keys 'v1.1.0' - find('.gl-dropdown-item', text: 'v1.1.0', match: :first).click + select_listbox_item('v1.1.0') expect(page).to have_content "b83d6e3" end diff --git a/spec/features/merge_requests/user_sorts_merge_requests_spec.rb b/spec/features/merge_requests/user_sorts_merge_requests_spec.rb index cf99f2cb94a..58d796f8288 100644 --- a/spec/features/merge_requests/user_sorts_merge_requests_spec.rb +++ b/spec/features/merge_requests/user_sorts_merge_requests_spec.rb @@ -27,15 +27,15 @@ RSpec.describe 'User sorts merge requests', :js, feature_category: :code_review_ visit(merge_requests_dashboard_path(assignee_username: user.username)) - expect(find('.filter-dropdown-container button.dropdown-toggle')).to have_content('Milestone') + expect(find('.filter-dropdown-container button.gl-new-dropdown-toggle')).to have_content('Milestone') visit(project_merge_requests_path(project)) - expect(find('.filter-dropdown-container button.dropdown-toggle')).to have_content('Milestone') + expect(find('.filter-dropdown-container button.gl-new-dropdown-toggle')).to have_content('Milestone') visit(merge_requests_group_path(group)) - expect(find('.filter-dropdown-container button.dropdown-toggle')).to have_content('Milestone') + expect(find('.filter-dropdown-container button.gl-new-dropdown-toggle')).to have_content('Milestone') end it 'fallbacks to issuable_sort cookie key when remembering the sorting option' do @@ -43,7 +43,7 @@ RSpec.describe 'User sorts merge requests', :js, feature_category: :code_review_ visit(merge_requests_dashboard_path(assignee_username: user.username)) - expect(find('.filter-dropdown-container button.dropdown-toggle')).to have_content('Milestone') + expect(find('.filter-dropdown-container button.gl-new-dropdown-toggle')).to have_content('Milestone') end it 'separates remember sorting with issues', :js do diff --git a/spec/features/projects/pipelines/pipelines_spec.rb b/spec/features/projects/pipelines/pipelines_spec.rb index 6a44f421249..b5f640f1cca 100644 --- a/spec/features/projects/pipelines/pipelines_spec.rb +++ b/spec/features/projects/pipelines/pipelines_spec.rb @@ -597,8 +597,8 @@ RSpec.describe 'Pipelines', :js, feature_category: :projects do it 'changes the Pipeline ID column for Pipeline IID' do page.find('[data-testid="pipeline-key-collapsible-box"]').click - within '.gl-dropdown-contents' do - dropdown_options = page.find_all '.gl-dropdown-item' + within '.gl-new-dropdown-contents' do + dropdown_options = page.find_all '.gl-new-dropdown-item' dropdown_options[1].click end @@ -675,7 +675,7 @@ RSpec.describe 'Pipelines', :js, feature_category: :projects do click_button project.default_branch wait_for_requests - find('.gl-dropdown-item', text: 'master').click + find('.gl-new-dropdown-item', text: 'master').click wait_for_requests end |