From d525168410957f73e3e52740c3f015112e8ab0fc Mon Sep 17 00:00:00 2001 From: Senem Soy Date: Tue, 4 Apr 2023 12:00:26 -0700 Subject: [PATCH] Reproduce missing refund log entry bug This reproduces the issue mentioned here #4866 Co-authored-by: Benjamin Willems --- .../features/admin/orders/new_refund_spec.rb | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/backend/spec/features/admin/orders/new_refund_spec.rb b/backend/spec/features/admin/orders/new_refund_spec.rb index 039e54fc520..e972014f5dd 100644 --- a/backend/spec/features/admin/orders/new_refund_spec.rb +++ b/backend/spec/features/admin/orders/new_refund_spec.rb @@ -19,7 +19,25 @@ click_button 'Refund' end expect(page).to have_content 'Refund has been successfully created!' - expect(page).to have_selector 'td', text: amount + within 'tr[data-hook="refunds_row"]' do + expect(page).to have_selector 'td', text: amount + end + end + + it 'creates a new log entry for a refund', pending: 'This is pending because currently no log entry is created for this refund.' do + visit spree.new_admin_order_payment_refund_path(order, payment) + expect(page).not_to have_selector 'td', text: amount + within '.new_refund' do + fill_in 'refund_amount', with: amount + select reason.name, from: 'Reason' + click_button 'Refund' + end + expect(page).to have_content 'Refund has been successfully created!' + within 'tr[data-hook="payments_row"]' do + payment_number = find_all('td').first.text + click_on payment_number + expect(page).to have_selector 'tr.log_entry' + end end it 'disables the button at submit' do