diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-04 09:08:20 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-04 09:08:20 +0000 |
commit | d80f3cd75e700b6e62910865bfd36734644ffa89 (patch) | |
tree | aa2fa2f2b4385854c13591bef8e74924ef661657 /spec/features | |
parent | be81c1578d65f25edfde8aa550f190b8d3e6d976 (diff) | |
download | gitlab-ce-d80f3cd75e700b6e62910865bfd36734644ffa89.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features')
27 files changed, 306 insertions, 107 deletions
diff --git a/spec/features/admin/admin_runners_spec.rb b/spec/features/admin/admin_runners_spec.rb index 6bcadda6523..ca2fd2f2e9e 100644 --- a/spec/features/admin/admin_runners_spec.rb +++ b/spec/features/admin/admin_runners_spec.rb @@ -57,7 +57,7 @@ describe "Admin Runners" do expect(page).to have_content 'runner-active' expect(page).to have_content 'runner-paused' - input_filtered_search_keys('status=active') + input_filtered_search_keys('status:=active') expect(page).to have_content 'runner-active' expect(page).not_to have_content 'runner-paused' end @@ -68,7 +68,7 @@ describe "Admin Runners" do visit admin_runners_path - input_filtered_search_keys('status=offline') + input_filtered_search_keys('status:=offline') expect(page).not_to have_content 'runner-active' expect(page).not_to have_content 'runner-paused' @@ -83,12 +83,12 @@ describe "Admin Runners" do visit admin_runners_path - input_filtered_search_keys('status=active') + input_filtered_search_keys('status:=active') expect(page).to have_content 'runner-a-1' expect(page).to have_content 'runner-b-1' expect(page).not_to have_content 'runner-a-2' - input_filtered_search_keys('status=active runner-a') + input_filtered_search_keys('status:=active runner-a') expect(page).to have_content 'runner-a-1' expect(page).not_to have_content 'runner-b-1' expect(page).not_to have_content 'runner-a-2' @@ -105,7 +105,7 @@ describe "Admin Runners" do expect(page).to have_content 'runner-project' expect(page).to have_content 'runner-group' - input_filtered_search_keys('type=project_type') + input_filtered_search_keys('type:=project_type') expect(page).to have_content 'runner-project' expect(page).not_to have_content 'runner-group' end @@ -116,7 +116,7 @@ describe "Admin Runners" do visit admin_runners_path - input_filtered_search_keys('type=instance_type') + input_filtered_search_keys('type:=instance_type') expect(page).not_to have_content 'runner-project' expect(page).not_to have_content 'runner-group' @@ -131,12 +131,12 @@ describe "Admin Runners" do visit admin_runners_path - input_filtered_search_keys('type=project_type') + input_filtered_search_keys('type:=project_type') expect(page).to have_content 'runner-a-1' expect(page).to have_content 'runner-b-1' expect(page).not_to have_content 'runner-a-2' - input_filtered_search_keys('type=project_type runner-a') + input_filtered_search_keys('type:=project_type runner-a') expect(page).to have_content 'runner-a-1' expect(page).not_to have_content 'runner-b-1' expect(page).not_to have_content 'runner-a-2' @@ -153,7 +153,7 @@ describe "Admin Runners" do expect(page).to have_content 'runner-blue' expect(page).to have_content 'runner-red' - input_filtered_search_keys('tag=blue') + input_filtered_search_keys('tag:=blue') expect(page).to have_content 'runner-blue' expect(page).not_to have_content 'runner-red' @@ -165,7 +165,7 @@ describe "Admin Runners" do visit admin_runners_path - input_filtered_search_keys('tag=red') + input_filtered_search_keys('tag:=red') expect(page).not_to have_content 'runner-blue' expect(page).not_to have_content 'runner-blue' @@ -179,13 +179,13 @@ describe "Admin Runners" do visit admin_runners_path - input_filtered_search_keys('tag=blue') + input_filtered_search_keys('tag:=blue') expect(page).to have_content 'runner-a-1' expect(page).to have_content 'runner-b-1' expect(page).not_to have_content 'runner-a-2' - input_filtered_search_keys('tag=blue runner-a') + input_filtered_search_keys('tag:=blue runner-a') expect(page).to have_content 'runner-a-1' expect(page).not_to have_content 'runner-b-1' diff --git a/spec/features/boards/boards_spec.rb b/spec/features/boards/boards_spec.rb index 8aad598b843..db6bb639e79 100644 --- a/spec/features/boards/boards_spec.rb +++ b/spec/features/boards/boards_spec.rb @@ -624,7 +624,7 @@ describe 'Issue Boards', :js do end def set_filter(type, text) - find('.filtered-search').native.send_keys("#{type}=#{text}") + find('.filtered-search').native.send_keys("#{type}:=#{text}") end def submit_filter diff --git a/spec/features/boards/modal_filter_spec.rb b/spec/features/boards/modal_filter_spec.rb index d14041ecf3f..31f4c502c61 100644 --- a/spec/features/boards/modal_filter_spec.rb +++ b/spec/features/boards/modal_filter_spec.rb @@ -211,7 +211,7 @@ describe 'Issue Boards add issue modal filtering', :js do end def set_filter(type, text = '') - find('.add-issues-modal .filtered-search').native.send_keys("#{type}=#{text}") + find('.add-issues-modal .filtered-search').native.send_keys("#{type}:=#{text}") end def submit_filter diff --git a/spec/features/dashboard/issues_filter_spec.rb b/spec/features/dashboard/issues_filter_spec.rb index 8e7fd1f500f..8e2a3d983b1 100644 --- a/spec/features/dashboard/issues_filter_spec.rb +++ b/spec/features/dashboard/issues_filter_spec.rb @@ -28,14 +28,14 @@ describe 'Dashboard Issues filtering', :js do context 'filtering by milestone' do it 'shows all issues with no milestone' do - input_filtered_search("milestone=none") + input_filtered_search("milestone:=none") expect(page).to have_issuable_counts(open: 1, closed: 0, all: 1) expect(page).to have_selector('.issue', count: 1) end it 'shows all issues with the selected milestone' do - input_filtered_search("milestone=%\"#{milestone.title}\"") + input_filtered_search("milestone:=%\"#{milestone.title}\"") expect(page).to have_issuable_counts(open: 1, closed: 0, all: 1) expect(page).to have_selector('.issue', count: 1) @@ -63,7 +63,7 @@ describe 'Dashboard Issues filtering', :js do let!(:label_link) { create(:label_link, label: label, target: issue) } it 'shows all issues with the selected label' do - input_filtered_search("label=~#{label.title}") + input_filtered_search("label:=~#{label.title}") page.within 'ul.content-list' do expect(page).to have_content issue.title diff --git a/spec/features/dashboard/issues_spec.rb b/spec/features/dashboard/issues_spec.rb index a2ead1b5d33..ff661014fb9 100644 --- a/spec/features/dashboard/issues_spec.rb +++ b/spec/features/dashboard/issues_spec.rb @@ -30,7 +30,7 @@ RSpec.describe 'Dashboard Issues' do it 'shows issues when current user is author', :js do reset_filters - input_filtered_search("author=#{current_user.to_reference}") + input_filtered_search("author:=#{current_user.to_reference}") expect(page).to have_content(authored_issue.title) expect(page).to have_content(authored_issue_on_public_project.title) diff --git a/spec/features/dashboard/merge_requests_spec.rb b/spec/features/dashboard/merge_requests_spec.rb index bb515cfae82..0c728ab22de 100644 --- a/spec/features/dashboard/merge_requests_spec.rb +++ b/spec/features/dashboard/merge_requests_spec.rb @@ -107,7 +107,7 @@ describe 'Dashboard Merge Requests' do it 'shows authored merge requests', :js do reset_filters - input_filtered_search("author=#{current_user.to_reference}") + input_filtered_search("author:=#{current_user.to_reference}") expect(page).to have_content(authored_merge_request.title) expect(page).to have_content(authored_merge_request_from_fork.title) @@ -120,7 +120,7 @@ describe 'Dashboard Merge Requests' do it 'shows labeled merge requests', :js do reset_filters - input_filtered_search("label=#{label.name}") + input_filtered_search("label:=#{label.name}") expect(page).to have_content(labeled_merge_request.title) diff --git a/spec/features/dashboard/projects_spec.rb b/spec/features/dashboard/projects_spec.rb index 9bd2e85e3b8..73f759f8a54 100644 --- a/spec/features/dashboard/projects_spec.rb +++ b/spec/features/dashboard/projects_spec.rb @@ -152,6 +152,61 @@ describe 'Dashboard Projects' do end end + describe 'with a pipeline', :clean_gitlab_redis_shared_state do + let(:pipeline) { create(:ci_pipeline, project: project, sha: project.commit.sha, ref: project.default_branch) } + + before do + # Since the cache isn't updated when a new pipeline is created + # we need the pipeline to advance in the pipeline since the cache was created + # by visiting the login page. + pipeline.succeed + end + + it 'shows that the last pipeline passed' do + visit dashboard_projects_path + + page.within('.controls') do + expect(page).to have_xpath("//a[@href='#{pipelines_project_commit_path(project, project.commit, ref: pipeline.ref)}']") + expect(page).to have_css('.ci-status-link') + expect(page).to have_css('.ci-status-icon-success') + expect(page).to have_link('Pipeline: passed') + end + end + + shared_examples 'hidden pipeline status' do + it 'does not show the pipeline status' do + visit dashboard_projects_path + + page.within('.controls') do + expect(page).not_to have_xpath("//a[@href='#{pipelines_project_commit_path(project, project.commit, ref: pipeline.ref)}']") + expect(page).not_to have_css('.ci-status-link') + expect(page).not_to have_css('.ci-status-icon-success') + expect(page).not_to have_link('Pipeline: passed') + end + end + end + + context 'guest user of project and project has private pipelines' do + let(:guest_user) { create(:user) } + + before do + project.update(public_builds: false) + project.add_guest(guest_user) + sign_in(guest_user) + end + + it_behaves_like 'hidden pipeline status' + end + + context 'when dashboard_pipeline_status is disabled' do + before do + stub_feature_flags(dashboard_pipeline_status: false) + end + + it_behaves_like 'hidden pipeline status' + end + end + context 'last push widget', :use_clean_rails_memory_store_caching do before do event = create(:push_event, project: project, author: user) diff --git a/spec/features/groups/issues_spec.rb b/spec/features/groups/issues_spec.rb index a3fa87e3242..5b2e98804b0 100644 --- a/spec/features/groups/issues_spec.rb +++ b/spec/features/groups/issues_spec.rb @@ -48,7 +48,7 @@ describe 'Group issues page' do let(:user2) { user_outside_group } it 'filters by only group users' do - filtered_search.set('assignee=') + filtered_search.set('assignee:=') expect(find('#js-dropdown-assignee .filter-dropdown')).to have_content(user.name) expect(find('#js-dropdown-assignee .filter-dropdown')).not_to have_content(user2.name) diff --git a/spec/features/groups/merge_requests_spec.rb b/spec/features/groups/merge_requests_spec.rb index 0038a8e4892..f87fa10e2f4 100644 --- a/spec/features/groups/merge_requests_spec.rb +++ b/spec/features/groups/merge_requests_spec.rb @@ -52,7 +52,7 @@ describe 'Group merge requests page' do let(:user2) { user_outside_group } it 'filters by assignee only group users' do - filtered_search.set('assignee=') + filtered_search.set('assignee:=') expect(find('#js-dropdown-assignee .filter-dropdown')).to have_content(user.name) expect(find('#js-dropdown-assignee .filter-dropdown')).not_to have_content(user2.name) diff --git a/spec/features/issues/filtered_search/dropdown_assignee_spec.rb b/spec/features/issues/filtered_search/dropdown_assignee_spec.rb index 8aa29cddd5f..c207e91f02e 100644 --- a/spec/features/issues/filtered_search/dropdown_assignee_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_assignee_spec.rb @@ -20,13 +20,13 @@ describe 'Dropdown assignee', :js do describe 'behavior' do it 'loads all the assignees when opened' do - input_filtered_search('assignee=', submit: false, extra_space: false) + input_filtered_search('assignee:=', submit: false, extra_space: false) expect_filtered_search_dropdown_results(filter_dropdown, 2) end it 'shows current user at top of dropdown' do - input_filtered_search('assignee=', submit: false, extra_space: false) + input_filtered_search('assignee:=', submit: false, extra_space: false) expect(filter_dropdown.first('.filter-dropdown-item')).to have_content(user.name) end @@ -35,7 +35,7 @@ describe 'Dropdown assignee', :js do describe 'selecting from dropdown without Ajax call' do before do Gitlab::Testing::RequestBlockerMiddleware.block_requests! - input_filtered_search('assignee=', submit: false, extra_space: false) + input_filtered_search('assignee:=', submit: false, extra_space: false) end after do diff --git a/spec/features/issues/filtered_search/dropdown_author_spec.rb b/spec/features/issues/filtered_search/dropdown_author_spec.rb index c95bd7071b3..8ded11b3b08 100644 --- a/spec/features/issues/filtered_search/dropdown_author_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_author_spec.rb @@ -20,13 +20,13 @@ describe 'Dropdown author', :js do describe 'behavior' do it 'loads all the authors when opened' do - input_filtered_search('author=', submit: false, extra_space: false) + input_filtered_search('author:=', submit: false, extra_space: false) expect_filtered_search_dropdown_results(filter_dropdown, 2) end it 'shows current user at top of dropdown' do - input_filtered_search('author=', submit: false, extra_space: false) + input_filtered_search('author:=', submit: false, extra_space: false) expect(filter_dropdown.first('.filter-dropdown-item')).to have_content(user.name) end @@ -35,7 +35,7 @@ describe 'Dropdown author', :js do describe 'selecting from dropdown without Ajax call' do before do Gitlab::Testing::RequestBlockerMiddleware.block_requests! - input_filtered_search('author=', submit: false, extra_space: false) + input_filtered_search('author:=', submit: false, extra_space: false) end after do diff --git a/spec/features/issues/filtered_search/dropdown_base_spec.rb b/spec/features/issues/filtered_search/dropdown_base_spec.rb index 2a800f054a0..14d3f48b8fc 100644 --- a/spec/features/issues/filtered_search/dropdown_base_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_base_spec.rb @@ -27,14 +27,14 @@ describe 'Dropdown base', :js do it 'shows loading indicator when opened' do slow_requests do # We aren't using `input_filtered_search` because we want to see the loading indicator - filtered_search.set('assignee=') + filtered_search.set('assignee:=') expect(page).to have_css("#{js_dropdown_assignee} .filter-dropdown-loading", visible: true) end end it 'hides loading indicator when loaded' do - input_filtered_search('assignee=', submit: false, extra_space: false) + input_filtered_search('assignee:=', submit: false, extra_space: false) expect(find(js_dropdown_assignee)).not_to have_css('.filter-dropdown-loading') end @@ -42,7 +42,7 @@ describe 'Dropdown base', :js do describe 'caching requests' do it 'caches requests after the first load' do - input_filtered_search('assignee=', submit: false, extra_space: false) + input_filtered_search('assignee:=', submit: false, extra_space: false) initial_size = dropdown_assignee_size expect(initial_size).to be > 0 @@ -50,7 +50,7 @@ describe 'Dropdown base', :js do new_user = create(:user) project.add_maintainer(new_user) find('.filtered-search-box .clear-search').click - input_filtered_search('assignee=', submit: false, extra_space: false) + input_filtered_search('assignee:=', submit: false, extra_space: false) expect(dropdown_assignee_size).to eq(initial_size) end diff --git a/spec/features/issues/filtered_search/dropdown_emoji_spec.rb b/spec/features/issues/filtered_search/dropdown_emoji_spec.rb index 4c11f83318b..9ab0f49cd15 100644 --- a/spec/features/issues/filtered_search/dropdown_emoji_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_emoji_spec.rb @@ -43,19 +43,19 @@ describe 'Dropdown emoji', :js do describe 'behavior' do it 'opens when the search bar has my-reaction=' do - filtered_search.set('my-reaction=') + filtered_search.set('my-reaction:=') expect(page).to have_css(js_dropdown_emoji, visible: true) end it 'loads all the emojis when opened' do - input_filtered_search('my-reaction=', submit: false, extra_space: false) + input_filtered_search('my-reaction:=', submit: false, extra_space: false) expect_filtered_search_dropdown_results(filter_dropdown, 3) end it 'shows the most populated emoji at top of dropdown' do - input_filtered_search('my-reaction=', submit: false, extra_space: false) + input_filtered_search('my-reaction:=', submit: false, extra_space: false) expect(first("#{js_dropdown_emoji} .filter-dropdown li")).to have_content(award_emoji_star.name) end diff --git a/spec/features/issues/filtered_search/dropdown_label_spec.rb b/spec/features/issues/filtered_search/dropdown_label_spec.rb index 1e90efc8d56..a982053dbcb 100644 --- a/spec/features/issues/filtered_search/dropdown_label_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_label_spec.rb @@ -21,7 +21,7 @@ describe 'Dropdown label', :js do describe 'behavior' do it 'loads all the labels when opened' do create(:label, project: project, title: 'bug-label') - filtered_search.set('label=') + filtered_search.set('label:=') expect_filtered_search_dropdown_results(filter_dropdown, 1) end diff --git a/spec/features/issues/filtered_search/dropdown_milestone_spec.rb b/spec/features/issues/filtered_search/dropdown_milestone_spec.rb index 1f62a8e0c8d..56beb35a1c5 100644 --- a/spec/features/issues/filtered_search/dropdown_milestone_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_milestone_spec.rb @@ -23,7 +23,7 @@ describe 'Dropdown milestone', :js do describe 'behavior' do before do - filtered_search.set('milestone=') + filtered_search.set('milestone:=') end it 'loads all the milestones when opened' do diff --git a/spec/features/issues/filtered_search/dropdown_release_spec.rb b/spec/features/issues/filtered_search/dropdown_release_spec.rb index fd0a98f9ddc..ae1c84d71b4 100644 --- a/spec/features/issues/filtered_search/dropdown_release_spec.rb +++ b/spec/features/issues/filtered_search/dropdown_release_spec.rb @@ -23,7 +23,7 @@ describe 'Dropdown release', :js do describe 'behavior' do before do - filtered_search.set('release=') + filtered_search.set('release:=') end it 'loads all the releases when opened' do diff --git a/spec/features/issues/filtered_search/filter_issues_spec.rb b/spec/features/issues/filtered_search/filter_issues_spec.rb index a518831ea2b..756699fb854 100644 --- a/spec/features/issues/filtered_search/filter_issues_spec.rb +++ b/spec/features/issues/filtered_search/filter_issues_spec.rb @@ -67,7 +67,7 @@ describe 'Filter issues', :js do it 'filters by all available tokens' do search_term = 'issue' - input_filtered_search("assignee=@#{user.username} author=@#{user.username} label=~#{caps_sensitive_label.title} milestone=%#{milestone.title} #{search_term}") + input_filtered_search("assignee:=@#{user.username} author:=@#{user.username} label:=~#{caps_sensitive_label.title} milestone:=%#{milestone.title} #{search_term}") wait_for_requests @@ -84,7 +84,7 @@ describe 'Filter issues', :js do describe 'filter issues by author' do context 'only author' do it 'filters issues by searched author' do - input_filtered_search("author=@#{user.username}") + input_filtered_search("author:=@#{user.username}") wait_for_requests @@ -98,7 +98,7 @@ describe 'Filter issues', :js do describe 'filter issues by assignee' do context 'only assignee' do it 'filters issues by searched assignee' do - input_filtered_search("assignee=@#{user.username}") + input_filtered_search("assignee:=@#{user.username}") wait_for_requests @@ -108,7 +108,7 @@ describe 'Filter issues', :js do end it 'filters issues by no assignee' do - input_filtered_search('assignee=none') + input_filtered_search('assignee:=none') expect_tokens([assignee_token('None')]) expect_issues_list_count(3) @@ -122,7 +122,7 @@ describe 'Filter issues', :js do it 'filters issues by multiple assignees' do create(:issue, project: project, author: user, assignees: [user2, user]) - input_filtered_search("assignee=@#{user.username} assignee=@#{user2.username}") + input_filtered_search("assignee:=@#{user.username} assignee:=@#{user2.username}") expect_tokens([ assignee_token(user.name), @@ -138,7 +138,7 @@ describe 'Filter issues', :js do describe 'filter issues by label' do context 'only label' do it 'filters issues by searched label' do - input_filtered_search("label=~#{bug_label.title}") + input_filtered_search("label:=~#{bug_label.title}") expect_tokens([label_token(bug_label.title)]) expect_issues_list_count(2) @@ -146,7 +146,7 @@ describe 'Filter issues', :js do end it 'filters issues not containing searched label' do - input_filtered_search("label!=~#{bug_label.title}") + input_filtered_search("label:!=~#{bug_label.title}") expect_tokens([label_token(bug_label.title)]) expect_issues_list_count(6) @@ -154,7 +154,7 @@ describe 'Filter issues', :js do end it 'filters issues by no label' do - input_filtered_search('label=none') + input_filtered_search('label:=none') expect_tokens([label_token('None', false)]) expect_issues_list_count(4) @@ -162,7 +162,7 @@ describe 'Filter issues', :js do end it 'filters issues by no label' do - input_filtered_search('label!=none') + input_filtered_search('label:!=none') expect_tokens([label_token('None', false)]) expect_issues_list_count(4) @@ -170,7 +170,7 @@ describe 'Filter issues', :js do end it 'filters issues by multiple labels' do - input_filtered_search("label=~#{bug_label.title} label=~#{caps_sensitive_label.title}") + input_filtered_search("label:=~#{bug_label.title} label:=~#{caps_sensitive_label.title}") expect_tokens([ label_token(bug_label.title), @@ -181,7 +181,7 @@ describe 'Filter issues', :js do end it 'filters issues by multiple labels with not operator' do - input_filtered_search("label!=~#{bug_label.title} label=~#{caps_sensitive_label.title}") + input_filtered_search("label:!=~#{bug_label.title} label:=~#{caps_sensitive_label.title}") expect_tokens([ label_token(bug_label.title), @@ -196,7 +196,7 @@ describe 'Filter issues', :js do special_issue = create(:issue, title: "Issue with special character label", project: project) special_issue.labels << special_label - input_filtered_search("label=~#{special_label.title}") + input_filtered_search("label:=~#{special_label.title}") expect_tokens([label_token(special_label.title)]) expect_issues_list_count(1) @@ -208,7 +208,7 @@ describe 'Filter issues', :js do special_issue = create(:issue, title: "Issue with special character label", project: project) special_issue.labels << special_label - input_filtered_search("label!=~#{special_label.title}") + input_filtered_search("label:!=~#{special_label.title}") expect_tokens([label_token(special_label.title)]) expect_issues_list_count(8) @@ -218,7 +218,7 @@ describe 'Filter issues', :js do it 'does not show issues for unused labels' do new_label = create(:label, project: project, title: 'new_label') - input_filtered_search("label=~#{new_label.title}") + input_filtered_search("label:=~#{new_label.title}") expect_tokens([label_token(new_label.title)]) expect_no_issues_list @@ -226,7 +226,7 @@ describe 'Filter issues', :js do end it 'does show issues for bug label' do - input_filtered_search("label!=~#{bug_label.title}") + input_filtered_search("label:!=~#{bug_label.title}") expect_tokens([label_token(bug_label.title)]) expect_issues_list_count(6) @@ -240,7 +240,7 @@ describe 'Filter issues', :js do special_multiple_issue = create(:issue, title: "Issue with special character multiple words label", project: project) special_multiple_issue.labels << special_multiple_label - input_filtered_search("label=~'#{special_multiple_label.title}'") + input_filtered_search("label:=~'#{special_multiple_label.title}'") # Check for search results (which makes sure that the page has changed) expect_issues_list_count(1) @@ -252,7 +252,7 @@ describe 'Filter issues', :js do end it 'single quotes' do - input_filtered_search("label=~'#{multiple_words_label.title}'") + input_filtered_search("label:=~'#{multiple_words_label.title}'") expect_issues_list_count(1) expect_tokens([label_token("\"#{multiple_words_label.title}\"")]) @@ -260,7 +260,7 @@ describe 'Filter issues', :js do end it 'double quotes' do - input_filtered_search("label=~\"#{multiple_words_label.title}\"") + input_filtered_search("label:=~\"#{multiple_words_label.title}\"") expect_tokens([label_token("\"#{multiple_words_label.title}\"")]) expect_issues_list_count(1) @@ -272,7 +272,7 @@ describe 'Filter issues', :js do double_quotes_label_issue = create(:issue, title: "Issue with double quotes label", project: project) double_quotes_label_issue.labels << double_quotes_label - input_filtered_search("label=~'#{double_quotes_label.title}'") + input_filtered_search("label:=~'#{double_quotes_label.title}'") expect_tokens([label_token("'#{double_quotes_label.title}'")]) expect_issues_list_count(1) @@ -284,7 +284,7 @@ describe 'Filter issues', :js do single_quotes_label_issue = create(:issue, title: "Issue with single quotes label", project: project) single_quotes_label_issue.labels << single_quotes_label - input_filtered_search("label=~\"#{single_quotes_label.title}\"") + input_filtered_search("label:=~\"#{single_quotes_label.title}\"") expect_tokens([label_token("\"#{single_quotes_label.title}\"")]) expect_issues_list_count(1) @@ -296,7 +296,7 @@ describe 'Filter issues', :js do it 'filters issues by searched label, label2, author, assignee, milestone and text' do search_term = 'bug' - input_filtered_search("label=~#{bug_label.title} label=~#{caps_sensitive_label.title} author=@#{user.username} assignee=@#{user.username} milestone=%#{milestone.title} #{search_term}") + input_filtered_search("label:=~#{bug_label.title} label:=~#{caps_sensitive_label.title} author:=@#{user.username} assignee:=@#{user.username} milestone:=%#{milestone.title} #{search_term}") wait_for_requests @@ -314,7 +314,7 @@ describe 'Filter issues', :js do it 'filters issues by searched label, label2, author, assignee, not included in a milestone' do search_term = 'bug' - input_filtered_search("label=~#{bug_label.title} label=~#{caps_sensitive_label.title} author=@#{user.username} assignee=@#{user.username} milestone!=%#{milestone.title} #{search_term}") + input_filtered_search("label:=~#{bug_label.title} label:=~#{caps_sensitive_label.title} author:=@#{user.username} assignee:=@#{user.username} milestone:!=%#{milestone.title} #{search_term}") wait_for_requests @@ -344,7 +344,7 @@ describe 'Filter issues', :js do describe 'filter issues by milestone' do context 'only milestone' do it 'filters issues by searched milestone' do - input_filtered_search("milestone=%#{milestone.title}") + input_filtered_search("milestone:=%#{milestone.title}") expect_tokens([milestone_token(milestone.title)]) expect_issues_list_count(5) @@ -352,7 +352,7 @@ describe 'Filter issues', :js do end it 'filters issues by no milestone' do - input_filtered_search("milestone=none") + input_filtered_search("milestone:=none") expect_tokens([milestone_token('None', false)]) expect_issues_list_count(3) @@ -360,7 +360,7 @@ describe 'Filter issues', :js do end it 'filters issues by negation of no milestone' do - input_filtered_search("milestone!=none ") + input_filtered_search("milestone:!=none ") expect_tokens([milestone_token('None', false, '!=')]) expect_issues_list_count(5) @@ -372,7 +372,7 @@ describe 'Filter issues', :js do create(:issue, project: project, milestone: future_milestone, author: user) end - input_filtered_search("milestone=upcoming") + input_filtered_search("milestone:=upcoming") expect_tokens([milestone_token('Upcoming', false)]) expect_issues_list_count(1) @@ -384,7 +384,7 @@ describe 'Filter issues', :js do create(:issue, project: project, milestone: future_milestone, author: user) end - input_filtered_search("milestone!=upcoming") + input_filtered_search("milestone:!=upcoming") expect_tokens([milestone_token('Upcoming', false, '!=')]) expect_issues_list_count(8) @@ -392,7 +392,7 @@ describe 'Filter issues', :js do end it 'filters issues by started milestones' do - input_filtered_search("milestone=started") + input_filtered_search("milestone:=started") expect_tokens([milestone_token('Started', false)]) expect_issues_list_count(5) @@ -400,7 +400,7 @@ describe 'Filter issues', :js do end it 'filters issues by negation of started milestones' do - input_filtered_search("milestone!=started") + input_filtered_search("milestone:!=started") expect_tokens([milestone_token('Started', false, '!=')]) expect_issues_list_count(3) @@ -411,7 +411,7 @@ describe 'Filter issues', :js do special_milestone = create(:milestone, title: '!@\#{$%^&*()}', project: project) create(:issue, project: project, milestone: special_milestone) - input_filtered_search("milestone=%#{special_milestone.title}") + input_filtered_search("milestone:=%#{special_milestone.title}") expect_tokens([milestone_token(special_milestone.title)]) expect_issues_list_count(1) @@ -422,7 +422,7 @@ describe 'Filter issues', :js do special_milestone = create(:milestone, title: '!@\#{$%^&*()}', project: project) create(:issue, project: project, milestone: special_milestone) - input_filtered_search("milestone!=%#{special_milestone.title}") + input_filtered_search("milestone:!=%#{special_milestone.title}") expect_tokens([milestone_token(special_milestone.title, false, '!=')]) expect_issues_list_count(8) @@ -432,7 +432,7 @@ describe 'Filter issues', :js do it 'does not show issues for unused milestones' do new_milestone = create(:milestone, title: 'new', project: project) - input_filtered_search("milestone=%#{new_milestone.title}") + input_filtered_search("milestone:=%#{new_milestone.title}") expect_tokens([milestone_token(new_milestone.title)]) expect_no_issues_list @@ -442,7 +442,7 @@ describe 'Filter issues', :js do it 'show issues for unused milestones' do new_milestone = create(:milestone, title: 'new', project: project) - input_filtered_search("milestone!=%#{new_milestone.title}") + input_filtered_search("milestone:!=%#{new_milestone.title}") expect_tokens([milestone_token(new_milestone.title, false, '!=')]) expect_issues_list_count(8) @@ -521,7 +521,7 @@ describe 'Filter issues', :js do context 'searched text with other filters' do it 'filters issues by searched text, author, text, assignee, text, label1, text, label2, text, milestone and text' do - input_filtered_search("bug author=@#{user.username} report label=~#{bug_label.title} label=~#{caps_sensitive_label.title} milestone=%#{milestone.title} foo") + input_filtered_search("bug author:=@#{user.username} report label:=~#{bug_label.title} label:=~#{caps_sensitive_label.title} milestone:=%#{milestone.title} foo") expect_issues_list_count(1) expect_filtered_search_input('bug report foo') @@ -595,7 +595,7 @@ describe 'Filter issues', :js do end it 'milestone dropdown loads milestones' do - input_filtered_search("milestone=", submit: false) + input_filtered_search("milestone:=", submit: false) within('#js-dropdown-milestone') do expect(page).to have_selector('.filter-dropdown .filter-dropdown-item', count: 1) @@ -603,7 +603,7 @@ describe 'Filter issues', :js do end it 'label dropdown load labels' do - input_filtered_search("label=", submit: false) + input_filtered_search("label:=", submit: false) within('#js-dropdown-label') do expect(page).to have_selector('.filter-dropdown .filter-dropdown-item', count: 3) diff --git a/spec/features/issues/filtered_search/visual_tokens_spec.rb b/spec/features/issues/filtered_search/visual_tokens_spec.rb index 2af2e096bcc..29111bff344 100644 --- a/spec/features/issues/filtered_search/visual_tokens_spec.rb +++ b/spec/features/issues/filtered_search/visual_tokens_spec.rb @@ -36,7 +36,7 @@ describe 'Visual tokens', :js do describe 'editing a single token' do before do - input_filtered_search('author=@root assignee=none', submit: false) + input_filtered_search('author:=@root assignee:=none', submit: false) first('.tokens-container .filtered-search-token').click wait_for_requests end @@ -77,7 +77,7 @@ describe 'Visual tokens', :js do describe 'editing multiple tokens' do before do - input_filtered_search('author=@root assignee=none', submit: false) + input_filtered_search('author:=@root assignee:=none', submit: false) first('.tokens-container .filtered-search-token').click end @@ -93,7 +93,7 @@ describe 'Visual tokens', :js do describe 'editing a search term while editing another filter token' do before do - input_filtered_search('foo assignee=', submit: false) + input_filtered_search('foo assignee:=', submit: false) first('.tokens-container .filtered-search-term').click end @@ -112,7 +112,7 @@ describe 'Visual tokens', :js do describe 'add new token after editing existing token' do before do - input_filtered_search('author=@root assignee=none', submit: false) + input_filtered_search('author:=@root assignee:=none', submit: false) first('.tokens-container .filtered-search-token').double_click filtered_search.send_keys(' ') end @@ -123,7 +123,7 @@ describe 'Visual tokens', :js do end it 'opens token dropdown' do - filtered_search.send_keys('author=') + filtered_search.send_keys('author:=') expect(page).to have_css('#js-dropdown-author', visible: true) end @@ -131,7 +131,7 @@ describe 'Visual tokens', :js do describe 'visual tokens' do it 'creates visual token' do - filtered_search.send_keys('author=@thomas ') + filtered_search.send_keys('author:=@thomas ') token = page.all('.tokens-container .filtered-search-token')[1] expect(token.find('.name').text).to eq('Author') @@ -140,7 +140,7 @@ describe 'Visual tokens', :js do end it 'does not tokenize incomplete token' do - filtered_search.send_keys('author=') + filtered_search.send_keys('author:=') find('body').click token = page.all('.tokens-container .js-visual-token')[1] @@ -152,7 +152,7 @@ describe 'Visual tokens', :js do describe 'search using incomplete visual tokens' do before do - input_filtered_search('author=@root assignee=none', extra_space: false) + input_filtered_search('author:=@root assignee:=none', extra_space: false) end it 'tokenizes the search term to complete visual token' do diff --git a/spec/features/merge_requests/filters_generic_behavior_spec.rb b/spec/features/merge_requests/filters_generic_behavior_spec.rb index c3400acae4f..2bea819cc33 100644 --- a/spec/features/merge_requests/filters_generic_behavior_spec.rb +++ b/spec/features/merge_requests/filters_generic_behavior_spec.rb @@ -23,7 +23,7 @@ describe 'Merge Requests > Filters generic behavior', :js do context 'when filtered by a label' do before do - input_filtered_search('label=~bug') + input_filtered_search('label:=~bug') end describe 'state tabs' do diff --git a/spec/features/merge_requests/user_filters_by_assignees_spec.rb b/spec/features/merge_requests/user_filters_by_assignees_spec.rb index 3abee3b656a..12d682bbb15 100644 --- a/spec/features/merge_requests/user_filters_by_assignees_spec.rb +++ b/spec/features/merge_requests/user_filters_by_assignees_spec.rb @@ -18,7 +18,7 @@ describe 'Merge Requests > User filters by assignees', :js do context 'filtering by assignee:none' do it 'applies the filter' do - input_filtered_search('assignee=none') + input_filtered_search('assignee:=none') expect(page).to have_issuable_counts(open: 1, closed: 0, all: 1) expect(page).not_to have_content 'Bugfix1' @@ -28,7 +28,7 @@ describe 'Merge Requests > User filters by assignees', :js do context 'filtering by assignee=@username' do it 'applies the filter' do - input_filtered_search("assignee=@#{user.username}") + input_filtered_search("assignee:=@#{user.username}") expect(page).to have_issuable_counts(open: 1, closed: 0, all: 1) expect(page).to have_content 'Bugfix1' diff --git a/spec/features/merge_requests/user_filters_by_labels_spec.rb b/spec/features/merge_requests/user_filters_by_labels_spec.rb index 7a80ebe9be3..6308579d2d9 100644 --- a/spec/features/merge_requests/user_filters_by_labels_spec.rb +++ b/spec/features/merge_requests/user_filters_by_labels_spec.rb @@ -22,7 +22,7 @@ describe 'Merge Requests > User filters by labels', :js do context 'filtering by label:none' do it 'applies the filter' do - input_filtered_search('label=none') + input_filtered_search('label:=none') expect(page).to have_issuable_counts(open: 0, closed: 0, all: 0) expect(page).not_to have_content 'Bugfix1' @@ -32,7 +32,7 @@ describe 'Merge Requests > User filters by labels', :js do context 'filtering by label:~enhancement' do it 'applies the filter' do - input_filtered_search('label=~enhancement') + input_filtered_search('label:=~enhancement') expect(page).to have_issuable_counts(open: 1, closed: 0, all: 1) expect(page).to have_content 'Bugfix2' @@ -42,7 +42,7 @@ describe 'Merge Requests > User filters by labels', :js do context 'filtering by label:~enhancement and label:~bug' do it 'applies the filters' do - input_filtered_search('label=~bug label=~enhancement') + input_filtered_search('label:=~bug label:=~enhancement') expect(page).to have_issuable_counts(open: 1, closed: 0, all: 1) expect(page).to have_content 'Bugfix2' diff --git a/spec/features/merge_requests/user_filters_by_milestones_spec.rb b/spec/features/merge_requests/user_filters_by_milestones_spec.rb index 8cb686e191e..d2a420be996 100644 --- a/spec/features/merge_requests/user_filters_by_milestones_spec.rb +++ b/spec/features/merge_requests/user_filters_by_milestones_spec.rb @@ -18,14 +18,14 @@ describe 'Merge Requests > User filters by milestones', :js do end it 'filters by no milestone' do - input_filtered_search('milestone=none') + input_filtered_search('milestone:=none') expect(page).to have_issuable_counts(open: 1, closed: 0, all: 1) expect(page).to have_css('.merge-request', count: 1) end it 'filters by a specific milestone' do - input_filtered_search("milestone=%'#{milestone.title}'") + input_filtered_search("milestone:=%'#{milestone.title}'") expect(page).to have_issuable_counts(open: 1, closed: 0, all: 1) expect(page).to have_css('.merge-request', count: 1) @@ -33,7 +33,7 @@ describe 'Merge Requests > User filters by milestones', :js do describe 'filters by upcoming milestone' do it 'does not show merge requests with no expiry' do - input_filtered_search('milestone=upcoming') + input_filtered_search('milestone:=upcoming') expect(page).to have_issuable_counts(open: 0, closed: 0, all: 0) expect(page).to have_css('.merge-request', count: 0) @@ -43,7 +43,7 @@ describe 'Merge Requests > User filters by milestones', :js do let(:milestone) { create(:milestone, project: project, due_date: Date.tomorrow) } it 'shows merge requests' do - input_filtered_search('milestone=upcoming') + input_filtered_search('milestone:=upcoming') expect(page).to have_issuable_counts(open: 1, closed: 0, all: 1) expect(page).to have_css('.merge-request', count: 1) @@ -54,7 +54,7 @@ describe 'Merge Requests > User filters by milestones', :js do let(:milestone) { create(:milestone, project: project, due_date: Date.yesterday) } it 'does not show any merge requests' do - input_filtered_search('milestone=upcoming') + input_filtered_search('milestone:=upcoming') expect(page).to have_issuable_counts(open: 0, closed: 0, all: 0) expect(page).to have_css('.merge-request', count: 0) diff --git a/spec/features/merge_requests/user_filters_by_multiple_criteria_spec.rb b/spec/features/merge_requests/user_filters_by_multiple_criteria_spec.rb index 5c9d53778d2..5fac31e58ba 100644 --- a/spec/features/merge_requests/user_filters_by_multiple_criteria_spec.rb +++ b/spec/features/merge_requests/user_filters_by_multiple_criteria_spec.rb @@ -20,7 +20,7 @@ describe 'Merge requests > User filters by multiple criteria', :js do describe 'filtering by label:~"Won\'t fix" and assignee:~bug' do it 'applies the filters' do - input_filtered_search("label=~\"Won't fix\" assignee=@#{user.username}") + input_filtered_search("label:=~\"Won't fix\" assignee:=@#{user.username}") expect(page).to have_issuable_counts(open: 1, closed: 0, all: 1) expect(page).to have_content 'Bugfix2' @@ -30,7 +30,7 @@ describe 'Merge requests > User filters by multiple criteria', :js do describe 'filtering by text, author, assignee, milestone, and label' do it 'filters by text, author, assignee, milestone, and label' do - input_filtered_search_keys("author=@#{user.username} assignee=@#{user.username} milestone=%\"v1.1\" label=~\"Won't fix\" Bug") + input_filtered_search_keys("author:=@#{user.username} assignee:=@#{user.username} milestone:=%\"v1.1\" label:=~\"Won't fix\" Bug") expect(page).to have_issuable_counts(open: 1, closed: 0, all: 1) expect(page).to have_content 'Bugfix2' diff --git a/spec/features/merge_requests/user_filters_by_target_branch_spec.rb b/spec/features/merge_requests/user_filters_by_target_branch_spec.rb index faff7de729d..abe97d4c07e 100644 --- a/spec/features/merge_requests/user_filters_by_target_branch_spec.rb +++ b/spec/features/merge_requests/user_filters_by_target_branch_spec.rb @@ -17,7 +17,7 @@ describe 'Merge Requests > User filters by target branch', :js do context 'filtering by target-branch:master' do it 'applies the filter' do - input_filtered_search('target-branch=master') + input_filtered_search('target-branch:=master') expect(page).to have_issuable_counts(open: 1, closed: 0, all: 1) expect(page).to have_content mr1.title @@ -27,7 +27,7 @@ describe 'Merge Requests > User filters by target branch', :js do context 'filtering by target-branch:merged-target' do it 'applies the filter' do - input_filtered_search('target-branch=merged-target') + input_filtered_search('target-branch:=merged-target') expect(page).to have_issuable_counts(open: 1, closed: 0, all: 1) expect(page).not_to have_content mr1.title @@ -37,7 +37,7 @@ describe 'Merge Requests > User filters by target branch', :js do context 'filtering by target-branch:feature' do it 'applies the filter' do - input_filtered_search('target-branch=feature') + input_filtered_search('target-branch:=feature') expect(page).to have_issuable_counts(open: 0, closed: 0, all: 0) expect(page).not_to have_content mr1.title diff --git a/spec/features/projects/blobs/user_follows_pipeline_suggest_nudge_spec.rb b/spec/features/projects/blobs/user_follows_pipeline_suggest_nudge_spec.rb new file mode 100644 index 00000000000..b23cea65b37 --- /dev/null +++ b/spec/features/projects/blobs/user_follows_pipeline_suggest_nudge_spec.rb @@ -0,0 +1,67 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe 'User follows pipeline suggest nudge spec when feature is enabled', :js do + let(:user) { create(:user, :admin) } + let(:project) { create(:project, :empty_repo) } + + describe 'viewing the new blob page' do + before do + stub_feature_flags(suggest_pipeline: true) + sign_in(user) + end + + context 'when the page is loaded from the link using the suggest_gitlab_ci_yml param' do + before do + visit namespace_project_new_blob_path(namespace_id: project.namespace, project_id: project, id: 'master', suggest_gitlab_ci_yml: 'true') + end + + it 'pre-fills .gitlab-ci.yml for file name' do + file_name = page.find_by_id('file_name') + + expect(file_name.value).to have_content('.gitlab-ci.yml') + end + + it 'chooses the .gitlab-ci.yml Template Type' do + template_type = page.find(:css, '.template-type-selector .dropdown-toggle-text') + + expect(template_type.text).to have_content('.gitlab-ci.yml') + end + + it 'displays suggest_gitlab_ci_yml popover' do + popover_selector = '.suggest-gitlab-ci-yml' + + expect(page).to have_css(popover_selector, visible: true) + + page.within(popover_selector) do + expect(page).to have_content('1/2: Choose a template') + end + end + end + + context 'when the page is visited without the param' do + before do + visit namespace_project_new_blob_path(namespace_id: project.namespace, project_id: project, id: 'master') + end + + it 'does not pre-fill .gitlab-ci.yml for file name' do + file_name = page.find_by_id('file_name') + + expect(file_name.value).not_to have_content('.gitlab-ci.yml') + end + + it 'does not choose the .gitlab-ci.yml Template Type' do + template_type = page.find(:css, '.template-type-selector .dropdown-toggle-text') + + expect(template_type.text).to have_content('Select a template type') + end + + it 'does not display suggest_gitlab_ci_yml popover' do + popover_selector = '.b-popover.suggest-gitlab-ci-yml' + + expect(page).not_to have_css(popover_selector, visible: true) + end + end + end +end diff --git a/spec/features/projects/releases/user_views_edit_release_spec.rb b/spec/features/projects/releases/user_views_edit_release_spec.rb index d4c88065b90..820e8277af3 100644 --- a/spec/features/projects/releases/user_views_edit_release_spec.rb +++ b/spec/features/projects/releases/user_views_edit_release_spec.rb @@ -6,22 +6,27 @@ describe 'User edits Release', :js do let_it_be(:project) { create(:project, :repository) } let_it_be(:release) { create(:release, project: project, name: 'The first release' ) } let_it_be(:user) { create(:user) } + let(:show_feature_flag) { true } before do + stub_feature_flags(release_show_page: show_feature_flag) + project.add_developer(user) gitlab_sign_in(user) visit edit_project_release_path(project, release) + + wait_for_requests end def fill_out_form_and_click(button_to_click) fill_in 'Release title', with: 'Updated Release title' fill_in 'Release notes', with: 'Updated Release notes' - click_button button_to_click + click_link_or_button button_to_click - wait_for_requests + wait_for_all_requests end it 'renders the breadcrumbs' do @@ -42,31 +47,66 @@ describe 'User edits Release', :js do expect(find_field('Release notes').value).to eq(release.description) expect(page).to have_button('Save changes') - expect(page).to have_button('Cancel') + expect(page).to have_link('Cancel') end - it 'redirects to the main Releases page without updating the Release when "Cancel" is clicked' do + it 'does not update the Release when "Cancel" is clicked' do original_name = release.name original_description = release.description fill_out_form_and_click 'Cancel' - expect(current_path).to eq(project_releases_path(project)) - release.reload expect(release.name).to eq(original_name) expect(release.description).to eq(original_description) end - it 'updates the Release and redirects to the main Releases page when "Save changes" is clicked' do + it 'updates the Release when "Save changes" is clicked' do fill_out_form_and_click 'Save changes' - expect(current_path).to eq(project_releases_path(project)) - release.reload expect(release.name).to eq('Updated Release title') expect(release.description).to eq('Updated Release notes') end + + context 'when the release_show_page feature flag is disabled' do + let(:show_feature_flag) { false } + + it 'redirects to the main Releases page when "Cancel" is clicked' do + fill_out_form_and_click 'Cancel' + + expect(page).to have_current_path(project_releases_path(project)) + end + + it 'redirects to the main Releases page when "Save changes" is clicked' do + fill_out_form_and_click 'Save changes' + + expect(page).to have_current_path(project_releases_path(project)) + end + end + + context 'when the release_show_page feature flag is enabled' do + it 'redirects to the previous page when "Cancel" is clicked when the url includes a back_url query parameter' do + back_path = project_releases_path(project, params: { page: 2 }) + visit edit_project_release_path(project, release, params: { back_url: back_path }) + + fill_out_form_and_click 'Cancel' + + expect(page).to have_current_path(back_path) + end + + it 'redirects to the main Releases page when "Cancel" is clicked when the url does not include a back_url query parameter' do + fill_out_form_and_click 'Cancel' + + expect(page).to have_current_path(project_releases_path(project)) + end + + it 'redirects to the dedicated Release page when "Save changes" is clicked' do + fill_out_form_and_click 'Save changes' + + expect(page).to have_current_path(project_release_path(project, release)) + end + end end diff --git a/spec/features/projects/releases/user_views_release_spec.rb b/spec/features/projects/releases/user_views_release_spec.rb new file mode 100644 index 00000000000..6120acb4f1f --- /dev/null +++ b/spec/features/projects/releases/user_views_release_spec.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe 'User views Release', :js do + let(:project) { create(:project, :repository) } + let(:release) { create(:release, project: project, name: 'The first release' ) } + let(:user) { create(:user) } + + before do + project.add_developer(user) + + gitlab_sign_in(user) + + visit project_release_path(project, release) + end + + it 'renders the breadcrumbs' do + within('.breadcrumbs') do + expect(page).to have_content("#{project.creator.name} #{project.name} Releases #{release.name}") + + expect(page).to have_link(project.creator.name, href: user_path(project.creator)) + expect(page).to have_link(project.name, href: project_path(project)) + expect(page).to have_link('Releases', href: project_releases_path(project)) + expect(page).to have_link(release.name, href: project_release_path(project, release)) + end + end + + it 'renders the release details' do + within('.release-block') do + expect(page).to have_content(release.name) + expect(page).to have_content(release.tag) + expect(page).to have_content(release.commit.short_id) + expect(page).to have_content(release.description) + end + end +end |