Skip to content

Commit

Permalink
Update Spec to force AJAX Error
Browse files Browse the repository at this point in the history
Specs did not catch the deprecated method "error" because there were
not any tests that checked for an AJAX error. Added steps to a current
current test to ensure an AJAX call fails to cover the method "fail"
and "then" incase those methods might be deprecated in the future
  • Loading branch information
cpfergus1 committed Sep 15, 2022
1 parent 6ae4717 commit 17cfbc6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions backend/spec/features/admin/orders/shipments_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,16 @@ def ship_shipment
alert_text = page.driver.browser.switch_to.alert.text
expect(alert_text).to include 'Please select the split destination'
page.driver.browser.switch_to.alert.accept
find('#item_quantity').fill_in(with: 'text')
find('.select2-container').click
find(:xpath, '//body').all('.select2-drop li.select2-result', text: "#{location_name} (0 on hand)")[1].click
find('.save-split').click
wait = Selenium::WebDriver::Wait.new ignore: Selenium::WebDriver::Error::NoSuchAlertError
alert_text = wait.until { page.driver.browser.switch_to.alert.text }
expect(alert_text).to include 'Quantity must be greater than 0'
page.driver.browser.switch_to.alert.accept
find('#item_quantity').fill_in(with: '1')
find('.save-split').click
end
expect(page).to have_content /Pending package from '#{location_name}'/i
end
Expand Down

0 comments on commit 17cfbc6

Please sign in to comment.