Пример #1
0
	def testDownloadVideo(self):
		#Launch Browser
		self._launchBrowser()

		# input download audio url
		d(resourceId = 'com.android.browser:id/url', text = '输入网址').set_text('http://pan.baidu.com/s/1eQcRK3o')
		d.press('enter')
		d.sleep(5)
		d.swipe(540,1400,540,400,100)
		# click download
		d.click(800,1550)
		assert d(text = '是否下载该文件?').wait.exists(timeout = 10000), 'Not trigger download. '
		d(text = '下载').click.wait()
		if  d(textContains = '您正在通过移动数据下载').exists:
			d(text = '继续').click.wait()
		#Looping 60s to check if download is ok
		for i in range(60):
			if u.getFileCount('/sdcard/Download', 'mp4') > 0:
				return
			d.sleep(1)
		assert False, 'Can not download video in 60s. '

		#Close all webpage windows and clear downloaded resource
		#self._closeWindows()
		self._clearData()
Пример #2
0
	def testDownloadPics(self):
		#Launch Browser
		self._launchBrowser()

		#Input download pics url
		d(resourceId = 'com.android.browser:id/url', text = '输入网址').set_text('auto.smartisan.com/media/Auto_Test_Image.jpg')
		d.sleep(1)
		d.press('enter')
		d.sleep(5)
		# swipe up to show '普通下载'
		d.long_click(500, 670)
		d.sleep(1)
		assert d(text = '保存图片').wait.exists(timeout = 5000),'Save download window does not pop-up in 5s!'
		d(text = '保存图片').click()
		if  d(textContains = '您正在通过移动数据下载').wait.exists(timeout=1000):
			d(text = '继续').click.wait()
		
		#Looping 60s to check if download is ok
		for i in range(60):
			if u.getFileCount('/sdcard/Download', 'jpg') > 0:
				return
			d.sleep(1)
		assert False, 'Can not download pics in 60s. '

		#Close all webpage windows and clear downloaded resource
		#self._closeWindows()
		self._clearData()
Пример #3
0
	def testDownloadAudio(self):
		#Launch Browser
		self._launchBrowser()

		# input download audio url
		d(resourceId = 'com.android.browser:id/url', text = '输入网址').set_text('auto.smartisan.com/media/Auto_Test_Music.mp3')
		d.sleep(1)
		d.press('enter')
		assert d(text = '是否下载该文件?').wait.exists(timeout = 10000), 'Not trigger download. '
		d(text = '下载').click.wait()
		if  d(textContains = '您正在通过移动数据下载').exists:
			d(text = '继续').click.wait()
		#Looping 60s to check if download is ok
		for i in range(60):
			if u.getFileCount('/sdcard/Download', 'mp3') > 0:
				return
			d.sleep(1)
		assert False, 'Can not download audio in 60s. '

		#Close all webpage windows and clear downloaded resource
		#self._closeWindows()
		self._clearData()