Skip to content
Open
Show file tree
Hide file tree
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
10 changes: 1 addition & 9 deletions spec/support/double_click_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,5 @@
#
# # Assert something based on the double click.
def ferrum_double_click(css_selector)
node = Capybara.page.driver.browser.at_css(css_selector)
x, y = node.find_position
mouse = node.page.mouse
mouse.move(x:, y:)
mouse.down
mouse.up
sleep(0.05)
mouse.down
mouse.up
Capybara.page.driver.browser.at_css(css_selector).click(mode: :double, delay: 0.05)
end
15 changes: 7 additions & 8 deletions spec/system/distribution_system_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -915,17 +915,16 @@
click_button "Yes, it's correct"
end

expect(page).to have_content("Distribution created!")

# Make sure the button is there before trying to double click it
expect(page.find('form[action*="/picked_up"] .btn.btn-success.btn-md')).to have_content("Distribution Complete")
expect(page).to have_button("Distribution Complete", visible: true)

# Double click on the Distribution complete button
ferrum_double_click('form[action*="/picked_up"] .btn.btn-success.btn-md')
# Double click on the Distribution Complete button
ferrum_double_click("form[action='#{distribution_path(id: organization.distributions.last.id)}/picked_up']")

# Capybara will be quick to determine that a screen doesn't have content.
# Make some positive assertions that only appears on the new screen to make
# sure it's loaded before asserting something isn't there.
expect(page).not_to have_content("Distribution Complete")
expect(page).to have_content("Complete")
expect(page).to have_content("This distribution has been marked as being completed!")
expect(page).not_to have_button("Distribution Complete")

# If it tries to mark the distribution as completed twice, the second time
# will fail (the distribution is already complete) and show this error
Expand Down
Loading