Beispiel #1
0
    def test_10(self):
        '''
            Greeting 录音
        :return:
        '''

        sleep(2)
        # self.driver(label=u"btn whitesidebar nomal").click()
        if self.driver(label=u"btn dotsidebar nomal").exists:
            self.driver(label=u"btn dotsidebar nomal").click()
        elif self.driver(label=u"btn whitesidebar nomal").exists:
            self.driver(label=u"btn whitesidebar nomal").click()
        self.driver(label=u"+1 520-214-1991").click()

        if self.driver(
                xpath="//Cell[2]/StaticText[2]").text == '+1 520-214-1991':
            self.driver(xpath="//Cell[2]/Button").click()
        else:
            self.driver(xpath="//Cell[1]/Button").click()
        self.driver(label=u"Greetings").click()
        check = threading.Thread(
            target=self.driver(name=u"ic_greet_recording").wait, args=(20, ))
        check.start()
        self.driver(name=u"ic_greet_recording").tap_hold(10)
        sleep(1)
        self.assertTrue(self.driver(label=u"Button").exists)
        self.assertTrue(self.driver(labelContains=u"Audio").exists)
        sec = self.driver(labelContains=u"Audio").text.split('(')[1][:-1]
        self.assertTrue(':' in sec)
        self.assertTrue(self.driver(label=u"contact normal").exists)
        self.driver(label=u"contact normal").click()
        if self.driver(type="Switch").text == '1':
            self.driver(type="Switch").click()
        self.driver(type="Switch").click()
        sleep(1)
        self.assertTrue(self.driver(type="Switch").text == '1')
        self.driver(label=u"Save").click()
        sleep(1)
        self.assertTrue(self.driver(label="Uploading Audio file").exists)
        self.driver(label="Uploading Audio file").wait_gone(timeout=60)
        sleep(2)
        self.driver(label=u"Greetings").click()
        self.assertTrue(self.driver(type="Switch").text == '1')
        pfm.SwipeElement(self.driver,
                         self.driver(type="Cell"),
                         'left',
                         timeout=3)  #左划元素
        self.driver(label="DELETE").click()
        self.driver(type="Switch").click()
        self.driver(label=u"Save").click()
        sleep(4)
        self.driver(label=u"Greetings").click()
        self.assertTrue(self.driver(type="Switch").text == '0')
    def test_07(self):
        '''
            短信扣费-扣除套餐短信条数
        '''
        self.driver(label=u"Messages").click()
        while self.driver(className="Cell").exists:
            sleep(2)
            pfm.SwipeElement(self.driver, self.driver(type="Cell"), 'left', 3)
            self.driver(label=u"Delete").click()

        self.driver(label="2Call").click()

        messages_send_before = int(
            self.driver(xpath="//Table/StaticText[5]").text.split(' ')[0])

        self.assertTrue(messages_send_before > 0)
        self.driver(label=u"Messages").click()

        self.driver(label=u"btn addnew nomal").click()
        self.driver(label=u"Address Bar Text View").set_text("19093036369")
        self.driver(label=u"+1 909-303-6369").click()
        self.driver(label=u"Message Input Toolbar Text Input View").set_text(
            "Hi~ this is test message ,wish you happy every day")

        self.driver(label=u"Message Input Toolbar Send Button").click()
        sleep(1)
        self.driver(label="Cancel").click()
        sleep(2)

        self.driver(label="2Call").click()
        self.driver(label=str(messages_send_before - 1) +
                    " Messages").wait(timeout=20.0)
        self.driver(label=u"Messages").click()
        while self.driver(className="Cell").exists:
            sleep(2)
            pfm.SwipeElement(self.driver, self.driver(type="Cell"), 'left', 3)
            self.driver(label=u"Delete").click()
Beispiel #3
0
    def test_06(self):
        '''
            contacts - groups
        '''

        self.driver(label=u"Contacts").click()
        self.driver(label=u"Groups").click()
        self.assertTrue(self.driver(label=u"Groups").exists)
        self.driver(label=u"New group").click()
        self.driver(label=u"Bird Fire").click()
        self.driver(label=u"Ca").click()
        self.driver(type="TextField").set_text('test group')
        self.driver(label=u"Done").click()
        sleep(2)

        self.assertTrue(self.driver(label=u"test group (2)").exists)
        self.driver(label=u"test group (2)").click()
        self.assertTrue(self.driver(label=u"Edit Group").exists)
        self.assertTrue(self.driver(label=u"Group name").exists)
        self.assertEqual(self.driver(type="TextField").text, 'test group')
        self.assertTrue(self.driver(label=u"Group members (2)").exists)
        self.assertTrue(self.driver(label=u"Bird Fire").exists)
        self.assertTrue(self.driver(label=u"+1 909-303-6554").exists)
        self.assertTrue(self.driver(label=u"Ca").exists)
        self.assertTrue(self.driver(label=u"+1 450-924-0805").exists)

        self.driver(type="TextField").set_text('1')
        self.driver(label=u"Add member").click()
        sleep(1)
        self.driver(label=u"Tester 2").click()
        self.driver(label=u"NEXT").click()
        self.assertTrue(self.driver(label=u"Tester 2").exists)
        self.driver(label=u"Save").click()
        sleep(4)
        self.driver(label=u"btn back nomal").click()
        sleep(2)
        self.assertTrue(self.driver(label=u"test group1 (2)").exists)
        while not self.driver(label="DELETE").exists:
            pfm.SwipeElement(self.driver,
                             self.driver(label=u"test group1 (2)"),
                             'left',
                             timeout=3)

        self.driver(label="DELETE").click()
        sleep(2)
        self.assertTrue(not self.driver(label=u"test group1 (2)").exists)
    def test_10(self):
        '''
            短信列表-左划功能菜单:2Call,call
        '''

        self.driver(label=u"Messages").click()
        sleep(2)
        while self.driver(className="Cell").exists:
            sleep(2)
            pfm.SwipeElement(self.driver, self.driver(type="Cell"), 'left', 3)
            self.driver(label=u"Delete").click()
        if not self.driver(className="Cell")[0].exists:
            self.driver(label=u"btn addnew nomal").click()
            self.driver(label=u"Address Bar Text View").set_text("19093036369")
            self.driver(label=u"+1 909-303-6369").click()
            self.driver(
                label=u"Message Input Toolbar Text Input View").set_text(
                    "Hi~ this is test message ,wish you happy every day")
            self.driver(label=u"Message Input Toolbar Send Button").click()
            self.driver(label="Cancel").click()

        sleep(2)
        pfm.SwipeElement(self.driver, self.driver(type="Cell"), 'left', 3)
        sleep(2)
        self.driver(className='Cell').child(label=u"2Call").click()
        self.driver(label="Add to App Contacts").click()
        self.driver(label=u"Cancel").click()
        sleep(2)
        pfm.SwipeElement(self.driver, self.driver(type="Cell"), 'left', 3)

        sleep(2)
        self.driver(className='Cell').child(label=u"2Call").click()

        self.driver(label="Copy Number").click()
        sleep(3)
        self.driver(className="Cell")[0].click()
        self.driver(label=u"Message Input Toolbar Text Input View").click()

        self.driver(label=u"Message Input Toolbar Text Input View").tap_hold(3)
        self.driver(label=u"Paste").click()
        self.assertEqual(
            self.driver(label=u"Message Input Toolbar Text Input View").text,
            '+19093036369')
        self.driver(label=u"btn back nomal").click()
        sleep(2)
        pfm.SwipeElement(self.driver, self.driver(type="Cell"), 'left', 3)
        sleep(2)
        self.driver(className='Cell').child(label=u"2Call").click()
        self.driver(label=u"Block This Number").click()
        self.driver(label="Sure").click()
        sleep(6)
        pfm.SwipeElement(self.driver, self.driver(type="Cell"), 'left', 3)
        sleep(2)
        self.driver(className='Cell').child(label=u"2Call").click()
        self.driver(label=u"UnBlock This Number").click()
        self.driver(label="Sure").click()
        sleep(5)
        pfm.SwipeElement(self.driver, self.driver(type="Cell"), 'left', 4)
        sleep(2)
        self.driver(className='Cell').child(label=u"2Call").click()
        self.assertTrue(self.driver(label=u"Block This Number").exists)
        self.driver(label="Cancel").click()

        sleep(3)
        pfm.SwipeElement(self.driver, self.driver(type="Cell"), 'left', 3)
        sleep(2)
        self.driver(label="Call").click()
        self.driver(label=u"btn hangup nomal").click()
    def test_06(self):
        '''
           短信收发界面-短信发送-短信及图片
        '''
        self.driver(label=u"Messages").click()

        while self.driver(className="Cell")[0].exists:
            sleep(2)
            self.driver.swipe(1200, 280, 500, 280, 2.0)
            self.driver(label=u"Delete").click()

        self.driver(label=u"btn addnew nomal").click()
        self.driver(label=u"Address Bar Text View").set_text("19093036369")
        self.driver(label=u"+1 909-303-6369").click()

        # 添加文字
        self.driver(label=u"Message Input Toolbar Text Input View").set_text(
            "Hi~ this is test message ,wish you happy every day")
        self.driver(label=u"Message Input Toolbar Send Button").click()
        self.driver(className="Cell").click()

        self.driver(label=u"Message Input Toolbar Text Input View").set_text(
            "Thank you for your wishes")
        self.driver(label=u"Message Input Toolbar Send Button").click()
        sleep(2)
        self.assertEqual(
            self.driver(className="TextView")[3].text,
            'Thank you for your wishes')

        #发送图片--快捷图片
        self.driver(label=u"Message Input Toolbar Camera Button").click()
        self.driver(className="Cell")[3].click()
        self.assertTrue(self.driver(name=u"ImageSelectedOn").exists)
        self.driver(className="Cell")[4].click()
        sleep(1)
        self.assertTrue(
            self.driver(label=u"You can only choose 1 images").exists)
        self.driver(label="OK").click()
        self.driver(label=u"Send").click()
        self.driver(label=u"Message Input Toolbar Text Input View").click()

        # #发送图片--拍照
        # self.driver(label=u"Message Input Toolbar Camera Button").click()
        # self.driver(label=u"Take Photo").click()
        # sleep(3)
        # self.assertTrue(self.driver(label=u"Camera Mode").exists)
        # self.assertTrue(self.driver(label=u"Cancel").enabled)
        # self.assertTrue(self.driver(label=u"Camera chooser").enabled)
        # self.driver(label = u"Take Picture").click()
        # self.assertTrue(self.driver(label=u"Retake").enabled)
        # sleep(2)
        # self.driver(label=u"Use Photo", name=u"Use Photo", className="Button").click()
        # sleep(2)
        # self.driver(label=u"Message Input Toolbar Text Input View").click()
        # sleep(2)
        # while not self.driver(label=u"Enter Message").exists:
        #     self.driver(label=u"delete").click()  # 删除输入框内图片

        #发送图片--图库
        self.driver(label=u"Message Input Toolbar Camera Button").click()
        self.driver(label=u"Photo Library").click()
        # self.driver(label=u"Camera Roll").click()
        # self.driver(label=u"Photos").click()
        # sleep(2)
        if self.driver(label="Fast Repost").exists:
            self.driver(label="Fast Repost").click()
        else:
            self.driver(label="All Photos").click()
        sleep(2)
        self.driver(className="Cell")[-1].click()

        # self.driver(label=u"Message Input Toolbar Send Button").click()
        sleep(2)
        if self.driver(label=u"btn back nomal").exists:
            self.driver(label=u"btn back nomal").click()
        else:
            self.driver(label=u"Cancel").click()

        while self.driver(type="Cell").exists:
            sleep(2)
            pfm.SwipeElement(self.driver, self.driver(type="Cell"), 'left', 3)
            self.driver(label=u"Delete").click()
        sleep(1)
Beispiel #6
0
    def test_12(self):
        '''
            侧边栏-号码设置:Recordings
        '''
        sleep(2)
        # self.driver(label=u"btn whitesidebar nomal").click()
        if self.driver(label=u"btn dotsidebar nomal").exists:
            self.driver(label=u"btn dotsidebar nomal").click()
        elif self.driver(label=u"btn whitesidebar nomal").exists:
            self.driver(label=u"btn whitesidebar nomal").click()
        self.driver(label=u"+1 520-214-1991").click()

        if self.driver(
                xpath="//Cell[2]/StaticText[2]").text == '+1 520-214-1991':
            self.driver(xpath="//Cell[2]/Button").click()
        else:
            self.driver(xpath="//Cell[1]/Button").click()

        self.driver(label="Recordings").click()
        self.assertTrue(self.driver(label=u"Recording").exists)
        if self.driver(type="Cell").exists:
            while self.driver(type="Cell").exists:
                pfm.SwipeElement(self.driver,
                                 self.driver(type="Cell"),
                                 'left',
                                 timeout=2)
                self.driver(label="Delete").click()
                sleep(1)
        self.driver(label=u"btn back nomal").click()
        self.driver(label=u"btn back nomal").click()  #退回到主界面

        self.driver(label="Keypad").click()
        sleep(2)
        if not self.driver(label=u"btn recording hd normal").exists:
            return
        if self.driver(label=u"HD Recording: On").exists:
            self.driver(label=u"btn recording hd normal").click()

        self.driver(label=u"btn recording hd normal").click()
        self.driver(label='OK').click()
        self.driver(label=u"HD Recording: On").wait(timeout=10.0)
        Phonenumber = '8008002775'
        for i in Phonenumber:
            self.driver(label=i, name=i, className="Button").click()

        self.assertTrue(self.driver(label=u"(800) 800-2775").exists)
        self.driver(label=u"btn answer nomal").click()
        self.driver(label=u"calling...").wait(timeout=10.0)
        self.driver(label=u"calling...").wait_gone(timeout=10.0)
        sleep(10)  # 延迟,增加通话时间
        self.driver(label=u"btn hangup nomal").click()
        self.driver(label=u"btn answer nomal").wait(timeout=10)
        sleep(2)
        # self.driver(label=u"btn whitesidebar nomal").click()
        if self.driver(label=u"btn dotsidebar nomal").exists:
            self.driver(label=u"btn dotsidebar nomal").click()
        elif self.driver(label=u"btn whitesidebar nomal").exists:
            self.driver(label=u"btn whitesidebar nomal").click()
        if self.driver(
                xpath="//Cell[2]/StaticText[2]").text == '+1 520-214-1991':
            self.driver(xpath="//Cell[2]/Button").click()
        else:
            self.driver(xpath="//Cell[1]/Button").click()
        self.driver(label="Recordings").click()
        sleep(2)
        currentDate = time.strftime('%m/%d/%Y', time.localtime(time.time()))
        self.assertTrue(self.driver(label=currentDate).exists)
        self.assertTrue(self.driver(label=u"+1 800-800-2775").exists)
        self.assertTrue(self.driver(label=u"btn play normal").exists)

        sec = self.driver(xpath="//Cell[1]/StaticText[2]").text[:-1]
        recordTime = self.driver(xpath="//Cell[1]/StaticText[3]").text

        self.assertTrue(sec.isdigit())

        self.assertTrue(
            time.strftime('%Y/%m/%d', time.localtime(time.time())) in
            recordTime)
        self.driver(label=u"btn play normal").click()
        self.driver(label=u"btn stop normal").click()
        while self.driver(type="Cell").exists:
            pfm.SwipeElement(self.driver,
                             self.driver(type="Cell"),
                             'left',
                             timeout=2)
            self.driver(label="Delete").click()
            sleep(1)
        self.driver(label=u"btn back nomal").click()
Beispiel #7
0
    def test_04(self):
        '''
            contact - 创建新的2call联系人
        :return:
        '''

        # self.driver(label=u"btn whitesidebar nomal").click()
        if self.driver(label=u"btn dotsidebar nomal").exists:
            self.driver(label=u"btn dotsidebar nomal").click()
        elif self.driver(label=u"btn whitesidebar nomal").exists:
            self.driver(label=u"btn whitesidebar nomal").click()
        self.driver(label=u"+1 520-214-1991").click()
        # self.driver(label=u"btn whitesidebar nomal").click()
        if self.driver(label=u"btn dotsidebar nomal").exists:
            self.driver(label=u"btn dotsidebar nomal").click()
        elif self.driver(label=u"btn whitesidebar nomal").exists:
            self.driver(label=u"btn whitesidebar nomal").click()
        self.driver(label=u"Contacts").click()
        sleep(2)
        self.driver(label=u"btn add normal").click()
        self.driver(label=u"Contacts", name=u"Contacts", type="Button").click()
        sleep(2)
        self.assertEqual(self.driver(className="TextField")[0].text, 'First')
        self.assertEqual(self.driver(className="TextField")[2].text, 'Last')
        self.assertEqual(self.driver(className="TextField")[3].text, 'Company')

        self.driver(className="TextField")[0].set_text("Tester")
        self.driver(className="TextField")[2].set_text("2call")
        self.driver(className="TextField")[3].set_text("lianjie")

        self.driver(className="TextField")[4].clear_text()
        self.driver(className="TextField")[4].set_text("19093036554")
        self.driver(label=u"Done", name=u"Done", className="Button").click()
        sleep(3)
        self.assertTrue(self.driver(label=u"Tester 2call").exists)
        self.assertTrue(self.driver(label=u"+1 909-303-6554").exists)
        self.assertTrue(
            self.driver(label=u"2Call", name=u"2Call",
                        className="StaticText").exists)
        self.assertTrue(self.driver(label=u"T").exists)

        for i in range(5):
            if self.driver(label=u"Tester 2call").displayed:
                break
            self.driver.swipe(600, 1800, 600, 750, 1.0)

        self.driver(label=u"Tester 2call",
                    name=u"Tester 2call",
                    type="StaticText").click()
        self.assertTrue(self.driver(label=u"+1 909-303-6554").exists)
        self.assertTrue(self.driver(label=u"Tester 2call").exists)
        self.driver(label=u"btn back nomal").click()

        sleep(2)
        while not self.driver(label=u"Delete").exists:
            pfm.SwipeElement(self.driver,
                             self.driver(label=u"Tester 2call"),
                             direction='left',
                             timeout=2)
            if self.driver(label=u"btn back nomal").exists:
                self.driver(label=u"btn back nomal").click()
                sleep(2)
        self.driver(label=u"Delete").click()
        sleep(4)