def test_cancel_tos_link(self, driver): login(driver, user=settings.CAS_TOS_USER, password=settings.CAS_TOS_USER_PASSWORD) tos_page = LoginToSPage(driver, verify=True) # click the Cancel link and verify that you are redirected back to the OSF home page tos_page.cancel_link.click() assert LandingPage(driver, verify=True)
def test_cancel_2fa_login(self, driver): login(driver, user=settings.CAS_2FA_USER, password=settings.CAS_2FA_USER_PASSWORD) two_factor_page = Login2FAPage(driver, verify=True) # click the Cancel link and verify that you are redirected back to the OSF home page two_factor_page.cancel_link.click() assert LandingPage(driver, verify=True)
def test_account_disabled_page(self, driver): login( driver, user=settings.DEACTIVATED_USER, password=settings.DEACTIVATED_USER_PASSWORD, ) exception_page = GenericCASPage(driver, verify=True) assert exception_page.navbar_brand.text == 'OSF HOME' assert exception_page.status_message.text == 'Account disabled'
def test_account_not_confirmed_page(self, driver): login( driver, user=settings.UNCONFIRMED_USER, password=settings.UNCONFIRMED_USER_PASSWORD, ) exception_page = GenericCASPage(driver, verify=True) assert exception_page.navbar_brand.text == 'OSF HOME' assert exception_page.status_message.text == 'Account not confirmed'
def test_need_help_link(self, driver): login(driver, user=settings.CAS_2FA_USER, password=settings.CAS_2FA_USER_PASSWORD) two_factor_page = Login2FAPage(driver, verify=True) two_factor_page.need_help_link.click() assert ('https://help.osf.io' and 'Enable-or-Disable-Two-Factor-Authentication' in driver.current_url)
def test_make_public(self, driver, project_page): # Set project to public project_page.make_public_link.click() project_page.confirm_privacy_change_link.click() assert project_page.make_private_link.present() # Confirm logged out user can now see project logout(driver) project_page.goto() login(driver)
def test_privacy_policy_link(self, driver): login(driver, user=settings.CAS_TOS_USER, password=settings.CAS_TOS_USER_PASSWORD) tos_page = LoginToSPage(driver, verify=True) tos_page.privacy_policy_link.click() assert ( driver.current_url == 'https://github.com/CenterForOpenScience/cos.io/blob/master/PRIVACY_POLICY.md' )
def test_terms_of_use_link(self, driver): login(driver, user=settings.CAS_TOS_USER, password=settings.CAS_TOS_USER_PASSWORD) tos_page = LoginToSPage(driver, verify=True) tos_page.terms_of_use_link.click() assert ( driver.current_url == 'https://github.com/CenterForOpenScience/cos.io/blob/master/TERMS_OF_USE.md' )
def test_continue_button_disabled(self, driver): login(driver, user=settings.CAS_TOS_USER, password=settings.CAS_TOS_USER_PASSWORD) tos_page = LoginToSPage(driver, verify=True) # verify that at first the Continue button is disabled and then becomes enabled after checking the checkbox assert driver.find_element( By.ID, 'primarySubmitButton').get_property('disabled') tos_page.tos_checkbox.click() assert tos_page.continue_button.is_enabled()
def test_invalid_one_time_password(self, driver): login(driver, user=settings.CAS_2FA_USER, password=settings.CAS_2FA_USER_PASSWORD) two_factor_page = Login2FAPage(driver, verify=True) # Enter an invalid one-time password and click the Verify button and verify that you receive an error message two_factor_page.oneTimePassword_input.send_keys_deliberately('999999') two_factor_page.verify_button.click() assert (two_factor_page.login_error_message.text == 'The one-time password you entered is incorrect.')
def test_make_public(self, driver, project_page): # Set project to public WebDriverWait(driver, 5).until( EC.element_to_be_clickable( (By.XPATH, '//a[contains(text(), "Make Public")]'))) project_page.make_public_link.click() project_page.confirm_privacy_change_link.click() assert project_page.make_private_link.present() # Confirm logged out user can now see project logout(driver) project_page.goto() login(driver)
def test_one_time_password_required(self, driver): login(driver, user=settings.CAS_2FA_USER, password=settings.CAS_2FA_USER_PASSWORD) # verify that you are now on the 2 Factor Authentication page two_factor_page = Login2FAPage(driver, verify=True) assert two_factor_page.username_input.present() assert two_factor_page.oneTimePassword_input.present() # click the Verify button and verify that you receive an error message that a one-time password is required two_factor_page.verify_button.click() assert (two_factor_page.login_error_message.text == 'One-time password is required.')
def test_login(self): try: driver = self.driver driver.get(utils.URL) log = login(driver) log.usernamebox(utils.username) log.passwordbox(utils.password) log.logintab() x = driver.title() assert x == "Ganesh" except AssertionError as error: print("exception occurred") ctime = moment.now().strftime("%d-%m-%Y_%H-%M-%S") filename = "screenshot_" + ctime allure.attach(self.driver.get_screenshot_as_png(), name=filename, attachment_type=allure.attachment_type.PNG) raise
def test_logout_link(self, driver, page): page.navbar.user_dropdown.click() page.navbar.logout_link.click() LandingPage(driver, verify=True) assert 'goodbye' in driver.current_url login(driver)
def test_loginact(self): driver=self.driver time=login(driver) time.loginactime(USERNAME,PASSWORD)