def __init__(self): self._driver = Firefox(executable_path=urls.FIREFOX_EXE_PATH) self._setup_driver() self._account = AccountPage(self._driver) self._practice = PracticePage(self._driver) self._settings = SettingsPage(self._driver) self._keyboard = Keyboard()
def test_incorrect_token(browser,login,logout): """Test incorrect token input. Expected result: Error 'Check your input' highlighted is seen """ settings_page = SettingsPage(browser) settings_page.load() settings_page.input_text_in_field(SettingsPageLocators.TOKEN_TB,TEMP_TOKEN) settings_page.update_token_btn_click() assert settings_page.is_element_seen(SettingsPageLocators.SAVE_FAILED) and \ settings_page.visible_element_get_text(SettingsPageLocators.SAVE_FAILED)=="Check your input"
def test_settings(self): main_page = MainPage(self.driver) main_page.skip_familiarization() settings_page = SettingsPage(self.driver) settings_page.go_to_settings() settings_page.add_language('Українська') settings_page.check_language_presence('Українська') time.sleep(5) # For visual confirm
def test_manage_suite_lnk(browser, login, close): """Test that Manage_suite_lnk is clickable and redirecting user to the suites manager page if user login Test covers that user also is able to navigate backward""" settings_page = SettingsPage(browser) settings_page.load() settings_page.suite_manager_lnk_click() settings_page.backward() assert browser.current_url == locators.SettingsPageLocators.SETTINGS_URL
def test_trunner_link_logon_user(browser, login, close): """Test that Trunner_link is clickable and redirect user to the Suites(if user is logon) Test covers that user also is able to navigate backward""" settings_page = SettingsPage(browser) settings_page.load() settings_page.trunner_lnk_click() settings_page.backward() assert browser.current_url == locators.SettingsPageLocators.SETTINGS_URL
class TypingBot: def __init__(self): self._driver = Firefox(executable_path=urls.FIREFOX_EXE_PATH) self._setup_driver() self._account = AccountPage(self._driver) self._practice = PracticePage(self._driver) self._settings = SettingsPage(self._driver) self._keyboard = Keyboard() def _setup_driver(self): self._driver.set_window_size(1440, 900) self._driver.implicitly_wait(timers.IMPLICIT_WAIT) def login(self): self._driver.get(urls.LOGGED_IN_URL) print('Logged In!') def go_to_practice(self): self._account.click_practice() self._practice.close_popup_window() def change_settings(self): self._practice.go_to_settings() self._settings.extend_alphabet() self._settings.extend_lesson_length() self._settings.enable_capital_letters() self._settings.enable_punctuation_characters() self._settings.save_settings() def practice_for_repetitions(self, practice_reps=1): for i in range(practice_reps): input_text = self._get_text_input_items() self._keyboard.type_sentence(input_text) time.sleep(timers.WAIT_FOR_NEXT_PRACTICE) def cleanup(self): self._driver.quit() def _get_text_input_items(self): input_items = self._practice.find_text_input_items() input_items_text = [ ' ' if item.text == '␣' else item.text for item in input_items ] input_text = ''.join(input_items_text) return input_text
def test_5(self, setUp): home_page = HomePage(driver=self.driver) home_page.open("/") home_page.click_login_button() login_page = LoginPage(driver=self.driver) login_page.login_with_email_and_password("*****@*****.**", "yamin787898") home_page.click_my_account() dashboard_page = DashboardPage(driver=self.driver) dashboard_page.click_settings() settings_page = SettingsPage(driver=self.driver) settings_page.change_password("yamin787898", "Y@min787898") time.sleep(5) settings_page.open("/") time.sleep(5) home_page.click_my_account() self.driver.implicitly_wait(20) dashboard_page = DashboardPage(driver=self.driver) dashboard_page.click_settings() self.driver.implicitly_wait(20) settings_page = SettingsPage(driver=self.driver) settings_page.change_password("Y@min787898", "yamin787898")
def before_all(context): context.hipchat_login = HIPCHAT_LOGIN context.hipchat_pass = HIPCHAT_PASS context.hipchat_login_2 = HIPCHAT_LOGIN_2 context.hipchat_pass_2 = HIPCHAT_PASS_2 context.base_url = "https://bortnik.hipchat.com" context.driver = webdriver.Chrome() context.wait = ui.WebDriverWait(context.driver, 10) context.lobby_page = LobbyPage(context) context.login_page = LoginPage(context) context.authorized_page = AuthorizedPage(context) context.api_page = ApiPage(context) context.settings_page = SettingsPage(context) context.people_page = PeoplePage(context) context.emoticons_page = EmoticonsPage(context) context.search_page = SearchPage(context) context.people_page = PeoplePage(context) context.test_name = "@test"
def open_settings(self): self.driver.find_element(*HeaderPage.button_menu).click() self.driver.find_elements(*HeaderPage.menu_actions)[0].click() return SettingsPage(self.driver)
def to_settings_page(self) -> SettingsPage: path = self.settings.get_attribute('href') setting_page = SettingsPage(self.driver, path=path) setting_page.open() return setting_page
def test_username(browser, login, logout): """ Test that username is correct in 'Hello' dropdown """ settings_page = SettingsPage(browser) settings_page.load() username = settings_page.get_user_name_from_hello() assert username == LOGIN
def test_title_info(browser,login,logout): """Check that title is displayed and it is consistent""" settings_page = SettingsPage(browser) settings_page.load() text = settings_page.visible_element_get_text(SettingsPageLocators.SETTINGS_TITLE) assert text==LOGIN+"'s profile settings"
def test_password_match(browser,login,logout): """Test correct password input that match. Expected result: Changes are applied """ settings_page = SettingsPage(browser) settings_page.load() settings_page.input_text_in_field(SettingsPageLocators.NEW_PASSWORD_TB, PASSWORD) settings_page.input_text_in_field(SettingsPageLocators.CONFIRM_PASSWORD_TB, PASSWORD) settings_page.update_password_btn_click() assert settings_page.is_element_seen(SettingsPageLocators.SAVE_SUCCESS) and \ settings_page.visible_element_get_text(SettingsPageLocators.SAVE_SUCCESS)=="Saved"
def test_mismatch_password(browser,login,logout): """Test mismatch in password input. Expected result: Alert 'Passwords are not the same. Please, check your input.' """ settings_page = SettingsPage(browser) settings_page.load() settings_page.input_text_in_field(SettingsPageLocators.NEW_PASSWORD_TB, DB_PASSWORD) settings_page.input_text_in_field(SettingsPageLocators.CONFIRM_PASSWORD_TB, TEMP_PASSW) settings_page.update_password_btn_click() alert_text = settings_page.get_text_from_alert() # get text from first alert settings_page.handling_alert() # accept first allert assert alert_text=="Passwords are not the same. Please, check your input."