class Signup: def __init__(self, driver): self.driver = driver self.header = Header(self.driver) def join_ka(self, status, email, username, password): self.header.open_sign_up() if status == 'learner': self.driver.find_element_by_xpath(Locators.sign_up_learner_button_xpath).click() self.driver.find_element_by_xpath(Locators.sign_up_learner_button_xpath).click() Select(self.driver.find_element_by_id(Locators.month_birthday_picker_dropdown_id)).select_by_value('1') Select(self.driver.find_element_by_id(Locators.day_birthday_picker_dropdown_id)).select_by_value('1') wait = WebDriverWait(self.driver, 10) wait.until(ec.visibility_of_element_located((By.ID, Locators.year_birthday_picker_dropdown_id))) Select(self.driver.find_element_by_id(Locators.year_birthday_picker_dropdown_id)).select_by_value('2019') self.driver.find_element_by_xpath(Locators.sign_up_with_email_button_xpath).click() self.driver.find_element_by_id(Locators.email_id).send_keys(email) self.driver.find_element_by_id(Locators.username_id).send_keys(username) self.driver.find_element_by_id(Locators.password_id).send_keys(password) wait.until(ec.visibility_of_element_located((By.CSS_SELECTOR, Locators.sign_up_button_css))) self.driver.find_element_by_css_selector(Locators.sign_up_button_css).click() return Personalize(self.driver)
def test_get_schedule_summary(self): assert 'Khan Academy' in self.driver.title header_page = Header(self.driver) sign_up_page = header_page.open_sign_up() email = "*****@*****.**" rand_num = str(random.sample(range(1, 10000), 1)[0]) username = "******" + rand_num password = "******" + rand_num personalize_ka_page = sign_up_page.join_ka('learner', email, username, password) assert personalize_ka_page.is_popup_dialog_visible()
def test_login_in(self): x = Header(self.driver) x.click_sign_in() LogIn(self.driver).log_in() user_name = Header(self.driver).get_user_name() current_url = Header(self.driver).get_current_url() self.assertEqual(user_name, "Test Test") self.assertEqual(current_url, urls.my_account)
def test_login_logout(self, person='USER'): driver = self.driver start = Header(driver) signin = SignInPage(driver) start.transit('Log in') signin.login(person) start.transit('Profile') start.transit('Log out')
def __init__(self, browser_init): self.browser_init = browser_init self.header = Header(self.browser_init) self.sign_in_page = SignInPage(self.browser_init) self.forgot_password_page = ForgotPasswordPage(self.browser_init) self.confirmation_password_page = ConfirmPassword(self.browser_init) self.vacancies_page = VacanciesPage(self.browser_init) self.view_vacancy_page = ViewVacancyPage(self.browser_init) self.preview_resume_page = PreviewResumePage(self.browser_init) self.edit_resume_page = EditResumePage(self.browser_init) self.view_company_page = ViewCompanyPage(self.browser_init) self.companies_page = CompaniesPage(self.browser_init) self.my_companies_page = MyCompaniesPage(self.browser_init) self.update_company_page = UpdateCompanyPage(self.browser_init) self.create_vacancy_page = CreateVacancyPage(self.browser_init) self.create_company_page = CreateCompanyPage(self.browser_init) self.company_details_page = CompanyDetailsPage(self.browser_init) self.hot_vacancies_page = HotVacanciesPage(self.browser_init) self.search_page = SearchPage(self.browser_init) self.user_profile_page = UserPage(self.browser_init)
def test_elements_present(self): Shops(self.driver).open_default_url() h = Header(self.driver) for locator in h.locators: assert(h.is_element_available(h.locators[locator]))
def __init__(self, driver): self.driver = driver self.header = Header(self.driver)
def test_login_in_incorrect_email(self): x = Header(self.driver) x.click_sign_in() LogIn(self.driver)
def __init__(self, driver): self.driver = driver self.main_page = Main() self.header = Header()