diff options
Diffstat (limited to 'spec/features/merge_requests/filter_merge_requests_spec.rb')
-rw-r--r-- | spec/features/merge_requests/filter_merge_requests_spec.rb | 70 |
1 files changed, 39 insertions, 31 deletions
diff --git a/spec/features/merge_requests/filter_merge_requests_spec.rb b/spec/features/merge_requests/filter_merge_requests_spec.rb index f0019be86ad..b51ae0890e4 100644 --- a/spec/features/merge_requests/filter_merge_requests_spec.rb +++ b/spec/features/merge_requests/filter_merge_requests_spec.rb @@ -12,7 +12,7 @@ describe 'Filter merge requests' do let!(:wontfix) { create(:label, project: project, title: "Won't fix") } before do - project.team << [user, :master] + project.add_master(user) group.add_developer(user) sign_in(user) create(:merge_request, source_project: project, target_project: project) @@ -24,7 +24,9 @@ describe 'Filter merge requests' do let(:search_query) { "assignee:@#{user.username}" } def expect_assignee_visual_tokens - expect_tokens([{ name: 'assignee', value: "@#{user.username}" }]) + wait_for_requests + + expect_tokens([assignee_token(user.name)]) expect_filtered_search_input_empty end @@ -57,7 +59,7 @@ describe 'Filter merge requests' do let(:search_query) { "milestone:%\"#{milestone.title}\"" } def expect_milestone_visual_tokens - expect_tokens([{ name: 'milestone', value: "%\"#{milestone.title}\"" }]) + expect_tokens([milestone_token("\"#{milestone.title}\"")]) expect_filtered_search_input_empty end @@ -91,7 +93,7 @@ describe 'Filter merge requests' do input_filtered_search('label:none') expect_mr_list_count(1) - expect_tokens([{ name: 'label', value: 'none' }]) + expect_tokens([label_token('none', false)]) expect_filtered_search_input_empty end @@ -99,7 +101,7 @@ describe 'Filter merge requests' do input_filtered_search("label:~#{label.title}") expect_mr_list_count(0) - expect_tokens([{ name: 'label', value: "~#{label.title}" }]) + expect_tokens([label_token(label.title)]) expect_filtered_search_input_empty end @@ -107,10 +109,7 @@ describe 'Filter merge requests' do input_filtered_search("label:~\"#{wontfix.title}\" label:~#{label.title}") expect_mr_list_count(0) - expect_tokens([ - { name: 'label', value: "~\"#{wontfix.title}\"" }, - { name: 'label', value: "~#{label.title}" } - ]) + expect_tokens([label_token("\"#{wontfix.title}\""), label_token(label.title)]) expect_filtered_search_input_empty end @@ -118,16 +117,13 @@ describe 'Filter merge requests' do input_filtered_search("label:~\"#{wontfix.title}\"") expect_mr_list_count(0) - expect_tokens([{ name: 'label', value: "~\"#{wontfix.title}\"" }]) + expect_tokens([label_token("\"#{wontfix.title}\"")]) expect_filtered_search_input_empty input_filtered_search_keys("label:~#{label.title}") expect_mr_list_count(0) - expect_tokens([ - { name: 'label', value: "~\"#{wontfix.title}\"" }, - { name: 'label', value: "~#{label.title}" } - ]) + expect_tokens([label_token("\"#{wontfix.title}\""), label_token(label.title)]) expect_filtered_search_input_empty end end @@ -143,10 +139,9 @@ describe 'Filter merge requests' do context 'assignee and label', js: true do def expect_assignee_label_visual_tokens - expect_tokens([ - { name: 'assignee', value: "@#{user.username}" }, - { name: 'label', value: "~#{label.title}" } - ]) + wait_for_requests + + expect_tokens([assignee_token(user.name), label_token(label.title)]) expect_filtered_search_input_empty end @@ -170,7 +165,7 @@ describe 'Filter merge requests' do describe 'filter merge requests by text' do before do - create(:merge_request, title: "Bug", source_project: project, target_project: project, source_branch: "bug") + create(:merge_request, title: "Bug", source_project: project, target_project: project, source_branch: "wip") bug_label = create(:label, project: project, title: 'bug') milestone = create(:milestone, title: "8", project: project) @@ -179,7 +174,7 @@ describe 'Filter merge requests' do title: "Bug 2", source_project: project, target_project: project, - source_branch: "bug2", + source_branch: "fix", milestone: milestone, author: user, assignee: user) @@ -214,7 +209,7 @@ describe 'Filter merge requests' do input_filtered_search_keys(' label:~bug') expect_mr_list_count(1) - expect_tokens([{ name: 'label', value: '~bug' }]) + expect_tokens([label_token('bug')]) expect_filtered_search_input('Bug') end @@ -227,7 +222,7 @@ describe 'Filter merge requests' do input_filtered_search_keys(' milestone:%8') expect_mr_list_count(1) - expect_tokens([{ name: 'milestone', value: '%8' }]) + expect_tokens([milestone_token('8')]) expect_filtered_search_input('Bug') end @@ -240,7 +235,10 @@ describe 'Filter merge requests' do input_filtered_search_keys(" assignee:@#{user.username}") expect_mr_list_count(1) - expect_tokens([{ name: 'assignee', value: "@#{user.username}" }]) + + wait_for_requests + + expect_tokens([assignee_token(user.name)]) expect_filtered_search_input('Bug') end @@ -252,19 +250,21 @@ describe 'Filter merge requests' do input_filtered_search_keys(" author:@#{user.username}") + wait_for_requests + expect_mr_list_count(1) - expect_tokens([{ name: 'author', value: "@#{user.username}" }]) + expect_tokens([author_token(user.name)]) expect_filtered_search_input('Bug') end end end - describe 'filter merge requests and sort', js: true do + describe 'filter merge requests and sort', :js do before do bug_label = create(:label, project: project, title: 'bug') - mr1 = create(:merge_request, title: "Frontend", source_project: project, target_project: project, source_branch: "Frontend") - mr2 = create(:merge_request, title: "Bug 2", source_project: project, target_project: project, source_branch: "bug2") + mr1 = create(:merge_request, title: "Frontend", source_project: project, target_project: project, source_branch: "wip") + mr2 = create(:merge_request, title: "Bug 2", source_project: project, target_project: project, source_branch: "fix") mr1.labels << bug_label mr2.labels << bug_label @@ -293,7 +293,9 @@ describe 'Filter merge requests' do it 'filter by current user' do visit project_merge_requests_path(project, assignee_id: user.id) - expect_tokens([{ name: 'assignee', value: "@#{user.username}" }]) + wait_for_requests + + expect_tokens([assignee_token(user.name)]) expect_filtered_search_input_empty end @@ -303,7 +305,9 @@ describe 'Filter merge requests' do visit project_merge_requests_path(project, assignee_id: new_user.id) - expect_tokens([{ name: 'assignee', value: "@#{new_user.username}" }]) + wait_for_requests + + expect_tokens([assignee_token(new_user.name)]) expect_filtered_search_input_empty end end @@ -312,7 +316,9 @@ describe 'Filter merge requests' do it 'filter by current user' do visit project_merge_requests_path(project, author_id: user.id) - expect_tokens([{ name: 'author', value: "@#{user.username}" }]) + wait_for_requests + + expect_tokens([author_token(user.name)]) expect_filtered_search_input_empty end @@ -322,7 +328,9 @@ describe 'Filter merge requests' do visit project_merge_requests_path(project, author_id: new_user.id) - expect_tokens([{ name: 'author', value: "@#{new_user.username}" }]) + wait_for_requests + + expect_tokens([author_token(new_user.name)]) expect_filtered_search_input_empty end end |