Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- import sys
- import unittest
- from appium import webdriver
- class TestBaseClass(unittest.TestCase):
- def setUp(self):
- # set all desired capabilities for Appium
- desired_caps = {
- 'platformName': 'iOS',
- 'platformVersion': '11.1',
- 'automationName': 'XCUITest',
- 'deviceName': 'iPhone 7',
- 'app': os.path.join('...')
- }
- # Create driver object with Appium server address location
- self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_capabilities=desired_caps)
- # grab the "WEBVIEW_*" context
- webview_context = self.driver.contexts[1]
- # switch to the "WEBVIEW_*" context
- self.driver.switch_to.context(webview_context)
- def tearDown(self):
- if sys.exc_info()[0]:
- self.driver.save_screenshot(f'{self._testMethodName}.png')
- self.driver.quit()
- class ScientificCalcMath(TestBaseClass):
- # a bunch of test cases here...
- if __name__ == '__main__':
- suite = unittest.TestLoader().loadTestsFromTestCase(ScientificCalcMath)
- unittest.TextTestRunner(verbosity=2).run(suite)
Add Comment
Please, Sign In to add comment