Ensure the customer returns specs leverages time outs

This is the most probable cause of previous flakyness.
This commit is contained in:
Elia Schito 2023-12-27 11:43:31 +01:00
parent d9cb1e1f4f
commit a14176f34e
No known key found for this signature in database
GPG Key ID: 9A79FC0070180BEE

View File

@ -12,8 +12,8 @@ describe 'Customer returns', type: :feature do
click_button 'Create'
end
def order_state_label
find('dd.order-state').text
def expect_order_state_label_to_eq(text)
within('dd.order-state') { expect(page).to have_content(text) }
end
before do
@ -29,7 +29,7 @@ describe 'Customer returns', type: :feature do
expect(page).to have_content 'Customer Return has been successfully created'
expect(order_state_label).to eq('Returned')
expect_order_state_label_to_eq('Returned')
end
end
@ -54,16 +54,16 @@ describe 'Customer returns', type: :feature do
end
end
it 'marks the order as returned', :js, :flaky do
it 'marks the order as returned', :js do
create_customer_return('in_transit')
expect(page).to have_content 'Customer Return has been successfully created'
expect(order_state_label).to eq('Complete')
expect_order_state_label_to_eq('Complete')
within('[data-hook="rejected_return_items"] tbody tr:nth-child(1)') { click_button('Receive') }
expect(order_state_label).to eq('Complete')
expect_order_state_label_to_eq('Complete')
within('[data-hook="rejected_return_items"] tbody tr:nth-child(2)') { click_button('Receive') }
expect(order_state_label).to eq('Returned')
expect_order_state_label_to_eq('Returned')
end
end
end
@ -76,7 +76,7 @@ describe 'Customer returns', type: :feature do
create_customer_return('receive')
expect(page).to have_content 'Customer Return has been successfully created'
expect(order_state_label).to eq('Returned')
expect_order_state_label_to_eq('Returned')
end
end
@ -84,10 +84,10 @@ describe 'Customer returns', type: :feature do
it 'marks the order as returned', :js do
create_customer_return('in_transit')
expect(page).to have_content 'Customer Return has been successfully created'
expect(order_state_label).to eq('Complete')
expect_order_state_label_to_eq('Complete')
within('[data-hook="rejected_return_items"] tbody tr:nth-child(1)') { click_button('Receive') }
expect(order_state_label).to eq('Returned')
expect_order_state_label_to_eq('Returned')
end
end
end