Skip to content

Instantly share code, notes, and snippets.

@titusfortner
Last active August 29, 2015 14:07
Show Gist options
  • Save titusfortner/4c9c489598bbb0d852b4 to your computer and use it in GitHub Desktop.
Save titusfortner/4c9c489598bbb0d852b4 to your computer and use it in GitHub Desktop.
Failing Wait Tests
it "should not throw error when running error checks on closed window" do
browser.close
client = Selenium::WebDriver::Remote::Http::Default.new
client.timeout = 5
browser = Watir::Browser.start(WatirSpec.url_for("window_switching.html"), :chrome, http_client: client)
browser.a(:id => "open").click
window = browser.window(:title => "closeable window")
window.use
browser.a(:id => "close").click
expect { browser.driver.current_url }.to_not raise_error
expect(window).to_not be_present
end
it "should not throw error when running error checks on closed window" do
module Watir
class Browser
def run_checkers
@error_checkers.each { |e| e.call(self) } if window.present?
end
end
end
browser.goto WatirSpec.url_for("window_switching.html")
browser.a(:id => "open").click
window = browser.window(:title => "closeable window")
window.use
expect { browser.a(:id => "close").click }.to_not raise_error
expect(window).to_not be_present
end
@titusfortner
Copy link
Author

Current Code fails in Firefox with the correct error & in Chrome with the wrong error

Desired code works in Chrome, but fails in Firefox.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment