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_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 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 == "尊敬的用户,您好,账户已激活成功!"
Example #4
0
 def test_email_2(self, registerPage:RegisterPage):
     ''' 注册-邮箱格式不正确,密码为空,
     点提交按钮,邮箱输入框红色提示(class 属性包含errorput)'''
     # registerPage.open("/users/register/")
     registerPage.input_email("1234")
     registerPage.input_password("")
     registerPage.click_register_btn()
     # 实际结果
     actual_result = registerPage.get_email_class()
     print("实际结果", actual_result)
     # 断言
     assert "errorput" in actual_result
Example #5
0
 def test_password_5(self, registerPage:RegisterPage):
     '''
     注册-邮箱格式正确([email protected]), 密码大于20位,
     点提交按钮,密码框提示红色(class属性errorput)
     :return:
     '''
     # registerPage.open("/users/register/")
     registerPage.input_email("*****@*****.**")
     registerPage.input_password("1234567890123456789012")
     registerPage.click_register_btn()
     # 实际结果
     actual_result = registerPage.get_password_class()
     print("实际结果", actual_result)
     # 断言
     assert "errorput" in actual_result