Commit 9051cd17 authored by Robert Speicher's avatar Robert Speicher

Merge branch 'cngo-update-feature-specs' into 'master'

Improve feature specs

See merge request gitlab-org/gitlab!75253
parents df6aae19 36168062
...@@ -49,7 +49,7 @@ RSpec.describe 'Dashboard Issues' do ...@@ -49,7 +49,7 @@ RSpec.describe 'Dashboard Issues' do
describe 'new issue dropdown' do describe 'new issue dropdown' do
it 'shows projects only with issues feature enabled', :js do it 'shows projects only with issues feature enabled', :js do
find('.new-project-item-select-button').click click_button 'Toggle project select'
page.within('.select2-results') do page.within('.select2-results') do
expect(page).to have_content(project.full_name) expect(page).to have_content(project.full_name)
...@@ -58,7 +58,7 @@ RSpec.describe 'Dashboard Issues' do ...@@ -58,7 +58,7 @@ RSpec.describe 'Dashboard Issues' do
end end
it 'shows the new issue page', :js do it 'shows the new issue page', :js do
find('.new-project-item-select-button').click click_button 'Toggle project select'
wait_for_requests wait_for_requests
......
...@@ -34,7 +34,7 @@ RSpec.describe 'Dashboard Merge Requests' do ...@@ -34,7 +34,7 @@ RSpec.describe 'Dashboard Merge Requests' do
end end
it 'shows projects only with merge requests feature enabled', :js do it 'shows projects only with merge requests feature enabled', :js do
find('.new-project-item-select-button').click click_button 'Toggle project select'
page.within('.select2-results') do page.within('.select2-results') do
expect(page).to have_content(project.full_name) expect(page).to have_content(project.full_name)
......
...@@ -35,7 +35,7 @@ RSpec.describe 'Dashboard > Milestones' do ...@@ -35,7 +35,7 @@ RSpec.describe 'Dashboard > Milestones' do
describe 'new milestones dropdown', :js do describe 'new milestones dropdown', :js do
it 'takes user to a new milestone page', :js do it 'takes user to a new milestone page', :js do
find('.new-project-item-select-button').click click_button 'Toggle project select'
page.within('.select2-results') do page.within('.select2-results') do
first('.select2-result-label').click first('.select2-result-label').click
......
...@@ -101,7 +101,7 @@ RSpec.describe 'Group empty states' do ...@@ -101,7 +101,7 @@ RSpec.describe 'Group empty states' do
it "the new #{issuable_name} button opens a project dropdown" do it "the new #{issuable_name} button opens a project dropdown" do
within '.empty-state' do within '.empty-state' do
find('.new-project-item-select-button').click click_button 'Toggle project select'
end end
expect(page).to have_selector('.ajax-project-dropdown') expect(page).to have_selector('.ajax-project-dropdown')
......
...@@ -119,8 +119,9 @@ RSpec.describe 'Group issues page' do ...@@ -119,8 +119,9 @@ RSpec.describe 'Group issues page' do
end end
it 'shows projects only with issues feature enabled', :js do it 'shows projects only with issues feature enabled', :js do
find('.empty-state .js-lazy-loaded') within '.empty-state' do
find('.empty-state .new-project-item-link').click click_button 'Toggle project select'
end
page.within('.select2-results') do page.within('.select2-results') do
expect(page).to have_content(project.full_name) expect(page).to have_content(project.full_name)
...@@ -158,9 +159,7 @@ RSpec.describe 'Group issues page' do ...@@ -158,9 +159,7 @@ RSpec.describe 'Group issues page' do
it 'each issue item has a user-can-drag css applied' do it 'each issue item has a user-can-drag css applied' do
visit issues_group_path(group, sort: 'relative_position') visit issues_group_path(group, sort: 'relative_position')
page.within('.manual-ordering') do expect(page).to have_selector('.issue.user-can-drag', count: 3)
expect(page).to have_selector('.issue.user-can-drag', count: 3)
end
end end
it 'issues should be draggable and persist order' do it 'issues should be draggable and persist order' do
...@@ -224,7 +223,8 @@ RSpec.describe 'Group issues page' do ...@@ -224,7 +223,8 @@ RSpec.describe 'Group issues page' do
end end
it 'shows the pagination' do it 'shows the pagination' do
expect(page).to have_selector('.gl-pagination') expect(page).to have_link 'Prev'
expect(page).to have_link 'Next'
end end
it 'first pagination item is active' do it 'first pagination item is active' do
......
...@@ -197,17 +197,13 @@ RSpec.describe 'Sort Issuable List' do ...@@ -197,17 +197,13 @@ RSpec.describe 'Sort Issuable List' do
click_button('Created date') click_button('Created date')
click_on('Last updated') click_on('Last updated')
wait_for_requests expect(page).to have_css('.issue:first-child', text: last_updated_issuable.title)
expect(page).to have_css('.issue:last-child', text: first_updated_issuable.title)
expect(first_issue).to include(last_updated_issuable.title)
expect(last_issue).to include(first_updated_issuable.title)
click_on 'Sort direction' click_on 'Sort direction'
wait_for_requests expect(page).to have_css('.issue:first-child', text: first_updated_issuable.title)
expect(page).to have_css('.issue:last-child', text: last_updated_issuable.title)
expect(first_issue).to include(first_updated_issuable.title)
expect(last_issue).to include(last_updated_issuable.title)
end end
end end
end end
......
...@@ -64,7 +64,7 @@ RSpec.describe 'Labels Hierarchy', :js do ...@@ -64,7 +64,7 @@ RSpec.describe 'Labels Hierarchy', :js do
end end
else else
expect_issues_list_count(1) expect_issues_list_count(1)
expect(page).to have_selector('span.issue-title-text', text: labeled_issue.title) expect(page).to have_selector('.issue-title', text: labeled_issue.title)
end end
end end
end end
...@@ -74,7 +74,7 @@ RSpec.describe 'Labels Hierarchy', :js do ...@@ -74,7 +74,7 @@ RSpec.describe 'Labels Hierarchy', :js do
wait_for_requests wait_for_requests
expect(page).not_to have_selector('.btn-link', text: child_group_label.title) expect(page).not_to have_link child_group_label.title
end end
end end
...@@ -107,9 +107,9 @@ RSpec.describe 'Labels Hierarchy', :js do ...@@ -107,9 +107,9 @@ RSpec.describe 'Labels Hierarchy', :js do
end end
else else
expect_issues_list_count(3) expect_issues_list_count(3)
expect(page).to have_selector('span.issue-title-text', text: labeled_issue.title) expect(page).to have_selector('.issue-title', text: labeled_issue.title)
expect(page).to have_selector('span.issue-title-text', text: labeled_issue_2.title) expect(page).to have_selector('.issue-title', text: labeled_issue_2.title)
expect(page).to have_selector('span.issue-title-text', text: labeled_issue_3.title) expect(page).to have_selector('.issue-title', text: labeled_issue_3.title)
end end
end end
end end
...@@ -129,7 +129,7 @@ RSpec.describe 'Labels Hierarchy', :js do ...@@ -129,7 +129,7 @@ RSpec.describe 'Labels Hierarchy', :js do
end end
else else
expect_issues_list_count(1) expect_issues_list_count(1)
expect(page).to have_selector('span.issue-title-text', text: labeled_issue_3.title) expect(page).to have_selector('.issue-title', text: labeled_issue_3.title)
end end
end end
...@@ -231,7 +231,7 @@ RSpec.describe 'Labels Hierarchy', :js do ...@@ -231,7 +231,7 @@ RSpec.describe 'Labels Hierarchy', :js do
wait_for_requests wait_for_requests
expect(page).not_to have_selector('.btn-link', text: child_group_label.title) expect(page).not_to have_link child_group_label.title
end 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