Esempio n. 1
0
    def common_check(self):
        step = 1
        go_to_settings(self.driver)
        version = get_version_code(self.driver)
        db_ver = self.db.get_update_version()['version']
        if db_ver <= version:
            up_ver = vesion_plus(version)
            self.db.set_update_version(up_ver)
        self.driver.quit()
        self.driver = webdriver.Remote(APPIUM_URL, self.desired_caps)
        start_to_index(self.driver, self.mode)
        sleep(10)

        #验证设置中手动升级情况
        go_to_settings(self.driver)
        self.driver.find_element_by_id(VERSION).click()
        el_list = [UPDATE_MSG, BUTTON_OK, BUTTON_CANCEL]
        for el in el_list:
            assert element_exsist(self.driver, 'id', el)
        self.driver.find_element_by_id(BUTTON_CANCEL).click()
        self.driver.find_element_by_id(VERSION).click()
        self.driver.find_element_by_id(BUTTON_OK).click()
        assert self.driver.current_activity == ACTIVITY.get('install')
        print u'Step %s:非强制更新时,设置中手动检测到更新将会弹出提示,更新和取消功能有效测试:OK' % (str(step))
        step += 1
        return True
Esempio n. 2
0
    def common_check(self):
        step = 1

        el_list = [UPDATE_MSG, IGNORE_BOX, BUTTON_OK, BUTTON_CANCEL]
        assert element_exsist(self.driver, 'id', UPDATE_MSG)

        self.driver.find_element_by_id(IGNORE_BOX).click()
        self.driver.find_element_by_id(BUTTON_CANCEL).click()
        sleep(WAIT_TIME)
        assert element_exsist(self.driver, 'id', UPDATE_MSG) == False
        self.driver.quit()
        self.driver = webdriver.Remote(APPIUM_URL, self.desired_caps)
        sleep(10)
        assert element_exsist(self.driver, 'id', UPDATE_MSG) == False
        print u'Step %s:设置为忽略此版本后,启动时客户端不弹出此版本的升级提示测试:OK' % (str(step))
        step += 1

        go_to_settings(self.driver)
        self.driver.find_element_by_id(VERSION).click()
        el_list = [UPDATE_MSG, BUTTON_OK, BUTTON_CANCEL]
        for el in el_list:
            assert element_exsist(self.driver, 'id', el)
        print u'Step %s:设置为忽略此版本后,在设置中手动检测版本仍能弹出升级提示测试:OK' % (str(step))
        step += 1

        up_ver = vesion_plus(self.version, 2)
        self.db.set_update_version(up_ver)
        self.driver.quit()
        self.driver = webdriver.Remote(APPIUM_URL, self.desired_caps)
        sleep(10)
        assert element_exsist(self.driver, 'id', UPDATE_MSG)
        print u'Step %s:存在非忽略版本的版本升级时,仍能弹出升级提示测试:OK' % (str(step))
        step += 1

        up_ver = vesion_plus(self.version)
        self.db.set_update_version(up_ver)
        self.driver.quit()
        del_ignore_version_by_adb()
        clear_cache_by_adb()
        self.driver = webdriver.Remote(APPIUM_URL, self.desired_caps)
        sleep(10)
        assert element_exsist(self.driver, 'id', UPDATE_MSG)

        print u'Step %s:清除忽略版本配置后,可自动弹出升级提示测试:OK' % (str(step))
        step += 1

        return True
Esempio n. 3
0
    def common_check(self):
        step = 1

        #设置为自动强制更新时,更新测试
        up_ver = vesion_plus(self.version)
        self.db.set_update_version(up_ver,force_ver=self.version)
        self.driver.quit()
        self.driver = webdriver.Remote(APPIUM_URL, self.desired_caps)
        sleep(10)
        assert element_exsist(self.driver,*IGNORE_BUTTON) == False
        assert element_exsist(self.driver,*UPDATE_BUTTON) and element_exsist(self.driver,*UPDATE_DIALOG)
        self.driver.find_element(*UPDATE_BUTTON).click()
        # #self.driver.find_element(*BACK_APP_BUTTON).click()
        # for button in self.driver.find_elements_by_class_name('UIAButton'):
        #     if button.text.find(u'宜昌动向')!=-1:
        #         print button.text
        #         print button.size
        #         postion = get_el_center(button)
        #         print postion
        #         self.driver.tap([postion])
        #         button.click()
        assert element_exsist(self.driver,'id',u'精品推荐')
        print u'Step %s:强制更新可跳转到升级页面测试:OK' % (str(step))
        step+=1

        #设置为非强制更新时,更新测试
        self.db.set_update_version(up_ver,force_ver='')
        self.driver.quit()
        self.driver = webdriver.Remote(APPIUM_URL, self.desired_caps)
        sleep(10)
        assert element_exsist(self.driver,*IGNORE_BUTTON)
        assert element_exsist(self.driver,*UPDATE_BUTTON) and element_exsist(self.driver,*UPDATE_DIALOG)
        self.driver.find_element(*UPDATE_BUTTON).click()
        assert element_exsist(self.driver,'id',u'精品推荐')
        print u'Step %s:非强制更新可跳转到升级页面测试:OK' % (str(step))
        step+=1

        #设置为非强制更新时,更新测试
        # self.driver.quit()
        # self.driver = webdriver.Remote(APPIUM_URL, self.desired_caps)
        # sleep(10)
        # start_to_index(self.driver,self.mode)
        # go_to_settings(self.driver)
        # self.driver.find_element(*VERSIONS).click()
        # self.driver.find_element(*UPDATE_BUTTON).click()
        # assert element_exsist(self.driver,'id',u'精品推荐')
        # print u'Step %s:非强制更新时,在设置中手动检测更新可跳转到升级页面测试:OK' % (str(step))
        # step+=1

        return True
Esempio n. 4
0
    def common_check(self):
        step = 1

        #设置为自动强制更新时,更新测试
        up_ver = vesion_plus(self.version)
        self.db.set_update_version(up_ver, force_ver=self.version)
        self.driver.quit()
        self.driver = webdriver.Remote(APPIUM_URL, self.desired_caps)
        sleep(10)
        assert element_exsist(self.driver, 'id', BUTTON_CANCEL) == False
        assert element_exsist(self.driver, 'id', BUTTON_OK) and element_exsist(
            self.driver, 'id', UPDATE_DIALOG)
        self.driver.find_element_by_id(BUTTON_OK).click()
        assert self.driver.current_activity == ACTIVITY.get('install')
        print u'Step %s:强制更新可跳转到升级页面测试:OK' % (str(step))
        step += 1

        #设置为非强制更新时,更新测试
        self.db.set_update_version(up_ver, force_ver='')
        self.driver.quit()
        self.driver = webdriver.Remote(APPIUM_URL, self.desired_caps)
        sleep(10)
        assert element_exsist(self.driver, 'id', BUTTON_CANCEL)
        assert element_exsist(self.driver, 'id', BUTTON_OK) and element_exsist(
            self.driver, 'id', UPDATE_DIALOG)
        self.driver.find_element_by_id(BUTTON_OK).click()
        assert self.driver.current_activity == ACTIVITY.get('install')
        print u'Step %s:非强制更新可跳转到升级页面测试:OK' % (str(step))
        step += 1

        #设置为非强制更新时,更新测试
        self.driver.quit()
        self.driver = webdriver.Remote(APPIUM_URL, self.desired_caps)
        sleep(10)
        start_to_index(self.driver, self.mode)
        go_to_settings(self.driver)
        self.driver.find_element_by_id(VERSION).click()
        self.driver.find_element_by_id(BUTTON_OK).click()
        assert self.driver.current_activity == ACTIVITY.get('install')
        print u'Step %s:非强制更新时,在设置中手动检测更新可跳转到升级页面测试:OK' % (str(step))
        step += 1

        return True
Esempio n. 5
0
 def setUp(self):
     #self.testcases = conf.readcfg(__file__)
     self.desired_caps = desired_caps
     print 'Test Start...................................'
     self.result = 'f'
     self.msg = ''
     self.tsl = TestlinkHandler()
     self.mode = MODE
     self.db = DbLib()
     #self.api = ChnlRequest(self.mode)
     self.driver = webdriver.Remote(APPIUM_URL, self.desired_caps)
     start_to_index(self.driver, self.mode)
     go_to_settings(self.driver)
     self.version = get_version_code(self.driver)
     up_ver = vesion_plus(self.version)
     self.db.set_update_version(up_ver)
     self.driver.quit()
     self.driver = webdriver.Remote(APPIUM_URL, self.desired_caps)
     sleep(10)
Esempio n. 6
0
 def common_check(self):
     step = 1
     go_to_settings(self.driver)
     version = get_version_code(self.driver)
     db_ver = self.db.get_update_version()['version']
     if db_ver <= version:
         up_ver = vesion_plus(version)
         self.db.set_update_version(up_ver)
     self.driver.quit()
     self.driver = webdriver.Remote(APPIUM_URL, self.desired_caps)
     sleep(10)
     el_list = [UPDATE_MSG, IGNORE_BOX, BUTTON_OK, BUTTON_CANCEL]
     assert element_exsist(self.driver, 'id', UPDATE_MSG)
     print u'Step %s:服务器有更新包时,wifi环境弹出更新提示框测试:OK' % (str(step))
     step += 1
     for el in el_list:
         assert element_exsist(self.driver, 'id', el)
     print u'Step %s:更新提示框中包含版本升级提示、忽略更新框、更新和取消按钮测试:OK' % (str(step))
     step += 1