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

Commit

Permalink
Merge pull request #56 from chirarobert/wait_for_watch_message
Browse files Browse the repository at this point in the history
Added a wait for ajax to be ready when watching/unwatching a page.
  • Loading branch information
bebef1987 committed Jun 17, 2014
2 parents 5701cd6 + a230490 commit 298e491
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pages/header_region.py
Expand Up @@ -5,6 +5,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait

from page import Page

Expand Down Expand Up @@ -62,6 +63,7 @@ def is_watch_visible(self):

def click_watch(self):
self.selenium.find_element(*self._watch_locator).click()
self.wait_for_ajax()
from watch_page import WatchPage
return WatchPage(self.testsetup)

Expand All @@ -71,6 +73,7 @@ def is_unwatch_visible(self):

def click_unwatch(self):
self.selenium.find_element(*self._unwatch_locator).click()
self.wait_for_ajax()
from watch_page import WatchPage
return WatchPage(self.testsetup)

Expand All @@ -94,3 +97,7 @@ def click_search_button(self):
self.selenium.find_element(*self._search_button_locator).click()
from search_results import SearchResultsPage
return SearchResultsPage(self.testsetup)

def wait_for_ajax(self):
WebDriverWait(self.selenium, self.timeout).until(
lambda m: self.selenium.execute_script('return jQuery.active == 0'))

0 comments on commit 298e491

Please sign in to comment.