Skip to content

Commit 75cd6bc

Browse files
Add wait before address fill in
I can't figure out why there needs to be a wait here but this test fails because the address doesn't get filled in without this. The fill_addresses_fields_with helper successfully focuses each field and calls fill_in with the correct value but nothing is actually typed into the field. Something is happening on page load that prevents these from being filled in but visually it doesn't seem like there's anything to check for so I resorted to just trying over and over and checking whether the text actually gets typed in.
1 parent 6de294e commit 75cd6bc

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

templates/spec/support/solidus_starter_frontend/system/checkout_helpers.rb

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,19 @@ def fill_addresses_fields_with(address)
5555
%w[firstname lastname]
5656
end
5757

58-
fields.each do |field|
59-
fill_in "order_bill_address_attributes_#{field}", with: address.send(field).to_s
58+
wait_time = 3
59+
while wait_time > 0
60+
fields.each do |field|
61+
fill_in "order_bill_address_attributes_#{field}", with: address.send(field).to_s
62+
end
63+
select "United States of America", from: "order_bill_address_attributes_country_id"
64+
select address.state.name.to_s, from: "order_bill_address_attributes_state_id"
65+
66+
break if find("#order_bill_address_attributes_#{fields.first}").value == address.send(fields.first).to_s
67+
68+
sleep 0.1
69+
wait_time -= 0.1
6070
end
61-
select "United States of America", from: "order_bill_address_attributes_country_id"
62-
select address.state.name.to_s, from: "order_bill_address_attributes_state_id"
6371

6472
check 'order_use_billing'
6573
end

0 commit comments

Comments
 (0)