Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure the customer returns specs leverage time outs #5569

Merged
merged 1 commit into from
Dec 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions backend/spec/features/admin/orders/customer_returns_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ def create_customer_return(value)
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
Expand All @@ -29,7 +29,7 @@ def order_state_label

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

Expand All @@ -54,16 +54,16 @@ def order_state_label
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
Expand All @@ -76,18 +76,18 @@ def order_state_label
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

context 'when creating a return with state "In Transit" and then marking it as "Received"' 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
Expand Down