mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Merge pull request #5739 from Matt-Yorkley/flaky-spec-complex-oc
Flaky spec order_cycles/complex_updating_specific_time
This commit is contained in:
@@ -69,7 +69,8 @@ feature '
|
||||
select 'My supplier', from: 'new_supplier_id'
|
||||
click_button 'Add supplier'
|
||||
expect(page).to have_selector("table.exchanges tr.supplier", text: "My supplier")
|
||||
page.all("table.exchanges tr.supplier td.products").each(&:click)
|
||||
|
||||
open_all_exchange_product_tabs
|
||||
|
||||
expect(page).to have_selector "#order_cycle_incoming_exchange_1_variants_#{initial_variants.last.id}", visible: true
|
||||
page.find("#order_cycle_incoming_exchange_1_variants_#{initial_variants.last.id}", visible: true).click # uncheck (with visible:true filter)
|
||||
@@ -87,6 +88,7 @@ feature '
|
||||
select 'Supplier fee 2', from: 'order_cycle_incoming_exchange_2_enterprise_fees_0_enterprise_fee_id'
|
||||
|
||||
click_button 'Save and Next'
|
||||
expect(page).to have_content 'Your order cycle has been updated.'
|
||||
|
||||
# And I add a distributor and some products
|
||||
select 'My distributor', from: 'new_distributor_id'
|
||||
@@ -105,12 +107,7 @@ feature '
|
||||
find(:css, "tags-input .tags input").set "wholesale\n"
|
||||
end
|
||||
|
||||
exchange_rows = page.all("table.exchanges tbody")
|
||||
exchange_rows.each do |exchange_row|
|
||||
exchange_row.find("td.products").click
|
||||
# Wait for the products panel to be visible.
|
||||
expect(exchange_row).to have_selector "tr", count: 2
|
||||
end
|
||||
open_all_exchange_product_tabs
|
||||
|
||||
uncheck "order_cycle_outgoing_exchange_2_variants_#{v1.id}"
|
||||
check "order_cycle_outgoing_exchange_2_variants_#{v2.id}"
|
||||
@@ -165,4 +162,15 @@ feature '
|
||||
def wait_for_edit_form_to_load_order_cycle(order_cycle)
|
||||
expect(page).to have_field "order_cycle_name", with: order_cycle.name
|
||||
end
|
||||
|
||||
def open_all_exchange_product_tabs
|
||||
exchange_rows = page.all("table.exchanges tbody")
|
||||
exchange_rows.each do |exchange_row|
|
||||
exchange_row.find("td.products").click
|
||||
within(exchange_row) do
|
||||
# Wait for the products panel to be visible.
|
||||
expect(page).to have_selector ".exchange-products"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user