Skip to content

Commit

Permalink
Merge pull request #3451 from DMPRoadmap/aaron/issues/3450
Browse files Browse the repository at this point in the history
Fix Flaky Tests / Optimize Checking of `plan.title` Within `spec/features/plans/exports_spec.rb`
  • Loading branch information
benjaminfaure authored Nov 18, 2024
2 parents 1b34730 + 03389e8 commit 0f263f7
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions spec/features/plans/exports_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
select('html')
new_window = window_opened_by { click_button 'Download Plan' }
within_window new_window do
expect(page.source).to have_text(plan.title)
expect(page.title).to have_text(plan.title)
end
end

Expand All @@ -60,7 +60,7 @@
select('html')
new_window = window_opened_by { click_button 'Download Plan' }
within_window new_window do
expect(page.source).to have_text(plan.title)
expect(page.title).to have_text(plan.title)
end
end

Expand Down Expand Up @@ -91,7 +91,7 @@
click_button 'Download Plan'
end
within_window new_window do
expect(page.source).to have_text(plan.title)
expect(page.title).to have_text(plan.title)
plan.phases.each do |phase|
expect(page.source).to have_text(phase.title)
end
Expand All @@ -101,7 +101,7 @@
click_button 'Download Plan'
end
within_window new_window do
expect(page.source).to have_text(plan.title)
expect(page.title).to have_text(plan.title)
expect(page.source).to have_text(plan.phases[1].title)
expect(page.source).not_to have_text(plan.phases[2].title) if plan.phases.length > 2
end
Expand Down Expand Up @@ -173,18 +173,18 @@ def _regular_download(format)
click_button 'Download Plan'
end
within_window new_window do
expect(page.source).to have_text(plan.title)
expect(page.title).to have_text(plan.title)
end
else
click_button 'Download Plan'
expect(page.source).to have_text(plan.title)
expect(page.title).to have_text(plan.title)
end
end

def _all_phase_download
_select_option('phase_id', 'All')
click_button 'Download Plan'
expect(page.source).to have_text(plan.title)
expect(page.title).to have_text(plan.title)
plan.phases.each do |phase| # All phase titles should be included in output
expect(page.source).to have_text(phase.title)
end
Expand All @@ -193,7 +193,7 @@ def _all_phase_download
def _single_phase_download
_select_option('phase_id', plan.phases[1].id)
click_button 'Download Plan'
expect(page.source).to have_text(plan.title)
expect(page.title).to have_text(plan.title)
expect(page.source).to have_text(plan.phases[1].title)
expect(page.source).not_to have_text(plan.phases[2].title) if plan.phases.length > 2
end
Expand Down

0 comments on commit 0f263f7

Please sign in to comment.