I'm testing Android app which has a document parts. After installation it contains one document as default, and swiping down it updates 5 documents more. That is one test case and after that app is closed
def tearDown(self):
self.driver.quit()
After I start another test, after this one, there is only one document. What am I doing wrong? How to prevent app starts from with default settings?
I use Appium v1.7.2 and Python
Here is a code
import os
import unittest
from appium import webdriver
from time import sleep
from appium.webdriver.common.touch_action import TouchAction
class meTest(unittest.TestCase):
def setUp(self):
desired_caps = {}
desired_caps['platformName'] = 'Android'
desired_caps['platformVersion'] = '7.1.1'
desired_caps['deviceName'] = 'Xperia Z5 Dual'
desired_caps['autoGrantPermissions'] = 'true'
desired_caps['appPackage'] = 'package.name'
desired_caps['newCommandTimeout'] = '3600'
desired_caps['appActivity'] = 'com.android....MainActivity'
self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
def test_DocumentsUpdate(self):
sleep(5)
manuallyDocumentSelectioBbutton = self.driver.find_element_by_xpath("//*[contains(@text, 'Documents')]").click()
sleep(5)
self.driver.swipe(470, 90, 470, 1000, 10000)
sleep(120)
def tearDown(self):
self.driver.quit()
# ---START OF SCRIPT
if __name__ == '__main__':
suite = unittest.TestLoader().loadTestsFromTestCase(meTest)
unittest.TextTestRunner(verbosity=2).run(suite)
Appium by default resets the application for each test case. Include the following capability and you should get the behavior you're looking for.
desired_caps['noReset'] = 'true'
More information on the various capabilities can be found at https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/caps.md.