Skip to content

Commit

Permalink
oeps
Browse files Browse the repository at this point in the history
  • Loading branch information
adi-herwana-nus committed Sep 30, 2024
1 parent ef3ac42 commit 239ea98
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions spec/support/active_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ def wait_for_job
end
end

# TODO: Whenever possible, rewrite tests currently using these functions to use alternative solutions.
# Sleeping for a preset time is inherently flaky as the page may not always behave the same way.
# https://thoughtbot.com/blog/write-reliable-asynchronous-integration-tests-with-capybara

# Wait for page/react lifecycle to finish loading/end
def wait_for_page
sleep 2.5
Expand All @@ -76,6 +80,13 @@ def wait_for_field_debouncing
sleep 0.5
end

# Wait for certain animations to finish before performing further actions (e.g. clicking a list element)
# The animation may cause tests to click the wrong element if it happens at just the right time.
# As with all the wait_for_* methods, we should stop using this when a better solution is found.
def wait_for_animation
sleep 1
end

def visit_current_path
tries ||= 10
visit current_path
Expand Down

0 comments on commit 239ea98

Please sign in to comment.