def test_login_s(self, user_phone, password, is_true): """判断登录成功方法""" logging.info('输入账号:{},输入密码:{}'.format(user_phone, password)) # 调用登录方法 PageFactory.get_n_login().login_operation(user_phone, password) # 判断登录是否成功 if is_true: try: # 查找用户名 Base().search_ele(PageElements.user_name) except: print('\n登录失败') # 添加截图 allure.attach(Base.driver.get_screenshot_as_png(), "截图", allure.attachment_type.PNG) assert False else: print('\n登录成功') assert True self.dc() else: # 判断登录是否成功 try: # 查找用户名 Base().search_ele(PageElements.user_name) except: print('\n登录失败') PageFactory.get_n_login().click_close_login() assert True else: print('\n登录成功') # 添加截图 allure.attach(Base.driver.get_screenshot_as_png(), "截图", allure.attachment_type.PNG) assert False
def dc(self): """判断登出方法""" # 点击设置 PageFactory.get_y_login().click_setting_btn() # 调用登出操作 PageFactory.get_setting().log_out_operation() # # 判断登出是否成功 if PageFactory.get_home().get_user_navigation_checked() == "true": print('\n登出失败') else: print('\n登出成功')
def setup_class(self): """判断登录退出方法""" try: # 查找“更新提示” Base().search_ele(PageElements.close_update) except: pass else: # 点击“x” PageFactory.get_home().click_close_update() finally: # 点击“我” PageFactory.get_home().click_user_navigation()
def test_login(self, user_phone, password): """判断登录成功方法""" # 点击“去登录” PageFactory.get_go_to_login().click_go_to_login() # 调用登录方法 PageFactory.get_n_login().login_operation(user_phone, password) # 判断登录是否成功 try: # 查找用户名 Base().search_ele(PageElements.user_name) except: print('\n登录失败') assert False else: print('\n登录成功') assert True self.dc()
def dc(self): """判断登出方法""" # 点击设置 PageFactory.get_y_login().click_setting_btn() # 调用登出操作 PageFactory.get_setting().log_out_operation() # 点击“我” PageFactory.get_home().click_user_navigation() # 判断登出是否成功 try: # 查找“已有账号,去登录” Base().search_ele(PageElements.go_to_login) except: print('\n登出失败') else: print('\n登出成功')
def test_login(self, user_phone, password): """判断登录成功方法""" # 输入手机号 PageFactory.get_n_login().send_phone(user_phone) # 输入密码 PageFactory.get_n_login().send_password(password) # 点击登录 PageFactory.get_n_login().click_login_btn() # 判断登录是否成功 try: # 查找用户名 Base().search_ele(PageElements.user_name) except: print('\n登录失败') assert True else: print('\n登录成功') assert False
def setup(self): # 点击“我” PageFactory.get_home().click_user_navigation() # 点击“去登录” PageFactory.get_go_to_login().click_go_to_login()
def setup_class(self): """判断登录退出方法""" PageFactory.get_home().close_update_btn()