From 0a8ad8bd3756216a4ee1694504f0e9e48b18a4fb Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Fri, 10 Dec 2021 14:03:22 +1100 Subject: [PATCH] Make flaky system spec reliable It was failing 50% of the time since it was converted into a system spec. --- spec/system/admin/order_spec.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/spec/system/admin/order_spec.rb b/spec/system/admin/order_spec.rb index a77fe8a47ca..8920571aca2 100644 --- a/spec/system/admin/order_spec.rb +++ b/spec/system/admin/order_spec.rb @@ -219,7 +219,15 @@ def new_order_with_distribution(distributor, order_cycle) fill_in "order_bill_address_attributes_address1", with: "xxx" fill_in "order_bill_address_attributes_city", with: "xxx" fill_in "order_bill_address_attributes_zipcode", with: "xxx" - select "Australia", from: "order_bill_address_attributes_country_id" + + # The country is already selected and we avoid re-selecting it here + # because it would trigger an API call which we would need to wait for + # while we have no visual indicator for the wait. + # + # Ideally, we would implement a visual cue like disable the state field + # while the data is fetched from the API. + # + # select "Australia", from: "order_bill_address_attributes_country_id" select "Victoria", from: "order_bill_address_attributes_state_id" fill_in "order_bill_address_attributes_phone", with: "xxx"