def test_02_modify_pwd(self): '''验证修改后的密码能否登录''' log.info("验证修改后的密码能否登录") tel = get_yaml_value(TEST_ACCOUNT_PATH, 'account_1') pwd = get_yaml_value(TEST_ACCOUNT_PATH, 'new_pwd_s') lp = LoginPage(self.driver) lp.login_opera_again(tel, pwd) log.info("登录操作") time.sleep(2) # 断言是否登录成功 result = False if lp.new_is_exist_element("立即更新"): result = True # 有则点击取消 UpdatePopup(self.driver).cancel_opera() elif lp.new_is_exist_element("首页"): result = True self.assertTrue(result) time.sleep(2) # 为不影响后面的测试,需将密码还原成旧密码 ms = MySet(self.driver) ms.enter_to_my() ms.enter_to_set() # 修改密码操作 old_pwd = get_yaml_value(TEST_ACCOUNT_PATH, 'new_pwd_s') new_pwd = get_yaml_value(TEST_ACCOUNT_PATH, 'old_pwd_s') ms.change_pwd(old_pwd, new_pwd) time.sleep(2)
def test_brandInfo_submit(self): '''验证商家品牌信息提交功能''' log.info("验证设置页商家品牌信息提交功能") ms = MySet(self.driver) # ->我的->设置 ms.enter_to_my() ms.enter_to_set() # 提交商家品牌信息操作 ms.brand_opera("自动化测试") # 断言是否提交成功 result = ms.is_toast_exist("提交成功") # log.info("result: %s" % result) self.assertTrue(result)
def test_03_logout(self): '''退出登录''' log.info("验证退出登录") # 进入我的->设置 ms = MySet(self.driver) ms.enter_to_my() ms.enter_to_set() # 点击退出登录 ms.logout_opera() # 断言是否退出成功 time.sleep(1) result = ms.new_is_exist_element("验证码登录") self.assertTrue(result)
def test_01_modify_pwd(self): '''验证能否修改密码''' log.info("验证能否修改密码") # ->我的->设置 ms = MySet(self.driver) ms.enter_to_my() ms.enter_to_set() # 修改密码操作 old_pwd = get_yaml_value(TEST_ACCOUNT_PATH, 'old_pwd_s') new_pwd = get_yaml_value(TEST_ACCOUNT_PATH, 'new_pwd_s') ms.change_pwd(old_pwd, new_pwd) # 判断是否修改成功 result = False if ms.is_toast_exist("修改成功"): result = True elif ms.new_is_exist_element("验证码登录"): result = True self.assertTrue(result) time.sleep(2)