diff options
author | Robert Speicher <rspeicher@gmail.com> | 2017-08-31 21:34:33 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2017-09-01 17:44:56 +0300 |
commit | e3ce7739c0aaf1b4c67dbee76616e896518719f1 (patch) | |
tree | 64551f83f88ff1eef6f95d90cc964210fb21fe26 /spec/features/issues/filtered_search | |
parent | dceb2112d2ec34a947edfb2c9ec4d286fea4661a (diff) |
Remove redundant specs from filter_issues_spec
While testing the various search tokens, we would add the token and a
search term, then verify the correct issues were returned. Then we'd add
a new token, search again, and verify again. Then another, and another.
This was entirely redundant. If the search with higher specificity
returned the same results as the search with lower specificity, we can
be sure the lower specificity searches also worked without actually
testing them.
Because this entire spec performs very extensive setup, it's important
to limit the number of times we perform that setup.
Diffstat (limited to 'spec/features/issues/filtered_search')
-rw-r--r-- | spec/features/issues/filtered_search/filter_issues_spec.rb | 264 |
1 files changed, 10 insertions, 254 deletions
diff --git a/spec/features/issues/filtered_search/filter_issues_spec.rb b/spec/features/issues/filtered_search/filter_issues_spec.rb index eedb6280304..18db5ae7fb7 100644 --- a/spec/features/issues/filtered_search/filter_issues_spec.rb +++ b/spec/features/issues/filtered_search/filter_issues_spec.rb @@ -108,43 +108,9 @@ describe 'Filter issues', js: true do end context 'author with other filters' do - let(:search_term) { 'issue' } - - it 'filters issues by searched author and text' do - input_filtered_search("author:@#{user.username} #{search_term}") - - wait_for_requests - - expect_tokens([author_token(user.name)]) - expect_issues_list_count(3) - expect_filtered_search_input(search_term) - end - - it 'filters issues by searched author, assignee and text' do - input_filtered_search("author:@#{user.username} assignee:@#{user.username} #{search_term}") - - wait_for_requests - - expect_tokens([author_token(user.name), assignee_token(user.name)]) - expect_issues_list_count(3) - expect_filtered_search_input(search_term) - end - - it 'filters issues by searched author, assignee, label, and text' do - input_filtered_search("author:@#{user.username} assignee:@#{user.username} label:~#{caps_sensitive_label.title} #{search_term}") - - wait_for_requests - - expect_tokens([ - author_token(user.name), - assignee_token(user.name), - label_token(caps_sensitive_label.title) - ]) - expect_issues_list_count(1) - expect_filtered_search_input(search_term) - end - it 'filters issues by searched author, assignee, label, milestone and text' do + search_term = 'issue' + input_filtered_search("author:@#{user.username} assignee:@#{user.username} label:~#{caps_sensitive_label.title} milestone:%#{milestone.title} #{search_term}") wait_for_requests @@ -183,43 +149,9 @@ describe 'Filter issues', js: true do end context 'assignee with other filters' do - let(:search_term) { 'searchTerm' } - - it 'filters issues by searched assignee and text' do - input_filtered_search("assignee:@#{user.username} #{search_term}") - - wait_for_requests - - expect_tokens([assignee_token(user.name)]) - expect_issues_list_count(2) - expect_filtered_search_input(search_term) - end - - it 'filters issues by searched assignee, author and text' do - input_filtered_search("assignee:@#{user.username} author:@#{user.username} #{search_term}") - - wait_for_requests - - expect_tokens([assignee_token(user.name), author_token(user.name)]) - expect_issues_list_count(2) - expect_filtered_search_input(search_term) - end - - it 'filters issues by searched assignee, author, label, text' do - input_filtered_search("assignee:@#{user.username} author:@#{user.username} label:~#{caps_sensitive_label.title} #{search_term}") - - wait_for_requests - - expect_tokens([ - assignee_token(user.name), - author_token(user.name), - label_token(caps_sensitive_label.title) - ]) - expect_issues_list_count(1) - expect_filtered_search_input(search_term) - end - it 'filters issues by searched assignee, author, label, milestone and text' do + search_term = 'searchTerm' + input_filtered_search("assignee:@#{user.username} author:@#{user.username} label:~#{caps_sensitive_label.title} milestone:%#{milestone.title} #{search_term}") expect_tokens([ @@ -235,8 +167,6 @@ describe 'Filter issues', js: true do end describe 'filter issues by label' do - let(:search_term) { 'bug' } - context 'only label' do it 'filters issues by searched label' do input_filtered_search("label:~#{bug_label.title}") @@ -347,39 +277,9 @@ describe 'Filter issues', js: true do end context 'label with other filters' do - it 'filters issues by searched label and text' do - input_filtered_search("label:~#{caps_sensitive_label.title} #{search_term}") - - expect_tokens([label_token(caps_sensitive_label.title)]) - expect_issues_list_count(1) - expect_filtered_search_input(search_term) - end - - it 'filters issues by searched label, author and text' do - input_filtered_search("label:~#{caps_sensitive_label.title} author:@#{user.username} #{search_term}") - - wait_for_requests - - expect_tokens([label_token(caps_sensitive_label.title), author_token(user.name)]) - expect_issues_list_count(1) - expect_filtered_search_input(search_term) - end - - it 'filters issues by searched label, author, assignee and text' do - input_filtered_search("label:~#{caps_sensitive_label.title} author:@#{user.username} assignee:@#{user.username} #{search_term}") - - wait_for_requests - - expect_tokens([ - label_token(caps_sensitive_label.title), - author_token(user.name), - assignee_token(user.name) - ]) - expect_issues_list_count(1) - expect_filtered_search_input(search_term) - end - it 'filters issues by searched label, author, assignee, milestone and text' do + search_term = 'bug' + input_filtered_search("label:~#{caps_sensitive_label.title} author:@#{user.username} assignee:@#{user.username} milestone:%#{milestone.title} #{search_term}") expect_tokens([ @@ -394,47 +294,9 @@ describe 'Filter issues', js: true do end context 'multiple labels with other filters' do - it 'filters issues by searched label, label2, and text' do - input_filtered_search("label:~#{bug_label.title} label:~#{caps_sensitive_label.title} #{search_term}") - - expect_tokens([ - label_token(bug_label.title), - label_token(caps_sensitive_label.title) - ]) - expect_issues_list_count(1) - expect_filtered_search_input(search_term) - end - - it 'filters issues by searched label, label2, author and text' do - input_filtered_search("label:~#{bug_label.title} label:~#{caps_sensitive_label.title} author:@#{user.username} #{search_term}") - - wait_for_requests - - expect_tokens([ - label_token(bug_label.title), - label_token(caps_sensitive_label.title), - author_token(user.name) - ]) - expect_issues_list_count(1) - expect_filtered_search_input(search_term) - end - - it 'filters issues by searched label, label2, author, assignee and text' do - input_filtered_search("label:~#{bug_label.title} label:~#{caps_sensitive_label.title} author:@#{user.username} assignee:@#{user.username} #{search_term}") - - wait_for_requests - - expect_tokens([ - label_token(bug_label.title), - label_token(caps_sensitive_label.title), - author_token(user.name), - assignee_token(user.name) - ]) - expect_issues_list_count(1) - expect_filtered_search_input(search_term) - end - 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}") wait_for_requests @@ -524,44 +386,9 @@ describe 'Filter issues', js: true do end context 'milestone with other filters' do - let(:search_term) { 'bug' } - - it 'filters issues by searched milestone and text' do - input_filtered_search("milestone:%#{milestone.title} #{search_term}") - - expect_tokens([milestone_token(milestone.title)]) - expect_issues_list_count(2) - expect_filtered_search_input(search_term) - end - - it 'filters issues by searched milestone, author and text' do - input_filtered_search("milestone:%#{milestone.title} author:@#{user.username} #{search_term}") - - wait_for_requests - - expect_tokens([ - milestone_token(milestone.title), - author_token(user.name) - ]) - expect_issues_list_count(2) - expect_filtered_search_input(search_term) - end - - it 'filters issues by searched milestone, author, assignee and text' do - input_filtered_search("milestone:%#{milestone.title} author:@#{user.username} assignee:@#{user.username} #{search_term}") - - wait_for_requests - - expect_tokens([ - milestone_token(milestone.title), - author_token(user.name), - assignee_token(user.name) - ]) - expect_issues_list_count(2) - expect_filtered_search_input(search_term) - end - it 'filters issues by searched milestone, author, assignee, label and text' do + search_term = 'bug' + input_filtered_search("milestone:%#{milestone.title} author:@#{user.username} assignee:@#{user.username} label:~#{bug_label.title} #{search_term}") wait_for_requests @@ -638,77 +465,6 @@ describe 'Filter issues', js: true do end context 'searched text with other filters' do - it 'filters issues by searched text and author' do - # After searching, all search terms are placed at the end - input_filtered_search("bug author:@#{user.username}") - - expect_issues_list_count(2) - expect_filtered_search_input('bug') - end - - it 'filters issues by searched text, author and more text' do - input_filtered_search("bug author:@#{user.username} report") - - expect_issues_list_count(1) - expect_filtered_search_input('bug report') - end - - it 'filters issues by searched text, author and assignee' do - input_filtered_search("bug author:@#{user.username} assignee:@#{user.username}") - - expect_issues_list_count(2) - expect_filtered_search_input('bug') - end - - it 'filters issues by searched text, author, more text and assignee' do - input_filtered_search("bug author:@#{user.username} report assignee:@#{user.username}") - - expect_issues_list_count(1) - expect_filtered_search_input('bug report') - end - - it 'filters issues by searched text, author, more text, assignee and even more text' do - input_filtered_search("bug author:@#{user.username} report assignee:@#{user.username} foo") - - expect_issues_list_count(1) - expect_filtered_search_input('bug report foo') - end - - it 'filters issues by searched text, author, assignee and label' do - input_filtered_search("bug author:@#{user.username} assignee:@#{user.username} label:~#{bug_label.title}") - - expect_issues_list_count(2) - expect_filtered_search_input('bug') - end - - it 'filters issues by searched text, author, text, assignee, text, label and text' do - input_filtered_search("bug author:@#{user.username} assignee:@#{user.username} report label:~#{bug_label.title} foo") - - expect_issues_list_count(1) - expect_filtered_search_input('bug report foo') - end - - it 'filters issues by searched text, author, assignee, label and milestone' do - input_filtered_search("bug author:@#{user.username} assignee:@#{user.username} label:~#{bug_label.title} milestone:%#{milestone.title}") - - expect_issues_list_count(2) - expect_filtered_search_input('bug') - end - - it 'filters issues by searched text, author, text, assignee, text, label, text, milestone and text' do - input_filtered_search("bug author:@#{user.username} assignee:@#{user.username} report label:~#{bug_label.title} milestone:%#{milestone.title} foo") - - expect_issues_list_count(1) - expect_filtered_search_input('bug report foo') - end - - it 'filters issues by searched text, author, assignee, multiple labels and milestone' do - input_filtered_search("bug author:@#{user.username} assignee:@#{user.username} label:~#{bug_label.title} label:~#{caps_sensitive_label.title} milestone:%#{milestone.title}") - - expect_issues_list_count(1) - expect_filtered_search_input('bug') - end - 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} assignee:@#{user.username} report label:~#{bug_label.title} label:~#{caps_sensitive_label.title} milestone:%#{milestone.title} foo") |