def test_me_0004(self): """编辑资料页面昵称里面输入字符串""" me_page = MinePage() self.assertEqual(me_page.is_on_this_page(), True) me_page.click_personal_photo() meEdit_page = MeEditProfilePage() meEdit_page.input_profile_name('昵称', r"<>'\"&\n\r") self.assertEqual(meEdit_page.is_toast_exist('不能包含特殊字符和表情'), True)
def test_me_0005(self): """编辑资料页面昵称里面输入数字""" me_page = MinePage() self.assertEqual(me_page.is_on_this_page(), True) me_page.click_personal_photo() meEdit_page = MeEditProfilePage() meEdit_page.input_profile_name('昵称', '4135435') meEdit_page.click_save() self.assertTrue(meEdit_page.check_text_exist('保存成功'))
def test_me_0002(self): """编辑资料页面里面点击头像""" me_page = MinePage() self.assertEqual(me_page.is_on_this_page(), True) me_page.click_personal_photo() meEdit_page = MeEditProfilePage() meEdit_page.click_profile_photo() meEdit_page.click_photo_more() time.sleep(2) meEdit_page.element_is_clickable('从手机相册选择') meEdit_page.element_is_clickable('保存到手机')
def test_me_0003(self): """编辑资料页面昵称里面输入sql语句""" me_page = MinePage() time.sleep(2) self.assertEqual(me_page.is_on_this_page(), True) me_page.click_personal_photo() meEdit_page = MeEditProfilePage() meEdit_page.input_profile_name('昵称', 'selectfrom') time.sleep(1) meEdit_page.click_save() for i in range(3): if meEdit_page.is_toast_exist('保存成功', timeout=0.3) \ or meEdit_page.is_toast_exist('您的资料未变化', timeout=0.3): break
def test_me_0019(self): """验证我-设置-退出当前账号 中 "1、联网正常 2、已登陆客户端 3、在我模块-设置页面" 点击退出当前账号 成功退出登录显示,并跳转至登录页 """ me_page = MinePage() time.sleep(1) for i in range(3): if me_page.is_element_already_exist_c('设置'): me_page.click_locator_key_c('设置') break else: me_page.page_up() time.sleep(1) me_page.click_locator_key_c('退出当前账号') time.sleep(3) self.assertTrue(me_page.check_wait_text_exits('一键登录'))
def test_me_0017(self): """验证邀请有礼正常打开""" me_page = MinePage() time.sleep(1) me_page.click_locator_key_c('邀请有礼') self.assertTrue(me_page.check_wait_text_exits('邀请有奖')) me_page.click_locator_key_c('我_二级页面_相同返回')
def test_me_0007(self): """编辑年龄选项选择年龄""" me_edit_page = MeEditProfilePage() MinePage().click_personal_photo() time.sleep(0.5) me_edit_page.input_random_name() me_edit_page.click_locator_key('年龄') me_edit_page.click_locator_key('年龄_90后') time.sleep(0.5) me_edit_page.click_locator_key('保存') self.assertTrue(me_edit_page.check_text_exist('保存成功'))
def test_me_0006(self): """点击性别选项选择性别""" me_edit_page = MeEditProfilePage() MinePage().click_personal_photo() time.sleep(0.5) me_edit_page.input_random_name() me_edit_page.click_locator_key('性别') me_edit_page.click_locator_key('性别_男') time.sleep(0.5) me_edit_page.click_locator_key('保存') self.assertTrue(me_edit_page.is_toast_exist('保存成功'), True)
def make_already_in_me_page(): """确保应用在消息页面""" # 如果在消息页,不做任何操作 fp = FooterPage() call = CallPage() me_page = MinePage() # 如果icue在我的页面 if me_page.is_on_this_page(): return # 如果在通话页面 if call.is_element_already_exist_c('加号'): fp.open_me_page() time.sleep(1) return # 如果不在我的页面,也不在通话页面,重启app # Preconditions.relaunch_app() # 进入一键登录页 Preconditions.make_already_in_call_page() fp.open_me_page() time.sleep(1)
def test_me_0009(self): """编辑职业选项选择职业""" me_edit_page = MeEditProfilePage() MinePage().click_personal_photo() time.sleep(0.5) me_edit_page.input_random_name() me_edit_page.click_locator_key('职业') me_edit_page.click_locator_key('职业_计算机') me_edit_page.click_locator_key('保存') for i in range(3): if me_edit_page.is_toast_exist('保存成功', timeout=0.3) \ or me_edit_page.is_toast_exist('您的资料未变化', timeout=0.3): break
def test_me_0001(self): """资料页面的字段可显示并且可以编辑""" me_page = MinePage() time.sleep(1) self.assertEqual(me_page.is_on_this_page(), True) me_page.click_personal_photo() meEdit_page = MeEditProfilePage() time.sleep(2) self.assertEqual(meEdit_page.is_text_exist("昵称"), True) self.assertEqual(meEdit_page.is_text_exist("性别"), True) self.assertEqual(meEdit_page.is_text_exist("年龄"), True) self.assertEqual(meEdit_page.is_text_exist("我的标签"), True) self.assertEqual(meEdit_page.is_text_exist("职业"), True) meEdit_page.click_profile_photo() meEdit_page.click_photo_back() time.sleep(2) self.assertEqual(meEdit_page.element_is_clickable("电话"), False) self.assertEqual(meEdit_page.element_is_clickable("昵称"), True) self.assertEqual(meEdit_page.element_is_clickable("性别"), True) self.assertEqual(meEdit_page.element_is_clickable("年龄"), True) self.assertEqual(meEdit_page.element_is_clickable("我的标签"), True) self.assertEqual(meEdit_page.element_is_clickable("职业"), True)
def test_me_0008(self): """编辑标签选项选择标签""" me_edit_page = MeEditProfilePage() MinePage().click_personal_photo() time.sleep(0.5) me_edit_page.click_locator_key('我的标签') time.sleep(3) me_edit_page.click_locator_key('添加个性标签') time.sleep(0.5) me_edit_page.click_locator_key('标签取消') for i in range(6): me_edit_page.click_tag_index('标签', i) time.sleep(0.5) self.assertTrue(me_edit_page.check_text_exist('最多选择5个标签来形容自己'))
def make_already_in_me_profilePage(): """""" Preconditions.make_already_in_me_page() me_page = MinePage() me_page.click_personal_photo()
def test_me_0013(self): """验证活动中心页面正常打开""" me_page = MinePage() me_page.click_locator_key_c('活动中心') self.assertTrue(me_page.check_wait_text_exits('活动中心', timeout=3 * 60)) me_page.click_locator_key_c('我_二级页面_相同返回')
def test_me_0014(self): """验证卡券页面正常打开""" me_page = MinePage() me_page.click_locator_key_c('卡券') self.assertTrue(me_page.check_wait_text_exits('我的卡券')) me_page.click_locator_key_c('我_二级页面_相同返回')
def test_me_0018(self): """验证帮助与反馈正常打开""" me_page = MinePage() me_page.click_locator_key_c('帮助与反馈') self.assertTrue(me_page.check_wait_text_exits('帮助与反馈')) me_page.click_locator_key_c('我_二级页面_相同返回')
def test_me_0015(self): """验证积分页面正常打开""" me_page = MinePage() count = 3 flag = False while count > 0: times = 1 * 60 me_page.click_locator_key_c('积分') while times > 0: if me_page.is_text_present_c('已连续签到', default_timeout=0.5): me_page.click_text('我知道了') if me_page.is_text_present_c('我的积分', default_timeout=0.5): flag = True break times -= 1 else: me_page.click_locator_key_c('我_二级页面_相同返回') if flag: break count -= 1 self.assertTrue(me_page.check_wait_text_exits('我的积分')) me_page.click_locator_key_c('我_二级页面_相同返回')