def login(self, email, password): self.click_browserid_login() from browserid import BrowserID pop_up = BrowserID(self.selenium, self.timeout) pop_up.sign_in(email, password) WebDriverWait(self.selenium, self.timeout).until(lambda s: self.is_user_loggedin)
def sign_in(self, user='******'): credentials = self.testsetup.credentials[user] self.header.click_sign_in() from browserid import BrowserID browser_id = BrowserID(self.selenium, self.timeout) browser_id.sign_in(credentials['email'], credentials['password']) self.header.wait_for_sign_out_visible()
def sign_in(self, user='******'): credentials = self.testsetup.credentials[user] self.header.click_sign_in() from browserid import BrowserID browser_id = BrowserID(self.selenium, self.timeout) browser_id.sign_in(credentials['email'], credentials['password']) WebDriverWait(self.selenium, self.timeout).until(lambda s: s.find_element(*self.header._sign_out_locator))
def login(self, user, expectation): self.click_browserid_login() from browserid import BrowserID browser_id = BrowserID(self.selenium, self.timeout) browser_id.sign_in(user['email'], user['password']) self.wait_for_element_visible(*self._logout_menu_item_locator) return self.expected_page(expectation)
def login_user_browser_id(self, user): credentials = self.testsetup.credentials[user] from browserid import BrowserID pop_up = BrowserID(self.selenium, self.timeout) pop_up.sign_in(credentials["email"], credentials["password"]) WebDriverWait(self.selenium, 20).until(lambda s: s.find_element(*self._logout_locator))
def login(self, user='******'): self.click_browserid_login() credentials = self.testsetup.credentials[user] from browserid import BrowserID pop_up = BrowserID(self.selenium, self.timeout) pop_up.sign_in(credentials['email'], credentials['password']) WebDriverWait(self.selenium, self.timeout).until(lambda s: self.is_user_loggedin)
def sign_in(self, user='******'): credentials = self.testsetup.credentials[user] self.header.click_sign_in() from browserid import BrowserID browser_id = BrowserID(self.selenium, self.timeout) browser_id.sign_in(credentials['email'], credentials['password']) WebDriverWait(self.selenium, self.timeout).until( lambda s: s.find_element(*self.header._sign_out_locator))
def login(self, user): self.click_browserid_login() browser_id = BrowserID(self.selenium, self.timeout) browser_id.sign_in(user["email"], user["password"]) self.wait_for_element_visible(*self._logout_menu_item_locator) from pages.user.user_profile_edit import UserProfileEditPage return UserProfileEditPage(self.testsetup)
def login(self, user): self.click_login() browser_id = BrowserID(self.selenium, self.timeout) browser_id.sign_in(user['email'], user['password']) Wait(self.selenium, self.timeout).until( EC.visibility_of_element_located(self._logout_menu_item_locator)) from pages.user.user_profile_edit import UserProfileEditPage return UserProfileEditPage(self.base_url, self.selenium).wait_for_page_to_load()
def login(self, user): self.click_login() browser_id = BrowserID(self.selenium, self.timeout) browser_id.sign_in(user["email"], user["password"]) Wait(self.selenium, self.timeout).until(EC.visibility_of_element_located(self._logout_menu_item_locator)) from pages.user.user_profile_edit import UserProfileEditPage return UserProfileEditPage(self.base_url, self.selenium).wait_for_page_to_load()
def login_user_browser_id(self, user): credentials = self.testsetup.credentials[user] from browserid import BrowserID pop_up = BrowserID(self.selenium, self.timeout) pop_up.sign_in(credentials['email'], credentials['password']) WebDriverWait( self.selenium, 20).until(lambda s: s.find_element(*self._logout_locator))
def create_new_user(self, user): self.click_browserid_login() from browserid import BrowserID pop_up = BrowserID(self.selenium, self.timeout) pop_up.sign_in(user['email'], user['password']) WebDriverWait(self.selenium, 20).until(lambda s: self.is_user_loggedin) from pages.register import Register return Register(self.testsetup)
def login(self, email, password): from home_page import MozTrapHomePage from browserid import BrowserID self.selenium.find_element(*self._browserid_locator).click() browser_id = BrowserID(self.selenium, timeout=self.timeout) browser_id.sign_in(email, password) WebDriverWait(self.selenium, self.timeout).until( lambda s: self.header.is_user_logged_in) return MozTrapHomePage(self.testsetup)
def create_new_user(self, email, password): self.click_browserid_login() from browserid import BrowserID pop_up = BrowserID(self.selenium, self.timeout) pop_up.sign_in(email, password) WebDriverWait(self.selenium, 20).until(lambda s: self.is_user_loggedin) from pages.register import Register return Register(self.testsetup)
def create_new_user(self, user): self.click_browserid_login() from browserid import BrowserID pop_up = BrowserID(self.selenium, self.timeout) pop_up.sign_in(user['email'], user['password']) WebDriverWait(self.selenium, 20).until(lambda s: self.is_user_loggedin) from pages.register import ProfileTab return ProfileTab(self.testsetup)
def login(self, user='******'): self.selenium.find_element(*self._browserid_login_locator).click() credentials = self.testsetup.credentials[user] from browserid import BrowserID pop_up = BrowserID(self.selenium, self.timeout) pop_up.sign_in(credentials['email'], credentials['password']) WebDriverWait(self.selenium, self.timeout).until( lambda s: self.is_logged_in, message='Could not log in within %s seconds.' % self.timeout)
def log_in(browser, persona_user): browser.get('http://localhost:5000') browser.implicitly_wait(3) login_link = browser.find_element_by_link_text('Log in') login_link.click() browser_id = BrowserID(browser) browser_id.sign_in(persona_user['email'], persona_user['password'])
def login(self, user="******"): from pages.desktop.login import Login login_page = Login(self.testsetup) login_page.click_login() credentials = self.testsetup.credentials[user] from browserid import BrowserID pop_up = BrowserID(self.selenium, self.timeout) pop_up.sign_in(credentials['email'], credentials['password']) WebDriverWait(self.selenium, self.timeout).until(lambda s: self.footer.is_user_logged_in)
def login(self, user="******"): self.header.click_login() credentials = self.testsetup.credentials[user] from browserid import BrowserID pop_up = BrowserID(self.selenium, self.timeout) pop_up.sign_in(credentials["email"], credentials["password"]) WebDriverWait(self.selenium, self.timeout).until(lambda s: self.header.is_user_logged_in)
def create_new_user(self, email, password): self.click_browserid_login() from browserid import BrowserID pop_up = BrowserID(self.selenium, self.timeout) pop_up.sign_in(email, password) WebDriverWait(self.selenium, self.timeout).until(lambda s: self.is_user_loggedin) from pages.register import Register return Register(self.base_url, self.selenium)
def sign_in(self, user): if type(user) is str: user = self.testsetup.credentials[user] from browserid import BrowserID self.header.click_login() browser_id = BrowserID(self.selenium, timeout=self.timeout) browser_id.sign_in(user['email'], user['password']) WebDriverWait(self.selenium, self.timeout).until(lambda s: self.header.is_user_logged_in)
def login(self, user = "******"): if isinstance(user, dict): credentials = {'email': user['email'], 'password':user['pass']} if isinstance(user, str): credentials = self.testsetup.credentials[user] from browserid import BrowserID pop_up = BrowserID(self.selenium, self.timeout) pop_up.sign_in(credentials['email'], credentials['password']) WebDriverWait(self.selenium, self.timeout).until(lambda s: self.header.is_user_logged_in)
def login(self, email=None, password=None): if not all([email, password]): email, password = self._create_persona_test_user() self.click_login() from browserid import BrowserID pop_up = BrowserID(self.selenium, self.timeout) pop_up.sign_in(email, password) WebDriverWait(self.selenium, self.timeout).until( lambda s: self.is_user_logged_in) from pages.home import Home return Home(self.testsetup)
def login_with_credentials(self, credentials): """Log in using a vouched email from personatestuser.org""" self.click_login_browser_id() from browserid import BrowserID pop_up = BrowserID(self.selenium, self.timeout) pop_up.sign_in(credentials['email'], credentials['password']) WebDriverWait(self.selenium, self.timeout).until(lambda s: self.is_user_logged_in) from pages.home import Home return Home(self.testsetup)
def login(self, email, password, error=False): self.click_login() from browserid import BrowserID pop_up = BrowserID(self.selenium, self.timeout) pop_up.sign_in(email, password) if error: WebDriverWait(self.selenium, self.timeout).until( expected.visibility_of_element_located(self._error_locator)) else: WebDriverWait(self.selenium, self.timeout).until(lambda s: self.is_user_logged_in) from pages.home import Home return Home(self.base_url, self.selenium)
def sign_in(self, user): if type(user) is str: user = self.testsetup.credentials[user] from browserid import BrowserID self.header.click_login() browser_id = BrowserID(self.selenium, timeout=self.timeout) browser_id.sign_in(user['email'], user['password']) WebDriverWait( self.selenium, self.timeout).until(lambda s: self.header.is_user_logged_in)
def login(self, email, password, error=False): self.click_login() from browserid import BrowserID pop_up = BrowserID(self.selenium, self.timeout) pop_up.sign_in(email, password) if error: WebDriverWait(self.selenium, self.timeout).until( expected.visibility_of_element_located(self._error_locator)) else: WebDriverWait(self.selenium, self.timeout).until( lambda s: self.is_user_logged_in) from pages.home import Home return Home(self.base_url, self.selenium)
def create_new_account(self): """Retrieves a vouched email and password and logs in""" credentials = self.get_new_user() self.click_login_browser_id() from browserid import BrowserID pop_up = BrowserID(self.selenium, self.timeout) pop_up.sign_in(credentials['email'], credentials['password']) WebDriverWait(self.selenium, self.timeout).until(lambda s: self.is_user_logged_in) from pages.home import Home return Home(self.testsetup)
def login(self, user='******'): from home_page import MozTrapHomePage if type(user) is str: user = self.testsetup.credentials[user] from browserid import BrowserID self.selenium.find_element(*self._browserid_locator).click() browser_id = BrowserID(self.selenium, timeout=self.timeout) browser_id.sign_in(user['email'], user['password']) WebDriverWait(self.selenium, self.timeout).until(lambda s: self.header.is_user_logged_in) return MozTrapHomePage(self.testsetup)
def login(self, email, password, error=False): self.click_login() from browserid import BrowserID pop_up = BrowserID(self.selenium, self.timeout) pop_up.sign_in(email, password) if error: element = self.selenium.find_element(*self._error_locator) WebDriverWait(self.selenium, self.timeout).until( lambda s: element.is_displayed()) else: WebDriverWait(self.selenium, self.timeout).until( lambda s: self.is_user_logged_in) from pages.home import Home return Home(self.testsetup)
def test_sign_in_helper_with_returning_user_immediately(self, mozwebqa): browser_id = BrowserID(mozwebqa.selenium, mozwebqa.timeout) browser_id.sign_in(mozwebqa.email, mozwebqa.password) WebDriverWait(mozwebqa.selenium, mozwebqa.timeout).until( lambda s: s.find_element(*self._persona_logged_in_indicator_locator).is_displayed()) self.log_out(mozwebqa.selenium, mozwebqa.timeout) mozwebqa.selenium.find_element(*self._persona_login_button_locator).click() browser_id.sign_in() WebDriverWait(mozwebqa.selenium, mozwebqa.timeout).until( lambda s: s.find_element(*self._persona_logged_in_indicator_locator).is_displayed())
def login(self, user='******'): from home_page import MozTrapHomePage if isinstance(user, str): user = self.testsetup.credentials[user] from browserid import BrowserID self.selenium.find_element(*self._browserid_locator).click() browser_id = BrowserID(self.selenium, timeout=self.timeout) browser_id.sign_in(user['email'], user['password']) WebDriverWait( self.selenium, self.timeout).until(lambda s: self.header.is_user_logged_in) return MozTrapHomePage(self.testsetup)
def test_sign_in_is_this_your_computer_immediately(self, mozwebqa): browser_id = BrowserID(mozwebqa.selenium, mozwebqa.timeout) browser_id.sign_in(mozwebqa.email, mozwebqa.password) WebDriverWait(mozwebqa.selenium, mozwebqa.timeout).until( lambda s: s.find_element(*self._persona_logged_in_indicator_locator).is_displayed()) self.log_out(mozwebqa.selenium, mozwebqa.timeout) mozwebqa.selenium.find_element(*self._persona_login_button_locator).click() from browserid.pages.sign_in import SignIn signin = SignIn(mozwebqa.selenium, mozwebqa.timeout) signin.click_sign_in_returning_user() WebDriverWait(mozwebqa.selenium, mozwebqa.timeout).until( lambda s: s.find_element(*self._persona_logged_in_indicator_locator).is_displayed())
def login(self, user="******"): if self._page_url not in self.selenium.current_url: self.selenium.get(self.base_url + self._page_url) self.selenium.find_element(*self._browser_id_link_locator).click() credentials = self.testsetup.credentials[user] from browserid import BrowserID pop_up = BrowserID(self.testsetup.selenium, self.testsetup.timeout) pop_up.sign_in(credentials['email'], credentials['password']) WebDriverWait(self.selenium, self.timeout).until(lambda s: self.header.logged_in, 'Timed-out waiting for the login to complete') from pages.dashboard_page import DashboardPage return DashboardPage(self.testsetup)
def login(self, user='******'): from home_page import MozTrapHomePage if type(user) is str: user = self.testsetup.credentials[user] if self.is_browserid_visible: from browserid import BrowserID self.click(self._browserid_locator) browser_id = BrowserID(self.selenium, timeout=self.timeout) browser_id.sign_in(user['email'], user['password']) self.selenium.wait_for_page_to_load(timeout=self.timeout) else: self.type(self._username_locator, user['username']) self.type(self._password_locator, user['password']) self.click(self._submit_locator, True) return MozTrapHomePage(self.testsetup)
def login(self, email=None, password=None): ''' Login using persona - if no email is specified a one time set of verified persona credentials, email and password, are generated and used. :param email: verified BrowserID email :param password: BrowserID password ''' if email is None: credentials = self.get_new_persona_credentials() email = credentials['email'] password = credentials['password'] self.selenium.find_element(*self._browserid_login_locator).click() from browserid import BrowserID pop_up = BrowserID(self.selenium, self.timeout) pop_up.sign_in(email, password) WebDriverWait(self.selenium, self.timeout).until( lambda s: self.is_logged_in, message='Could not log in within %s seconds.' % self.timeout)
def test_user_can_log_in_and_log_out(self): self.browser.get('http://localhost:5000') self.browser.implicitly_wait(3) # On the homepage, the user sees the 'Log in' link. login_link = self.browser.find_element_by_link_text('Log in') self.assertTrue(login_link.is_displayed()) # The user is then able to actually log in. login_link.click() browser_id = BrowserID(self.browser) browser_id.sign_in(self.persona_user['email'], self.persona_user['password']) time.sleep(5) logout_link = self.browser.find_element_by_link_text('Log out') self.assertTrue(logout_link.is_displayed()) # The user can click the logout link and again see the login link. logout_link.click() login_link = self.browser.find_element_by_link_text('Log in') self.assertTrue(login_link.is_displayed())
def login(self, user='******'): from home_page import MozTrapHomePage if type(user) is str: user = self.testsetup.credentials[user] if self.is_browserid_visible: from browserid import BrowserID self.selenium.find_element(*self._browserid_locator).click() browser_id = BrowserID(self.selenium, timeout=self.timeout) browser_id.sign_in(user['email'], user['password']) else: self.selenium.find_element(*self._username_locator).send_keys( user['username']) self.selenium.find_element(*self._password_locator).send_keys( user['password']) self.selenium.find_element(*self._submit_locator).click() WebDriverWait( self.selenium, self.timeout).until(lambda s: self.header.is_user_logged_in) return MozTrapHomePage(self.testsetup)
def login(self, email, password): self.click_browserid_login() from browserid import BrowserID pop_up = BrowserID(self.selenium, self.timeout) pop_up.sign_in(email, password) WebDriverWait(self.selenium, 20).until(lambda s: self.is_user_loggedin)
def login_user_browser_id(self, user): credentials = self.testsetup.credentials[user] from browserid import BrowserID browserid = BrowserID(self.selenium, self.timeout) browserid.sign_in(credentials['email'], credentials['password']) WebDriverWait(self.selenium, 10).until(lambda s: s.find_element(*self._home_logout_locator))
def login(self, user, expectation): self.click_browserid_login() browser_id = BrowserID(self.selenium, self.timeout) browser_id.sign_in(user['email'], user['password']) self.wait_for_element_visible(*self._logout_menu_item_locator) return self.expected_page(expectation)