Beispiel #1
0
    def setUp(self):
        print('Test start')
        #读取设备名字
        try:
            txt = open('./devices', 'r')
            phone = []
            for i in txt:
                phone.append(i)
            system1 = phone[0]
            device = phone[1]
            txt.close()
        except:
            system1 = '4.4.4'
            device = 'Android Emulator'
        desired_caps = {}
        desired_caps['platformName'] = 'Android'
        desired_caps['platformVersion'] = '%s' % system1
        desired_caps['deviceName'] = '%s' % device
        desired_caps['appPackage'] = 'com.bugua.fight'
        desired_caps[
            'appActivity'] = 'com.yuelian.qqemotion.splash.SplashActivity'
        desired_caps['resetKeyboard'] = 'True'
        desired_caps['unicodeKeyboard'] = 'True'

        self.d = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)
        self.extend = Appium_Extend(self.d)
        self.ElementCheck = ElementCheck(self, self.d)

        time.sleep(5)
 def setUp(self):
     desired_caps = {}
     desired_caps['deviceName'] = '3a11d697'  
     desired_caps['platformName'] = 'Android'   
     desired_caps['platformVersion'] = '5.1.1'
     #desired_caps['unicodeKeyboard'] = "true"#使用 Unicode 输入法。默认值false
     #desired_caps['resetKeyboard'] = "true"#在设定了 unicodeKeyboard 关键字的 Unicode 测试结束后,重置输入法到原有状态。如果单独使用,将会被忽略。默认值 false
     desired_caps['appPackage'] = 'com.yuntongxun.ecdemo'  
     desired_caps['appActivity'] = 'com.yuntongxun.ecdemo.ui.LauncherActivity' 
     self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
     self.verificationErrors = []
     self.driver.implicitly_wait(30)
     self.extend = Appium_Extend(self.driver)     
 def setUp(self):
     desired_caps = {}
     desired_caps['deviceName'] = '3a11d697'  # 3a11d697 :红米note3
     desired_caps['platformName'] = 'Android'
     desired_caps['platformVersion'] = '5.1.1'
     desired_caps[
         'appPackage'] = 'com.yuntongxun.eckuailiao'  #com.yuntongxun.eckuailiao
     desired_caps[
         'appActivity'] = 'com.yuntongxun.ecdemo.ui.account.SplashActivity'  #com.yuntongxun.ecdemo.ui.phonemodel.PhoneUI#com.yuntongxun.ecdemo.ui.account.LoginActivity
     self.driver = webdriver.Remote('http://localhost:4723/wd/hub',
                                    desired_caps)
     self.verificationErrors = []
     self.driver.implicitly_wait(10)
     self.extend = Appium_Extend(self.driver)
    def setUp(self):
        desired_caps = {}
        desired_caps["platformName"] = "Android"
        desired_caps["platformVersion"] = "4.3"
        desired_caps["deviceName"] = "3a11d697"
        desired_caps["appPackage"] = "com.yuntongxun.rongxin.lite"
        desired_caps[
            "appActivity"] = "com.yuntongxun.rongxin.lite.permission.RECEIVE_MSG"
        self.driver = webdriver.Remote("http://127.0.0.1:4723/wd/hub",
                                       desired_caps)

        self.extend = Appium_Extend(self.driver)

        #回到主屏幕
        self.driver.press_keycode(3)
    def setUp(self):
        desired_caps = {
            'platformName': 'Android',
            'deviceName': 'Mi6',
            'platformVersion': '8.0.0',
            #apk包名
            'appPackage': 'com.etnet.android.iq',
            #apk的launcherActivity
            'appActivity': '.MainActivity'
        }

        self.driver = webdriver.Remote("http://127.0.0.1:4723/wd/hub", desired_caps)

        self.extend = Appium_Extend(self.driver)

        #回到主屏幕
        # self.driver.press_keycode(3)
        self.swipe = Swipe(self.driver)
Beispiel #6
0
 def setUp(self):
     desired_caps = {}
     desired_caps['deviceName'] = '3a11d697'
     desired_caps['platformName'] = 'Android'
     desired_caps['platformVersion'] = '5.1.1'
     #desired_caps['unicodeKeyboard'] = "true"#使用 Unicode 输入法。默认值false
     #desired_caps['resetKeyboard'] = "true"#在设定了 unicodeKeyboard 关键字的 Unicode 测试结束后,重置输入法到原有状态。如果单独使用,将会被忽略。默认值 false
     desired_caps['appPackage'] = 'com.yuntongxun.ecdemo'
     desired_caps[
         'appActivity'] = 'com.yuntongxun.ecdemo.ui.LauncherActivity'
     self.driver = webdriver.Remote('http://localhost:4723/wd/hub',
                                    desired_caps)
     self.verificationErrors = []
     self.driver.implicitly_wait(30)
     self.extend = Appium_Extend(self.driver)
     #获得机器屏幕大小x,y
     x = self.driver.get_window_size()['width']
     y = self.driver.get_window_size()['height']
     l = [x, y]
     with open('F:\Appium\size\size.txt', 'w') as f:
         for i in range(len(l)):
             f.write(str(l[i]) + '\n')
         f.close()
Beispiel #7
0
    def setUp(self):
        desired_caps = {}
        desired_caps['deviceName'] = '3a11d697'
        desired_caps['platformName'] = 'Android'
        desired_caps['platformVersion'] = '5.1.1'
        desired_caps['appPackage'] = 'com.yuntongxun.ecdemo'
        desired_caps[
            'appActivity'] = 'com.yuntongxun.ecdemo.ui.LauncherActivity'
        self.driver = webdriver.Remote('http://localhost:4723/wd/hub',
                                       desired_caps)
        self.verificationErrors = []
        self.driver.implicitly_wait(30)
        self.extend = Appium_Extend(self.driver)

        #获得机器屏幕大小x,y
        x = self.driver.get_window_size()['width']
        y = self.driver.get_window_size()['height']
        l = [x, y]
        print l
        with open('F:\Appium\size\size.txt', 'w') as f:
            for i in range(len(l)):
                f.write(str(l[i]) + '\n')
                print l[i]
            f.close()
Beispiel #8
0
 def setUp(self):
     wq = set_driver()
     self.driver = wq.get_driver()
     self.verificationErrors = []
     self.driver.implicitly_wait(10)
     self.extend = Appium_Extend(self.driver)
def setUp(self):    
    desired_caps = {}
    desired_caps['deviceName'] = '3a11d697'  #adb devices查到的设备名
    desired_caps['platformName'] = 'Android'   #设备系统
    desired_caps['platformVersion'] = '5.1.1'   #系统版本       
    desired_caps['appPackage'] = 'com.yuntongxun.ecdemo'  #被测App的包名
    #desired_caps['unicodeKeyboard'] = "true"#使用 Unicode 输入法。默认值false
    #desired_caps['resetKeyboard'] = "true"#在设定了 unicodeKeyboard 关键字的 Unicode 测试结束后,重置输入法到原有状态。如果单独使用,将会被忽略。默认值 false
    desired_caps['appActivity'] = 'com.yuntongxun.ecdemo.ui.LauncherActivity' #启动时的Activity
    driver = webdriver.Remote('http://*****:*****@text='昵 称']").set_text("I am a nickname")
    driver.find_element_by_xpath("//android.widget.EditText[@text='签 名']").set_text("I am signature")
    driver.find_element_by_id("sign_in_button").click()      
    
    time.sleep(5)   
    swipLeft(500)#左划
    
    #查找联系人
    driver.find_element_by_id("card_item_tv").click()
    driver.find_element_by_id("content").click()
    driver.find_element_by_id("content").send_keys("13366778604")
    driver.find_element_by_id("text_right").click()
      
    #发送文本消息   
    driver.find_element_by_id("chatting_content_et").click()
    driver.find_element_by_id("chatting_content_et").send_keys("hello tester")
    time.sleep(5)
    driver.find_element_by_id("chatting_send_btn").click()
    #driver.press_keycode('66')
    driver.press_keycode('4')#按下返回键    
    driver.find_element_by_id("chatting_content_itv").click()
    time.sleep(2)
    sendoutcontent = driver.find_element_by_id("chatting_content_itv").get_attribute("text")
    print sendoutcontent
    receivecontent = driver.find_element_by_id("tv_read_unread").get_attribute("text")
    assert_equal(sendoutcontent,"hello tester",msg=u'发送的消息验证失败')
    assert_equal(receivecontent,u"未读")
    #driver.find_element_by_id("chatting_content_et").click()
    driver.find_element_by_id("chatting_mode_btn").click()
    time.sleep(2)
    
    #发送语音
    action1 = TouchAction(driver)  
    el = driver.find_element_by_id("voice_record_imgbtn")
    action1.long_press(el,duration=5000).perform()

    #发送图片
    driver.find_element_by_id("chatting_attach_btn").click()
    driver.find_element_by_id("app_grid_item_icon_mask").click()
    driver.find_element_by_id("imageview_photo").click()
    driver.find_element_by_id("text_right").click()
    
    #视频通话
    time.sleep(5)
    wq = driver.find_element_by_id("chatting_attach_btn")
    assert_not_none(wq,u"未定位到加号按钮")
    wq.click()
    time.sleep(2)
    driver.tap([(400,1660)], )#点击

    print "Start : %s" % time.ctime()
    time.sleep(6)
    print "End : %s" % time.ctime()
    #图片对比
    test_get_screen_by_element()
    test_same_as()
    time.sleep(2)
    driver.find_element_by_id("video_botton_cancle").click()
    #image1=driver.find_element_by_xpath("//android.widget.RelativeLayout[last()]/LinearLayout/LinearLayout/LinearLayout/LinearLayout/ImageView")  
      
    #退出
    driver.find_element_by_id("btn_left").click()    
    driver.find_element_by_id("btn_plus").click()#加号
    time.sleep(2)
    driver.tap([(590,1190)], )#点击设置
    time.sleep(2)
    '''
    origin_el=driver.find_element_by_name("新消息声音")
    destination_el=driver.find_element_by_name("华为推送")
    driver.scroll(destination_el,origin_el)
    '''
    swipeUp(500)#上滑    
    driver.find_element_by_name(u"退出当前账号").click()
    driver.find_element_by_id("dilaog_button3").click()

    driver.quit()
Beispiel #10
0
 def __init__(self, tester, driver):
     unittest.TestCase()
     self.tester = tester
     self.driver = driver
     self.Extend = Appium_Extend(driver)