Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 31 lines (23 sloc) 0.939 kb
b38dc72 @davehunt Created tests for logging in and logging out.
davehunt authored
1 #!/usr/bin/env python
9d83222 MPL2 licence migration
Zac 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/.
b38dc72 @davehunt Created tests for logging in and logging out.
davehunt authored
5
757232b Wait for page title to be present.
Zac authored
6 from selenium.webdriver.support.ui import WebDriverWait
c46449b @davehunt Reordered imports, and removed superfluous assertion message.
davehunt authored
7 from unittestzero import Assert
b38dc72 @davehunt Created tests for logging in and logging out.
davehunt authored
8
dd80388 @davehunt PEP8 fixes.
davehunt authored
9
b38dc72 @davehunt Created tests for logging in and logging out.
davehunt authored
10 class Page(object):
11
12 def __init__(self, testsetup):
13 self.testsetup = testsetup
14 self.base_url = testsetup.base_url
15 self.selenium = testsetup.selenium
77e14cb Updating project structure to resemble other projects structure.
Glenn Howard authored
16 self.timeout = testsetup.timeout
b38dc72 @davehunt Created tests for logging in and logging out.
davehunt authored
17
18 @property
19 def is_the_current_page(self):
757232b Wait for page title to be present.
Zac authored
20 if self._page_title:
77e14cb Updating project structure to resemble other projects structure.
Glenn Howard authored
21 WebDriverWait(self.selenium, self.timeout).until(lambda s: s.title)
757232b Wait for page title to be present.
Zac authored
22
c46449b @davehunt Reordered imports, and removed superfluous assertion message.
davehunt authored
23 Assert.equal(self.selenium.title, self._page_title)
757232b Wait for page title to be present.
Zac authored
24 return True
b38dc72 @davehunt Created tests for logging in and logging out.
davehunt authored
25
26 def is_element_visible(self, locator):
27 try:
77e14cb Updating project structure to resemble other projects structure.
Glenn Howard authored
28 return self.selenium.find_element(*locator).is_displayed()
b38dc72 @davehunt Created tests for logging in and logging out.
davehunt authored
29 except:
30 return False
Something went wrong with that request. Please try again.