Skip to content

Commit

Permalink
Bug 1582736 - Open new tab per navigation when testing acceptInsecure…
Browse files Browse the repository at this point in the history
…Certs r=marionette-reviewers,jgraham

Differential Revision: https://phabricator.services.mozilla.com/D90704
  • Loading branch information
mjzffr committed Sep 18, 2020
1 parent ed5b7a5 commit c4d2beb
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -731,17 +731,31 @@ def safe_session(self):
try:
self.capabilities = self.marionette.start_session(self.secure_tls)
self.assertFalse(self.capabilities["acceptInsecureCerts"])
# Always use a blank new tab for an empty history
self.new_tab = self.open_tab()
self.marionette.switch_to_window(self.new_tab)
Wait(self.marionette, timeout=self.marionette.timeout.page_load).until(
lambda _: self.history_length == 1,
message="The newly opened tab doesn't have a browser history length of 1")
yield self.marionette
finally:
self.close_all_tabs()
self.marionette.delete_session()

@contextlib.contextmanager
def unsafe_session(self):
try:
self.capabilities = self.marionette.start_session(self.insecure_tls)
self.assertTrue(self.capabilities["acceptInsecureCerts"])
# Always use a blank new tab for an empty history
self.new_tab = self.open_tab()
self.marionette.switch_to_window(self.new_tab)
Wait(self.marionette, timeout=self.marionette.timeout.page_load).until(
lambda _: self.history_length == 1,
message="The newly opened tab doesn't have a browser history length of 1")
yield self.marionette
finally:
self.close_all_tabs()
self.marionette.delete_session()

def test_navigate_by_command(self):
Expand Down

0 comments on commit c4d2beb

Please sign in to comment.