def test_send_txt(self): '''账号温强验证接收到的语音消息长度,发送链接消息''' try: self.driver.find_element_by_id( "com.yuntongxun.rongxin.lite:id/ytx_negative_btn").click( ) #点击取消下载 except: print(u"未弹出更新页") self.driver.find_element_by_name(u"魏阳阳").click() #点击账号 sendoutcontent = self.driver.find_element_by_id( "com.yuntongxun.rongxin.lite:id/chatting_content_itv" ).get_attribute("text") #验证接收到的消息 self.assertEqual(sendoutcontent, '59"') print(u'接收到的') #删除接收到的消息 el = self.driver.find_element_by_id( "com.yuntongxun.rongxin.lite:id/chatting_voice_play_anim_tv") action1 = TouchAction(self.driver) action1.long_press(el, duration=5000).perform() self.driver.find_element_by_name(u"删除").click() self.driver.find_element_by_id( "com.yuntongxun.rongxin.lite:id/ytx_positive_btn").click() #self.driver.find_element_by_id("com.yuntongxun.rongxin.lite:id/chatting_history_lv").click()#点击+ #发送链接 set.set1() text6 = get.get6() self.driver.find_element_by_id( "com.yuntongxun.rongxin.lite:id/chatting_content_et").send_keys( text6) #hello tester self.driver.find_element_by_id( "com.yuntongxun.rongxin.lite:id/chatting_send_btn").click() #发送 #删除发送的消息 time.sleep(2) print(u'发送' + text6) el = self.driver.find_element_by_id("chatting_content_itv") action1 = TouchAction(self.driver) action1.long_press(el, duration=5000).perform() self.driver.find_element_by_name(u"删除").click() self.driver.find_element_by_id( "com.yuntongxun.rongxin.lite:id/ytx_positive_btn").click()
def test_send_txtB(self): '''接收文本消息验证,并回复表情消息''' try: time.sleep(2) self.driver.find_element_by_id( "com.yuntongxun.rongxin.lite:id/ytx_negative_btn").click( ) #点击取消下载 logout.test_logout(self) #退出登录 except: print("未登录,无需执行退出登录操作") #time.sleep(2) login.test_login(self, phoneid="13671378634", password="******") try: self.driver.find_element_by_id( "com.yuntongxun.rongxin.lite:id/ytx_negative_btn").click( ) #点击取消下载 except: print(u"未弹出更新页") #time.sleep(2) #self.driver.find_element_by_id("com.yuntongxun.rongxin.lite:id/ytx_search_et").send_keys("13671378634") #self.driver.find_element_by_id("com.yuntongxun.eckuailiao:id/btn_my").click()#点击搜索 中文输入时无需收回键盘 self.driver.find_element_by_name(u"温强").click() #点击账号 #print "Start : %s" % time.ctime() self.driver.swipe(550, 500, 550, 1500, 5000) #下滑 self.driver.swipe(550, 500, 550, 1500, 5000) self.driver.swipe(550, 500, 550, 1500, 5000) #time.sleep(2) #验证接收文本消息 set.set1() text1 = get.get1() text2 = get.get2() text3 = get.get3() text4 = get.get4() text5 = get.get5() text6 = get.get6() text7 = get.get7() list1 = [text1, text2, text3, text4, text5, text6, text7] for i in list1: sendoutcontent = self.driver.find_element_by_id( "chatting_content_itv").get_attribute("text") #验证接收到的消息 self.assertEqual(sendoutcontent, i) #删除接收到的消息 el = self.driver.find_element_by_id("chatting_content_itv") action1 = TouchAction(self.driver) action1.long_press(el, duration=5000).perform() self.driver.find_element_by_name(u"删除").click() self.driver.find_element_by_id( "com.yuntongxun.rongxin.lite:id/ytx_positive_btn").click() #发送表情消息 self.driver.find_element_by_id( "com.yuntongxun.rongxin.lite:id/chatting_smiley_btn").click() self.driver.find_element_by_id( "com.yuntongxun.rongxin.lite:id/emoji_id").click() self.driver.find_element_by_id( "com.yuntongxun.rongxin.lite:id/chatting_send_btn").click() #发送 time.sleep(2) #验证发送消息 #删除发送消息 el = self.driver.find_element_by_id("chatting_content_itv") action1 = TouchAction(self.driver) action1.long_press(el, duration=5000).perform() self.driver.find_element_by_name(u"删除").click() self.driver.find_element_by_id( "com.yuntongxun.rongxin.lite:id/ytx_positive_btn").click()
def test_send_txt(self): '''查找联系人,发送各种文本消息''' try: time.sleep(2) self.driver.find_element_by_id( "com.yuntongxun.rongxin.lite:id/ytx_negative_btn").click( ) #点击取消下载 logout.test_logout(self) #退出登录 except: print("未登录,无需执行退出登录操作") #time.sleep(2) login.test_login(self, phoneid="13366778604", password="******") try: self.driver.find_element_by_id( "com.yuntongxun.rongxin.lite:id/ytx_negative_btn").click( ) #点击取消下载 except: print(u"未弹出更新页") #time.sleep(2) #clear_massage(self,name=u"容联幼稚园") clear_allmassage( self, accountnumber="com.yuntongxun.rongxin.lite:id/nickname_tv") #self.driver.find_element_by_id("com.yuntongxun.eckuailiao:id/btn_address_list").click() time.sleep(2) self.driver.find_element_by_id( "com.yuntongxun.rongxin.lite:id/ytx_search_et").click( ) #com.yuntongxun.rongxin.lite:id/input_search_et self.driver.find_element_by_id( "com.yuntongxun.rongxin.lite:id/input_search_et").send_keys( "13671378634") #self.driver.find_element_by_id("com.yuntongxun.eckuailiao:id/btn_my").click()#点击搜索 中文输入时无需收回键盘 self.driver.find_element_by_id( "com.yuntongxun.rongxin.lite:id/name_tv").click() #点击账号 #print "Start : %s" % time.ctime() time.sleep(2) try: self.driver.find_element_by_id( "com.yuntongxun.rongxin.lite:id/ytx_negative_btn").click( ) #点击取消下载 except: print(u"未弹出更新页") #发送文本消息 set.set1() text = get.get() text1 = get.get1() text2 = get.get2() text3 = get.get3() text4 = get.get4() text5 = get.get5() text6 = get.get6() text7 = get.get7() list1 = [text1, text2, text3, text4, text5, text6, text7] # ,text2,text3,text4,text5,text6,text7 for i in list1: self.driver.find_element_by_id( "com.yuntongxun.rongxin.lite:id/chatting_content_et" ).send_keys(i) #hello tester self.driver.find_element_by_id( "com.yuntongxun.rongxin.lite:id/chatting_send_btn").click( ) #发送 time.sleep(2) #验证发送消息 sendoutcontent = self.driver.find_element_by_id( "chatting_content_itv").get_attribute("text") #print sendoutcontent self.assertEqual(sendoutcontent, i, msg=u"显示与输入不一致") #删除发送消息 el = self.driver.find_element_by_id("chatting_content_itv") action1 = TouchAction(self.driver) action1.long_press(el, duration=5000).perform() self.driver.find_element_by_name(u"删除").click() self.driver.find_element_by_id( "com.yuntongxun.rongxin.lite:id/ytx_positive_btn").click() print(u'发送消息' + i)