Skip to content

Commit

Permalink
Merge pull request #5739 from Matt-Yorkley/flaky-spec-complex-oc
Browse files Browse the repository at this point in the history
Flaky spec order_cycles/complex_updating_specific_time
  • Loading branch information
mkllnk authored Jul 10, 2020
2 parents cc3361a + e742069 commit c1d7001
Showing 1 changed file with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@
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)
Expand All @@ -87,6 +88,7 @@
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'
Expand All @@ -105,12 +107,7 @@
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}"
Expand Down Expand Up @@ -165,4 +162,15 @@
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

0 comments on commit c1d7001

Please sign in to comment.