mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Stabilise spec by not relying on record ids
A spec was referring to and input id:
```
"order_cycle_incoming_exchange_0_variants_#{new_product.variants.first.id}"
```
But sometimes the exchange would have the id 1 instead of 0 and the test
would fail. Instead I opted to select the field by text visible to the
user.
This commit is contained in:
@@ -46,10 +46,9 @@ RSpec.describe '
|
||||
|
||||
expect_all_products_loaded
|
||||
|
||||
expect(page).to have_checked_field(
|
||||
"order_cycle_incoming_exchange_0_variants_#{new_product.variants.first.id}",
|
||||
disabled: false
|
||||
)
|
||||
within("div.exchange-product", text: "Z Last Product") do
|
||||
expect(page).to have_checked_field "1g", disabled: false
|
||||
end
|
||||
end
|
||||
|
||||
def expect_all_products_loaded
|
||||
|
||||
Reference in New Issue
Block a user