def test_member_0016(self): """ 1、联网正常 2、已登陆客户端 3、在通讯录-不限时长详情页面 点击不限时长成员头像 弹出拨打电话提示 """ contact_page = ContactsPage() # 确保在通讯录界面 self.assertEqual(contact_page.is_element_already_exist_c('通讯录_标题'), True) time.sleep(2) self.assertEqual( contact_page.get_elements_count_c('不限时长_联系人组') > 0, True) contact_page.get_elements_list_c('不限时长_联系人组')[0].click() time.sleep(1) if contact_page.is_element_already_exist_c('回呼_提示文本'): contact_page.click_locator_key_c('回呼_我知道了') n = 20 flag = False while n > 0: if (contact_page.is_text_present_c('飞信电话', default_timeout=0.1) and contact_page.is_text_present_c('12560', default_timeout=0.1)) \ or contact_page.is_text_present_c('对方已振铃', default_timeout=0.1): flag = True break n -= 1 try: self.assertEqual(flag, True) finally: try: contact_page.hang_up_the_call() except Exception: pass
def test_member_030(self): """ 1、联网正常 2、已登陆客户端 3、在通讯录-联系人详情页面 查看联系人详情元素 复用家庭网详情页面内容,去掉短号栏 """ contact_page = ContactsPage() contact_page.is_element_already_exist_c('通讯录_标题') # 初始化被叫手机 Preconditions.initialize_class('Android-移动-N') # 获取手机号码 cards = contact_page.get_cards_c(CardType.CHINA_MOBILE)[0] # 切换主叫手机 Preconditions.select_mobile('Android-移动') # 确保在通讯录界面 self.assertEqual(contact_page.is_element_already_exist_c('通讯录_标题'), True) # 展开家庭网 if not contact_page.if_home_net_expand(): contact_page.click_locator_key_c('家庭网_展开_收起') time.sleep(1) # 点击家庭网第一个联系人 n = 0 flag = False while n < 8: for contact in contact_page.get_elements_list_c('联系人号码'): if cards == contact.text: contact.click() flag = True break if flag: break contact_page.page_up() n += 1 time.sleep(3) # 修改备注 contact_page.click_locator_key_c('联系人_备注修改') self.assertEqual(contact_page.is_text_present_c('修改备注名'), True) # 清空输入框内容 contact_page.edit_clear_c('编辑备注_输入框') name = '备注' contact_page.input_text_c('编辑备注_输入框', name) contact_page.click_locator_key_c('编辑备注_保存') time.sleep(2) contact_page.click_locator_key_c('联系人_视频') contact_page.is_text_present_c('正在等待对方接听', default_timeout=20) self.assertEqual(contact_page.is_text_present_c(name), True) if contact_page.is_element_already_exist_c('视频页面_挂断'): contact_page.click_locator_key_c('视频页面_挂断')
def test_member_0046(self): """ 1、正常登陆 2、网络正常 3、当前页面为家庭网成员页面 4、已开通家庭网业务" 点击"添加成员"按钮 "(1)输入手机号码:输入框文字引导用户输入11位中国移动号码。输入框只能输入数字。 """ contact_page = ContactsPage() # 确保在通讯录界面 self.assertEqual( contact_page.is_element_already_exist_c('通讯录_标题', default_timeout=20), True) # 展开家庭网 if not contact_page.if_home_net_expand(): contact_page.click_locator_key_c('家庭网_展开_收起') time.sleep(1) # 点击家庭网第一个联系人 contact_page.click_locator_key_c('家庭网_管理') time.sleep(1) contact_page.click_locator_key_c('家庭网_添加成员') time.sleep(1) contact_page.click_locator_key_c('家庭网_通讯录') time.sleep(0.5) self.assertEqual(contact_page.is_text_present_c('选择号码'), True) contact_page.input_text_c('家庭网_通讯录_搜索框', '13800138001') time.sleep(0.5) self.assertEqual( contact_page.get_elements_count_c('家庭网_通讯录_号码') > 0, True)
def test_member_0029(self): """ 1、联网正常 2、已登陆客户端 3、在家庭网详情-编辑资料页面 输入空格并点击保存 使用原来名称 """ contact_page = ContactsPage() # 确保在通讯录界面 self.assertEqual(contact_page.is_element_already_exist_c('通讯录_标题'), True) # 展开家庭网 if not contact_page.if_home_net_expand(): contact_page.click_locator_key_c('家庭网_展开_收起') time.sleep(1) # 点击家庭网第一个联系人 contact_page.get_elements_list_c('联系人号码')[0].click() time.sleep(3) # 修改备注 contact_page.click_locator_key_c('联系人_备注修改') self.assertEqual(contact_page.is_text_present_c('修改备注名'), True) # 清空输入框内容 contact_page.edit_clear_c('编辑备注_输入框') name = ' ' contact_page.input_text_c('编辑备注_输入框', name) contact_page.click_locator_key_c('编辑备注_保存') try: contact_page.get_one_element_c('联系人_备注内容') except NoSuchElementException: print("Pass") except Exception: raise RuntimeError('测试失败')
def test_member_0028(self): """ 1、联网正常 2、已登陆客户端 3、在家庭网详情-编辑资料页面 输入html标签并点击保存 保存成功 """ contact_page = ContactsPage() # 确保在通讯录界面 self.assertEqual(contact_page.is_element_already_exist_c('通讯录_标题'), True) # 展开家庭网 if not contact_page.if_home_net_expand(): contact_page.click_locator_key_c('家庭网_展开_收起') time.sleep(1) # 点击家庭网第一个联系人 contact_page.get_elements_list_c('联系人号码')[0].click() time.sleep(3) # 修改备注 contact_page.click_locator_key_c('联系人_备注修改') time.sleep(0.5) self.assertEqual(contact_page.is_text_present_c('修改备注名'), True) contact_page.click_locator_key_c('编辑备注_返回') time.sleep(0.5) self.assertEqual( contact_page.is_element_already_exist_c('联系人_添加桌面', default_timeout=30), True)
def test_member_0010(self): """ 正确输入并点击保存 保存失败 """ contact_page = ContactsPage() # 确保在通讯录界面 self.assertEqual(contact_page.is_element_already_exist_c('通讯录_标题'), True) # 展开家庭网 if not contact_page.if_home_net_expand(): contact_page.click_locator_key_c('家庭网_展开_收起') time.sleep(1) # 点击家庭网第一个联系人 contact_page.get_elements_list_c('联系人号码')[0].click() time.sleep(3) # 修改备注 contact_page.click_locator_key_c('联系人_备注修改') self.assertEqual(contact_page.is_text_present_c('修改备注名'), True) # 清空输入框内容 contact_page.edit_clear_c('编辑备注_输入框') name = '正确的备注' contact_page.input_text_c('编辑备注_输入框', name) contact_page.click_locator_key_c('编辑备注_保存') self.assertEqual( contact_page.is_element_already_exist_c('联系人_备注内容', default_timeout=30), True) self.assertEqual(name == contact_page.get_element_text_c('联系人_备注内容'), True)
def test_member_008(self): """ 1、联网正常 2、已登陆客户端 3、在家庭网详情-编辑资料页面 输入html标签并点击保存 保存成功 """ contact_page = ContactsPage() # 确保在通讯录界面 self.assertEqual(contact_page.is_element_already_exist_c('通讯录_标题'), True) # 展开家庭网 if not contact_page.if_home_net_expand(): contact_page.click_locator_key_c('家庭网_展开_收起') time.sleep(1) # 点击家庭网第一个联系人 contact_page.get_elements_list_c('联系人号码')[0].click() time.sleep(3) # 修改备注 contact_page.click_locator_key_c('联系人_备注修改') self.assertEqual(contact_page.is_text_present_c('修改备注名'), True) # 清空输入框内容 contact_page.edit_clear_c('编辑备注_输入框') name = "<a href='baidu.com'>aa</a>" contact_page.input_text_c('编辑备注_输入框', name) contact_page.click_locator_key_c('编辑备注_保存') contact_page.is_toast_exist('备注失败,请重新输入', timeout=5)
def test_member_003(self): """ 1、联网正常 2、已登陆客户端 3、在家庭网-家庭网详情页面 1、点击编辑按钮 2、编辑任意内容,点击保存" "1、跳转到备注名编辑页 2、并回退到家庭网详情页面;用户名展示优先级: 备注名(存在服务端)>个人中心昵称>本地通讯录>家庭网名>短号 """ contact_page = ContactsPage() # 确保在通讯录界面 self.assertEqual(contact_page.is_element_already_exist_c('通讯录_标题'), True) # 展开家庭网 if not contact_page.if_home_net_expand(): contact_page.click_locator_key_c('家庭网_展开_收起') time.sleep(1) # 点击家庭网第一个联系人 contact_page.get_elements_list_c('联系人号码')[0].click() time.sleep(3) contact_page.click_locator_key_c('联系人_备注修改') self.assertEqual(contact_page.is_text_present_c('修改备注名'), True) contact_page.edit_clear_c('编辑备注_输入框') name = uuid.uuid4().__str__().replace('-', '') contact_page.input_text_c('编辑备注_输入框', name) contact_page.click_locator_key_c('编辑备注_保存') self.assertEqual( contact_page.is_element_already_exist_c('联系人_添加桌面', default_timeout=30), True)
def test_member_002(self): """ 1、联网正常 2、已登陆客户端 3、在家庭网-家庭网详情页面 " "1、点击编辑按钮 2、点击取消按钮" "1、跳转到备注名编辑页 2、返回到家庭网详情页面" """ contact_page = ContactsPage() # 确保在通讯录界面 time.sleep(1) self.assertEqual(contact_page.is_element_already_exist_c('通讯录_标题'), True) # 展开家庭网 if not contact_page.if_home_net_expand(): contact_page.click_locator_key_c('家庭网_展开_收起') time.sleep(1) # 点击家庭网第一个联系人 contact_page.get_elements_list_c('联系人号码')[0].click() time.sleep(3) contact_page.click_locator_key_c('联系人_备注修改') time.sleep(0.5) self.assertEqual(contact_page.is_text_present_c('修改备注名'), True) time.sleep(1) contact_page.click_locator_key_c('编辑备注_返回') time.sleep(0.5) self.assertEqual(contact_page.is_element_already_exist_c('联系人_添加桌面'), True)
def test_member_0065(self): """ "1、非广东、四川移动用户已登录APP; 2、网络正常; 3、当前在不限时长成员管理;" "1、长按要解绑的不限时长成员 2、点击“解绑”按钮; 3、点击“取消”键; " 弹框消失,取消本次解绑操作; """ contact_page = ContactsPage() # 确保在通讯录界面 self.assertEqual( contact_page.is_element_already_exist_c('通讯录_标题', default_timeout=20), True) # 展开家庭网 if not contact_page.if_meet_net_expand(): raise RuntimeError('密友圈没有成员') # 点击管理 contact_page.get_elements_list_c('密友圈_管理')[0].click() time.sleep(1) contact_page.press_element_c('密友圈_管理_成员') time.sleep(0.5) contact_page.click_text('解绑') time.sleep(0.5) contact_page.click_locator_key_c('密友圈_解绑_取消') time.sleep(1) self.assertEqual(contact_page.is_text_present_c('不限时长成员管理'), True)
def test_member_0056(self): """ "1、正常登陆 2、网络正常 3、当前页面为家庭网页面" 点击右上角“!”按钮 跳转至短号家庭网业务的规则说明,顶部有返回按钮 """ contact_page = ContactsPage() # 确保在通讯录界面 self.assertEqual( contact_page.is_element_already_exist_c('通讯录_标题', default_timeout=20), True) # 展开家庭网 if not contact_page.if_home_net_expand(): contact_page.click_locator_key_c('家庭网_展开_收起') time.sleep(1) # 点击家庭网第一个联系人 contact_page.click_locator_key_c('家庭网_管理') time.sleep(1) contact_page.click_locator_key_c('家庭网_感叹号') self.assertEqual( contact_page.is_text_present_c('业务规则', default_timeout=20), True) contact_page.click_locator_key_c('联系人_规则返回') time.sleep(1) self.assertEqual(contact_page.is_element_already_exist_c('家庭网_添加成员'), True)
def test_member_00117_02(self): """ "1、联网正常 2、已登陆客户端(已打开通讯录权限) 3、当前在通讯录模块页面,已开通家庭网 " "1、查看联系人列表展示 2、点击联系人后的电话icon 3、点击通讯录页中各列表内的成员; 1、联系人获逻辑取复用福利电话页面,显示在家庭网下方,列表展开显示; 联系人后方带有电话icon; 2、 点击电话icon,发起电话流程(回拨或者CS电话),打电话逻辑不变; 3、跳转至对应的联系人详情页(密友详情页、家庭网成员详情页、陌生人详情页)" """ contact_page = ContactsPage() contact_page.is_element_already_exist_c('通讯录_标题') # 初始化被叫手机 Preconditions.initialize_class('Android-移动-N') # 获取手机号码 cards = contact_page.get_cards_c(CardType.CHINA_MOBILE)[0] # 切换主叫手机 Preconditions.select_mobile('Android-移动') # 确保在通讯录界面 self.assertEqual(contact_page.is_element_already_exist_c('通讯录_标题'), True) time.sleep(1) # 展开家庭网 # if contact_page.if_home_net_expand(): # contact_page.click_locator_key_c('家庭网_展开_收起') # time.sleep(1) # 点击联系人 n = 0 flag = False while n < 8: for contact in contact_page.get_elements_list_c('联系人号码'): if cards == contact.text: contact.click() flag = True break if flag: break contact_page.page_up() n += 1 time.sleep(3) contact_page.is_text_present_c('电话规则说明')
def test_member_00103(self): """ 1、联网正常 2、已登陆客户端 3、在家庭网详情-编辑资料页面 输入空格并点击保存 使用原来名称 """ contact_page = ContactsPage() # 确保在通讯录界面 self.assertEqual(contact_page.is_element_already_exist_c('通讯录_标题'), True) # 展开家庭网 if not contact_page.if_home_net_expand(): contact_page.click_locator_key_c('家庭网_展开_收起') time.sleep(1) # 点击家庭网第一个联系人 contact_page.get_elements_list_c('联系人号码')[0].click() time.sleep(3) contact_page.is_text_present_c('电话规则说明')
def test_member_00111(self): """ 1、联网正常 2、已登陆客户端(家庭网主号) 3、当前在通讯录模块页面,已开通家庭网 " "1、查看家庭网列表展示 2、点击“管理”" "1、家庭网列表默认收起状态; 2、家庭网主好提供管理入口,点击则进入家庭网成员管理页面; """ contact_page = ContactsPage() # 确保在通讯录界面 self.assertEqual( contact_page.is_element_already_exist_c('通讯录_标题', default_timeout=20), True) # 展开家庭网 self.assertEqual(contact_page.if_home_net_expand(), True) # 点击家庭网第一个联系人 contact_page.click_locator_key_c('家庭网_管理') time.sleep(1) contact_page.is_text_present_c('家庭网成员管理')
def test_member_004(self): """ 1、联网正常 2、已登陆客户端 3、在家庭网详情-编辑资料页面 正确输入并点击保存(中文、英文、特殊符号) 保存成功 """ contact_page = ContactsPage() # 确保在通讯录界面 self.assertEqual(contact_page.is_element_already_exist_c('通讯录_标题'), True) # 展开家庭网 if not contact_page.if_home_net_expand(): contact_page.click_locator_key_c('家庭网_展开_收起') time.sleep(1) # 点击家庭网第一个联系人 contact_page.get_elements_list_c('联系人号码')[0].click() time.sleep(1) contact_page.click_locator_key_c('联系人_备注修改') self.assertEqual(contact_page.is_text_present_c('修改备注名'), True) contact_page.edit_clear_c('编辑备注_输入框') name = '中文备注' contact_page.input_text_c('编辑备注_输入框', name) contact_page.click_locator_key_c('编辑备注_保存') self.assertEqual( contact_page.is_element_already_exist_c('联系人_备注内容', default_timeout=30), True) self.assertEqual(name == contact_page.get_element_text_c('联系人_备注内容'), True) contact_page.click_locator_key_c('联系人_备注修改') time.sleep(1) contact_page.edit_clear_c('编辑备注_输入框') name = 'EnglishNickName' contact_page.input_text_c('编辑备注_输入框', name) contact_page.click_locator_key_c('编辑备注_保存') self.assertEqual( contact_page.is_element_already_exist_c('联系人_备注内容', default_timeout=30), True) self.assertEqual(name == contact_page.get_element_text_c('联系人_备注内容'), True) contact_page.click_locator_key_c('联系人_备注修改') time.sleep(1) contact_page.edit_clear_c('编辑备注_输入框') name = '!@#$%^&*(' contact_page.input_text_c('编辑备注_输入框', name) contact_page.click_locator_key_c('编辑备注_保存') self.assertEqual( contact_page.is_element_already_exist_c('联系人_备注内容', default_timeout=30), True) self.assertEqual(name == contact_page.get_element_text_c('联系人_备注内容'), True)
def test_member_00107_02(self): """ 1、查看密友圈(不限时长) 2、点击成员电话icon 3、点击“管理” 1、列表为横向可滑动显示查看:成员半透明底头像+电话icon,底部为不限时长联系人名称(名称显示优先级:备注名(存在服务端)>个人中心昵称>本地通讯录>家庭网名>短号); 2、点击icon发起电话流程(回拨或者CS电话),打电话逻辑不变; 3、进入不限时长成员管理页面,成员管理页面、添加成员页面以及功能逻辑与现网标准版一致;" """ contact_page = ContactsPage() # 确保在通讯录界面 self.assertEqual( contact_page.is_element_already_exist_c('通讯录_标题', default_timeout=20), True) # 密友圈没有成员 if not contact_page.if_meet_net_expand(): raise RuntimeError('密友圈没有成员') # 点击管理 contact_page.get_elements_list_c('密友圈_管理')[0].click() time.sleep(1) contact_page.click_locator_key_c('密友圈_添加成员') time.sleep(1) contact_page.is_text_present_c('添加不限时长成员', default_timeout=20)
def test_member_0012(self): """ 1、联网正常 2、已登陆客户端 3、在家庭网详情-编辑资料页面 1、点击通话入口; 2、在家庭网列表点成员电话icon" 呼叫页面显示成员短号 """ contact_page = ContactsPage() # 确保在通讯录界面 self.assertEqual(contact_page.is_element_already_exist_c('通讯录_标题'), True) # 展开家庭网 # if not contact_page.if_home_net_expand(): contact_page.click_locator_key_c('家庭网_展开_收起') time.sleep(1) # 点击家庭网第一个联系人 contact_page.get_elements_list_c('联系人号码')[0].click() time.sleep(3) # 修改备注 contact_page.click_locator_key_c('联系人_备注修改') time.sleep(0.5) self.assertEqual(contact_page.is_text_present_c('修改备注名'), True) # 清空输入框内容 contact_page.edit_clear_c('编辑备注_输入框') name = '修改的备注' time.sleep(0.5) contact_page.input_text_c('编辑备注_输入框', name) contact_page.click_locator_key_c('编辑备注_保存') time.sleep(0.5) self.assertEqual( contact_page.is_element_already_exist_c('联系人_备注内容', default_timeout=30), True) # 拨打电话 time.sleep(0.5) contact_page.click_locator_key_c('联系人_电话') contact_page.is_element_already_exist_c('视频页面_状态', default_timeout=10) if contact_page.is_element_already_exist_c('流量_提示内容'): contact_page.click_locator_key_c('流量_继续拨打') if contact_page.is_element_already_exist_c('无密友圈_提示文本'): contact_page.click_locator_key_c('无密友圈_取消') try: self.assertEqual( len(contact_page.get_element_text_c('电话页面_备注')) < 11, True) finally: try: contact_page.hang_up_the_call() except Exception: pass
def test_member_0107_01(self): """ 1、查看密友圈(不限时长) 2、点击成员电话icon 3、点击“管理” 1、列表为横向可滑动显示查看:成员半透明底头像+电话icon,底部为不限时长联系人名称(名称显示优先级:备注名(存在服务端)>个人中心昵称>本地通讯录>家庭网名>短号); 2、点击icon发起电话流程(回拨或者CS电话),打电话逻辑不变; 3、进入不限时长成员管理页面,成员管理页面、添加成员页面以及功能逻辑与现网标准版一致;" """ contact_page = ContactsPage() # 确保在通讯录界面 self.assertEqual(contact_page.is_element_already_exist_c('通讯录_标题'), True) time.sleep(2) self.assertEqual( contact_page.get_elements_count_c('不限时长_联系人组') > 0, True) contact_page.get_elements_list_c('不限时长_联系人组')[0].click() time.sleep(1) if contact_page.is_element_already_exist_c('回呼_提示文本'): contact_page.click_locator_key_c('回呼_我知道了') n = 20 flag = False while n > 0: if (contact_page.is_text_present_c('飞信电话', default_timeout=0.1) and contact_page.is_text_present_c('12560', default_timeout=0.1)) \ or contact_page.is_text_present_c('对方已振铃', default_timeout=0.1): flag = True break n -= 1 try: self.assertEqual(flag, True) finally: try: contact_page.hang_up_the_call() except Exception: pass
def test_member_00120(self): """ 1、联网正常 2、已登陆客户端 3、当前通讯录页面" 1、在搜索框中输入合法的手机号码 1、显示:无该联系人 """ contact_page = ContactsPage() # 确保在通讯录界面 self.assertEqual( contact_page.is_element_already_exist_c('通讯录_标题', default_timeout=20), True) contact_page.click_locator_key_c('搜索') time.sleep(0.5) contact_page.input_text_c('搜索_搜索框', '13800008888') time.sleep(0.8) self.assertEqual(contact_page.is_text_present_c('无该联系人'), True)
def test_member_00132(self): """ 顶部新增“添加异网成员资格”剩余个数提示 "1、已登录密友圈 2、网络正常 3、当前页面不限时长管理 4、非四川卡 5、活动期间内" 查看顶部文案显示 文案显示“您还可以设置XX个成员,其中非移动号成员体验名额还有X个”每个主叫号码添加异网成员体验资格为2个,超过2个后,不可再继续添加(体验资格设置为动态更新,默认为2个,方便往后配合活动增加体验资格上限的改造) """ contact_page = ContactsPage() # 确保在通讯录界面 self.assertEqual( contact_page.is_element_already_exist_c('通讯录_标题', default_timeout=20), True) contact_page.click_locator_key_c('密友圈_管理') time.sleep(0.5) self.assertEqual(contact_page.is_text_present_c('其中非移动号成员体验名额还有'), True)
def test_member_00155(self): """ 1、登录密友圈 2、跳转通讯录界面" "1、跳转通讯录tab 2、点击通讯录成员列表中的去添加快捷方式按钮 3、点击去开启" "1、在通讯录界面显示成员列表并显示添加快捷方式按钮 2、弹窗已尝试添加到桌面弹窗,对于主流手机(华为、OPPO、vivo、小米),弹窗右侧按钮改成“去开启”。点击“去开启”跳转到系统设置页面 3、若用户未悬浮窗权限,则以长toast的形式,根据机型不同,提示不同的提示文案 ②若用户已开启悬浮窗权限,则以悬浮窗形式(悬浮窗停留5S),根据机型不同,提示不同文案 """ contact_page = ContactsPage() # 确保在通讯录界面 self.assertEqual( contact_page.is_element_already_exist_c('通讯录_标题', default_timeout=20), True) contact_page.click_locator_key_c('添加桌面图标') time.sleep(0.5) if contact_page.is_text_present_c('已尝试添加到桌面'): contact_page.click_text('去开启')