Skip to content

Commit

Permalink
Improve feature test
Browse files Browse the repository at this point in the history
On CI this feature test was flaky. It seems like not all product pages
were being visited consistently; the errors were about "Jersey" being
missing from the expected page body text.
  • Loading branch information
benjaminwil committed Apr 2, 2024
1 parent 3622e3b commit 78e668f
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions spec/features/recently_viewed_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,23 @@

scenario 'keep track of recently viewed products', js: true do
visit spree.root_path
click_link 'Mug'
click_link 'Home'
click_link 'Jersey'
click_link 'Home'
within(:css, 'ul#recently_viewed_products') do
expect(page).to have_text 'Mug'
expect(page).to have_text 'Jersey'

click_link "Mug"
within "h1.product-title" do
expect(page).to have_text "Mug"
end

click_link "Home"

click_link "Jersey"
within "h1.product-title" do
expect(page).to have_text "Jersey"
end

click_link "Home"
within(:css, "ul#recently_viewed_products") do
expect(page).to have_text "Mug"
expect(page).to have_text "Jersey"
end
end
end

0 comments on commit 78e668f

Please sign in to comment.