Пример #1
0
    def test_send_txt(self):
        '''查找联系人,发送!@#$%^&*()_+-=[]{}\;':/,<>'''
        try:
            logout.test_logout(self)  #退出登录
        except:
            print "未登录,无需执行退出登录操作"
        time.sleep(2)
        login.test_login(self, phoneid="13311267857")
        time.sleep(2)
        #clear_massage(self,name=u"球球")
        clear_allmassage(self, id="com.yuntongxun.eckuailiao: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.eckuailiao:id/search").send_keys("13311267857")
        #self.driver.find_element_by_id("com.yuntongxun.eckuailiao:id/btn_my").click()#点击搜索
        self.driver.find_element_by_id(
            "com.yuntongxun.eckuailiao:id/account").click()  #点击账号
        #print "Start : %s" % time.ctime()
        time.sleep(2)
        self.driver.find_element_by_name(u"发消息").click()  #点击发消息
        #发送文本消息
        set.set1()
        text1 = get.get1()
        self.driver.find_element_by_id(
            "com.yuntongxun.eckuailiao:id/chatting_content_et").send_keys(
                text1)  #hello tester
        self.driver.find_element_by_id(
            "com.yuntongxun.eckuailiao:id/chatting_send_btn").click()  #发送
        time.sleep(2)
        #验证发送消息
        sendoutcontent = self.driver.find_element_by_id(
            "chatting_content_itv").get_attribute("text")
        #print sendoutcontent
        receivecontent = self.driver.find_element_by_id(
            "tv_read_unread").get_attribute("text")
        #print receivecontent
        assert_equal(sendoutcontent, text1, msg=u'发送的消息验证失败')
        assert_equal(receivecontent, u"已读", 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("dilaog_button3").click()
        #验证接收的消息
        sendoutcontent = self.driver.find_element_by_id(
            "chatting_content_itv").get_attribute("text")
        assert_equal(sendoutcontent, text1, msg=u'接收的消息验证失败')
        el = self.driver.find_element_by_id("chatting_content_itv")
        action1.long_press(el, duration=5000).perform()
        self.driver.find_element_by_name(u"删除").click()
        self.driver.find_element_by_id("dilaog_button3").click()
        self.driver.press_keycode('4')  #点击返回键
Пример #2
0
 def test_send_txt(self):
     '''查找联系人,发送文本消息(hello tester)''' 
     time.sleep(2)
     #self.driver.swipe(810,960,54,960,500)#左划
     time.sleep(2)
     #clear_massage(self,name=u"球球")#删除消息页面,昵称为**的聊天记录
     clear_allmassage(self,id="com.yuntongxun.eckuailiao: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.eckuailiao:id/search").send_keys("13311267857")
     #self.driver.find_element_by_id("com.yuntongxun.eckuailiao:id/btn_my").click()#点击搜索
     self.driver.find_element_by_id("com.yuntongxun.eckuailiao:id/account").click()#点击账号
     #self.driver.find_element_by_id("com.yuntongxun.eckuailiao:id/name_tv").click()
     time.sleep(2)
     #self.driver.find_element_by_xpath("//android.widget.Button[@Button='发消息']").click()
     self.driver.find_element_by_id("com.yuntongxun.eckuailiao:id/phone_chat").click()#点击发消息
     #发送文本消息 
     set.set1()
     text1=get.get2()
     self.driver.find_element_by_id("com.yuntongxun.eckuailiao:id/chatting_content_et").send_keys(text1)#hello tester
     self.driver.find_element_by_id("com.yuntongxun.eckuailiao:id/chatting_send_btn").click()#发送
     time.sleep(2)
     #验证发送消息
     sendoutcontent = self.driver.find_element_by_id("chatting_content_itv").get_attribute("text")
     print sendoutcontent
     receivecontent = self.driver.find_element_by_id("tv_read_unread").get_attribute("text")
     print receivecontent
     assert_equal(sendoutcontent,text1,msg=u'发送的消息验证失败')
     assert_equal(receivecontent,u"已读",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("dilaog_button3").click()        
     #验证接收的消息
     sendoutcontent = self.driver.find_element_by_id("chatting_content_itv").get_attribute("text")    
     assert_equal(sendoutcontent,"hello tester",msg=u'接收的消息验证失败')
     el = self.driver.find_element_by_id("chatting_content_itv")
     action1.long_press(el,duration=5000).perform()        
     self.driver.find_element_by_name(u"删除").click()
     self.driver.find_element_by_id("dilaog_button3").click()   
     self.driver.press_keycode('4')#点击返回键
Пример #3
0
 def case_one(self):
     lock = threading.Lock()
     lock.acquire()
     #self.driver = driver
     '''查找联系人,发送文本消息'''
     time.sleep(2)
     #login.test_login(self,phoneid="13311267857")
     time.sleep(2)
     clear_massage(self, name=u"球球")
     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.eckuailiao:id/search").send_keys("13366778604")
     self.driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/btn_my").click()  #点击搜索
     self.driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/account").click()  #点击账号
     print "Start : %s" % time.ctime()
     time.sleep(2)
     self.driver.find_element_by_name(u"发消息").click()  #点击发消息
     #发送文本消息
     set.set1()
     text1 = get.get1()
     self.driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/chatting_content_et").send_keys(
             text1)  #hello tester
     self.driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/chatting_send_btn").click()  #发送
     self.driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/chatting_content_et").send_keys(
             "text1")  #hello tester
     self.driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/chatting_send_btn").click()  #发送
     self.driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/chatting_content_et").send_keys(
             "text1")  #hello tester
     self.driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/chatting_send_btn").click()  #发送
     print "已经点击发送"
     '''
Пример #4
0
 def test_send_txt(self):
     '''查找联系人,发送文本消息''' 
     time.sleep(5)
     self.driver.swipe(810,960,54,960,500)#左划
     time.sleep(2)
     self.driver.find_element_by_id("com.yuntongxun.ecdemo:id/card_item_tv").click()
     self.driver.find_element_by_id("content").click()
     self.driver.find_element_by_id("content").send_keys("13311267857")
     self.driver.find_element_by_id("text_right").click()
     #发送文本消息 
     set.set1()
     text200=get.get()
     self.driver.find_element_by_id("chatting_content_et").click()
     self.driver.find_element_by_id("chatting_content_et").send_keys(text200)#hello tester
     self.driver.find_element_by_id("chatting_send_btn").click()#发送
     self.driver.press_keycode('4')#点击返回键
     time.sleep(2)
     #验证发送消息
     sendoutcontent = self.driver.find_element_by_id("chatting_content_itv").get_attribute("text")
     print sendoutcontent
     receivecontent = self.driver.find_element_by_id("tv_read_unread").get_attribute("text")
     print receivecontent
     assert_equal(sendoutcontent,text200,msg=u'发送的消息验证失败')
     assert_equal(receivecontent,u"已读",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("dilaog_button3").click()        
     #验证接收的消息
     sendoutcontent = self.driver.find_element_by_id("chatting_content_itv").get_attribute("text")    
     assert_equal(sendoutcontent,text200,msg=u'接收的消息验证失败')
     el = self.driver.find_element_by_id("chatting_content_itv")
     action1.long_press(el,duration=5000).perform()        
     self.driver.find_element_by_name(u"删除").click()
     self.driver.find_element_by_id("dilaog_button3").click()   
 def test_send_txt200(self):
     '''群成员发送文本消息'''
     clear_massage(self, name="groupname1")
     clear_massage(self, name=u"系统通知")
     driver = self.driver
     with open('F:\Appium\group\groupID.txt', 'r') as f:
         el = f.read()
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/btn_address_list").click()  #点击联系人
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/tv_head_group").click()  #点击群组
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/p_list").click()  #点击群组列表
     el = u"群组id:" + el
     driver.find_element_by_name(el).click()  #点击群组id,以后改为读取上一条用例创建群组的id
     #群成员发送@消息
     set.set1()
     text200 = get.get()
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/chatting_content_et").send_keys(
             text200)  #输入特殊字符
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/chatting_send_btn").click()  #点击发送
     #验证接收消息
     el = self.driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/chatting_content_itv").get_attribute(
             "text")
     assert_equal(el, text200, msg=u'消息验证失败')
     print "群组内发送消息成功"
     #删除发送消息
     el = self.driver.find_element_by_id(
         "com.yuntongxun.eckuailiao: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("dilaog_button3").click()
     '''        
Пример #6
0
    def test_send_txt(self):
        '''查找联系人,发送文本消息2049字符'''
        time.sleep(2)
        clear_massage(self, name=u"qiuqiu")  #删除消息页面,昵称为**的聊天记录
        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.eckuailiao:id/search").send_keys("13311267857")
        #self.driver.find_element_by_id("com.yuntongxun.eckuailiao:id/btn_my").click()#点击搜索
        self.driver.find_element_by_id(
            "com.yuntongxun.eckuailiao:id/account").click()  #点击账号
        #发送文本消息
        set.set1()
        text2049 = get.get()
        self.driver.find_element_by_id(
            "com.yuntongxun.eckuailiao:id/phone_chat").click()  #点击发消息
        self.driver.find_element_by_id("chatting_content_et").send_keys(
            text2049)  #hello tester
        self.driver.find_element_by_id("chatting_send_btn").click()  #发送
        time.sleep(2)
        el = self.driver.find_element_by_id(
            "com.yuntongxun.eckuailiao:id/dialog_tv_message").get_attribute(
                "text")
        assert_equal(el, u"您发送的文本超过最大长度限制", msg=u'消息验证失败')
        print u"发送文本长度最大2048验证通过"
        self.driver.find_element_by_id(
            "com.yuntongxun.eckuailiao:id/dilaog_button1").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("dilaog_button3").click()
Пример #7
0
    def test_send_txt(self):
        '''撤回文本、语音、图片、视频等消息'''
        try:
            logout.test_logout(self)  #退出登录
        except:
            print u"未登录,无需执行退出登录操作"
        time.sleep(2)
        login.test_login(self, phoneid="13311267857")
        time.sleep(2)
        driver = self.driver
        clear_massage(self, name=u"qiuqiu")
        clear_allmassage(self, id="com.yuntongxun.eckuailiao: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.eckuailiao:id/search").send_keys("13311267857")
        #self.driver.find_element_by_id("com.yuntongxun.eckuailiao:id/btn_my").click()#点击搜索 中文输入时无需收回键盘
        self.driver.find_element_by_id(
            "com.yuntongxun.eckuailiao:id/account").click()  #点击账号
        #print "Start : %s" % time.ctime()
        time.sleep(2)
        self.driver.find_element_by_name(u"发消息").click()  #点击发消息
        #发送文本消息
        set.set1()
        text1 = get.get3()
        self.driver.find_element_by_id(
            "com.yuntongxun.eckuailiao:id/chatting_content_et").send_keys(
                text1)  #hello tester
        self.driver.find_element_by_id(
            "com.yuntongxun.eckuailiao:id/chatting_send_btn").click()  #发送
        time.sleep(2)
        #撤销发送的消息
        driver.swipe(600, 300, 600, 1500, 500)  #下划
        time.sleep(2)
        driver.swipe(600, 300, 600, 1500, 500)  #下划
        time.sleep(2)
        el = self.driver.find_element_by_id(
            "com.yuntongxun.eckuailiao:id/chatting_content_itv")
        action1 = TouchAction(self.driver)
        action1.long_press(el, duration=5000).perform()
        self.driver.find_element_by_name(u"撤销").click()
        time.sleep(2)
        #删除撤销的信息
        el = self.driver.find_element_by_id(
            "com.yuntongxun.eckuailiao:id/chatting_time_tv").get_attribute(
                "text")
        assert_equal(el, u"你撤回了一条消息", msg=u'撤回消息消息验证失败')
        print u"撤回超长2048个字符消息成功"
        driver.find_element_by_id(
            "com.yuntongxun.eckuailiao:id/btn_right").click()  #点击聊天详情
        driver.find_element_by_name(u"清空聊天记录").click()  #点击聊天详情
        driver.press_keycode('4')
        #发送混合消息
        driver.find_element_by_id(
            "com.yuntongxun.eckuailiao:id/chatting_content_et"
        ).send_keys(
            u'中文1234567890ABCDEFGHIJKLMNOPQRSTUCWXYZabcdefghijklmnopqrstuvwxyz!#¥%……'
        )  #输入特殊字符
        driver.find_element_by_id(
            "com.yuntongxun.eckuailiao:id/chatting_send_btn").click()  #点击发送
        #撤销发送的消息
        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()
        #删除撤销的信息
        el = self.driver.find_element_by_id(
            "com.yuntongxun.eckuailiao:id/chatting_time_tv").get_attribute(
                "text")
        assert_equal(el, u"你撤回了一条消息", msg=u'撤回消息消息验证失败')
        print u"撤回表情文本混合消息成功"
        driver.find_element_by_id(
            "com.yuntongxun.eckuailiao:id/btn_right").click()  #点击聊天详情
        driver.find_element_by_name(u"清空聊天记录").click()  #点击聊天详情
        driver.press_keycode('4')

        #发送消息表情
        self.driver.find_element_by_id(
            "com.yuntongxun.eckuailiao:id/chatting_smiley_btn").click(
            )  #点击切换表情
        self.driver.find_element_by_name("😄").click()  #点击表情
        driver.find_element_by_id(
            "com.yuntongxun.eckuailiao:id/chatting_send_btn").click()  #点击发送
        #撤销发送的消息
        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()
        #删除撤销的信息
        el = self.driver.find_element_by_id(
            "com.yuntongxun.eckuailiao:id/chatting_time_tv").get_attribute(
                "text")
        assert_equal(el, u"你撤回了一条消息", msg=u'撤回消息消息验证失败')
        print u"撤回表情消息成功"
        driver.find_element_by_id(
            "com.yuntongxun.eckuailiao:id/btn_right").click()  #点击聊天详情
        driver.find_element_by_name(u"清空聊天记录").click()  #点击聊天详情
        driver.press_keycode('4')

        #发送语音消息
        self.driver.find_element_by_id("chatting_mode_btn").click()  #左下角语音按钮
        action1 = TouchAction(self.driver)
        el = self.driver.find_element_by_id("voice_record_imgbtn")
        action1.long_press(el, duration=62000).perform()
        #撤销发送的消息
        el = self.driver.find_element_by_id(
            "com.yuntongxun.eckuailiao:id/tv_read_unread")  #已读状态
        action1 = TouchAction(self.driver)
        action1.long_press(el, duration=5000).perform()
        self.driver.find_element_by_name(u"撤销").click()
        #删除撤销的信息
        el = self.driver.find_element_by_id(
            "com.yuntongxun.eckuailiao:id/chatting_time_tv").get_attribute(
                "text")
        assert_equal(el, u"你撤回了一条消息", msg=u'撤回消息消息验证失败')
        print u"撤回语音消息成功"
        driver.find_element_by_id(
            "com.yuntongxun.eckuailiao:id/btn_right").click()  #点击聊天详情
        driver.find_element_by_name(u"清空聊天记录").click()  #点击聊天详情
        driver.press_keycode('4')

        #成员发送图片
        self.driver.find_element_by_id("chatting_attach_btn").click()  #点击加号
        self.driver.find_element_by_name(u"相册").click()  #点击相册
        self.driver.find_element_by_name("image").click()
        self.driver.find_element_by_id(
            "com.yuntongxun.eckuailiao:id/checkmark").click()  #点击选中
        self.driver.find_element_by_id(
            "com.yuntongxun.eckuailiao:id/btn_send").click()  #点击发送
        #撤销发送的消息
        el = self.driver.find_element_by_id(
            "com.yuntongxun.eckuailiao:id/tv_read_unread")  #已读状态
        action1 = TouchAction(self.driver)
        action1.long_press(el, duration=5000).perform()
        self.driver.find_element_by_name(u"撤销").click()
        #删除撤销的信息
        el = self.driver.find_element_by_id(
            "com.yuntongxun.eckuailiao:id/chatting_time_tv").get_attribute(
                "text")
        assert_equal(el, u"你撤回了一条消息", msg=u'撤回消息消息验证失败')
        print u"撤回图片消息成功"
        driver.find_element_by_id(
            "com.yuntongxun.eckuailiao:id/btn_right").click()  #点击聊天详情
        driver.find_element_by_name(u"清空聊天记录").click()  #点击聊天详情
        driver.press_keycode('4')

        #发送短视频
        self.driver.find_element_by_id("chatting_attach_btn").click()  #点击加号
        self.driver.find_element_by_name(u"短视频").click()
        time.sleep(2)
        action1 = TouchAction(self.driver)
        el = self.driver.find_element_by_xpath(
            "//android.widget.FrameLayout//android.view.View[2]")
        action1.long_press(el, duration=9000).perform()
        self.driver.find_element_by_xpath(
            "//android.widget.FrameLayout//android.view.View[2]").click(
            )  #点击发送

        #撤销发送的消息
        el = self.driver.find_element_by_id(
            "com.yuntongxun.eckuailiao:id/tv_read_unread")  #已读状态
        action1 = TouchAction(self.driver)
        action1.long_press(el, duration=5000).perform()
        self.driver.find_element_by_name(u"撤销").click()
        #删除撤销的信息
        el = self.driver.find_element_by_id(
            "com.yuntongxun.eckuailiao:id/chatting_time_tv").get_attribute(
                "text")
        assert_equal(el, u"你撤回了一条消息", msg=u'撤回消息消息验证失败')
        print u"撤回短视频消息成功"
        driver.find_element_by_id(
            "com.yuntongxun.eckuailiao:id/btn_right").click()  #点击聊天详情
        driver.find_element_by_name(u"清空聊天记录").click()  #点击聊天详情
        driver.press_keycode('4')
Пример #8
0
#coding:utf-8
import set
import get

set.set1()
el = get.get()
#print el