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:
Maikel Linke
2024-08-06 12:31:54 +10:00
parent f5875e4c0b
commit e055b8b16c

View File

@@ -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