Commit 203eba2a authored by Rémy Coutable's avatar Rémy Coutable

Improve a spec to make it faster and less flaky

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent 8a8bf427
...@@ -156,12 +156,9 @@ RSpec.describe 'group epic roadmap', :js do ...@@ -156,12 +156,9 @@ RSpec.describe 'group epic roadmap', :js do
end end
context 'when over 1000 epics exist for the group' do context 'when over 1000 epics exist for the group' do
6.times do |i|
let!("epic_#{i}") { create(:epic, group: group, start_date: 10.days.ago, end_date: 1.day.ago) }
end
before do before do
stub_const('Groups::RoadmapController::EPICS_ROADMAP_LIMIT', 5) stub_const('Groups::RoadmapController::EPICS_ROADMAP_LIMIT', 1)
create_list(:epic, 2, group: group, start_date: 10.days.ago, end_date: 1.day.ago)
visit group_roadmap_path(group) visit group_roadmap_path(group)
wait_for_requests wait_for_requests
end end
...@@ -172,30 +169,23 @@ RSpec.describe 'group epic roadmap', :js do ...@@ -172,30 +169,23 @@ RSpec.describe 'group epic roadmap', :js do
expect(page).to have_selector('.js-epics-limit-callout', count: 1) expect(page).to have_selector('.js-epics-limit-callout', count: 1)
expect(find('.js-epics-limit-callout')).to have_content 'Some of your epics may not be visible. A roadmap is limited to the first 1,000 epics, in your selected sort order.' expect(find('.js-epics-limit-callout')).to have_content 'Some of your epics may not be visible. A roadmap is limited to the first 1,000 epics, in your selected sort order.'
end end
page.within('.js-epics-limit-callout') do
expect(find_link('Learn more')[:href]).to eq("https://docs.gitlab.com/ee/user/group/roadmap/")
end
end end
it 'is removed after dismissal' do it 'is removed after dismissal and even after reload' do
find('.js-epics-limit-callout .js-close-callout').click page.within('.js-epics-limit-callout') do
find('.js-close-callout').click
end
expect(page).not_to have_selector('.js-epics-limit-callout') expect(page).not_to have_selector('.js-epics-limit-callout')
end
it 'does not appear on page after dismissal and reload' do refresh
find('.js-epics-limit-callout .js-close-callout').click
visit group_roadmap_path(group)
wait_for_requests
expect(page).not_to have_selector('.js-epics-limit-callout') expect(page).not_to have_selector('.js-epics-limit-callout')
end end
it 'links to roadmap documentation' do
page.within('.js-epics-limit-callout') do
find('#js-learn-more').click
wait_for_requests
expect(URI.parse(current_url).host).to eq("docs.gitlab.com")
expect(URI.parse(current_url).path).to eq("/ee/user/group/roadmap/")
end
end
end end
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