Commit 36168062 authored by Coung Ngo's avatar Coung Ngo Committed by Robert Speicher

Improve feature specs

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