Commit 1c86e804 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'unexpected-filtering-on-merge-requests' into 'master'

Add tests for unintentional filtering bug in MR

!3872 has a lack of tests for Merge Requests while !3872 has only ones for Issues.

This MR has complementary tests for MR list.

See merge request !4154
parents a511a122 0d93e93e
...@@ -46,7 +46,7 @@ v 8.8.0 (unreleased) ...@@ -46,7 +46,7 @@ v 8.8.0 (unreleased)
- API support for the 'since' and 'until' operators on commit requests (Paco Guzman) - API support for the 'since' and 'until' operators on commit requests (Paco Guzman)
- Fix Gravatar hint in user profile when Gravatar is disabled. !3988 (Artem Sidorenko) - Fix Gravatar hint in user profile when Gravatar is disabled. !3988 (Artem Sidorenko)
- Expire repository exists? and has_visible_content? caches after a push if necessary - Expire repository exists? and has_visible_content? caches after a push if necessary
- Fix unintentional filtering bug in issues sorted by milestone due (Takuya Noguchi) - Fix unintentional filtering bug in Issue/MR sorted by milestone due (Takuya Noguchi)
- Fix adding a todo for private group members (Ahmad Sherif) - Fix adding a todo for private group members (Ahmad Sherif)
- Bump ace-rails-ap gem version from 2.0.1 to 4.0.2 which upgrades Ace Editor from 1.1.2 to 1.2.3 - Bump ace-rails-ap gem version from 2.0.1 to 4.0.2 which upgrades Ace Editor from 1.1.2 to 1.2.3
- Total method execution timings are no longer tracked - Total method execution timings are no longer tracked
......
...@@ -38,6 +38,7 @@ describe 'Projects > Merge requests > User lists merge requests', feature: true ...@@ -38,6 +38,7 @@ describe 'Projects > Merge requests > User lists merge requests', feature: true
expect(page).to have_content 'lfs' expect(page).to have_content 'lfs'
expect(page).not_to have_content 'fix' expect(page).not_to have_content 'fix'
expect(page).not_to have_content 'markdown' expect(page).not_to have_content 'markdown'
expect(count_merge_requests).to eq(1)
end end
it 'filters on a specific assignee' do it 'filters on a specific assignee' do
...@@ -46,6 +47,7 @@ describe 'Projects > Merge requests > User lists merge requests', feature: true ...@@ -46,6 +47,7 @@ describe 'Projects > Merge requests > User lists merge requests', feature: true
expect(page).not_to have_content 'lfs' expect(page).not_to have_content 'lfs'
expect(page).to have_content 'fix' expect(page).to have_content 'fix'
expect(page).to have_content 'markdown' expect(page).to have_content 'markdown'
expect(count_merge_requests).to eq(2)
end end
it 'sorts by newest' do it 'sorts by newest' do
...@@ -53,6 +55,7 @@ describe 'Projects > Merge requests > User lists merge requests', feature: true ...@@ -53,6 +55,7 @@ describe 'Projects > Merge requests > User lists merge requests', feature: true
expect(first_merge_request).to include('lfs') expect(first_merge_request).to include('lfs')
expect(last_merge_request).to include('fix') expect(last_merge_request).to include('fix')
expect(count_merge_requests).to eq(3)
end end
it 'sorts by oldest' do it 'sorts by oldest' do
...@@ -60,30 +63,35 @@ describe 'Projects > Merge requests > User lists merge requests', feature: true ...@@ -60,30 +63,35 @@ describe 'Projects > Merge requests > User lists merge requests', feature: true
expect(first_merge_request).to include('fix') expect(first_merge_request).to include('fix')
expect(last_merge_request).to include('lfs') expect(last_merge_request).to include('lfs')
expect(count_merge_requests).to eq(3)
end end
it 'sorts by last updated' do it 'sorts by last updated' do
visit_merge_requests(project, sort: sort_value_recently_updated) visit_merge_requests(project, sort: sort_value_recently_updated)
expect(first_merge_request).to include('lfs') expect(first_merge_request).to include('lfs')
expect(count_merge_requests).to eq(3)
end end
it 'sorts by oldest updated' do it 'sorts by oldest updated' do
visit_merge_requests(project, sort: sort_value_oldest_updated) visit_merge_requests(project, sort: sort_value_oldest_updated)
expect(first_merge_request).to include('markdown') expect(first_merge_request).to include('markdown')
expect(count_merge_requests).to eq(3)
end end
it 'sorts by milestone due soon' do it 'sorts by milestone due soon' do
visit_merge_requests(project, sort: sort_value_milestone_soon) visit_merge_requests(project, sort: sort_value_milestone_soon)
expect(first_merge_request).to include('fix') expect(first_merge_request).to include('fix')
expect(count_merge_requests).to eq(3)
end end
it 'sorts by milestone due later' do it 'sorts by milestone due later' do
visit_merge_requests(project, sort: sort_value_milestone_later) visit_merge_requests(project, sort: sort_value_milestone_later)
expect(first_merge_request).to include('markdown') expect(first_merge_request).to include('markdown')
expect(count_merge_requests).to eq(3)
end end
it 'filters on one label and sorts by due soon' do it 'filters on one label and sorts by due soon' do
...@@ -94,6 +102,7 @@ describe 'Projects > Merge requests > User lists merge requests', feature: true ...@@ -94,6 +102,7 @@ describe 'Projects > Merge requests > User lists merge requests', feature: true
sort: sort_value_due_date_soon) sort: sort_value_due_date_soon)
expect(first_merge_request).to include('fix') expect(first_merge_request).to include('fix')
expect(count_merge_requests).to eq(1)
end end
context 'while filtering on two labels' do context 'while filtering on two labels' do
...@@ -110,6 +119,7 @@ describe 'Projects > Merge requests > User lists merge requests', feature: true ...@@ -110,6 +119,7 @@ describe 'Projects > Merge requests > User lists merge requests', feature: true
sort: sort_value_due_date_soon) sort: sort_value_due_date_soon)
expect(first_merge_request).to include('fix') expect(first_merge_request).to include('fix')
expect(count_merge_requests).to eq(1)
end end
context 'filter on assignee and' do context 'filter on assignee and' do
...@@ -119,6 +129,7 @@ describe 'Projects > Merge requests > User lists merge requests', feature: true ...@@ -119,6 +129,7 @@ describe 'Projects > Merge requests > User lists merge requests', feature: true
sort: sort_value_due_date_soon) sort: sort_value_due_date_soon)
expect(first_merge_request).to include('fix') expect(first_merge_request).to include('fix')
expect(count_merge_requests).to eq(1)
end end
end end
end end
...@@ -134,4 +145,8 @@ describe 'Projects > Merge requests > User lists merge requests', feature: true ...@@ -134,4 +145,8 @@ describe 'Projects > Merge requests > User lists merge requests', feature: true
def last_merge_request def last_merge_request
page.all('ul.mr-list > li').last.text page.all('ul.mr-list > li').last.text
end end
def count_merge_requests
page.all('ul.mr-list > li').count
end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment