Skip to content
This repository has been archived by the owner on Jan 20, 2022. It is now read-only.

Commit

Permalink
Bug 1145112 - Update toolbars.py for using Wait().until(). r=whimboo
Browse files Browse the repository at this point in the history
  • Loading branch information
Sandeep Murthy authored and whimboo committed Jun 25, 2015
1 parent 196330c commit f75e5cd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
.*.swp
_build/
dist/
venv/
17 changes: 9 additions & 8 deletions firefox_puppeteer/tests/test_toolbars.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import unittest

from marionette_driver import Wait
from marionette_driver.errors import NoSuchElementException

from firefox_ui_harness.decorators import skip_under_xvfb
Expand Down Expand Up @@ -36,7 +37,7 @@ def test_load_url(self):
locationbar.load_url(data_uri)

with self.marionette.using_context('content'):
self.wait_for_condition(lambda mn: mn.get_url() == data_uri)
Wait(self.marionette).until(lambda mn: mn.get_url() == data_uri)

def test_urlbar_input(self):
urlbar_input = self.browser.navbar.locationbar.urlbar_input
Expand Down Expand Up @@ -96,7 +97,7 @@ def test_popup_elements(self):
self.assertFalse(autocompleteresults.is_open)
self.browser.navbar.locationbar.urlbar.send_keys('a')
results = autocompleteresults.results
self.wait_for_condition(lambda _: autocompleteresults.is_complete)
Wait(self.marionette).until(lambda _: autocompleteresults.is_complete)
visible_result_count = len(autocompleteresults.visible_results)
self.assertTrue(visible_result_count > 0)
self.assertEqual(visible_result_count,
Expand All @@ -106,7 +107,7 @@ def test_popup_elements(self):
def test_close(self):
autocompleteresults = self.browser.navbar.locationbar.autocomplete_results
self.browser.navbar.locationbar.urlbar.send_keys('a')
self.wait_for_condition(lambda _: autocompleteresults.is_open)
Wait(self.marionette).until(lambda _: autocompleteresults.is_open)
# The Wait in the library implementation will fail this if this doesn't
# end up closing.
autocompleteresults.close()
Expand All @@ -115,7 +116,7 @@ def test_close(self):
def test_force_close(self):
autocompleteresults = self.browser.navbar.locationbar.autocomplete_results
self.browser.navbar.locationbar.urlbar.send_keys('a')
self.wait_for_condition(lambda _: autocompleteresults.is_open)
Wait(self.marionette).until(lambda _: autocompleteresults.is_open)
# The Wait in the library implementation will fail this if this doesn't
# end up closing.
autocompleteresults.close(force=True)
Expand All @@ -128,7 +129,7 @@ def test_matching_text(self):

autocompleteresults = self.browser.navbar.locationbar.autocomplete_results
self.browser.navbar.locationbar.urlbar.send_keys(input_text)
self.wait_for_condition(lambda _: autocompleteresults.is_complete)
Wait(self.marionette).until(lambda _: autocompleteresults.is_complete)
visible_results = autocompleteresults.visible_results
self.assertTrue(len(visible_results) > 0)
for result in visible_results:
Expand Down Expand Up @@ -173,7 +174,7 @@ def test_popup_elements(self):
self.marionette.navigate(self.url)

self.identity_popup.box.click()
self.wait_for_condition(lambda _: self.identity_popup.is_open)
Wait(self.marionette).until(lambda _: self.identity_popup.is_open)

self.assertEqual(self.identity_popup.icon.get_attribute('localName'), 'image')
self.assertEqual(self.identity_popup.secure_connection_label.get_attribute('localName'),
Expand All @@ -197,7 +198,7 @@ def test_open_close(self):
self.assertFalse(self.identity_popup.is_open)

self.identity_popup.box.click()
self.wait_for_condition(lambda _: self.identity_popup.is_open)
Wait(self.marionette).until(lambda _: self.identity_popup.is_open)

self.identity_popup.close()

Expand All @@ -211,7 +212,7 @@ def test_force_close(self):
self.assertFalse(self.identity_popup.is_open)

self.identity_popup.box.click()
self.wait_for_condition(lambda _: self.identity_popup.is_open)
Wait(self.marionette).until(lambda _: self.identity_popup.is_open)

self.identity_popup.close(force=True)

Expand Down

0 comments on commit f75e5cd

Please sign in to comment.