def test_invalid_postalCode(self, gender, first_name, last_name, email, password, day, month, year, company, address, city, state, postal_code, add_info, home_phone, mobile_phone, alias): """Attempt to register user with invalid postal code""" hp = HomePage(self.driver) hp.click_zaloguj_btn() lp = LoginPage(self.driver) lp.fill_email(email) lp.click_create_btn() rp = RegisterPage(self.driver) rp.choose_gender(gender) rp.fill_name(first_name) rp.fill_surname(last_name) rp.fill_password(password) rp.choose_day(day) rp.choose_month(month) rp.choose_year(year) rp.accept_newsletter() rp.accept_specialOffers() rp.fill_company(company) rp.fill_address(address) rp.fill_city(city) rp.choose_state(state) rp.fill_postalCode(postal_code) rp.fill_addInfo(add_info) rp.fill_homePhone(home_phone) rp.fill_mobilePhone(mobile_phone) rp.fill_alias(alias) rp.click_registerButton() rp.check_postalCode_error()
def test_login_input_field_short_length( self, browser ): # должна быть не меньше 8 символов и не больше 18 символов page = RegisterPage(browser, register_url) page.open() page.enter_login_non_valid(login_less_then_8) page.take_a_screenshot(browser)
def test_incorrect_password(self): home_page = HomePage(self.driver) home_page.click_sign_in_btn() time.sleep(2) login_page = LoginPage(self.driver) login_page.click_registration_btn() register_page = RegisterPage(self.driver) register_page.fill_name_field(td.valid_name) register_page.fill_surname_field(td.valid_surname) register_page.choose_gender(td.gender) register_page.fill_phone_number_country_code_field(td.valid_country) register_page.fill_phone_field(td.valid_phone) register_page.fill_email_field(td.valid_email) register_page.fill_password_field(td.invalid_password) register_page.fill_country_field(td.valid_country) register_page.select_privacy_policy() register_page.click_register_btn() error_notices = self.driver.find_elements(*RegisterPageLocators.ERROR_NOTICES) visible_error_notices = [] for error in error_notices: if error.is_displayed(): visible_error_notices.append(error) self.assertEqual(len(visible_error_notices),1) self.assertEqual(visible_error_notices[0].get_attribute('innerText'),u"Wpisz hasło") time.sleep(5)
def test_incorrect_email(self): """Test rejestracji nowego użytkownika - błędny e-mail""" # Tworzę instancję klasy HomePage, dzięki czemu zyskuję możliwość # korzystania z metod w niej zawartych hp = HomePage(self.driver) hp.click_zaloguj_btn() lp = LoginPage(self.driver) lp.click_register_btn() rp = RegisterPage(self.driver) # Wpisz imię rp.fill_name("Przemek") # Wpisz nazwisko rp.fill_surname("Nowak") # Wybierz płeć rp.choose_gender("M") # Wybierz kod kraju rp.choose_country_code("+48") # Wpisz numer telefonu rp.fill_telephone('321321321') # Wpisz niepoprawny e-mail rp.fill_email('dddd.pl') # Wpisz hasło rp.fill_password('Qwessdry123@') # Wybierz narodowość rp.choose_nationality("Polska") # Zaznacz "Akceptuję Informację o polityce prywatności" rp.accept_privacy_policy() # Kliknij ZAREJESTRUJ [ NIE STOSOWAĆ DLA PRZYPADKU POZYTYWNEGO !!!!] # Sprawdź poprawność wyświetlanych błędów rp.verify_visible_errors(1, ["Nieprawidłowy adres e-mail"]) time.sleep(2)
def test_empty_password(self): register_page = RegisterPage(self.driver) register_page.enter_email(Variables.VALID_EMAIL) register_page.accept_privacy_policy() register_page.click_register_button() register_page.error_should_be_visible(Variables.NO_PASSWORD_MESSAGE)
def test_not_checked_privacy_policy(self): register_page = RegisterPage(self.driver) register_page.enter_email(Variables.VALID_EMAIL) register_page.enter_password_confirm(Variables.VALID_PASSWORD) register_page.enter_password_confirm(Variables.VALID_PASSWORD) register_page.click_register_button() register_page.error_should_be_visible(Variables.ACCEPT_PRIVACY_MESSAGE)
def test_empty_email(self): register_page = RegisterPage(self.driver) register_page.enter_password(Variables.VALID_PASSWORD) register_page.enter_password_confirm(Variables.VALID_PASSWORD) register_page.accept_privacy_policy() register_page.click_register_button() register_page.email_should_be_required()
def setUp(self): self.logger = Log() self.logger.info( '##################### START ######################') warnings.simplefilter('ignore', ResourceWarning) driver = init_driver() self.driver = driver self.loginPage = LoginPage(self.driver) self.registerPage = RegisterPage(self.driver) self.settingPage = SettingPage(self.driver)
def test_different_passwords(self): register_page = RegisterPage(self.driver) register_page.enter_email(Variables.VALID_EMAIL) register_page.enter_password_confirm(Variables.VALID_PASSWORD) register_page.enter_password_confirm(Variables.OTHER_PASSWORD) register_page.accept_privacy_policy() register_page.click_register_button() register_page.error_should_be_visible( Variables.PASSWORD_NOT_MATCH_MESSAGE)
def test_short_password(self): register_page = RegisterPage(self.driver) register_page.enter_email(Variables.VALID_EMAIL) register_page.enter_password(Variables.SHORT_PASSWORD) register_page.enter_password_confirm(Variables.SHORT_PASSWORD) register_page.accept_privacy_policy() register_page.click_register_button() register_page.error_should_be_visible( Variables.PASSWORD_TOO_SHORT_MESSAGE)
def test_existing_email(self): register_page = RegisterPage(self.driver) register_page.enter_email(Variables.VALID_EMAIL) register_page.enter_password(Variables.VALID_PASSWORD) register_page.enter_password_confirm(Variables.VALID_PASSWORD) register_page.accept_privacy_policy() register_page.click_register_button() register_page.error_should_be_visible( Variables.USER_ALREADY_EXISTS_MESSAGE)
def __init__(self, driver, base_url): self.driver = driver self.driver.get(base_url) self.driver.maximize_window() self.login_page = LoginPage(driver, base_url) self.internal_page = InternalPage(driver, base_url) self.main_page = MainPage(driver, base_url) self.movie_page = MoviePage(driver, base_url) self.register_page = RegisterPage(driver, base_url) self.edit_page = EditPage(driver, base_url) self.cart_page = CartPage(driver, base_url) self.wait = WebDriverWait(driver, 10)
def test_register_success(self, driver, base_url, delete_user): '''测试注册成功案例 数据清理账号''' register = RegisterPage(driver, base_url) register.open("/users/register/") # 操作步骤 register.input_email("*****@*****.**") register.input_password("123456") register.click_register_btn() # 实际结果 actual_result = register.register_success_text() # 断言 assert actual_result == "尊敬的用户,您好,账户已激活成功!"
def test_register_email_existed(self, driver, base_url): '''重复注册,注册失败''' register = RegisterPage(driver, base_url) register.open("/users/register/") # 操作步骤 register.input_email("*****@*****.**") register.input_password("123456") register.click_register_btn() # 实际结果 actual_result = register.register_success_text() # 断言 assert actual_result != "尊敬的用户,您好,账户已激活成功!"
def setUpClass(cls): logger.info("开始执行测试类") cls.desired = cls.conf.read_alone cls.desired["app"] = APK_PATH cls.driver = webdriver.Remote( command_executor="http://192.168.1.103:4723/wd/hub", desired_capabilities=cls.desired) cls.home_page = HomePage(cls.driver) cls.login_page = LoginPage(cls.driver) cls.loan_page = LoanPage(cls.driver) cls.user_page = UserPage(cls.driver) cls.invest_page = InvestPage(cls.driver) cls.register_page = RegisterPage(cls.driver)
def login(driver, username, password): welcome(driver) navigation = Navigation(driver) navigation.account_btn().click() account_page = AccountPage(driver) account_page.click_login().click() register_page = RegisterPage(driver) register_page.login_btn().click() login_page = LoginPage(driver) login_page.login(username, password)
def test_incorrect_email(self): hp = HomePage(self.driver) hp.click_accept_banner() hp.click_sign_in() rp = RegisterPage(self.driver) rp.fill_name('Jan') rp.fill_lastname('Kowalski') rp.fill_email('jkowalski.pl') rp.fill_password('H@slo123') rp.confirm_password('H@slo123') rp.accept_policy() rp.create_account() rp.verify_visible_errors(1, ['Wprowadzono niepoprawny adres e-mail']) time.sleep(2)
def test_incorrect_email(self, name, surname, country_code, phone, invalid_email, password, country, gender): hp = HomePage(self.driver) hp.click_zaloguj_btn() lp = LoginPage(self.driver) lp.click_register_btn() rp = RegisterPage(self.driver) rp.fill_name(name) rp.fill_surname(surname) rp.choose_gender(gender) rp.choose_country_code(country_code) rp.fill_telephone(phone) rp.fill_email(invalid_email) rp.fill_password(password) rp.choose_nationality(country) rp.accept_privacy_policy() rp.accept_terms() rp.verify_visible_errors(1, ["Nieprawidłowy adres e-mail"])
def test_incorrect_email(self): home_page = HomePage(self.driver) #Checks if the word "Python" is in title home_page._verify_page() home_page.click_zaloguj_button() login_page = LoginPage(self.driver) login_page.click_rejestracja_button() register_page = RegisterPage(self.driver) register_page.fill_name_field(td.valid_name) register_page.fill_surname_field(td.valid_surname) register_page.choose_gender(td.gender) register_page.fill_telephone_field(td.valid_telephone) register_page.fill_email_field("sasda.pl") register_page.fill_password_field(td.valid_password) register_page.fill_country_field(td.valid_country) register_page.accept_privacy_policy() errors = register_page.return_displayed_error_notices() assert len(errors) == 1 error_text = errors[0].get_attribute("innerText") assert error_text == u"Nieprawidłowy adres e-mail"
def test_correct_registration(self): home_page = HomePage(self.driver) #Checks if the word "Python" is in title home_page._verify_page() home_page.click_zaloguj_button() login_page = LoginPage(self.driver) login_page.click_rejestracja_button() register_page = RegisterPage(self.driver) register_page.fill_name_field(td.valid_name) register_page.fill_surname_field(td.valid_surname) register_page.choose_gender(td.gender) register_page.fill_telephone_field(td.valid_telephone) register_page.fill_email_field(td.valid_email) register_page.fill_password_field(td.valid_password) register_page.fill_country_field(td.valid_country) register_page.accept_privacy_policy() register_page.check_if_register_button_is_enabled() register_page.check_if_no_error_notice_is_presented() time.sleep(2)
def test_correct_registration(self): home_page = HomePage(self.driver) home_page._verify_page() home_page = HomePage(self.driver) home_page.click_choose_local() home_page.click_choose_katowice() katowice_page = KatowicePage(self.driver) katowice_page.click_reserv_button() register_page = RegisterPage(self.driver) register_page.add_name_field(td.valid_name) register_page.add_lastname_field(td.valid_lastname) register_page.add_email_field(td.valid_email) register_page.add_phone_field(td.valid_phone) register_page.add_peoplenb_field(td.valid_peoplenb) register_page.add_hour_field(td.valid_hour) register_page.add_minutes_field(td.valid_minutes) register_page.add_endhour_field(td.valid_endhour) register_page.add_endminutes_field(td.valid_endminutes) register_page.click_date_field() register_page.click_datechosen_field() register_page.click_reserve_field() conf_page = ConfPage(self.driver) conf_page.check_registration()
login_page.browser_alert.accept() # Username field with correct login credentials (valid login) login_page.password_input.clear() login_page.repeat_password_input.clear() login_page.password_input.enter_text(Valid.password()) login_page.repeat_password_input.enter_text(Valid.password()) login_page.login_button.click() assert login_page.browser_alert.text == expected_successful_login_alert login_page.browser_alert.accept() # Register Form Test Scenario register_page = RegisterPage(driver=browser) register_page.go() # Expected results # Labels expected_userid_label_txt = 'User id:' expected_password_label_txt = 'Password:'******'Name:' expected_address_label_txt = 'Address:' expected_country_selection_label_txt = 'Country:' expected_zipcode_label_txt = 'ZIP Code:' expected_email_label_txt = 'Email:' expected_sex_selection_label_txt = 'Sex:' expected_english_checkbox_label_txt = 'English:' expected_about_label_txt = 'About:'
def step_impl(context): global page page.click_register_button() # global page is now an instance of RegisterPage page = RegisterPage(context.browser)
def test_login_input_valid(self, browser): page = RegisterPage(browser, register_url) page.open() page.enter_login_valid(login) page.take_a_screenshot(browser)
def test_login_input_long_length(self, browser): page = RegisterPage(browser, register_url) page.open() page.enter_login_non_valid(login_more_then_18) page.take_a_screenshot(browser)
def test_should_be_registration_button(self, browser): page = RegisterPage(browser, register_url) page.open() page.should_be_register_btn() page.take_a_screenshot(browser)
def test_should_be_repeat_password_input_field(self, browser): page = RegisterPage(browser, register_url) page.open() page.should_be_register_repeat_password_input() page.take_a_screenshot(browser)
def setUp(self): self.driver = webdriver.Firefox() self.register = RegisterPage(self.driver) self.homepage = HomePage(self.driver) self.dashboard = DashboardPage(self.driver)
def __init__(self, driver): self.driver = driver self.driver.get("http://www.5itest.cn/register") self.driver.maximize_window() self.register_p = RegisterPage(self.driver)
def test_user_registration(self, browser): page = RegisterPage(browser, register_url) page.open() page.user_register(login, email, password, password) page.take_a_screenshot(browser)