def test_03lastPageCheck(self,platform,browserName,version,length,width): filename = "test_03lastPage" + platform + browserName + length + width + ".png" desired_capabilities = {"platform": platform, "browserName": browserName, "version": version, "javascriptEnabled": True } driver = webdriver.Remote(command_executor='http://10.12.128.233:4444/wd/hub', desired_capabilities=desired_capabilities) dp = DestinationP(driver, self.url) dp.open(length, width) time.sleep(1) # 用户登录 login = LoginP(driver, self.url) login.login(self.username,self.password) #勾选All dp.checkAll("check") self.logger.printlog("check All") time.sleep(1) #翻到最后一页 dp.jumpToLastPage() time.sleep(2) dp.saveScreenToFile(self.path, filename) time.sleep(1) # check video size result = dp.checkVideoSize(self.expected_vsize) if(result==1): self.logger.printlog("视频和预期结果匹配") print("视频和预期结果匹配") dp.quit_page() self.assertEqual(result, 1), "test_03lastPage fail"
def test_08checkControlBoard(self,platform, browserName, version, length, width): filename = "test_08checkControlBoard" + platform + browserName + length + width + ".png" desired_capabilities = {"platform": platform, "browserName": browserName, "version": version, "javascriptEnabled": True } driver = webdriver.Remote(command_executor='http://10.12.128.233:4444/wd/hub', desired_capabilities=desired_capabilities) dp = DestinationP(driver, self.url) dp.open(length, width) time.sleep(1) # 用户登录 login = LoginP(driver, self.url) login.login(self.username, self.password) # 勾选All dp.checkAll("check") self.logger.printlog("check All") time.sleep(1) # 点击 controldelayBitraty and check size result_setBitDelaySize= dp.checkBitDelaySize(self.expect_setBitDelaySize, self.path, filename) if (result_setBitDelaySize == 1): self.logger.printlog("视频大小和预期结果匹配") print("视频大小和预期结果匹配") dp.quit_page() self.assertEqual(result_setBitDelaySize, 1), "test_08checkControlBoard check videosize fail"
def test_03lastPageCheck(self,platformName,browserName,deviceName,udid): filename = "test_03lastPageCheck" + deviceName + ".png" # self.logger.printlog("test_01mobile") desired_capabilities = {"platformName": platformName, "browserName": browserName, "platformVersion": "12.1.0", "deviceName": deviceName, "automationName": "XCUITest", "udid": udid, "useNewWDA": True } driver = wd.Remote(command_executor="http://10.12.128.233:4444/wd/hub", desired_capabilities=desired_capabilities) dp = DestinationP(driver, self.url) dp.open(self.length, self.width) time.sleep(1) # 用户登录 login = LoginP(driver, self.url) login.login(self.username, self.password) # 勾选All dp.checkAll("check") self.logger.printlog("check All") time.sleep(1) # 翻到最后一页 dp.jumpToLastPage() time.sleep(2) dp.saveScreenToFile(self.path, filename) time.sleep(1) # check video size result = dp.checkVideoSize(self.expected_vsize) if (result == 1): self.logger.printlog("视频和预期结果匹配") print("视频和预期结果匹配") dp.quit_page() self.assertEqual(result, 1), "test_03lastPage fail"
def test_01checkVideoSize(self, deviceName): filename = 'test_01checkVideoSize' + deviceName + ".jpg" # self.logger.printlog("test_01mobile") mobile_emulation = {"deviceName": deviceName} chrome_options = webdriver.ChromeOptions() chrome_options.add_experimental_option("mobileEmulation", mobile_emulation) # prefs = {"profile.managed_default_content_settings.images": 2} # chrome_options.add_experimental_option("prefs", prefs) # chrome_options.add_argument('blink-settings=imagesEnabled=false') driver = webdriver.Chrome( executable_path= "D:\\Python36\\chromedriver_win32\\chromedriver.exe", desired_capabilities=chrome_options.to_capabilities()) dp = DestinationP(driver, self.url) dp.open(self.length, self.width) time.sleep(1) #用户登录 login = LoginP(driver, self.url) login.login(self.username, self.password) #勾选All dp.checkAll("check") self.logger.printlog("check All") time.sleep(3) dp.saveScreenToFile(self.path, filename) time.sleep(1) #check video size result = dp.checkVideoSize(self.expected_vsize) if (result == 1): self.logger.printlog("视频和预期结果匹配") print("视频和语气结果匹配") dp.quit_page() self.assertEqual(result, 1), "test_01checkVideoSize fail"
def test_08checkControlBoard(self, deviceName): filename = "test_07checkRinfoSize" + deviceName + ".png" mobile_emulation = {"deviceName": deviceName} chrome_options = webdriver.ChromeOptions() chrome_options.add_experimental_option("mobileEmulation", mobile_emulation) # prefs = {"profile.managed_default_content_settings.images": 2} # chrome_options.add_experimental_option("prefs", prefs) # chrome_options.add_argument('blink-settings=imagesEnabled=false') driver = webdriver.Chrome( executable_path= "D:\\Python36\\chromedriver_win32\\chromedriver.exe", desired_capabilities=chrome_options.to_capabilities()) dp = DestinationP(driver, self.url) dp.open(self.length, self.width) time.sleep(1) # 用户登录 login = LoginP(driver, self.url) login.login(self.username, self.password) # 勾选All dp.checkAll("check") self.logger.printlog("check All") time.sleep(1) # 点击 controldelayBitraty and check size result_setBitDelaySize = dp.checkBitDelaySize( self.expect_setBitDelaySize, self.path, filename) if (result_setBitDelaySize == 1): self.logger.printlog("视频大小和预期结果匹配") print("视频大小和预期结果匹配") dp.quit_page() self.assertEqual(result_setBitDelaySize, 1), "test_08checkControlBoard check videosize fail"
def test_08checkControlBoard(self,platformName,browserName,deviceName,udid): filename = "test_08checkControlBoard" + deviceName + ".png" # self.logger.printlog("test_01mobile") desired_capabilities = {"platformName": platformName, "browserName": browserName, "platformVersion": "12.1.0", "deviceName": deviceName, "automationName": "XCUITest", "udid": udid, "useNewWDA": True } driver = wd.Remote(command_executor="http://10.12.128.233:4444/wd/hub", desired_capabilities=desired_capabilities) dp = DestinationP(driver, self.url) dp.open(self.length, self.width) time.sleep(1) # 用户登录 login = LoginP(driver, self.url) login.login(self.username, self.password) # 勾选All dp.checkAll("check") self.logger.printlog("check All") time.sleep(1) # 点击 controldelayBitraty and check size result_setBitDelaySize = dp.checkBitDelaySize(self.expect_setBitDelaySize, self.path, filename) if (result_setBitDelaySize == 1): self.logger.printlog("视频大小和预期结果匹配") print("视频大小和预期结果匹配") dp.quit_page() self.assertEqual(result_setBitDelaySize, 1), "test_08checkControlBoard check videosize fail"
def test_02checkPagination(self,platform,browserName,version,length,width): result=0 filename = "test_02checkPagination_" + platform + browserName + length + width + ".png" desired_capabilities = {"platform": platform, "browserName": browserName, "version": version, "javascriptEnabled": True } driver = webdriver.Remote(command_executor='http://10.12.128.233:4444/wd/hub', desired_capabilities=desired_capabilities) # print("browersName:"+str(browserName)+" version:"+self.driver.capabilities['version']) dp = DestinationP(driver, self.url) dp.open(length, width) time.sleep(1) # 用户登录 login = LoginP(driver, self.url) login.login(self.username,self.password) #勾选All dp.checkAll("check") self.logger.printlog("check All") time.sleep(1) #翻页 flag=dp.pagiation() if(flag==0): result=0 time.sleep(2) dp.saveScreenToFile(self.path, filename) time.sleep(1) # check video size result = dp.checkVideoSize(self.expected_vsize) self.logger.printlog("视频和语气结果匹配") print("视频和语气结果匹配") dp.quit_page() self.assertEqual(result, 1), "test_02checkPagination fail"
def test_04checkDynamicSorting(self, platform, browserName, version, length, width): filename = "test_04checkDynamicSorting" + platform + browserName + length + width desired_capabilities = { "platform": platform, "browserName": browserName, "version": version, "javascriptEnabled": True } try: driver = webdriver.Remote( command_executor='http://10.12.128.233:4444/wd/hub', desired_capabilities=desired_capabilities) dp = DestinationP(driver, self.url) dp.open(length, width) time.sleep(1) # 用户登录 login = LoginP(driver, self.url) login.login(self.username, self.password) # 勾选All dp.checkAll("check") print("check All") self.logger.printlog("check All") time.sleep(1) # 去掉勾选Sort and Favorite dp.checkDynamicSorting("uncheck") time.sleep(1) dp.checkFavorite('uncheck') time.sleep(1) # 点击dynamicSorting dp.checkDynamicSorting("check") time.sleep(2) # check video 的排序 result_sort = dp.checkVideoSort() if (result_sort == 1): self.logger.printlog("视频排序和预期结果匹配") print("视频排序和预期结果匹配") #截图 dp.saveScreenToFile(self.path, filename + "_sortTop.png") time.sleep(3) #下拉到底部截图 js = "$(window).scrollTop(100000000);" dp.execute_script(js) time.sleep(3) #video sort排序截图 dp.saveScreenToFile(self.path, filename + "_sortBottom.png") time.sleep(1) # # check video size # result = dp.checkVideoSize(self.expected_vsize) # if(result==1): # self.logger.printlog("所有视频和预期结果匹配") # print("所有视频和预期结果匹配") except Exception as e: print("Reason:", e) finally: dp.quit_page() # self.assertEqual(result, 1), "test_04checkDynamicSorting check videosize fail" self.assertEqual(result_sort, 1), "test_04checkDynamicSorting check videosort fail"
def test_08unfoldRinfo(self, platform, browserName, version, length, width): result_unfolderrTinfo = 0 filename = "test_08unfoldRinfo" + platform + browserName + length + width + ".png" desired_capabilities = { "platform": platform, "browserName": browserName, "version": version, "javascriptEnabled": True } try: driver = webdriver.Remote( command_executor='http://10.12.128.233:4444/wd/hub', desired_capabilities=desired_capabilities) dp = DestinationP(driver, self.url) dp.open(length, width) time.sleep(1) # 用户登录 login = LoginP(driver, self.url) login.login(self.username, self.password) # 取消勾选All dp.checkAll("uncheck") self.logger.printlog("uncheck All") time.sleep(1) # 去掉勾选Sort and Favorite dp.checkDynamicSorting("uncheck") time.sleep(1) dp.checkFavorite('uncheck') time.sleep(1) # 勾选live result_live = dp.checkLiveReceivers('check') print("check liveReceivers") # trinfo 框自动弹出and check size expect_rTinfoSize_unfolder = {'height': 0, 'width': 0} result_unfolderrTinfo = dp.unfolderrTInfo( expect_rTinfoSize_unfolder, self.path, filename) if (result_unfolderrTinfo == 1): self.logger.printlog("收起rTinfo下拉框成功") print("收起rTinfo下拉框成功") # # check video size # result = dp.checkVideoSize(self.expected_vsize) # if (result == 1): # self.logger.printlog("所有视频大小和预期结果匹配") # print("所有视频大小和预期结果匹配") except Exception as e: print("Reason:", e) finally: dp.quit_page() self.assertEqual(result_unfolderrTinfo, 1), "test_08unfoldRinfo unfolder Rinfo fail" self.assertEqual(result_live, 1), "test_08unfoldRinfo 勾选live,不显示Liveh视频 fail"
def test_05searchReceiverName(self, platform, browserName, version, length, width): searchText = "9a14" results = 1 filename = "test_06search" + platform + browserName + length + width + ".png" desired_capabilities = { "platform": platform, "browserName": browserName, "version": version, "javascriptEnabled": True } try: driver = webdriver.Remote( command_executor='http://10.12.128.233:4444/wd/hub', desired_capabilities=desired_capabilities) dp = DestinationP(driver, self.url) dp.open(length, width) time.sleep(1) # 用户登录 login = LoginP(driver, self.url) login.login(self.username, self.password) # 勾选All dp.checkAll("check") print("check All") self.logger.printlog("check All") time.sleep(1) # 去掉勾选Sort and Favorite dp.checkDynamicSorting("uncheck") time.sleep(1) dp.checkFavorite('uncheck') time.sleep(1) # 点击search,search dp.searchText(searchText) time.sleep(3) dp.saveScreenToFile(self.path, filename) time.sleep(1) # #check video size # result = dp.checkVideoSize(self.expected_vsize) # if (result == 1): # self.logger.printlog("视频大小和预期结果匹配") # print("视频大小和预期结果匹配") #check searchresult results = dp.checkReceiverName(searchText) if (results == 1): self.logger.printlog("搜索结果匹配") print("搜索结果匹配") except Exception as e: print("Reason:", e) finally: dp.quit_page() # self.assertEqual(result, 1), "test_05searchReceiverName check videosize fail" self.assertEqual(results, 1), "test_05searchReceiverName search fail"
def test_09checkControlBoard(self, platform, browserName, version, length, width): filename = "test_09checkControlBoard" + platform + browserName + length + width + ".png" desired_capabilities = { "platform": platform, "browserName": browserName, "version": version, "javascriptEnabled": True } try: driver = webdriver.Remote( command_executor='http://10.12.128.233:4444/wd/hub', desired_capabilities=desired_capabilities) dp = DestinationP(driver, self.url) dp.open(length, width) time.sleep(1) # 用户登录 login = LoginP(driver, self.url) login.login(self.username, self.password) # 取消勾选All dp.checkAll("uncheck") self.logger.printlog("uncheck All") time.sleep(1) # 去掉勾选Sort and Favorite dp.checkDynamicSorting("uncheck") time.sleep(1) dp.checkFavorite('uncheck') time.sleep(1) # 勾选live result_live = dp.checkLiveReceivers('check') print("check liveReceivers" + str(result_live)) time.sleep(1) # 点击 controldelayBitraty and check size result_setBitDelaySize = dp.checkBitDelaySize( self.expect_setBitDelaySize, self.path, filename) if (result_setBitDelaySize == 1): self.logger.printlog("BitDelaySize大小和预期结果匹配") print("BitDelaySize大小和预期结果匹配") # # check video size # result = dp.checkVideoSize(self.expected_vsize) # if (result == 1): # self.logger.printlog("所有视频大小和预期结果匹配") # print("所有视频大小和预期结果匹配") except Exception as e: print("Reason:", e) finally: dp.quit_page() self.assertEqual(result_setBitDelaySize, 1), "test_09checkControlBoard check videosize fail" self.assertEqual(result_live, 1), "test_09checkControlBoard 勾选live不显示live的视频 fail"
def test_02checkPagination(self, platform, browserName, version, length, width): result_pag = 0 filename = "test_02checkPagination_" + platform + browserName + length + width + ".png" desired_capabilities = { "platform": platform, "browserName": browserName, "version": version, "javascriptEnabled": True } try: driver = webdriver.Remote( command_executor='http://10.12.128.233:4444/wd/hub', desired_capabilities=desired_capabilities) # print("browersName:"+str(browserName)+" version:"+self.driver.capabilities['version']) dp = DestinationP(driver, self.url) dp.open(length, width) time.sleep(1) # 用户登录 login = LoginP(driver, self.url) login.login(self.username, self.password) #勾选All dp.checkAll("check") print("check All") self.logger.printlog("check All") time.sleep(1) # 去掉勾选Sort and Favorite dp.checkDynamicSorting("uncheck") time.sleep(1) dp.checkFavorite('uncheck') time.sleep(1) #翻页 flag = dp.pagiation() if (flag == 0): result_pag = 0 else: result_pag = 1 time.sleep(3) dp.saveScreenToFile(self.path, filename) time.sleep(1) # check video size # result = dp.checkVideoSize(self.expected_vsize) # if(result==1): # self.logger.printlog("视频和预期结果匹配") # print("视频和预期结果匹配") except Exception as e: print("Reason:", e) finally: dp.quit_page() self.assertEqual(result_pag, 1), "test_02checkPagination fail"
def test_10checkLiveVideo(self, platform, browserName, version, length, width): filename = "test_10checkLiveVideo" + platform + browserName + length + width + ".png" result = 1 desired_capabilities = { "platform": platform, "browserName": browserName, "version": version, "javascriptEnabled": True } try: driver = webdriver.Remote( command_executor='http://10.12.128.233:4444/wd/hub', desired_capabilities=desired_capabilities) dp = DestinationP(driver, self.url) dp.open(length, width) time.sleep(1) # 用户登录 login = LoginP(driver, self.url) login.login(self.username, self.password) # 取消勾选All dp.checkAll("uncheck") self.logger.printlog("uncheck All") time.sleep(1) # 去掉勾选Sort and Favorite dp.checkDynamicSorting("uncheck") time.sleep(1) dp.checkFavorite('uncheck') time.sleep(1) # 勾选live result_live = dp.checkLiveReceivers('check') if (result_live == 1): print("check liveReceivers") time.sleep(1) #点击所有视频的个eys图标 result_eye = dp.clickEyeIcon(self.path, filename) time.sleep(1) if (result_eye == 1): print("点击所有的视频都能打开") else: print("点击所有的视频都不能打开") except Exception as e: print(e) result = 0 finally: dp.quit_page() self.assertEqual(result, 1), "test_10checkLiveVideo fail" self.assertEqual(result_live, 1), "test_10checkLiveVideo 勾选live不显示live的视频 fail" self.assertEqual(result_eye, 1), "test_10checkLiveVideo 点击eye,不能显示所视频"
def test_05searchReceiverName(self, deviceName): searchText = "Ari" filename = "test_05searchReceiverName" + deviceName + ".png" mobile_emulation = {"deviceName": deviceName} chrome_options = webdriver.ChromeOptions() chrome_options.add_experimental_option("mobileEmulation", mobile_emulation) # prefs = {"profile.managed_default_content_settings.images": 2} # chrome_options.add_experimental_option("prefs", prefs) # chrome_options.add_argument('blink-settings=imagesEnabled=false') driver = webdriver.Chrome( executable_path= "D:\\Python36\\chromedriver_win32\\chromedriver.exe", desired_capabilities=chrome_options.to_capabilities()) dp = DestinationP(driver, self.url) dp.open(self.length, self.width) time.sleep(1) # 用户登录 login = LoginP(driver, self.url) login.login(self.username, self.password) # 勾选All dp.checkAll("check") self.logger.printlog("check All") time.sleep(1) # 点击search,search dp.searchText(searchText) time.sleep(1) dp.saveScreenToFile(self.path, filename) time.sleep(1) # check video size result = dp.checkVideoSize(self.expected_vsize) if (result == 1): self.logger.printlog("视频大小和预期结果匹配") print("视频大小和预期结果匹配") # check searchresult RNames = dp.getReceiverName() for rname in RNames: if (searchText not in rname): results = 0 break if (results == 1): self.logger.printlog("搜索结果匹配") print("搜索结果匹配") dp.quit_page() self.assertEqual(result, 1), "test_05searchReceiverName check videosize fail" self.assertEqual(results, 1), "test_05searchReceiverName search fail"
def test_05searchReceiverName(self,platformName,browserName,deviceName,udid): searchText="Ari" filename = "test_05searchReceiverName" + deviceName + ".png" # self.logger.printlog("test_01mobile") desired_capabilities = {"platformName": platformName, "browserName": browserName, "platformVersion": "12.1.0", "deviceName": deviceName, "automationName": "XCUITest", "udid": udid, "useNewWDA": True } driver = wd.Remote(command_executor="http://10.12.128.233:4444/wd/hub", desired_capabilities=desired_capabilities) dp = DestinationP(driver, self.url) dp.open(self.length, self.width) time.sleep(1) # 用户登录 login = LoginP(driver, self.url) login.login(self.username, self.password) # 勾选All dp.checkAll("check") self.logger.printlog("check All") time.sleep(1) # 点击search,search dp.searchText(searchText) time.sleep(1) dp.saveScreenToFile(self.path, filename) time.sleep(1) # check video size result = dp.checkVideoSize(self.expected_vsize) if (result == 1): self.logger.printlog("视频大小和预期结果匹配") print("视频大小和预期结果匹配") # check searchresult RNames = dp.getReceiverName() for rname in RNames: if (searchText not in rname): results = 0 break if (results == 1): self.logger.printlog("搜索结果匹配") print("搜索结果匹配") dp.quit_page() self.assertEqual(result, 1), "test_05searchReceiverName check videosize fail" self.assertEqual(results, 1), "test_05searchReceiverName search fail"
def test_05searchReceiverName(self, platform, browserName, version, length, width): searchText="Ari" results=1 filename = "test_06search" + platform + browserName + length + width + ".png" desired_capabilities = {"platform": platform, "browserName": browserName, "version": version, "javascriptEnabled": True } driver = webdriver.Remote(command_executor='http://10.12.128.233:4444/wd/hub', desired_capabilities=desired_capabilities) dp = DestinationP(driver, self.url) dp.open(length, width) time.sleep(1) # 用户登录 login = LoginP(driver, self.url) login.login(self.username,self.password) # 勾选All dp.checkAll("check") self.logger.printlog("check All") time.sleep(1) # 点击search,search dp.searchText(searchText) time.sleep(1) dp.saveScreenToFile(self.path, filename) time.sleep(1) #check video size result = dp.checkVideoSize(self.expected_vsize) if (result == 1): self.logger.printlog("视频大小和预期结果匹配") print("视频大小和预期结果匹配") #check searchresult RNames=dp.getReceiverName() for rname in RNames: if(searchText not in rname): results=0 break if(results==1): self.logger.printlog("搜索结果匹配") print("搜索结果匹配") dp.quit_page() self.assertEqual(result, 1), "test_05searchReceiverName check videosize fail" self.assertEqual(results,1),"test_05searchReceiverName search fail"
def test_02checkPagination(self,platformName,browserName,deviceName,udid): filename = "test_02checkPagination" + deviceName + ".png" # self.logger.printlog("test_01mobile") desired_capabilities = {"platformName": platformName, "browserName": browserName, "platformVersion": "12.1.0", "deviceName": deviceName, "automationName": "XCUITest", "udid": udid, "useNewWDA": True } driver = wd.Remote(command_executor="http://10.12.128.233:4444/wd/hub", desired_capabilities=desired_capabilities) # print("browersName:"+str(browserName)+" version:"+self.driver.capabilities['version']) dp = DestinationP(driver, self.url) dp.open(self.length, self.width) time.sleep(1) # 用户登录 login = LoginP(driver, self.url) login.login(self.username, self.password) # 勾选All dp.checkAll("check") self.logger.printlog("check All") time.sleep(1) # 翻页 flag = dp.pagiation() if (flag == 0): result = 0 print("翻页找不到页码") else: time.sleep(2) driver.get_screenshot_as_file(self.path + filename) time.sleep(1) # check video size result = dp.checkVideoSize(self.expected_vsize) self.logger.printlog("视频和语气结果匹配") print("视频和语气结果匹配") dp.quit_page() self.assertEqual(result, 1), "test_02checkPagination fail"
def test_02checkPagination(self, deviceName): result = 0 filename = "test_02checkPagination_" + deviceName + ".png" mobile_emulation = {"deviceName": deviceName} chrome_options = webdriver.ChromeOptions() chrome_options.add_experimental_option("mobileEmulation", mobile_emulation) # prefs = {"profile.managed_default_content_settings.images": 2} # chrome_options.add_experimental_option("prefs", prefs) # chrome_options.add_argument('blink-settings=imagesEnabled=false') driver = webdriver.Chrome( executable_path= "D:\\Python36\\chromedriver_win32\\chromedriver.exe", desired_capabilities=chrome_options.to_capabilities()) # print("browersName:"+str(browserName)+" version:"+self.driver.capabilities['version']) dp = DestinationP(driver, self.url) dp.open(self.length, self.width) time.sleep(1) # 用户登录 login = LoginP(driver, self.url) login.login(self.username, self.password) # 勾选All dp.checkAll("check") self.logger.printlog("check All") time.sleep(1) # 翻页 flag = dp.pagiation() if (flag == 0): result = 0 time.sleep(2) dp.saveScreenToFile(self.path, filename) time.sleep(1) # check video size result = dp.checkVideoSize(self.expected_vsize) self.logger.printlog("视频和语气结果匹配") print("视频和语气结果匹配") dp.quit_page() self.assertEqual(result, 1), "test_02checkPagination fail"