diff options
Diffstat (limited to 'files/puppet/modules/pixelated/files/functional-tests/page_objects/login_page.py')
-rw-r--r-- | files/puppet/modules/pixelated/files/functional-tests/page_objects/login_page.py | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/files/puppet/modules/pixelated/files/functional-tests/page_objects/login_page.py b/files/puppet/modules/pixelated/files/functional-tests/page_objects/login_page.py new file mode 100644 index 0000000..ae6e31c --- /dev/null +++ b/files/puppet/modules/pixelated/files/functional-tests/page_objects/login_page.py @@ -0,0 +1,61 @@ +# +# Copyright (c) 2015 ThoughtWorks, Inc. +# +# Pixelated is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Pixelated is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with Pixelated. If not, see <http://www.gnu.org/licenses/>. + +from base_page_object import BasePageObject +from selenium.common.exceptions import TimeoutException + + +class LoginPage(BasePageObject): + def __init__(self, context, timeout=10): + self._locators = { + 'username': 'input#email', + 'password': 'input#password', + 'login_button': 'input[type=submit]', + 'hive_svg': 'svg#hive' + } + super(LoginPage, self).__init__(context, timeout) + + def enter_username(self, username): + self._username_field().send_keys(username) + return self + + def enter_password(self, password): + self._password_field().send_keys(password) + return self + + def login(self): + self._login_button().click() + return self + + def _username_field(self): + return self._find_element_by_css_locator(self._locators['username']) + + def _password_field(self): + return self._find_element_by_css_locator(self._locators['password']) + + def _login_button(self): + return self._find_element_by_css_locator(self._locators['login_button']) + + def wait_interstitial_page(self, time=180): + if self._is_interstitial_page_displayed(): + self._wait_element_to_be_removed(self._locators['hive_svg'], time) + + def _is_interstitial_page_displayed(self): + try: + self._find_element_by_css_locator(self._locators['hive_svg'], 2) + return True + except TimeoutException: + return False |