diff options
Diffstat (limited to 'spec/features')
-rw-r--r-- | spec/features/dashboard/issuables_counter_spec.rb | 2 | ||||
-rw-r--r-- | spec/features/dashboard/issues_filter_spec.rb | 73 | ||||
-rw-r--r-- | spec/features/dashboard/issues_spec.rb | 43 | ||||
-rw-r--r-- | spec/features/dashboard/label_filter_spec.rb | 34 | ||||
-rw-r--r-- | spec/features/groups/labels/index_spec.rb | 3 | ||||
-rw-r--r-- | spec/features/merge_requests/filters_generic_behavior_spec.rb | 2 |
6 files changed, 76 insertions, 81 deletions
diff --git a/spec/features/dashboard/issuables_counter_spec.rb b/spec/features/dashboard/issuables_counter_spec.rb index 5dc59cfa841..5e6ec007569 100644 --- a/spec/features/dashboard/issuables_counter_spec.rb +++ b/spec/features/dashboard/issuables_counter_spec.rb @@ -14,7 +14,7 @@ RSpec.describe 'Navigation bar counter', :use_clean_rails_memory_store_caching, sign_in(user) end - it 'reflects dashboard issues count' do + it 'reflects dashboard issues count', :js do visit issues_path expect_counters('issues', '1', n_("%d assigned issue", "%d assigned issues", 1) % 1) diff --git a/spec/features/dashboard/issues_filter_spec.rb b/spec/features/dashboard/issues_filter_spec.rb index ee1e704c6c4..e67e04ee0b0 100644 --- a/spec/features/dashboard/issues_filter_spec.rb +++ b/spec/features/dashboard/issues_filter_spec.rb @@ -6,43 +6,55 @@ RSpec.describe 'Dashboard Issues filtering', :js, feature_category: :team_planni include Features::SortingHelpers include FilteredSearchHelpers - let(:user) { create(:user) } - let(:project) { create(:project) } - let(:milestone) { create(:milestone, project: project) } + let_it_be(:user) { create(:user) } + let_it_be(:project) { create(:project) } + let_it_be(:milestone) { create(:milestone, project: project) } - let!(:issue) { create(:issue, project: project, author: user, assignees: [user]) } - let!(:issue2) { create(:issue, project: project, author: user, assignees: [user], milestone: milestone) } + let_it_be(:issue) { create(:issue, project: project, author: user, assignees: [user]) } + let_it_be(:issue2) { create(:issue, project: project, author: user, assignees: [user], milestone: milestone) } + let_it_be(:label) { create(:label, project: project, title: 'bug') } + let_it_be(:label_link) { create(:label_link, label: label, target: issue) } + + let_it_be(:project2) { create(:project, namespace: user.namespace) } + let_it_be(:label2) { create(:label, title: 'bug') } before do + project.labels << label + project2.labels << label2 project.add_maintainer(user) sign_in(user) - - visit_issues end context 'without any filter' do it 'shows error message' do + visit issues_dashboard_path + expect(page).to have_content 'Please select at least one filter to see results' end end context 'filtering by milestone' do it 'shows all issues with no milestone' do - input_filtered_search("milestone:=none") + visit issues_dashboard_path + + select_tokens 'Milestone', '=', 'None', submit: true 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}\"") + visit issues_dashboard_path + + select_tokens 'Milestone', '=', milestone.title, submit: true expect(page).to have_issuable_counts(open: 1, closed: 0, all: 1) expect(page).to have_selector('.issue', count: 1) end it 'updates atom feed link' do - visit_issues(milestone_title: '', assignee_username: user.username) + visit issues_dashboard_path(milestone_title: '', assignee_username: user.username) + click_button 'Actions' link = find_link('Subscribe to RSS feed') params = CGI.parse(URI.parse(link[:href]).query) @@ -59,40 +71,47 @@ RSpec.describe 'Dashboard Issues filtering', :js, feature_category: :team_planni end context 'filtering by label' do - let(:label) { create(:label, project: project) } - let!(:label_link) { create(:label_link, label: label, target: issue) } + before do + visit issues_dashboard_path + end it 'shows all issues with the selected label' do - input_filtered_search("label:=~#{label.title}") + select_tokens 'Label', '=', label.title, submit: true - page.within 'ul.content-list' do - expect(page).to have_content issue.title - expect(page).not_to have_content issue2.title - end + expect(page).to have_content issue.title + expect(page).not_to have_content issue2.title + end + + it 'removes duplicate labels' do + select_tokens 'Label', '=' + send_keys 'bu' + + expect_suggestion('bug') + expect_suggestion_count(3) # Expect None, Any, and bug end end context 'sorting' do before do - visit_issues(assignee_username: user.username) + visit issues_dashboard_path(assignee_username: user.username) end it 'remembers last sorting value' do - pajamas_sort_by(s_('SortOptions|Created date')) - visit_issues(assignee_username: user.username) + click_button 'Created date' + click_button 'Updated date' + + visit issues_dashboard_path(assignee_username: user.username) - expect(page).to have_button('Created date') + expect(page).to have_button('Updated date') end it 'keeps sorting issues after visiting Projects Issues page' do - pajamas_sort_by(s_('SortOptions|Created date')) + click_button 'Created date' + click_button 'Due date' + visit project_issues_path(project) - expect(page).to have_button('Created date') + expect(page).to have_button('Due date') end end - - def visit_issues(...) - visit issues_dashboard_path(...) - end end diff --git a/spec/features/dashboard/issues_spec.rb b/spec/features/dashboard/issues_spec.rb index 4499aa021ff..70d9f7e5137 100644 --- a/spec/features/dashboard/issues_spec.rb +++ b/spec/features/dashboard/issues_spec.rb @@ -5,15 +5,15 @@ require 'spec_helper' RSpec.describe 'Dashboard Issues', feature_category: :team_planning do include FilteredSearchHelpers - let(:current_user) { create :user } - let(:user) { current_user } # Shared examples depend on this being available - let!(:public_project) { create(:project, :public) } - let(:project) { create(:project) } - let(:project_with_issues_disabled) { create(:project, :issues_disabled) } - let!(:authored_issue) { create :issue, author: current_user, project: project } - let!(:authored_issue_on_public_project) { create :issue, author: current_user, project: public_project } - let!(:assigned_issue) { create :issue, assignees: [current_user], project: project } - let!(:other_issue) { create :issue, project: project } + let_it_be(:current_user) { create :user } + let_it_be(:user) { current_user } # Shared examples depend on this being available + let_it_be(:public_project) { create(:project, :public) } + let_it_be(:project) { create(:project) } + let_it_be(:project_with_issues_disabled) { create(:project, :issues_disabled) } + let_it_be(:authored_issue) { create :issue, author: current_user, project: project } + let_it_be(:authored_issue_on_public_project) { create :issue, author: current_user, project: public_project } + let_it_be(:assigned_issue) { create :issue, assignees: [current_user], project: project } + let_it_be(:other_issue) { create :issue, project: project } before do [project, project_with_issues_disabled].each { |project| project.add_maintainer(current_user) } @@ -23,16 +23,16 @@ RSpec.describe 'Dashboard Issues', feature_category: :team_planning do it_behaves_like 'a "Your work" page with sidebar and breadcrumbs', :issues_dashboard_path, :issues - describe 'issues' do + describe 'issues', :js do it 'shows issues assigned to current user' do expect(page).to have_content(assigned_issue.title) expect(page).not_to have_content(authored_issue.title) expect(page).not_to have_content(other_issue.title) end - it 'shows issues when current user is author', :js do - reset_filters - input_filtered_search("author:=#{current_user.to_reference}") + it 'shows issues when current user is author' do + click_button 'Clear' + select_tokens 'Author', '=', current_user.to_reference, submit: true expect(page).to have_content(authored_issue.title) expect(page).to have_content(authored_issue_on_public_project.title) @@ -41,12 +41,21 @@ RSpec.describe 'Dashboard Issues', feature_category: :team_planning do end it 'state filter tabs work' do - find('#state-closed').click - expect(page).to have_current_path(issues_dashboard_url(assignee_username: current_user.username, state: 'closed'), url: true) + click_link 'Closed' + + expect(page).not_to have_content(assigned_issue.title) + expect(page).not_to have_content(authored_issue.title) + expect(page).not_to have_content(other_issue.title) end - it_behaves_like "it has an RSS button with current_user's feed token" - it_behaves_like "an autodiscoverable RSS feed with current_user's feed token" + describe 'RSS link' do + before do + click_button 'Actions' + end + + it_behaves_like "it has an RSS link with current_user's feed token" + it_behaves_like "an autodiscoverable RSS feed with current_user's feed token" + end end describe 'new issue dropdown' do diff --git a/spec/features/dashboard/label_filter_spec.rb b/spec/features/dashboard/label_filter_spec.rb deleted file mode 100644 index f116c84ff40..00000000000 --- a/spec/features/dashboard/label_filter_spec.rb +++ /dev/null @@ -1,34 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe 'Dashboard > label filter', :js, feature_category: :team_planning do - include FilteredSearchHelpers - - let(:filtered_search) { find('.filtered-search') } - let(:filter_dropdown) { find("#js-dropdown-label .filter-dropdown") } - - let(:user) { create(:user) } - let(:project) { create(:project, name: 'test', namespace: user.namespace) } - let(:project2) { create(:project, name: 'test2', path: 'test2', namespace: user.namespace) } - let(:label) { create(:label, title: 'bug', color: '#ff0000') } - let(:label2) { create(:label, title: 'bug') } - - before do - project.labels << label - project2.labels << label2 - - sign_in(user) - visit issues_dashboard_path - - init_label_search - end - - context 'duplicate labels' do - it 'removes duplicate labels' do - filtered_search.send_keys('bu') - - expect(filter_dropdown).to have_selector('.filter-dropdown-item', text: 'bug', count: 1) - end - end -end diff --git a/spec/features/groups/labels/index_spec.rb b/spec/features/groups/labels/index_spec.rb index ea27fa2c5d9..7b0a38a83db 100644 --- a/spec/features/groups/labels/index_spec.rb +++ b/spec/features/groups/labels/index_spec.rb @@ -24,6 +24,7 @@ RSpec.describe 'Group labels', feature_category: :team_planning do end it 'shows an edit label button', :js do - expect(page).to have_selector('.edit') + click_button 'Label actions dropdown' + expect(page).to have_link('Edit') end end diff --git a/spec/features/merge_requests/filters_generic_behavior_spec.rb b/spec/features/merge_requests/filters_generic_behavior_spec.rb index 197b9fa770d..4dbbde5168b 100644 --- a/spec/features/merge_requests/filters_generic_behavior_spec.rb +++ b/spec/features/merge_requests/filters_generic_behavior_spec.rb @@ -71,7 +71,7 @@ RSpec.describe 'Merge Requests > Filters generic behavior', :js, feature_categor context 'filter dropdown' do it 'filters by label name' do - init_label_search + filtered_search.set('label:=') filtered_search.send_keys('~bug') page.within '.filter-dropdown' do |