From a85e533dfe833f397af18be7c4784c9a049eac7f Mon Sep 17 00:00:00 2001 From: Sriram Viswanathan Date: Thu, 6 Apr 2017 11:47:18 -0300 Subject: [#938] Uses PageObject pattern for functional test with @anikarni --- .../features/page_objects/account_recovery_page.py | 51 ++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 service/test/functional/features/page_objects/account_recovery_page.py (limited to 'service/test/functional/features/page_objects/account_recovery_page.py') diff --git a/service/test/functional/features/page_objects/account_recovery_page.py b/service/test/functional/features/page_objects/account_recovery_page.py new file mode 100644 index 00000000..6f502994 --- /dev/null +++ b/service/test/functional/features/page_objects/account_recovery_page.py @@ -0,0 +1,51 @@ +# +# Copyright (c) 2017 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 . + +from base_page import BasePage + + +class AccountRecoveryPage(BasePage): + def __init__(self, context): + BasePage.__init__( + self, + context, + context.account_recovery_url + ) + + self._locators = { + 'admin_code': 'input[name="admin-code"]', + 'user_code': 'input[name="user-code"]', + 'new_password': 'input[name="new-password"]', + 'confirm_password': 'input[name="confirm-password"]', + 'submit_button': '.submit-button button[type="submit"]', + 'backup_account_link': 'a[href="/backup-account"]' + } + + def submit_admin_recovery_code(self, admin_code): + self.fill_by_css_selector(self._locators['admin_code'], admin_code) + self.find_element_by_css_selector(self._locators['submit_button']).click() + + def submit_user_recovery_code(self, user_code): + self.fill_by_css_selector(self._locators['user_code'], user_code) + self.find_element_by_css_selector(self._locators['submit_button']).click() + + def submit_new_password(self, new_password, confirm_password): + self.fill_by_css_selector(self._locators['new_password'], new_password) + self.fill_by_css_selector(self._locators['confirm_password'], confirm_password) + self.find_element_by_css_selector(self._locators['submit_button']).click() + + def go_to_backup_account(self): + self.find_element_by_css_selector(self._locators['backup_account_link']).click() -- cgit v1.2.3