Skip to content

Commit

Permalink
test: Do not wait 30 seconds for a test to fail
Browse files Browse the repository at this point in the history
If the modal cannot be openend after 5 seconds (Capybara default wait
tiem is 3 seconds) then something is wrong. We must not waste
precious resources and time for a buld to fail.
  • Loading branch information
tvdeyen committed Dec 3, 2024
1 parent c67f75f commit 7112488
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions admin/spec/features/orders/show_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
expect(page).to have_content("Order R123456789")
open_customer_menu
click_on "Edit billing address"
expect(page).to have_css("dialog", wait: 30)
expect(page).to have_css("dialog", wait: 5)

within("dialog") do
fill_in "Name", with: "John Doe"
Expand All @@ -74,7 +74,7 @@

open_customer_menu
click_on "Edit shipping address"
expect(page).to have_css("dialog", wait: 30)
expect(page).to have_css("dialog", wait: 5)

within("dialog") do
fill_in "Name", with: "Jane Doe"
Expand Down Expand Up @@ -119,18 +119,18 @@
expect(Spree::Order.last.line_items.count).to eq(0)

find("[aria-selected]", text: "Just another product").click
expect(page).to have_content("Variant added to cart successfully", wait: 30)
expect(page).to have_content("Variant added to cart successfully", wait: 5)

expect(Spree::Order.last.line_items.count).to eq(1)
expect(Spree::Order.last.line_items.last.quantity).to eq(1)

fill_in "line_item[quantity]", with: 4
expect(page).to have_content("Quantity updated successfully", wait: 30)
expect(page).to have_content("Quantity updated successfully", wait: 5)

expect(Spree::Order.last.line_items.last.quantity).to eq(4)

accept_confirm("Are you sure?") { click_on "Delete" }
expect(page).to have_content("Line item removed successfully", wait: 30)
expect(page).to have_content("Line item removed successfully", wait: 5)

expect(Spree::Order.last.line_items.count).to eq(0)
expect(page).to be_axe_clean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
visit "/admin/promotions"
expect(page).to have_content("My active Promotion")
click_on "Draft"
expect(page).to have_content("My draft Promotion", wait: 30)
expect(page).to have_content("My draft Promotion", wait: 5)
click_on "Future"
expect(page).to have_content("My future Promotion", wait: 30)
expect(page).to have_content("My future Promotion", wait: 5)
click_on "Expired"
expect(page).to have_content("My expired Promotion", wait: 30)
expect(page).to have_content("My expired Promotion", wait: 5)
click_on "All"
expect(page).to have_content("My active Promotion", wait: 30)
expect(page).to have_content("My active Promotion", wait: 5)
expect(page).to have_content("My draft Promotion")
expect(page).to have_content("My future Promotion")
expect(page).to have_content("My expired Promotion")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
visit "/admin/solidus/promotions"
expect(page).to have_content("My active Promotion")
click_on "Draft"
expect(page).to have_content("My draft Promotion", wait: 30)
expect(page).to have_content("My draft Promotion", wait: 5)
click_on "Future"
expect(page).to have_content("My future Promotion", wait: 30)
expect(page).to have_content("My future Promotion", wait: 5)
click_on "Expired"
expect(page).to have_content("My expired Promotion", wait: 30)
expect(page).to have_content("My expired Promotion", wait: 5)
click_on "All"
expect(page).to have_content("My active Promotion", wait: 30)
expect(page).to have_content("My active Promotion", wait: 5)
expect(page).to have_content("My draft Promotion")
expect(page).to have_content("My future Promotion")
expect(page).to have_content("My expired Promotion")
Expand Down

0 comments on commit 7112488

Please sign in to comment.