Esempio n. 1
0
    def test_wode03(self):
        try:
            testData = util.getTestDataInput('Wode',self._testMethodName)
            HiAppt1.enter_wode(self.driver)
            HiAppt1.check_msg(self.driver,**testData)

        except Exception as err:
            print 'exception:'+err.message
            path = os.getcwd()+'/tests/results/images/'
            fileName = path +self._testMethodName+time.strftime('_%Y%m%d%H%M%S')+'.png'
            self.driver.get_screenshot_as_file(fileName)
            self.assertFalse(True,'Run '+self._testMethodName+' failed')
Esempio n. 2
0
 def test_download_notexist1(self):
     try:
         hiapp = HiApp(self.driver)
         testData = util.getTestDataInput('Download', self._testMethodName)
         hiapp.download_app_notexist(**testData)
     except Exception as err:
         print 'exception:' + err.message
         path = os.getcwd() + '/tests/results/images/'
         fileName = path + self._testMethodName + time.strftime(
             '_%Y%m%d%H%M%S') + '.png'
         self.driver.get_screenshot_as_file(fileName)
         self.assertFalse(True, 'Run ' + self._testMethodName + ' failed')
Esempio n. 3
0
    def test_wode01(self):
        try:
            testData = util.getTestDataInput('Wode',self._testMethodName)
            hiapp = HiApp(self.driver)
            hiapp.enter_wode()
            hiapp.check_msg([u'//android.widget.TextView[@text="hiapps"]',u'//android.widget.TextView[@text="QQ 4008308300"]'],[u'hiapps',u'QQ 4008308300'])

        except Exception as err:
            print 'exception:'+err.message
            path = os.getcwd()+'/tests/results/images/'
            fileName = path +self._testMethodName+time.strftime('_%Y%m%d%H%M%S')+'.png'
            self.driver.get_screenshot_as_file(fileName)
            self.assertFalse(True,'Run '+self._testMethodName+' failed')
Esempio n. 4
0
 def test_download_music(self):
     try:
         # 数据驱动实现
         print self._testMethodName
         testdata = util.getTestDataInput("Download",self._testMethodName)
         print testdata["remover_app.appPkgName"]
         hiapp = HiApp(self.driver)
         hiapp.remover_app(**testdata)
         hiapp.download_app(**testdata)
         hiapp.app_is_exist(**testdata)
         # hiapp = HiApp(self.driver)
         # hiapp.remover_app(u'com.ezhoop.music')
         # hiapp.download_app(u'music')
         # hiapp.app_is_exist(u'com.ezhoop.music')
         # time.sleep(5)
         # el1 = self.driver.find_element_by_id('com.huawei.appmarket:id/search_edit_text')
         # el1.click()
         #
         # time.sleep(1)
         #
         # el2 = self.driver.find_element_by_id('com.huawei.appmarket:id/searchText')
         # el2.set_value('music')
         # time.sleep(2)
         # el3 = self.driver.find_element_by_id('com.huawei.appmarket:id/search_title_icon')
         # el3.click()
         # time.sleep(1)
         # el4 = self.driver.find_element_by_xpath('//android.widget.LinearLayout[@index=0]/android.widget.RelativeLayout/android.widget.RelativeLayout/android.widget.LinearLayout/android.widget.RelativeLayout/android.view.View[@index=1]')
         # el4.click()
         #
         # time.sleep(10)
         # # self.driver.is_app_installed('com.ezhoop.music')
         # print self.driver.is_app_installed('com.ezhoop.music')
         #
         # self.driver.remove_app('com.ezhoop.music')
         #
         # print self.driver.is_app_installed('com.ezhoop.music')
         #
         # time.sleep(1)
     except:
         time.sleep(3)
         path = 'E:\\worksplace\\AppTestGR2\\tests\\results\images\\'
         fileName = path+self._testMethodName+time.strftime('_%Y%m%d%H%M%S')+".png"
         self.driver.get_screenshot_as_file(fileName)
         self.assertFalse(True,'Run'+self._testMethodName+'failed')
         time.sleep(3)
Esempio n. 5
0
    def test_wode01(self):
        try:
            logs = util.createMainLog('E:\\worksplace\\AppTestGR2\\tests\\results\\')
            logs.debug("test_wode01----kaishi zgxing")
            testdata = util.getTestDataInput("Wode",self._testMethodName)
            hiapp = HiApp(self.driver)
            hiapp.enter_wode()
            hiapp.check_msg(**testdata)
            logs = util.createMainLog('E:\\worksplace\\AppTestGR2\\tests\\results\\')

            # hiapp = HiApp(self.driver)
            # hiapp.enter_wode()
            # hiapp.check_msg('//android.widget.TextView[@text="hiapps"]','hiapps')

            # time.sleep(3)
            # el1 = self.driver.find_element_by_xpath('//android.widget.TextView[@text="我的"]')
            # el1.click()
            #
            # time.sleep(1)
            #
            # e12 = self.driver.find_element_by_xpath('//android.widget.TextView[@text="关于"]')
            # time.sleep(1)
            # e12.click()
            #
            # el3 = self.driver.find_element_by_xpath('//android.widget.TextView[@text="hiapps"]')
            # self.assertTrue(el3.text == 'hiapps')
            # print el3.text
            # # 获取当前方法的名字
            # print self._testMethodName
            # #QQ 4008308300
            # el4 = self.driver.find_element_by_xpath('//android.widget.TextView[@text="QQ 4008308300"]')
            # self.assertTrue(el4.text == 'QQ 40083083')
            # print el4.text

        except:
            logs.debug("test_wode01----jieshu zgxing")
            time.sleep(3)
            path = 'E:\\worksplace\\AppTestGR2\\tests\\results\images\\'
            fileName = path+self._testMethodName+time.strftime('_%Y%m%d%H%M%S')+".png"
            self.driver.get_screenshot_as_file(fileName)
            self.assertFalse(True,'Run'+self._testMethodName+'failed')
            time.sleep(3)
Esempio n. 6
0
 def test_wode02(self):
     try:
         logs = util.createMainLog('E:\\worksplace\\AppTestGR2\\tests\\results\\')
         logs.debug("test_wode0----kaishi zgxing")
         testdata = util.getTestDataInput("Wode",self._testMethodName)
         hiapp = HiApp(self.driver)
         hiapp.enter_wode()
         hiapp.open_switch(**testdata)
         # keyword封装后的代码
         # hiapp = HiApp(self.driver)
         # hiapp.enter_wode()
         # hiapp.open_switch('//android.widget.RelativeLayout[@index=8]/android.widget.Switch')
         # # time.sleep(3)
         # # el1 = self.driver.find_element_by_xpath('//android.widget.TextView[@text="我的"]')
         # # el1.click()
         # e11 = find_element.find_element(self.driver,'//android.widget.TextView[@text="我的"]')
         # e11.click()
         #
         # time.sleep(1)
         # el2 = self.driver.find_element_by_xpath('//android.widget.TextView[@text="设置"]')
         # el2.click()
         #
         # time.sleep(1)
         # el3 = self.driver.find_element_by_xpath('//android.widget.RelativeLayout[@index=8]/android.widget.Switch')
         # if el3.get_attribute('checked') != u'true':
         #     el3.click()
         #     time.sleep(1)
         # self.assertTrue(el3.get_attribute('checked') == u'true')
         # print el3.text
     except:
         logs.debug("test_wode02----kaishi zgxing")
         time.sleep(3)
         path = 'E:\\worksplace\\AppTestGR2\\tests\\results\images\\'
         fileName = path+self._testMethodName+time.strftime('_%Y%m%d%H%M%S')+".png"
         self.driver.get_screenshot_as_file(fileName)
         self.assertFalse(True,'Run'+self._testMethodName+'failed')
         time.sleep(3)
Esempio n. 7
0
    def test_download_notexist1(self):
        try:
            logs = util.createMainLog('E:\\worksplace\\AppTestGR2\\tests\\results\\')
            logs.debug("test_download_notexist1----kaishi zgxing")
            print self._testMethodName
            testdata = util.getTestDataInput("Download",self._testMethodName)
            print testdata["remover_app.appPkgName"]
            hiapp = HiApp(self.driver)
            hiapp.download_app_notexist(**testdata)
            # hiapp = HiApp(self.driver)
            # hiapp.download_app_notexist(u'#()*')
            # time.sleep(5)
            # el1 = self.driver.find_element_by_id('com.huawei.appmarket:id/search_edit_text')
            # el1.click()
            #
            # time.sleep(1)
            #
            # el2 = self.driver.find_element_by_id('com.huawei.appmarket:id/searchText')
            # el2.clear()
            # # el2.set_value(r'#()*')
            # el2.set_text(u'#()*')
            # time.sleep(2)
            # el3 = self.driver.find_element_by_id('com.huawei.appmarket:id/search_title_icon')
            # el3.click()
            # time.sleep(1)

            # el4 = self.driver.find_element_by_xpath(u'//android.widget.TextView[@text="没有符合条件的内容"]')
            # self.assertTrue(el4.text == u'没有符合条件的内容')
        except:
            logs.debug("test_download_notexist1----kaishi zgxing")
            time.sleep(3)
            path = 'E:\\worksplace\\AppTestGR2\\tests\\results\images\\'
            fileName = path+self._testMethodName+time.strftime('_%Y%m%d%H%M%S')+".png"
            self.driver.get_screenshot_as_file(fileName)
            self.assertFalse(True,'Run'+self._testMethodName+'failed')
            time.sleep(3)