Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 43 lines (34 sloc) 1.467 kB
4857f22 @zalun page.py added, firefox instance in settings.py
zalun authored
1 #!/usr/bin/env python
c5c6dde Upgrade license to MPL 2.
Gervase Markham authored
2 # This Source Code Form is subject to the terms of the Mozilla Public
3 # License, v. 2.0. If a copy of the MPL was not distributed with this
4 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7054090 Place space between license and first import
Zac authored
5
d56f818 Add page title wait for webdriver issue workaround
Zac authored
6 from unittestzero import Assert
7 from selenium.webdriver.support.ui import WebDriverWait
e2ec36e Changes to address Dave's code review
Zac authored
8 from selenium.common.exceptions import NoSuchElementException
9 from selenium.common.exceptions import ElementNotVisibleException
4857f22 @zalun page.py added, firefox instance in settings.py
zalun authored
10
7d2554b Changes to allow multiple threads to run. Search tests adjusted to me…
Zac authored
11
4857f22 @zalun page.py added, firefox instance in settings.py
zalun authored
12 class Page(object):
68f5bcc @stupchiy copy-pasted is_element_present() method from amo tests
stupchiy authored
13
f9f39f6 @AutomatedTester Forgot to add a few files to previous commit for test_addons_count
AutomatedTester authored
14 def __init__(self, testsetup):
15 self.testsetup = testsetup
16 self.selenium = testsetup.selenium
a272071 Final update adding credentials and addressing davehunt's code sugges…
Zac Campbell authored
17 self.base_url = testsetup.base_url
7d2554b Changes to allow multiple threads to run. Search tests adjusted to me…
Zac authored
18
f9f39f6 @AutomatedTester Forgot to add a few files to previous commit for test_addons_count
AutomatedTester authored
19 @property
20 def is_the_current_page(self):
f56cc17 Simplify code.
Zac authored
21 if self._page_title:
22 WebDriverWait(self.selenium, 10).until(lambda s: self.selenium.title)
68f5bcc @stupchiy copy-pasted is_element_present() method from amo tests
stupchiy authored
23
787fe36 Update message as per dave's suggestion.
Zac authored
24 Assert.equal(self.selenium.title, self._page_title)
d56f818 Add page title wait for webdriver issue workaround
Zac authored
25 return True
26
89c0fe2 new login/logout tests
Zac authored
27 def is_element_visible(self, *locator):
b3adeb0 Changes to locator names and coding standards
Zac authored
28 try:
29 return self.selenium.find_element(*locator).is_displayed()
30 except NoSuchElementException, ElementNotVisibleException:
31 return False
68f5bcc @stupchiy copy-pasted is_element_present() method from amo tests
stupchiy authored
32
33 def is_element_present(self, *locator):
34 self.selenium.implicitly_wait(0)
35 try:
36 self.selenium.find_element(*locator)
37 return True
38 except NoSuchElementException:
39 return False
40 finally:
41 # set back to where you once belonged
42 self.selenium.implicitly_wait(self.testsetup.default_implicit_wait)
Something went wrong with that request. Please try again.