Exemplo n.º 1
0
    def test_login(self, phoneid="133_-"):  #13366778606
        '''带有数字_—账号登陆'''
        try:
            number = self.driver.find_element_by_id("edittext")
            self.assertIsNotNone(number)
            number.click()
            self.driver.find_element_by_id("edittext").set_text(
                phoneid)  #timecode
            self.driver.find_element_by_id("sign_in_button").click()  #点击登陆
            print u"成功点击登陆"
        except:
            print u"可能已经登录或者需要设置"

        try:
            #设置个人信息
            self.driver.find_element_by_xpath(
                "//android.widget.EditText[@text='昵 称']").set_text(
                    "I am a nickname")
            self.driver.find_element_by_xpath(
                "//android.widget.EditText[@text='签 名']").set_text(
                    "I am signature")  #I am signature
            self.driver.find_element_by_id("sign_in_button").click()
            el = self.driver.find_element_by_name(u"沟通").get_attribute("text")
            assert_equal(el, u"沟通", msg=u"登陆失败")
            print u"完成个人信息设置,进入主页面"
        except:
            print u"已经登录,或是老账号登陆,不需要设置"
        logout.test_logout(self)
    def test_send_txt(self):
        '''查找联系人,发送文本消息'''
        #查找联系人
        time.sleep(5)
        swip.swipLeft(self, 500)  #左划
        time.sleep(2)
        swip.swipLeft(self, 500)  #左划
        self.driver.find_element_by_id("group_name").click()
        wq = self.driver.find_element_by_id("chatting_attach_btn")
        assert_not_none(wq, u"未定位到加号按钮")
        wq.click()
        time.sleep(2)
        #发送语音
        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=5000).perform()
        #点击发送出去的语音
        self.driver.find_element_by_id(
            "chatting_voice_play_anim_tv").click()  #点击发送的语音
        time.sleep(5)
        self.driver.find_element_by_id("btn_left").click()  #点击右上角返回按钮
        logout.test_logout(self)  #退出登录
        login.test_login(self, el="13366778604")  #使用账号13366778606登录
        self.driver.find_element_by_name("13311267857").click()
        self.driver.find_element_by_id("chatting_voice_play_anim_tv").click()
        time.sleep(5)
        self.driver.press_keycode('4')  #点击返回键

        el = self.driver.find_element_by_id("avatar_iv")
        action1.long_press(el, duration=5000).perform()
        self.driver.find_element_by_name(u"删除该聊天").click()
        logout.test_logout(self)  #退出登录
        time.sleep(5)
 def test_group_dissolve(self):
     '''解散群组'''
     logout.test_logout(self)  #退出登录
     time.sleep(2)
     login.test_login(self, phoneid="17600645696")
     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()  #点击联系人
     time.sleep(2)
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/tv_head_group").click()  #点击群组
     time.sleep(2)
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/p_list").click()  #点击群组列表
     el = u"群组id:" + el
     driver.find_element_by_id("com.yuntongxun.eckuailiao:id/group_name"
                               ).click()  #点击群组id,以后改为读取上一条用例创建群组的id
     #driver.find_element_by_name(el).click()#点击群组id,读取上一条用例创建群组的id
     #解散群组
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/btn_right").click()  #点击群组管理
     time.sleep(2)
     driver.swipe(600, 800, 600, 100, 500)  #上划
     driver.find_element_by_name(u"解散该群").click()  #点击群组管理
     self.driver.press_keycode('4')  #点击返回
     time.sleep(2)
     self.driver.press_keycode('4')  #点击返回
 def test_creategroup(self):
     '''按群组ID查找群组'''
     driver = self.driver
     time.sleep(2)
     #Imtest.test_login(phoneid="13366778605")
     #test_a_login#调用登录
     login.test_login(self, el="13366778604")
     #查找群组
     #self.swipLeft(500)#左划
     #self.swipLeft(500)#左划
     with open('F:\Appium\group\groupID.txt', 'r') as f:
         el = f.read()
     driver.find_element_by_id("btn_plus").click()  #加号
     driver.context  #可以定位到悬浮窗口
     driver.find_element_by_name(u"查找群组").click()
     driver.find_element_by_name(u"按群组ID精确查询").click()
     driver.find_element_by_id("search_flite").send_keys(el)  #加号
     driver.find_element_by_id("text_right").click()  #点击确定
     time.sleep(2)
     driver.find_element_by_id("group_name").click()  #点击群组加入
     driver.find_element_by_id("red_btn").click()  #点击申请加入
     driver.find_element_by_id("btn_right").click()  #点击申请加入
     el = driver.find_element_by_xpath(
         "//android.widget.ScrollView//android.widget.TextView[@text='13311267857']"
     ).get_attribute("text")  #查找选择组成员
     print "账号" + el + "加入群组成功"
     logout.test_logout(self)  #退出登录
 def test_creategroup(self):
     '''创建讨论组'''
     try:
         logout.test_logout(self)  #退出登录
     except:
         print "未登录,无需执行退出登录操作"
     login.test_login(self, phoneid="13311267857")
     driver = self.driver
     clear_allmassage(self, id="com.yuntongxun.eckuailiao:id/nickname_tv")
     time.sleep(2)
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/btn_address_list").click()  #点击联系人
     time.sleep(2)
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/tv_head_discussion").click()  #点击讨论组
     driver.find_element_by_xpath(
         "//android.widget.ImageButton[2]").click()  #点击加号
     time.sleep(2)
     driver.find_element_by_name(u"联通").click()  #点击成员
     driver.find_element_by_name("温强").click()  #点击成员
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/btn_invite").click()  #点击邀请
     time.sleep(2)
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/btn_right").click()  #点击群组管理
     driver.find_element_by_name(u"讨论组个人名片").click()  #点击讨论组名片
     #将群组id保存到本地
     el = driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/accessory_checked").get_attribute(
             "text")
     with open('F:\Appium\group\groupID.txt', 'w') as f:
         f.write(el)
     print "讨论组ID为    " + el
    def test_send_readrurn(self):
        '''发送阅后即焚'''
        login.test_login(self, phoneid="13311267857")
        time.sleep(5)
        swip.swipLeft(self, 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("13366778604")
        self.driver.find_element_by_id("text_right").click()
        #发送阅后即焚图片
        self.driver.find_element_by_id("chatting_attach_btn").click()
        self.driver.find_element_by_name(u"阅后即焚").click()
        self.driver.find_element_by_name(u"拍照").click()
        time.sleep(2)
        self.driver.find_element_by_id(
            "com.lenovo.scg:id/shutter_button").click()
        time.sleep(2)
        self.driver.find_element_by_id("com.lenovo.scg:id/btn_done").click()
        time.sleep(2)
        self.driver.find_element_by_id("text_right").click()

        self.driver.press_keycode('4')  #点击返回键
        #self.driver.find_element_by_id("chatting_content_itv").click()
        time.sleep(2)
        logout.test_logout(self)  #退出登录
        login.test_login(self, phoneid="13366778604")  #使用账号receive登录

        time.sleep(2)
        self.driver.find_element_by_name("13311267857").click()
        self.driver.find_element_by_id("chatting_content_iv").click()
        time.sleep(2)
        self.driver.press_keycode('4')  #点击返回键
        #获取点击后的图片
        self.test_get_screen_by_element()
        #对比焚毁的图片
        self.test_same_as()
        time.sleep(2)
        print u"接收图片成功"
        #发送阅后即焚图片

        x1 = self.driver.find_element_by_id(
            "chatting_content_iv").location.get('x')
        y1 = self.driver.find_element_by_id(
            "chatting_content_iv").location.get('y')
        print x1, y1
        x1 = int(x1) + 400
        y1 = int(y1) + 100
        print x1, y1

        self.driver.tap([(x1, y1)], 5000)
        self.driver.find_element_by_name(u"删除").click()
        self.driver.find_element_by_id("dilaog_button3").click()  #确认删除

        self.driver.press_keycode('4')  #点击返回键
        logout.test_logout(self)  #退出登录
 def test_group_ban(self):
     '''管理员设置群成员禁言'''
     driver = self.driver
     time.sleep(3)
     member = "17600645696"  #被禁言成员账号
     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()  #点击群组
     time.sleep(1)
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/p_list").click()  #点击群组列表
     driver.find_element_by_id("com.yuntongxun.eckuailiao:id/group_name"
                               ).click()  #点击群组id,以后改为读取上一条用例创建群组的id
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/btn_right").click()  #点击群组管理
     time.sleep(2)
     #设置群成员禁言
     driver.find_element_by_name(u"设置群内禁言").click()  #点击设置群内禁言
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/tv_note").click()  #点击添加成员
     driver.find_element_by_name(member).click()  #点击成员
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/btn_invite").click()  #点击确定
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/dilaog_button3").click()  #点击确认
     driver.press_keycode('4')
     time.sleep(2)
     driver.press_keycode('4')
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/btn_left").click()  #群组内返回按钮
     driver.press_keycode('4')
     time.sleep(2)
     driver.press_keycode('4')
     time.sleep(2)
     logout.test_logout(self)  #退出登录
     login.test_login(self, phoneid=member)  #被禁言账号登录
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/btn_address_list").click()  #点击联系人
     time.sleep(2)
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/tv_head_group").click()  #点击群组
     time.sleep(2)
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/p_list").click()  #点击群组列表
     time.sleep(2)
     driver.find_element_by_id("com.yuntongxun.eckuailiao:id/group_name"
                               ).click()  #点击群组id,以后改为读取上一条用例创建群组的id
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/chatting_content_et").send_keys(
             "hello")
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/chatting_send_btn").click()  #点击发送
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/dilaog_button1").click()  #点击确认
     print "被设置禁言用户发送消息,页面弹出[您已经被禁言]提示"
Exemplo n.º 8
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')  #点击返回键
Exemplo n.º 9
0
    def test_send_readrurn(self):
        '''发送阅后即焚'''
        login.test_login(self, el="13311267857")
        self.driver.find_element_by_name("a1").click()
        #验证并删除上次发送的图片
        el = self.driver.find_element_by_id("tv_read_unread").get_attribute(
            "text")
        assert_equal(el, u"已读", msg=u"状态验证失败")
        print el + u" 阅读状态验证成功"
        el = self.driver.find_element_by_id("tv_read_unread")  #状态
        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()  #确认删除
        #发送阅后即焚图片
        self.driver.find_element_by_id("chatting_attach_btn").click()
        self.driver.find_element_by_name(u"阅后即焚").click()
        self.driver.find_element_by_name(u"选择相册").click()
        self.driver.find_element_by_id("imageview_photo").click()
        self.driver.find_element_by_id("text_right").click()

        self.driver.press_keycode('4')  #点击返回键
        #self.driver.find_element_by_id("chatting_content_itv").click()
        time.sleep(2)
        logout.test_logout(self)  #退出登录
        login.test_login(self, el="13366778604")  #使用账号receive登录

        time.sleep(2)
        self.driver.find_element_by_name("13311267857").click()
        self.driver.find_element_by_id("chatting_content_iv").click()
        time.sleep(2)
        self.driver.press_keycode('4')  #点击返回键
        #获取点击后的图片
        self.test_get_screen_by_element()
        #对比焚毁的图片
        self.test_same_as()
        time.sleep(2)
        print u"接收图片成功"
        #发送阅后即焚图片

        x1 = self.driver.find_element_by_id(
            "chatting_content_iv").location.get('x')
        y1 = self.driver.find_element_by_id(
            "chatting_content_iv").location.get('y')
        print x1, y1
        x1 = int(x1) + 400
        y1 = int(y1) + 100
        print x1, y1

        self.driver.tap([(x1, y1)], 5000)
        self.driver.find_element_by_name(u"删除").click()
        self.driver.find_element_by_id("dilaog_button3").click()  #确认删除

        self.driver.press_keycode('4')  #点击返回键
        logout.test_logout(self)  #退出登录
Exemplo n.º 10
0
    def test_send_picture(self):
        '''发送图片'''
        login.test_login(self, el="13311267857")
        self.driver.find_element_by_name("https://www.baidu.com").click()
        el = self.driver.find_element_by_id("tv_read_unread").get_attribute(
            "text")
        assert_equal(el, u"已读", msg=u"阅读状态验证失败")
        print el + 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()  #确认删除
        self.driver.press_keycode('4')  #点击返回键
        self.swipLeft(500)
        self.driver.find_element_by_name("13366778604").click()
        self.driver.find_element_by_id("entrance_chat").click()
        #发送图片
        self.driver.find_element_by_id("chatting_attach_btn").click()
        self.driver.find_element_by_id("app_grid_item_icon_mask").click()
        self.driver.find_element_by_id("imageview_photo").click()
        self.driver.find_element_by_id("text_right").click()

        #self.test_get_screen_by_element()#获取发送的图片保存到本地

        self.driver.press_keycode('4')  #点击返回键
        #self.driver.find_element_by_id("chatting_content_itv").click()
        time.sleep(2)
        logout.test_logout(self)  #退出登录
        login.test_login(self, el="13366778604")  #使用账号receive登录

        time.sleep(2)
        self.driver.find_element_by_name("13311267857").click()
        #接收到的图片对比发送的图片
        self.test_get_screen_by_element()  #获取发送的图片保存到本地
        self.test_same_as()
        time.sleep(2)
        print u"接收图片成功"

        x1 = self.driver.find_element_by_id(
            "chatting_content_iv").location.get('x')
        y1 = self.driver.find_element_by_id(
            "chatting_content_iv").location.get('y')
        print x1, y1
        x1 = int(x1) + 400
        y1 = int(y1) + 100
        print x1, y1

        self.driver.tap([(x1, y1)], 5000)
        self.driver.find_element_by_name(u"删除").click()
        self.driver.find_element_by_id("dilaog_button3").click()  #确认删除

        self.driver.press_keycode('4')  #点击返回键
        logout.test_logout(self)  #退出登录
Exemplo n.º 11
0
 def test_group_dissolve(self):
     '''转让群组'''
     driver = self.driver
     logout.test_logout(self)  #退出登录
     login.test_login(self, phoneid="13311267857")
     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()  #点击联系人
     time.sleep(2)
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/tv_head_group").click()  #点击群组
     time.sleep(2)
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/p_list").click()  #点击群组列表
     el = u"群组id:" + el
     driver.find_element_by_id("com.yuntongxun.eckuailiao:id/group_name"
                               ).click()  #点击群组id,以后改为读取上一条用例创建群组的id
     #driver.find_element_by_name(el).click()#点击群组id,读取上一条用例创建群组的id
     #解散群组
     driver.find_element_by_name(u"群name7?").click()  #点击群组
     time.sleep(2)
     el = driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/btn_middle").get_attribute("text")
     assert_equal(el, u'群name7?', msg=u'群组聊天页面群组名称显示不对')
     print u"群组聊天页面群组名称是 【" + el + "】 显示正确"
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/btn_right").click()  #点击群组管理
     time.sleep(2)
     driver.swipe(600, 800, 600, 100, 500)  #上划
     driver.find_element_by_name(u"解散该群").click()  #点击群组管理
     driver.find_element_by_name(u"group").click()  #点击群组
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/btn_right").click()  #点击群组管理
     driver.find_element_by_name(u"转让群组").click()  #点击转让
     driver.find_element_by_name("17600645696").click()  #点击转让
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/dilaog_button3").click()  #点击转让
     self.driver.press_keycode('4')  #点击返回
     time.sleep(2)
     self.driver.press_keycode('4')  #点击返回
     time.sleep(2)
     self.driver.press_keycode('4')  #点击返回
     time.sleep(2)
     self.driver.press_keycode('4')  #点击返回
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/btn_tab_msg").click()  #点击消息
     driver.find_element_by_name(u"系统通知").click()  #点击系统通知
     el = driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/result_summary").get_attribute(
             "text")
     assert_equal(el, u"[group的联通]已变更成群主", msg=u'系统通知显示不对')
     print "系统通知显示   " + el + "正确"
Exemplo n.º 12
0
    def test_send_txt(self):
        '''查找联系人,发送文本消息'''
        #查找联系人
        time.sleep(5)
        login.test_login(self, el="13311267857")
        self.driver.find_element_by_name("13366778604").click()
        #验证并删除上次发送的图片
        el = self.driver.find_element_by_id("tv_read_unread").get_attribute(
            "text")
        assert_equal(el, u"已读", msg=u"状态验证失败")
        print el + u" 阅读状态验证成功"
        el = self.driver.find_element_by_id("tv_read_unread")  #状态

        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()  #确认删除
        self.driver.press_keycode('4')  #点击返回键
        self.swipLeft(500)
        self.driver.find_element_by_name("13366778604").click()
        self.driver.find_element_by_id("entrance_chat").click()
        #发送文本消息
        text2048 = set_value.set_value()
        self.driver.find_element_by_id("chatting_content_et").click()
        self.driver.find_element_by_id("chatting_content_et").send_keys(
            text2048)  #hello tester
        self.driver.find_element_by_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")
        #验证发送消息
        assert_equal(sendoutcontent, "hello tester", msg=u'发送的消息验证失败')
        assert_equal(receivecontent, u"未读", msg=u'消息状态验证失败')
        self.driver.find_element_by_id("chatting_send_btn").click()
        self.driver.press_keycode('4')  #点击返回键

        logout.test_logout(self)  #退出登录
        login.test_login(self, el="13366778604")  #使用账号receive登录
        time.sleep(2)
        #验证发送消息
        sendoutcontent = self.driver.find_element_by_id(
            "chatting_content_itv").get_attribute("text")
        assert_equal(sendoutcontent, "hello tester", msg=u'发送的消息验证失败')
        #assert_equal(receivecontent,u"未读",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')  #点击返回键
        logout.test_logout(self)  #退出登录
Exemplo n.º 13
0
 def test_group_atmassage(self):  
     '''群成员发送@消息''' 
     clear_massage(self,name="group")
     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()#点击联系人
     time.sleep(2)
     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
     print el
     driver.find_element_by_id("com.yuntongxun.eckuailiao:id/group_name").click()#点击群组id,以后改为读取上一条用例创建群组的id
     #driver.find_element_by_name(el).click()#点击群组id,以后改为读取上一条用例创建群组的id 
     #群成员发送@消息
     driver.find_element_by_id("com.yuntongxun.eckuailiao:id/chatting_content_et").send_keys("@")#输入@
     driver.find_element_by_name(u"联通").click()#点击确认
     driver.find_element_by_id("com.yuntongxun.eckuailiao:id/chatting_send_btn").click()#点击发送
     driver.find_element_by_id("com.yuntongxun.eckuailiao:id/btn_right").click()#点击群组管理
     time.sleep(2)
     #driver.swipe(600,800,600,100,500)#上划 (810,960,54,960,500)
     driver.find_element_by_name(u"清空聊天记录").click()#点击删除群聊天记录
     time.sleep(2)
     driver.find_element_by_id("com.yuntongxun.eckuailiao:id/dilaog_button3").click()#点击确认
     driver.press_keycode('4')        
     driver.find_element_by_id("com.yuntongxun.eckuailiao:id/btn_left").click()#群组内返回按钮
     driver.press_keycode('4')
     time.sleep(2)
     driver.press_keycode('4')
     logout.test_logout(self)#退出登录
     login.test_login(self,phoneid = "17600645696")#@成员登录
     clear_massage(self,name=u"系统通知")    
     time.sleep(2)
     #验证接收@消息
     #el = self.driver.find_element_by_id("com.yuntongxun.eckuailiao:id/last_msg_tv").get_attribute("text")
     #assert_equal(el,u"[有人@我]球球: @联通 ",msg=u'@消息验证失败')
     #print "群组内@成员发送消息成功"
     self.driver.find_element_by_id("com.yuntongxun.eckuailiao:id/nickname_tv").click()#点击群组消息
     driver.find_element_by_id("com.yuntongxun.eckuailiao:id/btn_right").click()#点击群组管理        
     time.sleep(2)
     driver.swipe(600,960,600,60,500)#上划 (810,960,54,960,500)
     driver.find_element_by_name(u"清空聊天记录").click()#点击删除群聊天记录
     driver.find_element_by_id("com.yuntongxun.eckuailiao:id/dilaog_button3").click()#点击确认            
Exemplo n.º 14
0
 def test_send_massage(self):
     '''查找联系人,发送文本消息'''
     try:
         logout.test_logout(self)  #退出登录
     except:
         print "未登录,无需执行退出登录操作"
     time.sleep(2)
     self.driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/bu_register").click()
     self.driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/ed_name").send_keys("13366778604")
     self.driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/tv_getcode").click()  #点击获取验证码
     self.driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/ed_yanzhengma").send_keys("222222")
     self.driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/ed_pwd").send_keys("111111")
     self.driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/phone_regi").click()  #点击注册
Exemplo n.º 15
0
 def test_creategroup(self):  
     '''创建群组名称中文、省市英文、类型为朋友、公告为英文'''
     try:
         logout.test_logout(self)#退出登录
     except:
         print "未登录,无需执行退出登录操作"   
     login.test_login(self,phoneid="13311267857") 
     driver = self.driver
     print "Start : %s" % time.ctime()#输出当前时间
     time.sleep(2)
     print "Stop : %s" % time.ctime()#输出当前时间  
     driver.find_element_by_id("com.yuntongxun.eckuailiao:id/btn_address_list").click()#点击联系人
     print "Start : %s" % time.ctime()#输出当前时间
     time.sleep(2)
     print "Stop : %s" % time.ctime()#输出当前时间
     driver.find_element_by_id("com.yuntongxun.eckuailiao:id/tv_head_group").click()#点击群组
     print "Stop : %s" % time.ctime()#输出当前时间
     driver.find_element_by_id("com.yuntongxun.eckuailiao:id/p_list").click()#点击群组列表
     driver.find_element_by_xpath("//android.widget.ImageButton[2]").click()#点击加号
     
     time.sleep(2)
     driver.find_element_by_id("com.yuntongxun.eckuailiao:id/ed_group_name").send_keys(u'群组名称七个字')
     driver.find_element_by_id("com.yuntongxun.eckuailiao:id/ed_province").send_keys("HeilongjiangProvince")
     driver.find_element_by_id("com.yuntongxun.eckuailiao:id/ed_city").send_keys("HarbinMunicipality")
     driver.find_element_by_id("com.yuntongxun.eckuailiao:id/tv_notice_select").click()#点击公告
     driver.find_element_by_id("com.yuntongxun.eckuailiao:id/ed_notice").send_keys("Group announcement:group members must abide by the constitution of the republic of China.")#输入公告
     driver.find_element_by_xpath("//android.widget.TextView[@text='保存']").click()#点击保存
     driver.find_element_by_id("com.yuntongxun.eckuailiao:id/tv_group_type").click()#群组类型
     driver.find_element_by_name(u"朋友").click()#群组类型
     #driver.find_element_by_id("com.yuntongxun.eckuailiao:id/accessory_checked").click()#公开
     driver.find_element_by_name(u"下一步").click()#下一步
     time.sleep(2)
     driver.press_keycode('4')#点击返回
     driver.find_element_by_id("com.yuntongxun.eckuailiao:id/p_list").click()#点击群组列表
     driver.find_element_by_name(u"群组名称七个字").click()#点击群组
     time.sleep(2)
     el=driver.find_element_by_id("com.yuntongxun.eckuailiao:id/btn_middle").get_attribute("text")
     assert_equal(el,u'群组名称七个字',msg=u'群组聊天页面群组名称显示不对')
     print "群组聊天页面群组名称是 "+"群组名称七个字"+" 显示正确"
     driver.find_element_by_id("com.yuntongxun.eckuailiao:id/btn_right").click()#点击群组管理 
     time.sleep(2)
     driver.swipe(600,800,600,100,500)#上划
     driver.find_element_by_name(u"解散该群").click()#点击群组管理
 def test_creategroup(self):  
     '''转让群组''' 
     driver = self.driver
     time.sleep(5) 
     self.swipLeft(500)
     time.sleep(2)
     self.swipLeft(500)
     time.sleep(2)
     driver.find_element_by_id("com.yuntongxun.ecdemo:id/group_name").click()#点击群组  
     driver.find_element_by_id("com.yuntongxun.ecdemo:id/btn_right").click()#点击群组管理  
     #转让群组
     action1 = TouchAction(driver)  
     el = driver.find_element_by_name("13671378634")
     action1.long_press(el,duration=5000).perform()#长按成员
     driver.find_element_by_name(u"转让群组").click()
     driver.find_element_by_id("dilaog_button3").click()#点击确认
     time.sleep(2)
     el=driver.find_element_by_id("com.yuntongxun.ecdemo:id/account").get_attribute("text")
     assert_equal(el, u"13671378634",msg=u"群组转让验证失败")
     print "转让群组成功"
     self.driver.press_keycode('4')#点击返回键
     time.sleep(2)
     self.driver.press_keycode('4')#点击返回键 
     self.swipRight(500)
     time.sleep(2)
     self.swipRight(500)
     time.sleep(2)
     el=driver.find_element_by_id("com.yuntongxun.ecdemo:id/last_msg_tv").get_attribute("text")
     assert_equal(el,u"[11111111的QQ]已变更成成员", msg=u"系统通知错误")
     print u"系统通知显示"+el+" 系统通知外部正确"
     driver.find_element_by_id("nickname_tv").click()#id/nickname_tv
     el=driver.find_element_by_id("com.yuntongxun.ecdemo:id/result_summary").get_attribute("text")
     assert_equal(el,u"[11111111的QQ]已变更成成员", msg=u"系统通知错误")
     print u"系统通知显示"+el+"  系统通知内部正确"
     driver.find_element_by_id("text_right").click()#清空         
     self.driver.press_keycode('4')#点击返回键 
     el = self.driver.find_element_by_id("com.yuntongxun.ecdemo:id/nickname_tv")
     action1 = TouchAction(self.driver)
     action1.long_press(el,duration=5000).perform()  
     self.driver.find_element_by_name(u"删除该聊天").click()
     time.sleep(2)            
     logout.test_logout(self)#退出登录
Exemplo n.º 17
0
    def test_send_txt(self):
        '''发送链接消息'''
        time.sleep(2)
        #发送文本链接消息
        login.test_login(self, el="13311267857")
        self.driver.find_element_by_name("😄").click()
        #self.driver.find_element_by_name("a1").click()
        el = self.driver.find_element_by_id("tv_read_unread").get_attribute(
            "text")
        assert_equal(el, u"已读", msg=u"阅读状态验证失败")
        print el + 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()  #确认删除

        self.driver.find_element_by_id("chatting_content_et").send_keys(
            "https://www.baidu.com")
        time.sleep(2)
        self.driver.find_element_by_id("chatting_send_btn").click()
        self.driver.press_keycode('4')  #点击返回键
        #self.driver.press_keycode('4')#点击返回键
        #self.driver.find_element_by_id("chatting_content_itv").click()
        time.sleep(2)
        logout.test_logout(self)  #退出登录
        login.test_login(self, el="13366778604")  #使用账号receive登录
        time.sleep(2)
        self.driver.find_element_by_name("https://www.baidu.com").click()
        self.driver.find_element_by_id("chatting_content_itv").click()
        el = self.driver.contexts  #获取H5页面
        print el
        el = self.driver.find_element_by_id("btn_middle").get_attribute("text")
        assert_equal(el, u"下载", msg=u"访问链接失败")
        print u"访问链接成功"
        self.driver.press_keycode('4')  #点击返回键
        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')  #点击返回键
        logout.test_logout(self)  #退出登录
Exemplo n.º 18
0
 def test_clear_group(self):
     '''解散群组'''
     driver = self.driver
     try:
         logout.test_logout(self)  #退出登录
     except:
         print "未登录,无需执行退出登录操作"
     time.sleep(2)
     login.test_login(self, phoneid="13311267857")
     time.sleep(2)
     self.dissolve_group()
     time.sleep(2)
     driver.press_keycode('4')
     time.sleep(1)
     driver.press_keycode('4')
     logout.test_logout(self)  #退出登录
     time.sleep(2)
     login.test_login(self, phoneid="13366778604")
     time.sleep(2)
     self.dissolve_group()
     time.sleep(2)
     driver.press_keycode('4')
     time.sleep(1)
     driver.press_keycode('4')
     logout.test_logout(self)  #退出登录
     time.sleep(2)
     login.test_login(self, phoneid="17600645696")
     time.sleep(2)
     self.dissolve_group()
Exemplo n.º 19
0
 def test_revocation(self):
     '''讨论组撤回消息'''
     try:
         logout.test_logout(self)  #退出登录
     except:
         print "未登录,无需执行退出登录操作"
     login.test_login(self, phoneid="17600645696")
     driver = self.driver
     time.sleep(2)
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/btn_my").click()  #点击我的
     time.sleep(2)
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/self_info").click()  #点击个人信息
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/p_age").click()  #点击年龄
     driver.find_element_by_name(u"保存").click()  #点击保存
     time.sleep(2)
     el = self.driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/tv_my_age").get_attribute("text")
     assert_equal(el, "22", msg=u'消息验证失败')
     print "set age 22 success"
Exemplo n.º 20
0
    def test_send_expression(self):
        '''查找联系人,发送表情'''
        time.sleep(5)
        self.swipLeft(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("13366778604")
        self.driver.find_element_by_id("text_right").click()
        time.sleep(2)
        #发送表情
        self.driver.find_element_by_id("chatting_content_et").click()
        el = self.driver.find_element_by_id("chatting_smiley_btn")
        self.assertIsNotNone(el, msg=u"定位表情切换图标失败")
        el.click()  #点击切换到表情输入
        time.sleep(2)
        #driver.tap([(530,1450)], )#点击表情 失败了
        #driver.tap([(80,1255)], )#点击表情
        self.driver.find_element_by_name("😄").click()  #点击表情
        self.driver.find_element_by_id("chatting_send_btn").click()
        self.driver.press_keycode('4')  #点击返回键

        logout.test_logout(self)  #退出登录
        login.test_login(self, el="13366778604")  #使用账号13366778606登录
        self.driver.find_element_by_name("13311267857").click()
        el = self.driver.find_element_by_id(
            "chatting_content_itv").get_attribute("text")
        assert_equal(el, "😄", msg=u"接收表情失败")
        print u"接收表情成功" + el

        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()
        self.driver.press_keycode('4')  #点击返回键
        logout.test_logout(self)  #退出登录
        time.sleep(5)
Exemplo n.º 21
0
    def test_send_voicemessage(self):
        '''发送语音消息60秒''' 
        time.sleep(5)
        swip.swipLeft(self,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()   
                  
        #发送语音
        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=59000).perform()
        el=self.driver.find_element_by_id("tv_read_unread").get_attribute("text")
        assert_equal(el, u"已读", msg=u"状态验证失败")          
        print el+u" 阅读状态验证成功"
        el = self.driver.find_element_by_id("tv_read_unread")#状态
        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()#确认删除 
        el=[]
        el=self.driver.find_element_by_id("chatting_content_itv").get_attribute("text")
        a=str(el[0])+str(el[1])
        print a
        assert_equal(int(a), 58, msg=u"时间验证失败")            
        print el+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()#确认删除

        self.driver.press_keycode('4')#点击返回键
        logout.test_logout(self)#退出登录                
Exemplo n.º 22
0
 def test_addfriend(self):  
     '''添加好友''' 
     driver = self.driver
     time.sleep(2)
     member = "13366778604"  #登陆账号账号
     time.sleep(2) 
     driver.find_element_by_id("com.yuntongxun.eckuailiao:id/btn_address_list").click()#点击联系人
     time.sleep(2)
     driver.find_element_by_xpath("//android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.support.v4.view.ViewPager[1]/android.widget.LinearLayout[1]/android.view.ViewGroup[1]/android.widget.ImageButton[1]").click()#点击新的好友
     driver.find_element_by_id("com.yuntongxun.eckuailiao:id/search").send_keys('13366778604')#点击添加
     driver.find_element_by_id("com.yuntongxun.eckuailiao:id/tv_phone_tag2").click()#点击添加
     driver.find_element_by_id("com.yuntongxun.eckuailiao:id/btn_add").click()#点击添加到通讯录
     time.sleep(2)
     driver.press_keycode('4')
     logout.test_logout(self)#退出登录
     login.test_login(self,phoneid="13366778604")
     time.sleep(2)
     driver.find_element_by_id("com.yuntongxun.eckuailiao:id/btn_address_list").click()#点击联系人
     el=driver.find_element_by_id("com.yuntongxun.eckuailiao:id/tv_friend_num").get_attribute("text")
     assert_equal(el,"1",msg=u'邀请人数不对')
     driver.find_element_by_id("com.yuntongxun.eckuailiao:id/tv_head_newfriend").click()#点击新的好友
     driver.find_element_by_name(u"同意").click()#点击同意
     print "add friend success "           
Exemplo n.º 23
0
    def test_send_txt(self, i):
        '''查找联系人,发送各种文本消息'''
        try:
            logout.test_logout(self)  #退出登录
        except:
            print("未登录,无需执行退出登录操作")
        #time.sleep(2)
        login.test_login(self, phoneid="13366778604", password=iphone_password)
        time.sleep(2)
        self.driver.find_element_by_name(
            u"通讯录").click()  #com.yuntongxun.rongxin.lite:id/input_search_et
        self.driver.find_element_by_name(u"朱磊可").click()
        self.driver.find_element_by_accessibility_id(
            "yhc address chat").click()

        #self.driver.find_element_by_id("com.yuntongxun.eckuailiao:id/btn_my").click()#点击搜索 中文输入时无需收回键盘
        self.driver.find_element_by_class_name(
            "XCUIElementTypeTextView").click()  #点击输入框
        self.driver.find_element_by_class_name(
            "XCUIElementTypeTextView").send_keys(i)  #
        #print "Start : %s" % time.ctime()
        time.sleep(2)
        self.driver.press_keycode('66')  #点击回车
        time.sleep(2)
        #验证发送消息
        sendoutcontent = self.driver.find_element_by_accessibility_id(
            i).get_attribute("text")
        #print sendoutcontent
        assert (sendoutcontent, i)
        #删除发送消息
        self.driver.find_element_by_accessibility_id(
            "chat single right").click()
        self.driver.find_element_by_accessibility_id(u"清空聊天记录").click()
        self.driver.find_element_by_class_name("XCUIElementTypeButton").click()
        swip.swipRight(200)
        print(u'发送消息' + i)
    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()
Exemplo n.º 25
0
 def test_creategroup(self):
     '''邀请群成员'''
     driver = self.driver
     time.sleep(2)
     member = "13366778604"  #被踢出成员账号
     clear_allmassage(
         self, id="com.yuntongxun.eckuailiao:id/nickname_tv")  #清空消息记录
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/btn_address_list").click()  #点击联系人
     time.sleep(2)
     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()  #点击群组列表
     driver.find_element_by_id("com.yuntongxun.eckuailiao:id/group_name"
                               ).click()  #点击群组id,以后改为读取上一条用例创建群组的id
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/btn_right").click()  #点击群组管理
     time.sleep(2)
     #踢出群成员
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/group_card_item_avatar_iv").click(
         )  #点击+号
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/search").send_keys(member)  #查询
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/account").click()  #点击成员
     el = driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/account").get_attribute(
             "text")  #成员账号
     assert_equal(el, u"13366778604", msg=u"群组名称验证失败")
     #driver.press_keycode('4')
     time.sleep(2)
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/btn_invite").click()  #点击邀请
     time.sleep(2)
     driver.press_keycode('4')
     time.sleep(2)
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/btn_left").click()  #群组内返回按钮
     driver.press_keycode('4')
     time.sleep(2)
     driver.press_keycode('4')
     logout.test_logout(self)  #退出登录
     login.test_login(self, phoneid=member)  #登录
     time.sleep(2)
     driver.find_element_by_name(u"系统通知").click()  #点击系统通知消息
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/Refuse_btn").click()  #点击拒绝按钮
     el = driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/result_show").get_attribute("text")
     assert_equal(el, u"已拒绝", msg=u'邀请加入群组通知状态变显示不对')
     print u"邀请加入群组通知状态变为已拒绝"
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/text_right").click()  #点击清空
     driver.press_keycode('4')
     logout.test_logout(self)  #退出登录
     login.test_login(self, phoneid="13311267857")
     el = driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/last_msg_tv").get_attribute("text")
     assert_equal(el, u"温强拒绝加入群组", msg=u'系统通知消息显示不对')
     print u"系统通知【%s】显示正确" % el
Exemplo n.º 26
0
 def test_idjoin_group(self):
     '''通过群组ID搜索群组并加入'''
     driver = self.driver
     member = "17600645696"  #申请加入成员账号
     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()  #点击联系人
     time.sleep(2)
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/tv_head_group").click()  #点击群组
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/p_search").click()  #点击搜索群组
     driver.find_element_by_name(u"按群组ID精确查询").click()  #点击搜索群组
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/search_flite").send_keys(
             el)  #读取上一条用建群组的id 搜索
     #driver.find_element_by_id("com.yuntongxun.eckuailiao:id/search_flite").send_keys("groupname1")#点击群组管理
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/text_right").click()  #点击确定
     time.sleep(2)
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/group_name").click()  #点击群组
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/red_btn").click()  #点击申请加入
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/content").send_keys(
             "apply to join")  #输入申请文字
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/text_right").click()  #点击群定
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/btn_left").click()  #点击返回
     time.sleep(2)
     driver.press_keycode('4')
     time.sleep(2)
     driver.press_keycode('4')
     logout.test_logout(self)  #退出登录
     login.test_login(self, phoneid="13311267857")  #登录
     #管理员同意群组加入申请
     time.sleep(2)
     driver.find_element_by_name(u"系统通知").click()  #点击系统通知
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/accept_btn").click()  #点击同意
     time.sleep(2)
     el = driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/result_summary").get_attribute(
             "text")  #通知内容
     #assert_equal(el,u"管理员通过了[修月]的加群请求",msg=u"系统通知验证失败")
     print "系统通知未读消息数显示     " + el + "  正确"
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/text_right").click()  #点击清空
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/btn_left").click()  #点击返回
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/btn_address_list").click()  #点击联系人
     time.sleep(2)
     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()  #点击群组列表
     driver.find_element_by_id("com.yuntongxun.eckuailiao:id/group_name"
                               ).click()  #点击群组id,以后改为读取上一条用例创建群组的id
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/btn_right").click()  #点击群组管理
     #el=driver.find_element_by_id("com.yuntongxun.eckuailiao:id/tv_right").get_attribute("text")
     #assert_equal(el,u"2人",msg=u'申请人加入群组失败')
     print "申请人成功加入群"
 def test_creategroup(self):
     '''踢出群成员13366778604'''
     logout.test_logout(self)  #退出登录
     login.test_login(self, phoneid="13311267857")
     driver = self.driver
     clear_allmassage(
         self, id="com.yuntongxun.eckuailiao:id/nickname_tv")  #清空消息记录
     time.sleep(2)
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/btn_address_list").click()  #点击联系人
     time.sleep(2)
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/tv_head_group").click()  #点击群组
     time.sleep(2)
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/p_list").click()  #点击群组列表
     time.sleep(2)
     driver.find_element_by_id("com.yuntongxun.eckuailiao:id/group_name"
                               ).click()  #点击群组id,以后改为读取上一条用例创建群组的id
     time.sleep(2)
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/btn_right").click()  #点击群组管理
     time.sleep(2)
     #踢出群成员
     driver.find_element_by_xpath(
         "//android.widget.GridView[@resource-id=\"com.yuntongxun.eckuailiao:id/gv_member\"]/android.widget.LinearLayout[5]/android.widget.FrameLayout[1]/android.widget.TextView[1]"
     ).click()  #点击-号
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/search").send_keys(
             "13366778604")  #查询
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/account").click()  #点击成员
     el = driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/account").get_attribute(
             "text")  #成员账号
     assert_equal(el, u"13366778604", msg=u"群组名称验证失败")
     #driver.press_keycode('4')
     time.sleep(2)
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/btn_invite").click()  #点击删除
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/dilaog_button3").click()  #点击确认删除
     #el=driver.find_element_by_id("com.yuntongxun.eckuailiao:id/tv_right").get_attribute("text")#成员账号
     #assert_equal(el,u"2人",msg=u"群组成员数验证失败")
     driver.press_keycode('4')
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/btn_left").click()  #点击返回群组列表页
     driver.press_keycode('4')  #点击返回主页面
     time.sleep(2)
     driver.press_keycode('4')  #点击返回主页面
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/btn_tab_msg").click()  #点击消息
     el = driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/tv_unread_msg_number").get_attribute(
             "text")  #获取总消息数
     assert_equal(el, "1", msg=u'总未读消息数显示不对')
     print "总未读消息数" + el + "显示正确"
     el = driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/tipcnt_tv").get_attribute("text")
     assert_equal(el, "1", msg=u'系统通知未读消息数显示不对')
     print "系统通知未读消息数显示正确"
     driver.find_element_by_name(u"系统通知").click()  #点击成员
     #el=driver.find_element_by_id("com.yuntongxun.eckuailiao:id/tv_unread_msg_number").get_attribute("text")#获取总消息数
     #assert_equal(el,"1",msg=u'总未读消息数显示不对')
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/text_right").click()  #点击清空
Exemplo n.º 28
0
    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)
 def test_receive_massage(self):
     '''联系人置顶'''
     driver = self.driver
     print "Start : %s" % time.ctime()  #输出当前时间
     time.sleep(2)
     print "Stop : %s" % time.ctime()  #输出当前时间
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/btn_address_list").click()  #点击联系人
     driver.find_element_by_name(u"温强").click()  #点击名字
     driver.find_element_by_name(u"发消息").click()  #点击
     self.driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/chatting_content_et").send_keys(
             "1")  #hello tester
     self.driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/chatting_send_btn").click()  #发送
     driver.press_keycode('4')
     time.sleep(1)
     driver.press_keycode('4')
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/btn_tab_msg").click()  #消息
     time.sleep(1)
     el = driver.find_element_by_name(u"温强")  #定位名字
     action1 = TouchAction(self.driver)
     action1.long_press(el, duration=5000).perform()
     driver.find_element_by_name(u"置顶聊天").click()
     el = driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/nickname_tv").get_attribute('text')
     assert_equal(el, u"温强", msg=u'置顶消息验证失败')
     print u"联系人置顶成功"
     #取消置顶
     el = driver.find_element_by_name(u"温强")  #定位名字
     action1 = TouchAction(self.driver)
     action1.long_press(el, duration=5000).perform()
     driver.find_element_by_name(u"取消置顶").click()
     el = driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/nickname_tv").get_attribute('text')
     assert_equal(el, u"系统通知", msg=u'置顶消息验证失败')
     print u"联系人取消置顶成功"
     el = driver.find_element_by_name(u"group")  #定位名字
     action1 = TouchAction(self.driver)
     action1.long_press(el, duration=5000).perform()
     driver.find_element_by_name(u"置顶聊天").click()
     el = driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/nickname_tv").get_attribute('text')
     assert_equal(el, "group", msg=u'置顶消息验证失败')
     print u"联系人为群组置顶成功"
     #取消置顶
     el = driver.find_element_by_name(u"group")  #定位名字
     action1 = TouchAction(self.driver)
     action1.long_press(el, duration=5000).perform()
     driver.find_element_by_name(u"取消置顶").click()
     el = driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/nickname_tv").get_attribute('text')
     assert_equal(el, u"系统通知", msg=u'置顶消息验证失败')
     print u"联系人为群组取消置顶成功"
     el = driver.find_element_by_name(u"group")  #定位名字
     action1 = TouchAction(self.driver)
     action1.long_press(el, duration=5000).perform()
     driver.find_element_by_name(u"置顶聊天").click()
     el = driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/nickname_tv").get_attribute('text')
     assert_equal(el, u"group", msg=u'置顶消息验证失败')
     print u"联系人为群组置顶成功"
     el = driver.find_element_by_name(u"温强")  #定位名字
     action1 = TouchAction(self.driver)
     action1.long_press(el, duration=5000).perform()
     driver.find_element_by_name(u"置顶聊天").click()
     el = driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/nickname_tv").get_attribute('text')
     assert_equal(el, u"group", msg=u'置顶消息验证失败')
     print u"联系人置顶成功"
     driver.find_element_by_name(u"温强").click()
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/btn_right").click()
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/chat_add").click()
     driver.find_element_by_name(u"温强").click()
     driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/btn_invite").click()
     driver.press_keycode('4')
     driver.press_keycode('4')
     time.sleep(2)
     driver.press_keycode('4')
     el = driver.find_element_by_name(u"qiuqiu、温强创建的讨论组")  #定位名字
     action1 = TouchAction(self.driver)
     action1.long_press(el, duration=5000).perform()
     driver.find_element_by_name(u"置顶聊天").click()
     el = driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/nickname_tv").get_attribute('text')
     assert_equal(el, u"qiuqiu、温强创建的讨论组", msg=u'置顶消息验证失败')
     print u"联系人为讨论组置顶成功"
     logout.test_logout(self)  #退出登录
     #账号重新登录
     login.test_login(self, phoneid="13311267857")
     #取消置顶
     el = driver.find_element_by_name(u"温强")  #定位名字
     action1 = TouchAction(self.driver)
     action1.long_press(el, duration=5000).perform()
     driver.find_element_by_name(u"取消置顶").click()
     el = driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/nickname_tv").get_attribute('text')
     assert_equal(el, u"qiuqiu、温强创建的讨论组", msg=u'置顶消息验证失败')
     print u"重新登录后联系人取消置顶成功"
     el = driver.find_element_by_name(u"group")  #定位名字
     action1 = TouchAction(self.driver)
     action1.long_press(el, duration=5000).perform()
     driver.find_element_by_name(u"取消置顶").click()
     el = driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/nickname_tv").get_attribute('text')
     assert_equal(el, u"qiuqiu、温强创建的讨论组", msg=u'置顶消息验证失败')
     print u"重新登录后联系人为群组取消置顶成功"
     #取消置顶
     el = driver.find_element_by_name(u"qiuqiu、温强创建的讨论组")  #定位名字
     action1 = TouchAction(self.driver)
     action1.long_press(el, duration=5000).perform()
     driver.find_element_by_name(u"取消置顶").click()
     el = driver.find_element_by_id(
         "com.yuntongxun.eckuailiao:id/nickname_tv").get_attribute('text')
     assert_equal(el, u"qiuqiu、温强创建的讨论组", msg=u'置顶消息验证失败')
     print u"重新登录后联系人为讨论组取消置顶成功"
Exemplo n.º 30
0
    def test_receive_massage(self):
        '''成员接收各种类型消息'''
        try:
            logout.test_logout(self)  #退出登录
        except:
            print "未登录,无需执行退出登录操作"
        time.sleep(2)
        login.test_login(self, phoneid="13366778604")
        clear_massage(self, name=u"系统通知")
        driver = self.driver
        driver.find_element_by_name("qiuqiu").click()
        print "Start : %s" % time.ctime()  #输出当前时间
        time.sleep(2)
        print "Stop : %s" % time.ctime()  #输出当前时间
        #验证接收消息
        driver.swipe(600, 300, 600, 1500, 500)  #下划
        time.sleep(2)
        el = self.driver.find_element_by_id(
            "com.yuntongxun.eckuailiao:id/chatting_content_itv").get_attribute(
                "text")
        assert_equal(
            el,
            u"中文1234567890ABCDEFGHIJKLMNOPQRSTUCWXYZabcdefghijklmnopqrstuvwxyz!#¥%……",
            msg=u'消息验证失败')
        print "接收消息%s成功" % el
        #删除接收消息
        action1 = TouchAction(self.driver)
        el = self.driver.find_element_by_id(
            "com.yuntongxun.eckuailiao: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()
        #验证接收表情消息
        el = self.driver.find_element_by_id(
            "com.yuntongxun.eckuailiao:id/chatting_content_itv").get_attribute(
                "text")
        assert_equal(el, "😄", 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()
        #验证接收语音消息
        self.driver.find_element_by_id(
            "com.yuntongxun.eckuailiao:id/chatting_content_itv").click()
        time.sleep(5)
        l = self.driver.find_element_by_id(
            "com.yuntongxun.eckuailiao:id/chatting_content_itv").get_attribute(
                "text")
        l = l.split('"')
        l = l[0]
        assert_equal(l, "4", msg=u'消息验证失败')
        print "接收语音消息成功"
        #删除语音消息
        x1 = self.driver.find_element_by_id(
            "com.yuntongxun.eckuailiao:id/chatting_content_itv").location.get(
                'x')
        y1 = self.driver.find_element_by_id(
            "com.yuntongxun.eckuailiao:id/chatting_content_itv").location.get(
                'y')
        print x1, y1
        x1 = int(x1) + 400
        y1 = int(y1) + 100
        print x1, y1
        self.driver.tap([(x1, y1)], 5000)
        self.driver.find_element_by_name(u"删除").click()
        self.driver.find_element_by_id("dilaog_button3").click()  #确认删除

        #删除接收图片消息,验证以后加
        x1 = self.driver.find_element_by_id(
            "com.yuntongxun.eckuailiao:id/chatting_content_iv").location.get(
                'x')
        y1 = self.driver.find_element_by_id(
            "com.yuntongxun.eckuailiao:id/chatting_content_iv").location.get(
                'y')
        print x1, y1
        x1 = int(x1) + 400
        y1 = int(y1) + 100
        print x1, y1
        self.driver.tap([(x1, y1)], 5000)
        self.driver.find_element_by_name(u"删除").click()
        self.driver.find_element_by_id("dilaog_button3").click()  #确认删除

        #验证接收短视频消息
        #self.driver.find_element_by_id("com.yuntongxun.eckuailiao:id/btn_play_video").click()
        #time.sleep(5)
        el = self.driver.find_element_by_id(
            "com.yuntongxun.eckuailiao:id/tv_filesize")  #视频大小
        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()  #确认删除

        #验证接收阅后即焚消息
        x1 = self.driver.find_element_by_id(
            "com.yuntongxun.eckuailiao:id/chatting_content_iv").location.get(
                'x')
        y1 = self.driver.find_element_by_id(
            "com.yuntongxun.eckuailiao:id/chatting_content_iv").location.get(
                'y')
        print x1, y1
        x1 = int(x1) + 400
        y1 = int(y1) + 100
        print x1, y1

        self.driver.tap([(x1, y1)], 5000)
        self.driver.find_element_by_name(u"删除").click()
        self.driver.find_element_by_id("dilaog_button3").click()  #确认删除