class Test(unittest.TestCase): @classmethod def setUpClass(self): super(Test, self).setUpClass() self.device = AndroidDevice("samsung_galaxy_tab_3") self.device.start("it.sky.river") StormTest.WaitSec(4) pass @classmethod def tearDownClass(cls): super(Test, cls).tearDownClass() cls.device.stop() pass def test_tap_using_mapped_text(self): print "TEST TAP MAPPED TEXT" isPressed = self.device.tap(mappedText='openMenu') StormTest.WaitSec(4) self.device.tap(mappedText='closeMenu') self.assertEqual(isPressed, True, "Tap failed") pass def test_tap_element_using_text(self): print "TEST TAP ELEMENT USING TEXT" self.device.tap(mappedText='openMenu') StormTest.WaitSec(4) isCinemaPressed = self.device.tap(text='Cinema') StormTest.WaitSec(4) self.device.tap(mappedText='Home') StormTest.WaitSec(6) self.assertEqual(isCinemaPressed, True, "Tap on Cinema failed") pass def test_import_non_existent_device_commands_module_should_throw_an_exception(self): print "TEST IMPORT NON EXISTENT DEVICE COMMANDS MODULE SHOULD THROW AN EXCEPTION" self.assertRaises(ImportError, AndroidDevice, "samsung_galaxy_fake") pass def test_import_non_existent_app_commands_module_should_throw_an_exception(self): print "TEST IMPORT NON EXISTENT APP COMMANDS MODULE SHOULD THROW AN EXCEPTION" newDevice = AndroidDevice("samsung_galaxy_tab_3") self.assertRaises(ImportError, newDevice.start, "fake_app") pass '''
class Test(unittest.TestCase): @classmethod def setUpClass(self): super(Test, self).setUpClass() self.device = AndroidDevice("samsung_galaxy_tab_3") self.device.start("it.sky.river") StormTest.WaitSec(4) pass @classmethod def tearDownClass(cls): super(Test, cls).tearDownClass() cls.device.stop() pass def test_tap_using_mapped_text(self): print "TEST TAP MAPPED TEXT" isPressed = self.device.tap(mappedText='openMenu') StormTest.WaitSec(4) self.device.tap(mappedText='closeMenu') self.assertEqual(isPressed, True, "Tap failed") pass def test_tap_element_using_text(self): print "TEST TAP ELEMENT USING TEXT" self.device.tap(mappedText='openMenu') StormTest.WaitSec(4) isCinemaPressed = self.device.tap(text='Cinema') StormTest.WaitSec(4) self.device.tap(mappedText='Home') StormTest.WaitSec(6) self.assertEqual(isCinemaPressed, True, "Tap on Cinema failed") pass def test_import_non_existent_device_commands_module_should_throw_an_exception( self): print "TEST IMPORT NON EXISTENT DEVICE COMMANDS MODULE SHOULD THROW AN EXCEPTION" self.assertRaises(ImportError, AndroidDevice, "samsung_galaxy_fake") pass def test_import_non_existent_app_commands_module_should_throw_an_exception( self): print "TEST IMPORT NON EXISTENT APP COMMANDS MODULE SHOULD THROW AN EXCEPTION" newDevice = AndroidDevice("samsung_galaxy_tab_3") self.assertRaises(ImportError, newDevice.start, "fake_app") pass '''
def setUpClass(self): super(Test, self).setUpClass() self.device = AndroidDevice("samsung_galaxy_tab_3") self.device.start("it.sky.river") appLoaded = StormTest.WaitColorMatch((207, 209, 207), tolerances=(16, 16, 16), flatness=90, peakError=50, includedAreas=[1000, 750, 10, 10], timeToWait=15) if not appLoaded: return False pass
def test_import_non_existent_app_commands_module_should_throw_an_exception( self): print "TEST IMPORT NON EXISTENT APP COMMANDS MODULE SHOULD THROW AN EXCEPTION" newDevice = AndroidDevice("samsung_galaxy_tab_3") self.assertRaises(ImportError, newDevice.start, "fake_app") pass
def setUpClass(self): super(Test, self).setUpClass() self.device = AndroidDevice("samsung_galaxy_tab_3") self.device.start("it.sky.river") appLoaded = StormTest.WaitColorMatch((207,209,207), tolerances=(16,16,16), flatness=90, peakError=50, includedAreas=[1000,750,10,10], timeToWait=15) if not appLoaded: return False pass
def setUp(self): self.device = AndroidDevice("samsung_galaxy_tab_3") pass
class TestConnection(unittest.TestCase): def setUp(self): self.device = AndroidDevice("samsung_galaxy_tab_3") pass def tearDown(self): TestEnvironment.setSlotNumber(1) self.device.disconnect() pass def test_connect_device_to_the_server_with_success(self): print "TEST_CONNECT_DEVICE_TO_THE_SERVER_WITH_SUCCESS" isConnected = self.device.connect("Connect with the real server") self.assertEqual(isConnected, True, "Device connection to the server failed") pass def test_connect_device_should_fail_when_name_is_wrong(self): print "TEST_CONNECT_DEVICE_SHOULD_FAIL_WHEN_NAME_IS_WRONG" TestEnvironment.setServerName("WrongServerName") isConnected = self.device.connect("Connect with non existing server") self.assertEqual(isConnected, False, "Connection successful") pass def test_reserve_slot_should_fail_when_server_name_is_wrong(self): print "TEST_RESERVE_SLOT_SHOULD_FAIL_WHEN_SERVER_NAME_IS_WRONG" TestEnvironment.setServerName("WrongServerName") isConnected = self.device.connect("Connect with non existing server") self.assertEqual(isConnected, False, "Connection successful") pass def test_reserve_slot_should_fail_when_slot_number_is_wrong(self): print "TEST_SLOT_SHOULD_FAIL_WHEN_SLOT_NUMBER_IS_WRONG" TestEnvironment.setSlotNumber(10) isConnected = self.device.connect("Connect with the real server") self.assertEquals(isConnected, False, "Correct slot number") pass def test_disconnect_device_to_the_server(self): print "TEST_DISCONNECT_DEVICE_TO_THE_SERVER" isDisconnected = self.device.disconnect() self.assertEqual(isDisconnected, True, "Device disconnection to the server failed") pass def test_start_application_by_name_should_be_successfull(self): print "TEST START APPLICATION BY NAME SHOULD BE SUCCESSFULL" self.device.connect("Connect with the real server") isStarted = self.device.start("it.sky.river") self.assertEqual(isStarted, True, "App not started") pass def test_stop_application(self): print "TEST STOP APPLICATION" self.device.connect("Connect with the real server") self.device.start("it.sky.river") isStopped = self.device.stop() self.assertEqual(isStopped, True, "App not stopped") pass
def setUpClass(self): super(Test, self).setUpClass() self.device = AndroidDevice("samsung_galaxy_tab_3") self.device.start("it.sky.river") StormTest.WaitSec(4) pass
class Test(unittest.TestCase): @classmethod def setUpClass(self): super(Test, self).setUpClass() self.device = AndroidDevice("samsung_galaxy_tab_3") self.device.start("it.sky.river") appLoaded = StormTest.WaitColorMatch((207, 209, 207), tolerances=(16, 16, 16), flatness=90, peakError=50, includedAreas=[1000, 750, 10, 10], timeToWait=15) if not appLoaded: return False pass @classmethod def tearDownClass(cls): super(Test, cls).tearDownClass() cls.device.stop() pass def test_tap_using_mapped_text(self): print "TEST TAP MAPPED TEXT" isOpenPressed = self.device.tap(mappedText='OpenMenu') colorMatch = StormTest.WaitColorMatch((66, 171, 159), tolerances=(16, 16, 16), flatness=90, peakError=50, includedAreas=[420, 300, 10, 10], timeToWait=10) isOpen = colorMatch[0][1] print "Open menu " + str(colorMatch) StormTest.WaitSec(1) isClosePressed = self.device.tap(mappedText='CloseMenu') colorNoMatch = StormTest.WaitColorNoMatch( (41, 100, 168), tolerances=(16, 16, 16), flatness=90, peakError=50, includedAreas=[400, 430, 10, 10], timeToWait=10) isClose = colorNoMatch[0][1] print "Close menu " + str(colorNoMatch) self.assertTrue(isOpenPressed, "Tap failed") self.assertTrue(isOpen, "Tap failed") self.assertTrue(isClosePressed, "Tap failed") self.assertTrue(isClose, "Tap failed") pass def test_tap_element_using_text(self): print "TEST TAP ELEMENT USING TEXT" self.device.tap(mappedText='OpenMenu') StormTest.WaitSec(4) isPressed = self.device.tap(text='Cinema') colorMatch = StormTest.WaitColorMatch((0, 0, 68), tolerances=(16, 16, 16), flatness=90, peakError=50, includedAreas=[600, 140, 10, 10], timeToWait=10) isCinema = colorMatch[0][1] print "Open cinema " + str(colorMatch) StormTest.WaitSec(1) self.device.tap(mappedText='Home') #colorNoMatch = StormTest.WaitColorNoMatch((0,0,68), tolerances=(16,16,16), flatness=90, peakError=50, includedAreas=[400,430,10,10], timeToWait=15) colorMatch = StormTest.WaitColorMatch( (40, 120, 178), tolerances=(16, 16, 16), flatness=90, peakError=50, includedAreas=[1000, 750, 10, 10], timeToWait=10) StormTest.CaptureImageEx((0, 0, 1920, 1080), "Screenshot") isHome = colorMatch[0][1] print "Return to Home " + str(colorMatch) #StormTest.WaitSec(6) self.assertTrue(isPressed, "Tap on Cinema failed") self.assertTrue(isCinema, "Tap on Cinema failed") pass def test_import_non_existent_device_commands_module_should_throw_an_exception( self): print "TEST IMPORT NON EXISTENT DEVICE COMMANDS MODULE SHOULD THROW AN EXCEPTION" self.assertRaises(ImportError, AndroidDevice, "samsung_galaxy_fake") pass def test_import_non_existent_app_commands_module_should_throw_an_exception( self): print "TEST IMPORT NON EXISTENT APP COMMANDS MODULE SHOULD THROW AN EXCEPTION" newDevice = AndroidDevice("samsung_galaxy_tab_3") self.assertRaises(ImportError, newDevice.start, "fake_app") pass @unittest.skip("demonstrating skipping") def test_swipe(self): print "TEST SWIPE" swipeDown = self.device.swipe([700, 700, 700, 200, 0]) swipeUp = self.device.swipe([700, 200, 700, 700, 0]) self.assertTrue(swipeDown, "Swipe failed") self.assertTrue(swipeUp, "Swipe failed") pass @unittest.skip("demonstrating skipping") def test_enter_email(self): print "TEST ENTER EMAIL" self.device.tap(mappedText='OpenMenu') self.device.tap(text='Indirizzo mail. Editing.') StormTest.WaitSec(2) isEmailEntered = self.device.enterText("*****@*****.**") self.device.tap(mappedText='OpenAssistantMenu') self.device.tap(mappedText='CloseAssistantMenu') self.device.tap(mappedText='CloseMenu') self.assertTrue(isEmailEntered, "Fail to enter text") pass '''
from mobile_framework.android_device import AndroidDevice import stormtest.ClientAPI as StormTest from assistance_menu import AssistanceMenu from network_functions import connectToTheNetwork, disconnectToTheNetwork from tests_sky_online import login, logout if __name__ == '__main__': galaxyTab3 = AndroidDevice("samsung_galaxy_tab_3") galaxyTab3.start('it.sky.river') assistanceMenu = AssistanceMenu() StormTest.WaitSec(3) connectToTheNetwork(galaxyTab3, assistanceMenu) login(galaxyTab3) logout(galaxyTab3) disconnectToTheNetwork(galaxyTab3, assistanceMenu) StormTest.WaitSec(1) galaxyTab3.stop() pass
import stormtest.ClientAPI as StormTest from mobile_framework.android_device import AndroidDevice from scenario import catalogAvailability, audioVideoScenarios from navigateFunctions import playVideo, stopVideo, closeApp from recharge_device import rechargeDevice from check_crash import checkCrash if __name__ == '__main__': results = [] galaxyTab3 = AndroidDevice("samsung_galaxy_tab_3") galaxyTab3.connect('Warning center') galaxyTab3.start('it.sky.river') StormTest.WaitSec(10) serviceInfo = galaxyTab3.getServiceInfo() result = catalogAvailability(galaxyTab3, serviceInfo) results.append(result) if results[0] and playVideo(galaxyTab3, serviceInfo): StormTest.WaitSec(20) result1, result2, result3 = audioVideoScenarios( galaxyTab3, serviceInfo) results.append(result1) results.append(result2) results.append(result3) stopVideo(galaxyTab3) rechargeDevice(galaxyTab3)
import stormtest.ClientAPI as StormTest from mobile_framework.android_device import AndroidDevice from scenario import catalogAvailability, audioVideoScenarios from navigateFunctions import playVideo, stopVideo, closeApp from recharge_device import rechargeDevice from check_crash import checkCrash if __name__ == '__main__': results= [] galaxyTab3 = AndroidDevice("samsung_galaxy_tab_3") galaxyTab3.connect('Warning center') galaxyTab3.start('it.sky.river') StormTest.WaitSec(10) serviceInfo = galaxyTab3.getServiceInfo() result = catalogAvailability(galaxyTab3, serviceInfo) results.append(result) if results[0] and playVideo(galaxyTab3, serviceInfo): StormTest.WaitSec(20) result1, result2, result3 = audioVideoScenarios(galaxyTab3, serviceInfo) results.append(result1) results.append(result2) results.append(result3) stopVideo(galaxyTab3)
class Test(unittest.TestCase): @classmethod def setUpClass(self): super(Test, self).setUpClass() self.device = AndroidDevice("samsung_galaxy_tab_3") self.device.start("it.sky.river") appLoaded = StormTest.WaitColorMatch((207,209,207), tolerances=(16,16,16), flatness=90, peakError=50, includedAreas=[1000,750,10,10], timeToWait=15) if not appLoaded: return False pass @classmethod def tearDownClass(cls): super(Test, cls).tearDownClass() cls.device.stop() pass def test_tap_using_mapped_text(self): print "TEST TAP MAPPED TEXT" isOpenPressed = self.device.tap(mappedText='OpenMenu') colorMatch = StormTest.WaitColorMatch((66,171,159), tolerances=(16,16,16), flatness=90, peakError=50, includedAreas=[420,300,10,10], timeToWait=10) isOpen = colorMatch[0][1] print "Open menu " + str(colorMatch) StormTest.WaitSec(1) isClosePressed = self.device.tap(mappedText='CloseMenu') colorNoMatch = StormTest.WaitColorNoMatch((41,100,168), tolerances=(16,16,16), flatness=90, peakError=50, includedAreas=[400,430,10,10], timeToWait=10) isClose = colorNoMatch[0][1] print "Close menu " + str(colorNoMatch) self.assertTrue(isOpenPressed, "Tap failed") self.assertTrue(isOpen, "Tap failed") self.assertTrue(isClosePressed, "Tap failed") self.assertTrue(isClose, "Tap failed") pass def test_tap_element_using_text(self): print "TEST TAP ELEMENT USING TEXT" self.device.tap(mappedText='OpenMenu') StormTest.WaitSec(4) isPressed = self.device.tap(text='Cinema') colorMatch = StormTest.WaitColorMatch((0,0,68), tolerances=(16,16,16), flatness=90, peakError=50, includedAreas=[600,140,10,10], timeToWait=10) isCinema = colorMatch[0][1] print "Open cinema " + str(colorMatch) StormTest.WaitSec(1) self.device.tap(mappedText='Home') #colorNoMatch = StormTest.WaitColorNoMatch((0,0,68), tolerances=(16,16,16), flatness=90, peakError=50, includedAreas=[400,430,10,10], timeToWait=15) colorMatch = StormTest.WaitColorMatch((40,120,178), tolerances=(16,16,16), flatness=90, peakError=50, includedAreas=[1000,750,10,10], timeToWait=10) StormTest.CaptureImageEx((0,0,1920,1080), "Screenshot") isHome = colorMatch[0][1] print "Return to Home " + str(colorMatch) #StormTest.WaitSec(6) self.assertTrue(isPressed, "Tap on Cinema failed") self.assertTrue(isCinema, "Tap on Cinema failed") pass def test_import_non_existent_device_commands_module_should_throw_an_exception(self): print "TEST IMPORT NON EXISTENT DEVICE COMMANDS MODULE SHOULD THROW AN EXCEPTION" self.assertRaises(ImportError, AndroidDevice, "samsung_galaxy_fake") pass def test_import_non_existent_app_commands_module_should_throw_an_exception(self): print "TEST IMPORT NON EXISTENT APP COMMANDS MODULE SHOULD THROW AN EXCEPTION" newDevice = AndroidDevice("samsung_galaxy_tab_3") self.assertRaises(ImportError, newDevice.start, "fake_app") pass @unittest.skip("demonstrating skipping") def test_swipe(self): print "TEST SWIPE" swipeDown = self.device.swipe([700, 700, 700, 200, 0]) swipeUp = self.device.swipe([700, 200, 700, 700, 0]) self.assertTrue(swipeDown, "Swipe failed") self.assertTrue(swipeUp, "Swipe failed") pass @unittest.skip("demonstrating skipping") def test_enter_email(self): print "TEST ENTER EMAIL" self.device.tap(mappedText='OpenMenu') self.device.tap(text='Indirizzo mail. Editing.') StormTest.WaitSec(2) isEmailEntered = self.device.enterText("*****@*****.**") self.device.tap(mappedText='OpenAssistantMenu') self.device.tap(mappedText='CloseAssistantMenu') self.device.tap(mappedText='CloseMenu') self.assertTrue(isEmailEntered, "Fail to enter text") pass '''