示例#1
0
    def login(self, user="******"):
        from pages.desktop.login import Login

        login_page = Login(self.testsetup)

        if isinstance(user, MockUser):
            bid_login = login_page.click_login_register(expect="returning")
            bid_login.click_sign_in_returning_user()

        elif isinstance(user, str):
            bid_login = login_page.click_login_register(expect="new")
            credentials = self.testsetup.credentials[user]
            bid_login.sign_in(credentials["email"], credentials["password"])

        else:
            return False

        WebDriverWait(self.selenium, self.timeout).until(lambda s: self.footer.is_user_logged_in)
示例#2
0
    def create_new_user(self, user):
        # saves the current url
        current_url = self.selenium.current_url

        from pages.desktop.login import Login

        login_page = Login(self.testsetup)
        bid_login = login_page.click_login_register(expect="new")

        # creates the new user in the browserID pop up
        bid_login.sign_in_new_user(user["email"], user["password"])

        # Open restmail inbox, find the email
        inbox = RestmailInbox(user["email"])
        email = inbox.find_by_index(0)

        # Load the BrowserID link from the email in the browser
        self.selenium.get(email.verify_user_link)
        from browserid.pages.webdriver.complete_registration import CompleteRegistration

        CompleteRegistration(self.selenium, self.timeout)

        # restores the current url
        self.selenium.get(current_url)