Switch to using BrowserID page object model project as a submodule.
This commit is contained in:
Родитель
2c5e2b7fe5
Коммит
691eafbdfa
|
@ -1,91 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is Mozilla WebQA Selenium Tests.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Mozilla.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2011
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s): Bebe <florin.strugariu@softvision.ro>
|
||||
# Teodosia Pop <teodosia.pop@softvision.ro>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
import time
|
||||
|
||||
from page import Page
|
||||
|
||||
|
||||
class BrowserID(Page):
|
||||
|
||||
_pop_up_title = 'BrowserID'
|
||||
_email_locator = 'id=email'
|
||||
_password_locator = 'id=password'
|
||||
|
||||
_log_in_button_locator = 'css=button.returning'
|
||||
_next_button_locator = 'css=button.start'
|
||||
_sign_in_locator = 'id=signInButton'
|
||||
|
||||
def __init__(self, testsetup):
|
||||
Page.__init__(self, testsetup)
|
||||
|
||||
self.selenium.wait_for_pop_up('', self.timeout)
|
||||
|
||||
handles = self.selenium.get_all_window_titles()
|
||||
|
||||
for i in handles:
|
||||
self.selenium.select_window(i)
|
||||
if self.selenium.get_title == self._pop_up_title:
|
||||
self.selenium.window_focus()
|
||||
break
|
||||
|
||||
def login_browser_id(self, credentials):
|
||||
self.wait_for_element_visible(self._email_locator)
|
||||
|
||||
self.selenium.type(self._email_locator, credentials['email'])
|
||||
self.selenium.click(self._next_button_locator)
|
||||
self.wait_for_element_visible(self._password_locator)
|
||||
|
||||
self.selenium.type(self._password_locator, credentials['password'])
|
||||
self.selenium.click(self._log_in_button_locator)
|
||||
|
||||
def sign_in(self):
|
||||
self.wait_for_element_visible(self._sign_in_locator)
|
||||
self.selenium.click(self._sign_in_locator)
|
||||
|
||||
self._wait_for_popup_to_close(self.timeout)
|
||||
self.selenium.deselect_pop_up()
|
||||
|
||||
def _wait_for_popup_to_close(self, timeout):
|
||||
count = 0
|
||||
while len(self.selenium.get_all_window_titles()) > 1:
|
||||
time.sleep(1)
|
||||
count += 1
|
||||
if count == self.timeout / 1000:
|
||||
raise Exception("PopUp is still visible")
|
|
@ -46,7 +46,7 @@ class MozilliansBasePage(Page):
|
|||
_profile_link_locator = 'id=profile'
|
||||
_invite_link_locator = 'id=invite'
|
||||
_join_us_link_locator = 'id=register'
|
||||
_login_link_locator = 'css=#browserid-login > a'
|
||||
_login_link_locator = 'css=#create_profile .signin'
|
||||
_logout_link_locator = 'id=logout'
|
||||
_search_box_locator = 'id=q'
|
||||
_search_btn_locator = 'id=quick-search-btn'
|
||||
|
@ -161,12 +161,10 @@ class MozilliansLoginPage(MozilliansBasePage):
|
|||
|
||||
def log_in(self, user="user"):
|
||||
credentials = self.testsetup.credentials[user]
|
||||
browser_id = BrowserID(self.testsetup)
|
||||
|
||||
browser_id.login_browser_id(credentials)
|
||||
browser_id.sign_in()
|
||||
|
||||
self.sel.wait_for_page_to_load(self.timeout)
|
||||
from browserid import BrowserID
|
||||
browserid = BrowserID(self.selenium, self.timeout)
|
||||
browserid.sign_in(credentials['email'], credentials['password'])
|
||||
self.wait_for_element_present(MozilliansStartPage._logout_link_locator)
|
||||
|
||||
class MozilliansProfilePage(MozilliansBasePage):
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче