Skip to content

Commit

Permalink
Get tests passing
Browse files Browse the repository at this point in the history
  • Loading branch information
hopsoft committed Mar 26, 2024
1 parent 4f7711f commit 48a3297
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions test/application_system_test_case.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ def before_setup
@playwright_exec = Playwright.create(playwright_cli_executable_path: "npx playwright")
@playwright = @playwright_exec.playwright
@browser = @playwright.public_send(BROWSER).launch
@context = @browser.new_context # prepare new browser window
@context = @browser.new_context(
bypassCSP: true,
ignoreHTTPSErrors: true
)
@page = @context.new_page
@page.set_default_timeout Capybara.default_max_wait_time * 1_000
end
Expand Down Expand Up @@ -75,10 +78,11 @@ def element_mutated?(testid)
# @param interval [Integer] The time interval to wait between checks (default: 20ms)
def wait_for_mutations(testid, timeout: 5.seconds, interval: 0.02)
wait_for_mutations_finished testid, timeout: timeout, interval: interval
yield element(testid).element_handle if block_given?
sleep 0.1 # TODO: figure out why this is needed
Timeout.timeout timeout.to_i do
sleep interval.to_f until element_mutated?(testid)
end
yield element(testid).element_handle if block_given?
rescue Timeout::Error
sleep 0.5 # last ditch effort to avoid flakiness
yield element(testid).element_handle if block_given?
Expand All @@ -91,6 +95,7 @@ def wait_for_mutations(testid, timeout: 5.seconds, interval: 0.02)
# @param timeout [Integer] The maximum time to wait (default: 5s)
# @param interval [Integer] The time interval to wait between checks (default: 20ms)
def wait_for_mutations_finished(testid, timeout: 5.seconds, interval: 0.02)
sleep 0.1 # TODO: figure out why this is needed
Timeout.timeout timeout.to_i do
sleep interval.to_f while element_mutated?(testid)
end
Expand Down

0 comments on commit 48a3297

Please sign in to comment.