class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.settings = Settings(self) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.settings.launch() self.UTILS.test.test(self.UTILS.network.is_network_type_enabled("airplane") == False, "Airplane mode is disabled by default.") self.UTILS.reporting.logResult("info", "Turning airplane mode on ...") self.UTILS.test.test(True, "Getting airplane mode switch") x = self.UTILS.element.getElement(DOM.Settings.airplane_mode_switch, "Airplane mode switch") self.UTILS.test.test(True, "Airplane mode switch: {}".format(x)) time.sleep(5) x.tap() self.UTILS.network.wait_for_network_item_enabled("airplane") self.UTILS.test.test(self.UTILS.network.is_network_type_enabled("airplane") == True, "Airplane mode is now enabled.") self.UTILS.test.test(self.data_layer.get_setting('ril.radio.disabled') == True, "Radio functionality is now disabled.")
class test_main(GaiaTestCase): def __init__(self, *args, **kwargs): kwargs['restart'] = True super(test_main, self).__init__(*args, **kwargs) def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.settings = Settings(self) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Open the Settings application. self.settings.launch() # Tap hotspot. self.settings.hotspot() hotspot_settings = self.UTILS.element.getElement(DOM.Settings.hotspot_settings, "Hotspot settings") self.UTILS.test.test(hotspot_settings.is_enabled(), "Hotspot settings are enabled by default (<b>meaning that 'hotspot' is off</b>).")
class test_main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.settings = Settings(self) self.download_manager = DownloadManager(self) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.UTILS.statusbar.clearAllStatusBarNotifs() self.settings.launch() self.settings.downloads() edit_mode = self.UTILS.element.getElement(DOM.DownloadManager.download_edit_button, "Download edit button", True, 10) self.UTILS.test.TEST(edit_mode.get_attribute("class") == "disabled", "Edit mode button is disabled") edit_mode.tap() self.UTILS.element.waitForNotElements(DOM.DownloadManager.downloads_edit_header_title, "Edit downloads header")
class test_main(GaiaTestCase): def __init__(self, *args, **kwargs): kwargs['restart'] = True super(test_main, self).__init__(*args, **kwargs) def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.settings = Settings(self) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.UTILS.network.disableAllNetworkSettings() self.UTILS.test.test(self.UTILS.network.is_network_type_enabled("data") == False, "Data conn is disabled.") self.settings.launch() time.sleep(1) self.settings.cellular_and_data() data_switch = self.UTILS.element.getElement(DOM.Settings.celldata_DataConn_switch, "Data connection switch") data_switch.tap() # Wait for confirmation screen self.settings.confirm_data_conn() self.UTILS.network.wait_for_network_item_enabled("data") self.UTILS.test.test(self.UTILS.network.is_network_type_enabled("data") == True, "Data conn is now enabled.")
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.settings = Settings(self) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.settings.launch() self.UTILS.test.test( self.UTILS.network.is_network_type_enabled("airplane") == False, "Airplane mode is disabled by default.") self.UTILS.reporting.logResult("info", "Turning airplane mode on ...") self.UTILS.test.test(True, "Getting airplane mode switch") x = self.UTILS.element.getElement(DOM.Settings.airplane_mode_switch, "Airplane mode switch") self.UTILS.test.test(True, "Airplane mode switch: {}".format(x)) time.sleep(5) x.tap() self.UTILS.network.wait_for_network_item_enabled("airplane") self.UTILS.test.test( self.UTILS.network.is_network_type_enabled("airplane") == True, "Airplane mode is now enabled.") self.UTILS.test.test( self.data_layer.get_setting('ril.radio.disabled') == True, "Radio functionality is now disabled.")
class test_main(GaiaTestCase): def __init__(self, *args, **kwargs): kwargs['restart'] = True super(test_main, self).__init__(*args, **kwargs) def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.settings = Settings(self) self.wifi_name = self.UTILS.general.get_config_variable("ssid", "wifi") self.wifi_pass = self.UTILS.general.get_config_variable("password", "wifi") def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.settings.launch() time.sleep(1) self.settings.wifi() self.settings.connect_to_wifi(self.wifi_name, self.wifi_pass) self.UTILS.test.test(self.UTILS.network.is_network_type_enabled("wifi") == True, "Wifi mode is now enabled.")
class main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.loop = Loop(self) self.settings = Settings(self) self.fxa_user = self.UTILS.general.get_config_variable("fxa_user", "common") self.fxa_pass = self.UTILS.general.get_config_variable("fxa_pass", "common") self.connect_to_network() # Update loop self.loop.update_and_publish() self.loop.initial_test_checks() self.settings.launch() self.settings.fxa() self.settings.fxa_log_out() self.apps.kill_all() time.sleep(2) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.loop.launch() result = self.loop.wizard_or_login() if result: self.loop.firefox_login(self.fxa_user, self.fxa_pass) self.loop.allow_permission_ffox_login() self.UTILS.element.waitForElements(DOM.Loop.app_header, "Loop main view")
class main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.loop = Loop(self) self.settings = Settings(self) self.connect_to_network() self.loop.initial_test_checks() self.settings.launch() self.settings.fxa() self.settings.fxa_log_out() self.apps.kill_all() time.sleep(2) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.loop.launch() result = self.loop.wizard_or_login() if result: self.loop.phone_login() self.loop.allow_permission_phone_login() self.UTILS.element.waitForElements(DOM.Loop.app_header, "Loop main view")
class test_main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.settings = Settings(self) self.download_manager = DownloadManager(self) _ = setup_translations(self) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.UTILS.statusbar.clearAllStatusBarNotifs() self.settings.launch() self.settings.downloads() self.download_manager.clean_downloads_list() # Verify no downloads are present no_downloads = self.UTILS.element.getElement( DOM.DownloadManager.download_empty_list_content, "Getting empty list content") self.UTILS.test.test( no_downloads.text == _("No downloads"), "Verifying '{}' message is displayed".format(_("No downloads")))
class test_main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.settings = Settings(self) self.download_manager = DownloadManager(self) _ = setup_translations(self) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.UTILS.statusbar.clearAllStatusBarNotifs() self.settings.launch() self.settings.downloads() self.download_manager.clean_downloads_list() # Verify no downloads are present no_downloads = self.UTILS.element.getElement( DOM.DownloadManager.download_empty_list_content, "Getting empty list content") self.UTILS.test.test(no_downloads.text == _("No downloads"), "Verifying '{}' message is displayed".format(_("No downloads")))
class test_main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.settings = Settings(self) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.settings.launch() self.settings.wifi() self.settings.wifi_switch_on() available_networks = self.UTILS.element.getElements( DOM.Settings.wifi_available_networks, "Available networks", False) self.UTILS.reporting.logResult("info", "Found {} networks".format(len(available_networks))) for network in available_networks: network_name = network.find_element(*("css selector", "span")).text try: network.find_element(*("css selector", "aside.secured")) network.find_element(*("css selector", "small[data-l10n-id='securedBy']")) self.UTILS.reporting.logResult('info', "Network [{}] is secured".format(network_name)) except: self.UTILS.reporting.logResult('info', "Network [{}] is NOT secured".format(network_name))
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) self.gallery = Gallery(self) self.settings = Settings(self) self.test_msg = "Hello World" # Establish which phone number to use. self.phone_number = self.UTILS.general.get_config_variable("phone_number", "custom") self.UTILS.reporting.logComment("Sending mms to telephone number " + self.phone_number) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Configure Auto Retrieve as "on_with_r = On with roaming option" from messaging settings self.settings.launch() self.settings.configure_mms_auto_retrieve("on_with_r") self.messages.create_and_send_mms("image", [self.phone_number], self.test_msg) self.messages.wait_for_message() # Verify that the MMS has been received. self.messages.verify_mms_received("img", self.phone_number)
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.settings = Settings(self) self.browser = Browser(self) self.wifi_name = self.UTILS.general.get_config_variable("ssid", "wifi") self.wifi_pass = self.UTILS.general.get_config_variable("password", "wifi") self.testURL = self.UTILS.general.get_config_variable("test_url", "common") self.apps.set_permission_by_url(Browser.search_manifest_url, 'geolocation', 'deny') # switch off keyboard FTU screen self.data_layer.set_setting("keyboard.ftu.enabled", False) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Open the settings application. self.settings.launch() # Connect to the wifi. self.settings.wifi() self.settings.connect_to_wifi(self.wifi_name, self.wifi_pass) # Open the browser app. self.browser.launch() # Open our URL. self.browser.open_url(self.testURL)
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.messages = Messages(self) self.gallery = Gallery(self) self.settings = Settings(self) self.test_msg = "Hello World" # Establish which phone number to use. self.phone_number = self.UTILS.general.get_config_variable( "phone_number", "custom") self.UTILS.reporting.logComment("Sending mms to telephone number " + self.phone_number) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Configure Auto Retrieve as "on_with_r = On with roaming option" from messaging settings self.settings.launch() self.settings.configure_mms_auto_retrieve("on_with_r") self.messages.create_and_send_mms("image", [self.phone_number], self.test_msg) self.messages.wait_for_message() # Verify that the MMS has been received. self.messages.verify_mms_received("img", self.phone_number)
class test_main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.settings = Settings(self) _ = setup_translations(self) # Make sure bluetooth is not enabled before the tests starts self.data_layer.bluetooth_disable() self.wait_for_condition(lambda m: not self.data_layer.bluetooth_is_enabled, timeout=20, message="Bluetooth disabled") def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.UTILS.statusbar.toggleViaStatusBar("bluetooth") self.marionette.switch_to_frame() self.UTILS.element.waitForElements(DOM.Statusbar.bluetooth, "Bluetooth icon in statusbar", True, 20, False) # Open settings and check bluetooth is on. self.settings.launch() bluetooth = self.UTILS.element.getElement(DOM.Settings.bluetooth, "Bluetooth") self.UTILS.element.scroll_into_view(bluetooth) time.sleep(3) bluetooth_description = self.UTILS.element.getElement(DOM.Settings.bluetooth_desc, "Bluetooth description") self.UTILS.test.test(bluetooth_description.text == _("No devices paired"), "Bluetooth is marked as turned on.") self.UTILS.statusbar.toggleViaStatusBar("bluetooth") self.marionette.switch_to_frame() self.UTILS.element.waitForNotElements(DOM.Statusbar.bluetooth, "Bluetooth icon in statusbar")
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.settings = Settings(self) self.Browser = Browser(self) self.wifi_name = self.UTILS.general.get_config_variable("ssid", "wifi") self.wifi_pass = self.UTILS.general.get_config_variable("password", "wifi") def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.settings.launch() self.settings.wifi() self.settings.connect_to_wifi(self.wifi_name, self.wifi_pass) network = {'ssid': self.wifi_name} self.wait_for_condition(lambda m: self.data_layer.is_wifi_connected(network), timeout=30) self.UTILS.iframe.switchToFrame(*DOM.Settings.frame_locator) self.settings.wifi_list_tap_name(self.wifi_name) self.settings.wifi_forget() self.wait_for_condition(lambda m: not self.data_layer.is_wifi_connected(network), timeout=30) # make sure we need to add the details again. self.UTILS.iframe.switchToFrame(*DOM.Settings.frame_locator) self.settings.wifi_list_tap_name(self.wifi_name) time.sleep(1) self.UTILS.element.waitForElements(DOM.Settings.wifi_login_pass, "Password field")
class test_main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.browser = Browser(self) self.settings = Settings(self) self.download_manager = DownloadManager(self) self.video = Video(self) self.test_url = self.UTILS.general.get_config_variable("download_url", "common") self.file_name = "clipcanvas_14348_H264_320x180.mp4" self.data_url = "{}/{}".format(self.test_url, self.file_name) self.connect_to_network() self.settings.launch() self.settings.downloads() self.download_manager.clean_downloads_list() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.UTILS.statusbar.clearAllStatusBarNotifs() self.browser.launch() self.browser.open_url(self.test_url) self.download_manager.download_file(self.file_name) self.UTILS.statusbar.wait_for_notification_toaster_title("Download complete", timeout=120)
class test_main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.browser = Browser(self) self.settings = Settings(self) self.download_manager = DownloadManager(self) self.test_url = self.UTILS.general.get_config_variable("download_url", "common") self.file_name = "11MB.rar" self.data_url = "{}/{}".format(self.test_url, self.file_name) # make the download process slower self.data_layer.connect_to_cell_data() self.settings.launch() self.settings.downloads() self.download_manager.clean_downloads_list() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.UTILS.statusbar.clearAllStatusBarNotifs() self.browser.launch() self.browser.open_url(self.test_url) self.download_manager.download_file(self.file_name) self.UTILS.statusbar.wait_for_notification_toaster_title( text="Download started", notif_text="Downloading", timeout=15) is_there = self.UTILS.statusbar.isIconInStatusBar(DOM.Statusbar.downloads) self.UTILS.test.test(is_there, "Verify that the download icon in status bar is active")
class test_main(GaiaTestCase): def __init__(self, *args, **kwargs): kwargs['restart'] = True super(test_main, self).__init__(*args, **kwargs) def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.settings = Settings(self) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Open the Settings application. self.settings.launch() # Tap hotspot. self.settings.hotspot() hotspot_settings = self.UTILS.element.getElement( DOM.Settings.hotspot_settings, "Hotspot settings") self.UTILS.test.test( hotspot_settings.is_enabled(), "Hotspot settings are enabled by default (<b>meaning that 'hotspot' is off</b>)." )
class main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.loop = Loop(self) self.settings = Settings(self) self.test_contact = MockContact() self.fxa_user = self.UTILS.general.get_config_variable( "fxa_user", "common") self.fxa_pass = self.UTILS.general.get_config_variable( "fxa_pass", "common") self.connect_to_network() self.UTILS.general.insertContact(self.test_contact) # Clean start if not self.loop.is_installed(): self.loop.install() else: self.loop.launch() # If already logged in, logout if not self.loop.wizard_or_login(): self.loop.open_settings() self.loop.logout() self.settings.launch() self.settings.fxa() self.settings.fxa_log_out() self.apps.kill_all() time.sleep(2) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # First, login self.loop.launch() result = self.loop.wizard_or_login() if result: self.loop.firefox_login(self.fxa_user, self.fxa_pass) self.loop.allow_permission_ffox_login() self.UTILS.element.waitForElements(DOM.Loop.app_header, "Loop main view") self.loop.open_address_book() elem = (DOM.Contacts.view_all_contact_specific_contact[0], DOM.Contacts.view_all_contact_specific_contact[1].format( self.test_contact["givenName"])) entry = self.UTILS.element.getElement(elem, "Contact in address book") entry.tap() self.UTILS.iframe.switch_to_active_frame() elem = (DOM.Loop.call_screen_contact_details[0], DOM.Loop.call_screen_contact_details[1].format( self.test_contact["name"])) self.UTILS.element.waitForElements( elem, "Call to contact: {}".format(self.test_contact["name"]))
class test_main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.browser = Browser(self) self.settings = Settings(self) self.wifi_name = self.UTILS.general.get_config_variable("ssid", "wifi") self.wifi_pass = self.UTILS.general.get_config_variable("password", "wifi") self.data_layer.connect_to_wifi() self.data_layer.is_wifi_connected() self.apps.kill_all() self.url = "https://acperez.github.io/gecko-sw-test/" self.sw_scope = "https://acperez.github.io/gecko-sw-test/" self.sw_header = "https://acperez.github.io!appId=22&inBrowser=1" self.script_spec = "https://acperez.github.io/gecko-sw-test/service-worker.js" def tearDown(self): self.data_layer.disable_wifi() self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.browser.launch() self.browser.open_url(self.url) register_btn = self.UTILS.element.getElement(dom.acperez_register_btn_dom, "Register Worker button") register_btn.tap() self.settings.launch() time.sleep(2) self.settings.developer_settings() time.sleep(2) self.settings.service_workers_menu() div_dom = (DOM.Settings.service_worker_div[0], DOM.Settings.service_worker_div[1].format(self.sw_scope)) div_elem = self.UTILS.element.getElement(div_dom, "Service worker div") self.UTILS.element.scroll_into_view(div_elem) header = div_elem.find_element(*DOM.Settings.service_worker_header) self.UTILS.test.test(header.text == self.sw_header, "Header found [{}] Expected [{}]". format(header.text, self.sw_header)) scope = div_elem.find_element(*DOM.Settings.service_worker_scope) self.UTILS.test.test(self.sw_scope == scope.text, "Scope found [{}] Expected [{}]". format(scope.text, self.sw_scope)) script_spec = div_elem.find_element(*DOM.Settings.service_worker_script_spec) self.UTILS.test.test(self.script_spec == script_spec.text, "Script spec found [{}] Expected [{}]". format(script_spec.text, self.script_spec)) worker_url = div_elem.find_element(*DOM.Settings.service_worker_current_url) self.UTILS.test.test(self.script_spec == worker_url.text, "URL found [{}] Expected [{}]". format(worker_url.text, self.script_spec)) unregister_btn = div_elem.find_element(*DOM.Settings.service_worker_unregister_btn) unregister_btn.tap()
class main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.loop = Loop(self) self.settings = Settings(self) self.fxa_user_1 = self.UTILS.general.get_config_variable( "fxa_user", "common") self.fxa_pass_1 = self.UTILS.general.get_config_variable( "fxa_pass", "common") self.connect_to_network() self.loop.initial_test_checks() self.settings.launch() self.settings.fxa() if self.settings.is_fxa_logged_in(): self.settings.fxa_log_out() self.settings.fxa_log_in(self.fxa_user_1, self.fxa_pass_1) self.apps.kill_all() time.sleep(2) # First, login with the first fxa self.loop.launch() result = self.loop.wizard_or_login() if result: self.loop.tap_on_firefox_login_button() self.UTILS.element.waitForElements(DOM.Loop.app_header, "Loop main view") self.loop.open_settings() self.loop.logout() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Now logout of FxA via settings self.settings.launch() self.settings.fxa() self.settings.fxa_log_out() self.apps.kill_all() time.sleep(2) # And try to login in Loop self.loop.launch() result = self.loop.wizard_or_login() if result: self.loop.tap_on_firefox_login_button() self.UTILS.iframe.switchToFrame( *DOM.Loop.ffox_account_frame_locator) self.UTILS.element.waitForElements( DOM.Loop.ffox_account_login_title, "Firefox Accounts login")
class test_main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.browser = Browser(self) self.settings = Settings(self) self.wifi_name = self.UTILS.general.get_config_variable("ssid", "wifi") self.wifi_pass = self.UTILS.general.get_config_variable("password", "wifi") self.data_layer.connect_to_wifi() self.data_layer.is_wifi_connected() self.apps.kill_all() self.url = "http://jaoo.github.io/service-worker-testing/index.html" self.sw_scope = "http://jaoo.es/service-worker-testing/" self.sw_header = "http://jaoo.es!appId=22&inBrowser=1" self.script_spec = "http://jaoo.es/service-worker-testing/service.js" def tearDown(self): self.data_layer.disable_wifi() self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.browser.launch() self.browser.open_url(self.url) register_btn = self.UTILS.element.getElement(dom.register_btn_dom, "Register Worker button") register_btn.tap() self.settings.launch() time.sleep(2) self.settings.developer_settings() time.sleep(2) self.settings.service_workers_menu() div_dom = (DOM.Settings.service_worker_div[0], DOM.Settings.service_worker_div[1].format(self.sw_scope)) div_elem = self.UTILS.element.getElement(div_dom, "Service worker div") self.UTILS.element.scroll_into_view(div_elem) header = div_elem.find_element(*DOM.Settings.service_worker_header) self.UTILS.test.test(header.text == self.sw_header, "Header found [{}] Expected [{}]". format(header.text, self.sw_header)) scope = div_elem.find_element(*DOM.Settings.service_worker_scope) self.UTILS.test.test(self.sw_scope == scope.text, "Scope found [{}] Expected [{}]". format(scope.text, self.sw_scope)) script_spec = div_elem.find_element(*DOM.Settings.service_worker_script_spec) self.UTILS.test.test(self.script_spec == script_spec.text, "Script spec found [{}] Expected [{}]". format(script_spec.text, self.script_spec)) worker_url = div_elem.find_element(*DOM.Settings.service_worker_current_url) self.UTILS.test.test(self.script_spec == worker_url.text, "URL found [{}] Expected [{}]". format(worker_url.text, self.script_spec)) unregister_btn = div_elem.find_element(*DOM.Settings.service_worker_unregister_btn) unregister_btn.tap()
class main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.loop = Loop(self) self.settings = Settings(self) self.test_contact = MockContact() self.UTILS.general.insertContact(self.test_contact) self.fxa_user = self.UTILS.general.get_config_variable("fxa_user", "common") self.fxa_pass = self.UTILS.general.get_config_variable("fxa_pass", "common") _ = setup_translations(self) self.expected_message = _("No problem! Just share the following link and they can call you back from" " any browser.") self.connect_to_network() self.loop.initial_test_checks() self.settings.launch() self.settings.fxa() self.settings.fxa_log_out() self.apps.kill_all() time.sleep(2) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # First, login self.loop.launch() result = self.loop.wizard_or_login() if result: self.loop.firefox_login(self.fxa_user, self.fxa_pass) self.loop.allow_permission_ffox_login() self.UTILS.element.waitForElements(DOM.Loop.app_header, "Loop main view") self.loop.open_address_book() elem = (DOM.Contacts.view_all_contact_specific_contact[ 0], DOM.Contacts.view_all_contact_specific_contact[1].format(self.test_contact["givenName"])) entry = self.UTILS.element.getElement(elem, "Contact in address book") entry.tap() self.UTILS.iframe.switch_to_active_frame() elem = (DOM.Loop.call_screen_contact_details[ 0], DOM.Loop.call_screen_contact_details[1].format(self.test_contact["name"])) self.UTILS.element.waitForElements(elem, "Call to contact: {}".format(self.test_contact["name"])) time.sleep(5) self.apps.switch_to_displayed_app() self.UTILS.element.waitForElements(DOM.Loop.share_panel, "Share panel") not_a_user_explanation = self.marionette.find_element(*DOM.Loop.not_a_user_explanation) self.UTILS.test.test(not_a_user_explanation.text == self.expected_message, "Message found: {} (Expected: {}".\ format(not_a_user_explanation.text, self.expected_message))
class main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.loop = Loop(self) self.settings = Settings(self) self.scenario = "scenarios/urls/single/revoked/idb" self.aux_files_dir = self.UTILS.general.get_config_variable("aux_files", "loop") self.fxa_user = self.UTILS.general.get_config_variable("fxa_user", "common") self.fxa_pass = self.UTILS.general.get_config_variable("fxa_pass", "common") self.connect_to_network() # Insert our test contacts number_of_contacts = 3 contact_given = "Test" contact_family = map(str, range(1, number_of_contacts + 1)) contact_name = ["{} {}".format(contact_given, contact_family[i]) for i in range(number_of_contacts)] contact_numbers = ["666666666666", "777777777777", "888888888888"] test_contacts = [MockContact(name=contact_name[i], givenName=contact_given, familyName=contact_family[i], tel={'type': 'Mobile', 'value': contact_numbers[i]}) for i in range(number_of_contacts)] map(self.UTILS.general.insertContact, test_contacts) self.loop.initial_test_checks() # Make sure we're not logged in FxA self.settings.launch() self.settings.fxa() self.settings.fxa_log_out() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.loop.launch() # This needs to be done at this point, bcs if the app is freshly installed the persistence # directories are not in its place until the app is launched for the first time self.loop.update_db("{}/{}".format(self.aux_files_dir, self.scenario)) result = self.loop.wizard_or_login() if result: self.loop.firefox_login(self.fxa_user, self.fxa_pass) self.loop.allow_permission_ffox_login() self.UTILS.element.waitForElements(DOM.Loop.app_header, "Loop main view") self.loop.switch_to_urls() self.loop.open_settings() self.loop.delete_just_revoked(cancel=False) self.UTILS.element.waitForElements(DOM.Loop.call_log, "Check we are returned to the call log") current = self.loop.get_number_of_revoked_urls() self.UTILS.test.test(current == 0, "Check that after deleting the URL, we have one less")
class main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.loop = Loop(self) self.settings = Settings(self) self.fxa_user = self.UTILS.general.get_config_variable("fxa_user", "common") self.fxa_pass = self.UTILS.general.get_config_variable("fxa_pass", "common") self.fxa_user2 = self.UTILS.general.get_config_variable("fxa_user2", "common") self.fxa_pass2 = self.UTILS.general.get_config_variable("fxa_pass2", "common") self.connect_to_network() self.loop.initial_test_checks() self.logout_fxa() self.apps.kill_all() time.sleep(2) def tearDown(self): self.logout_fxa() self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # First, login self.loop.launch() result = self.loop.wizard_or_login() if result: self.loop.firefox_login(self.fxa_user2, self.fxa_pass2) self.loop.allow_permission_ffox_login() self.UTILS.element.waitForElements(DOM.Loop.app_header, "Loop main view") time.sleep(5) self.loop.open_settings() self.loop.logout() self.logout_fxa() self.apps.kill_all() time.sleep(2) self.loop.launch() result = self.loop.wizard_or_login() if result: self.loop.firefox_login(self.fxa_user, self.fxa_pass) self.UTILS.iframe.switch_to_frame(*DOM.Loop.frame_locator) self.loop.open_settings() login_info_elem = self.UTILS.element.getElement(DOM.Loop.settings_logged_as, "Login info") login_info = login_info_elem.text.split("\n")[-1] self.UTILS.test.test(login_info == self.fxa_user, "Login info matches [FxA]") def logout_fxa(self): self.settings.launch() self.settings.fxa() self.settings.fxa_log_out()
class main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.loop = Loop(self) self.contacts = Contacts(self) self.settings = Settings(self) self.test_contact = MockContact(givenName="QA", familyName="Automation") self.fxa_user = self.UTILS.general.get_config_variable("fxa_user", "common") self.fxa_pass = self.UTILS.general.get_config_variable("fxa_pass", "common") _ = setup_translations(self) self.expected_msg = _("This contact does not have either a phone number or an email address.") self.contacts.launch() self.contacts.start_create_new_contact() cont_fields = self.contacts.get_contact_fields() self.contacts.replace_str(cont_fields['givenName'], self.test_contact['givenName']) self.contacts.replace_str(cont_fields['familyName'], self.test_contact['familyName']) done_button = self.UTILS.element.getElement(DOM.Contacts.done_button, "'Done' button") done_button.tap() self.connect_to_network() self.loop.initial_test_checks() self.settings.launch() self.settings.fxa() self.settings.fxa_log_out() self.apps.kill_all() time.sleep(2) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # First, login self.loop.launch() result = self.loop.wizard_or_login() if result: self.loop.firefox_login(self.fxa_user, self.fxa_pass) self.loop.allow_permission_ffox_login() self.UTILS.element.waitForElements(DOM.Loop.app_header, "Loop main view") self.loop.open_address_book() elem = (DOM.Contacts.view_all_contact_specific_contact[ 0], DOM.Contacts.view_all_contact_specific_contact[1].format(self.test_contact["givenName"])) entry = self.UTILS.element.getElement(elem, "Contact in address book") entry.tap() time.sleep(5) self.marionette.switch_to_frame() title = self.UTILS.element.getElement(DOM.GLOBAL.modal_dialog_alert_title, "Error title") msg = self.UTILS.element.getElement(DOM.GLOBAL.modal_dialog_alert_msg, "Error message") self.UTILS.test.test(title.text == "Firefox Hello", "Error title matches") self.UTILS.test.test(msg.text == self.expected_msg, "Error message matches")
class test_main(GaiaTestCase): button_locator = ('css selector', "button.icon") def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.browser = Browser(self) self.settings = Settings(self) self.download_manager = DownloadManager(self) self.test_url = self.UTILS.general.get_config_variable("download_url", "common") self.file_name = "clipcanvas_14348_H264_320x180.mp4" self.data_url = "{}/{}".format(self.test_url, self.file_name) self.connect_to_network() self.settings.launch() self.settings.downloads() self.download_manager.clean_downloads_list() self.apps.kill_all() time.sleep(2) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.UTILS.statusbar.clearAllStatusBarNotifs() self.browser.launch() self.browser.open_url(self.test_url) self.download_manager.download_file(self.file_name) self.UTILS.statusbar.wait_for_notification_toaster_title("Download complete", timeout=60) time.sleep(3) self.settings.launch() self.settings.downloads() self.download_manager.open_download(self.data_url) share_option = self.UTILS.element.getElement(DOM.DownloadManager.download_file_option_share, "Getting Share option button") share_option.tap() self.marionette.switch_to_frame() share_menu = self.UTILS.element.getElement(DOM.GLOBAL.action_menu, "Share menu") options = share_menu.find_elements(*self.button_locator) self.UTILS.test.test(len(options) > 0, "A list with several options to share is shown") self._show_option(options) def _show_option(self, options): for option in options: self.UTILS.reporting.logResult('info', "Share option: {}".format(option.text))
class main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.loop = Loop(self) self.settings = Settings(self) self.fxa_user = self.UTILS.general.get_config_variable( "fxa_user", "common") self.fxa_pass = self.UTILS.general.get_config_variable( "fxa_pass", "common") self.connect_to_network() self.loop.initial_test_checks() self.logout_fxa() self.apps.kill_all() time.sleep(2) def tearDown(self): self.logout_fxa() self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # First, login self.loop.launch() result = self.loop.wizard_or_login() if result: self.loop.phone_login() self.loop.allow_permission_phone_login() self.UTILS.element.waitForElements(DOM.Loop.app_header, "Loop main view") time.sleep(5) self.loop.open_settings() self.loop.logout() self.loop.launch() result = self.loop.wizard_or_login() if result: self.loop.firefox_login(self.fxa_user, self.fxa_pass) self.UTILS.iframe.switch_to_frame(*DOM.Loop.frame_locator) self.loop.open_settings() login_info_elem = self.UTILS.element.getElement( DOM.Loop.settings_logged_as, "Login info") login_info = login_info_elem.text.split("\n")[-1] self.UTILS.test.test(login_info == self.fxa_user, "Login info matches [FxA]") def logout_fxa(self): self.settings.launch() self.settings.fxa() self.settings.fxa_log_out()
class main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.loop = Loop(self) self.settings = Settings(self) self.test_contact = MockContact() self.UTILS.general.insertContact(self.test_contact) self.fxa_user = self.UTILS.general.get_config_variable( "fxa_user", "common") self.fxa_pass = self.UTILS.general.get_config_variable( "fxa_pass", "common") self.connect_to_network() self.loop.initial_test_checks() self.settings.launch() self.settings.fxa() self.settings.fxa_log_out() self.apps.kill_all() time.sleep(2) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # First, login self.loop.launch() result = self.loop.wizard_or_login() if result: self.loop.firefox_login(self.fxa_user, self.fxa_pass) self.loop.allow_permission_ffox_login() self.UTILS.element.waitForElements(DOM.Loop.app_header, "Loop main view") self.loop.open_settings() self.loop.change_call_mode("Video") self.loop.settings_go_back() self.loop.open_address_book() elem = (DOM.Contacts.view_all_contact_specific_contact[0], DOM.Contacts.view_all_contact_specific_contact[1].format( self.test_contact["givenName"])) entry = self.UTILS.element.getElement(elem, "Contact in address book") entry.tap() self.UTILS.iframe.switch_to_active_frame() video_mode = self.UTILS.element.getElement( DOM.Loop.call_screen_video_mode, "Video") self.UTILS.test.test( not "setting-disabled" in video_mode.get_attribute("class"), "Video is disabled when call mode is set to 'Audio'")
class main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.loop = Loop(self) self.settings = Settings(self) self.fxa_user_1 = self.UTILS.general.get_config_variable("fxa_user", "common") self.fxa_pass_1 = self.UTILS.general.get_config_variable("fxa_pass", "common") self.connect_to_network() self.loop.initial_test_checks() self.settings.launch() self.settings.fxa() if self.settings.is_fxa_logged_in(): self.settings.fxa_log_out() self.settings.fxa_log_in(self.fxa_user_1, self.fxa_pass_1) self.apps.kill_all() time.sleep(2) # First, login with the first fxa self.loop.launch() result = self.loop.wizard_or_login() if result: self.loop.tap_on_firefox_login_button() self.UTILS.element.waitForElements(DOM.Loop.app_header, "Loop main view") self.loop.open_settings() self.loop.logout() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Now logout of FxA via settings self.settings.launch() self.settings.fxa() self.settings.fxa_log_out() self.apps.kill_all() time.sleep(2) # And try to login in Loop self.loop.launch() result = self.loop.wizard_or_login() if result: self.loop.tap_on_firefox_login_button() self.UTILS.iframe.switchToFrame(*DOM.Loop.ffox_account_frame_locator) self.UTILS.element.waitForElements(DOM.Loop.ffox_account_login_title, "Firefox Accounts login")
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.settings = Settings(self) self.Browser = Browser(self) self.wifi_name = self.UTILS.general.get_config_variable("ssid", "wifi") self.wifi_pass = self.UTILS.general.get_config_variable( "password", "wifi") def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # Open the Settings application. self.settings.launch() time.sleep(2) self.settings.wifi() self.settings.connect_to_wifi(self.wifi_name, self.wifi_pass) network = {'ssid': self.wifi_name} self.wait_for_condition( lambda m: self.data_layer.is_wifi_connected(network), timeout=30) """ Return to this wifi and check the details, giving some seconds for the device to get an IP address """ time.sleep(10) self.UTILS.iframe.switchToFrame(*DOM.Settings.frame_locator) self.settings.wifi_list_tap_name(self.wifi_name) self.UTILS.element.waitForElements(DOM.Settings.wifi_details_header, "Wifi Details header") _forget = self.UTILS.element.getElement( DOM.Settings.wifi_details_forget_btn, "Details for connected wifi - forget button") _ip = self.UTILS.element.getElement( DOM.Settings.wifi_details_ipaddress, "Details for connected wifi - ip address") _link = self.UTILS.element.getElement( DOM.Settings.wifi_details_linkspeed, "Details for connected wifi - link speed") _sec = self.UTILS.element.getElement( DOM.Settings.wifi_details_security, "Details for connected wifi - security") _signal = self.UTILS.element.getElement( DOM.Settings.wifi_details_signal, "Details for connected wifi - signal") screenshot = self.UTILS.debug.screenShotOnErr() self.UTILS.reporting.logResult("info", "Screenshot: ", screenshot)
class main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.loop = Loop(self) self.contacts = Contacts(self) self.settings = Settings(self) self.fxa_user = self.UTILS.general.get_config_variable( "fxa_user", "common") self.fxa_pass = self.UTILS.general.get_config_variable( "fxa_pass", "common") self.connect_to_network() self.target_name = "QA" self.test_contacts = [MockContact() for i in range(5)] self.test_contacts[0]["givenName"] = self.target_name self.test_contacts[0]["familyName"] = "Automation" map(self.UTILS.general.insertContact, self.test_contacts) # Clean start if not self.loop.is_installed(): self.loop.install() else: self.loop.launch() # If already logged in, logout if not self.loop.wizard_or_login(): self.loop.open_settings() self.loop.logout() self.settings.launch() self.settings.fxa() self.settings.fxa_log_out() self.apps.kill_all() time.sleep(2) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # First, login self.loop.launch() result = self.loop.wizard_or_login() if result: self.loop.firefox_login(self.fxa_user, self.fxa_pass) self.loop.allow_permission_ffox_login() self.UTILS.element.waitForElements(DOM.Loop.app_header, "Loop main view") self.loop.open_address_book() self.contacts.search(self.target_name) self.contacts.check_search_results(self.target_name)
class test_main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.browser = Browser(self) self.settings = Settings(self) self.download_manager = DownloadManager(self) self.test_url = self.UTILS.general.get_config_variable( "download_url", "common") self.file_name = "1GB.rar" self.data_url = "{}/{}".format(self.test_url, self.file_name) # make the download process slower self.data_layer.connect_to_cell_data() self.settings.launch() self.settings.downloads() self.download_manager.clean_downloads_list() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.UTILS.statusbar.clearAllStatusBarNotifs() self.browser.launch() self.browser.open_url(self.test_url) self.download_manager.download_file(self.file_name) self.UTILS.statusbar.wait_for_notification_toaster_title( text="Download started", notif_text="Downloading", timeout=15) time.sleep(5) self.apps.kill_all() time.sleep(2) self.settings.launch() self.settings.downloads() # Verify status downloading using data-state="downloading". self.download_manager.verify_download_status(self.data_url, "downloading") download_info = self.download_manager.get_download_info(self.data_url) match = re.search( r"(\d)+(.(\d)+)*\s(GB|MB|KB)\sof\s(\d)+(.(\d)+)*\sGB$", download_info.text) self.UTILS.test.test(match is not None, "Verify the the text is: 'X' GB of 'Y' GB") time.sleep(3) self.download_manager.stop_download(self.data_url, True)
class main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.loop = Loop(self) self.contacts = Contacts(self) self.settings = Settings(self) self.fxa_user = self.UTILS.general.get_config_variable("fxa_user", "common") self.fxa_pass = self.UTILS.general.get_config_variable("fxa_pass", "common") self.connect_to_network() self.target_name = "QA" self.test_contacts = [MockContact() for i in range(5)] self.test_contacts[0]["givenName"] = self.target_name self.test_contacts[0]["familyName"] = "Automation" map(self.UTILS.general.insertContact, self.test_contacts) # Clean start if not self.loop.is_installed(): self.loop.install() else: self.loop.launch() # If already logged in, logout if not self.loop.wizard_or_login(): self.loop.open_settings() self.loop.logout() self.settings.launch() self.settings.fxa() self.settings.fxa_log_out() self.apps.kill_all() time.sleep(2) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # First, login self.loop.launch() result = self.loop.wizard_or_login() if result: self.loop.firefox_login(self.fxa_user, self.fxa_pass) self.loop.allow_permission_ffox_login() self.UTILS.element.waitForElements(DOM.Loop.app_header, "Loop main view") self.loop.open_address_book() self.contacts.search(self.target_name) self.contacts.check_search_results(self.target_name)
class main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.loop = Loop(self) self.settings = Settings(self) self.test_contact = MockContact() self.fxa_user = self.UTILS.general.get_config_variable("fxa_user", "common") self.fxa_pass = self.UTILS.general.get_config_variable("fxa_pass", "common") self.connect_to_network() self.UTILS.general.insertContact(self.test_contact) # Clean start if not self.loop.is_installed(): self.loop.install() else: self.loop.launch() # If already logged in, logout if not self.loop.wizard_or_login(): self.loop.open_settings() self.loop.logout() self.settings.launch() self.settings.fxa() self.settings.fxa_log_out() self.apps.kill_all() time.sleep(2) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # First, login self.loop.launch() result = self.loop.wizard_or_login() if result: self.loop.firefox_login(self.fxa_user, self.fxa_pass) self.loop.allow_permission_ffox_login() self.UTILS.element.waitForElements(DOM.Loop.app_header, "Loop main view") self.loop.open_address_book() elem = (DOM.Contacts.view_all_contact_specific_contact[ 0], DOM.Contacts.view_all_contact_specific_contact[1].format(self.test_contact["givenName"])) entry = self.UTILS.element.getElement(elem, "Contact in address book") entry.tap() self.UTILS.iframe.switch_to_active_frame() elem = (DOM.Loop.call_screen_contact_details[0], DOM.Loop.call_screen_contact_details[1].format(self.test_contact["name"])) self.UTILS.element.waitForElements(elem, "Call to contact: {}".format(self.test_contact["name"]))
class test_main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.browser = Browser(self) self.settings = Settings(self) self.download_manager = DownloadManager(self) self.test_url = self.UTILS.general.get_config_variable( "download_url", "common") self.file_name = "Crazy_Horse.jpg" self.data_url = "{}/{}".format(self.test_url, self.file_name) self.connect_to_network() self.settings.launch() self.settings.downloads() self.download_manager.clean_downloads_list() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.UTILS.statusbar.clearAllStatusBarNotifs() self.browser.launch() self.browser.open_url(self.test_url) self.download_manager.download_file(self.file_name) self.UTILS.statusbar.wait_for_notification_toaster_title( "Download complete", timeout=60) time.sleep(5) self.apps.kill_all() time.sleep(2) self.settings.launch() self.settings.downloads() self.download_manager.open_download(self.data_url) self.download_manager.tap_on_open_option() # Verify that the image is opened. self.UTILS.iframe.switchToFrame(*DOM.Gallery.frame_locator) title = self.UTILS.element.getElement(DOM.Gallery.file_name_header, "File name header") self.UTILS.test.test(title.text == self.file_name, "File name matches in Gallery") is_loaded = self.UTILS.element.waitForElements( DOM.Gallery.current_image_pic, "Waiting for image to be loaded") self.UTILS.test.test(is_loaded, "Image has been loaded")
class test_main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.browser = Browser(self) self.settings = Settings(self) self.download_manager = DownloadManager(self) self.test_url = self.UTILS.general.get_config_variable( "download_url", "common") self.file_name = "105MB.rar" self.data_url = "{}/{}".format(self.test_url, self.file_name) # make the download process slower self.data_layer.connect_to_cell_data() self.settings.launch() self.settings.downloads() self.download_manager.clean_downloads_list() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.UTILS.statusbar.clearAllStatusBarNotifs() self.browser.launch() self.browser.open_url(self.test_url) self.download_manager.download_file(self.file_name) self.UTILS.statusbar.wait_for_notification_toaster_title( text="Download started", notif_text="Downloading", timeout=15) time.sleep(5) self.apps.kill_all() time.sleep(2) self.settings.launch() self.settings.downloads() # Verify status downloading using data-state="downloading". self.download_manager.verify_download_status(self.data_url, "downloading") self.download_manager.verify_download_graphical_status( self.data_url, "downloading") self.download_manager.stop_download(self.data_url, True) self.UTILS.statusbar.wait_for_notification_statusbar_title( "Download stopped")
class test_main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.browser = Browser(self) self.settings = Settings(self) self.download_manager = DownloadManager(self) self.music = Music(self) self.test_url = self.UTILS.general.get_config_variable( "download_url", "common") self.file_name = "GOSPEL.mp3" self.data_url = "{}/{}".format(self.test_url, self.file_name) self.connect_to_network() self.settings.launch() self.settings.downloads() self.download_manager.clean_downloads_list() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.browser.launch() self.browser.open_url(self.test_url) self.download_manager.download_file(self.file_name) self.UTILS.statusbar.wait_for_notification_toaster_title( "Download complete", timeout=60) time.sleep(5) self.apps.kill_all() time.sleep(2) self.settings.launch() self.settings.downloads() self.download_manager.open_download(self.data_url) self.download_manager.tap_on_open_option() self.UTILS.iframe.switchToFrame(*DOM.Music.frame_locator) time.sleep(5) title = self.UTILS.element.getElement( DOM.Music.title_song, "Getting song title in music player") self.UTILS.test.test(title.text in self.file_name, "Mp3 file title") self.UTILS.test.test(self.music.is_player_playing(), "Mp3 file is being played")
class test_main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.browser = Browser(self) self.settings = Settings(self) self.download_manager = DownloadManager(self) self.test_url = self.UTILS.general.get_config_variable("download_url", "common") self.file_name = "1GB.rar" self.data_url = "{}/{}".format(self.test_url, self.file_name) # make the download process slower self.data_layer.connect_to_cell_data() self.settings.launch() self.settings.downloads() self.download_manager.clean_downloads_list() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.UTILS.statusbar.clearAllStatusBarNotifs() self.browser.launch() self.browser.open_url(self.test_url) self.download_manager.download_file(self.file_name) self.UTILS.statusbar.wait_for_notification_toaster_title(text="Download started", notif_text="Downloading", timeout=15) time.sleep(5) self.apps.kill_all() time.sleep(2) self.settings.launch() self.settings.downloads() # Verify status downloading using data-state="downloading". self.download_manager.verify_download_status(self.data_url, "downloading") download_info = self.download_manager.get_download_info(self.data_url) match = re.search(r"(\d)+(.(\d)+)*\s(GB|MB|KB)\sof\s(\d)+(.(\d)+)*\sGB$", download_info.text) self.UTILS.test.test(match is not None, "Verify the the text is: 'X' GB of 'Y' GB") time.sleep(3) self.download_manager.stop_download(self.data_url, True)
class main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.loop = Loop(self) self.settings = Settings(self) self.connect_to_network() self.fxa_user = self.UTILS.general.get_config_variable( "fxa_user", "common") self.fxa_pass = self.UTILS.general.get_config_variable( "fxa_pass", "common") self.loop.initial_test_checks() self.logout_fxa() self.apps.kill_all() time.sleep(2) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # First, login self.loop.launch() result = self.loop.wizard_or_login() if result: self.loop.firefox_login(self.fxa_user, self.fxa_pass) self.loop.allow_permission_ffox_login() self.UTILS.element.waitForElements(DOM.Loop.app_header, "Loop main view") time.sleep(5) self.loop.open_settings() self.loop.logout() # The user is not logged in, so no ID is available. The screen to authenticate # is shown instead phone_btn = self.marionette.find_element( *DOM.Loop.wizard_login_phone_number) self.UTILS.test.test(phone_btn, "Use phone number login button is present") def logout_fxa(self): self.settings.launch() self.settings.fxa() self.settings.fxa_log_out()
class test_main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.browser = Browser(self) self.settings = Settings(self) self.download_manager = DownloadManager(self) self.test_url = self.UTILS.general.get_config_variable("download_url", "common") self.file_name = "11MB.rar" self.data_url = "{}/{}".format(self.test_url, self.file_name) self.connect_to_network() self.settings.launch() self.settings.downloads() self.download_manager.clean_downloads_list() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.browser.launch() self.browser.open_url(self.test_url) self.download_manager.download_file(self.file_name) self.UTILS.statusbar.wait_for_notification_toaster_title("Download complete", timeout=60) time.sleep(5) self.apps.kill_all() time.sleep(2) previous_number_of_pictures = len(self.data_layer.sdcard_files()) self.settings.launch() self.settings.downloads() self.download_manager.open_download(self.data_url) self.download_manager.open_download_delete_file() elem = (DOM.DownloadManager.download_element[0], DOM.DownloadManager.download_element[1].format(self.data_url)) self.UTILS.element.waitForNotElements(elem, "Download is not there") # Check that picture saved to SD card self.wait_for_condition( lambda m: len(self.data_layer.sdcard_files()) == previous_number_of_pictures - 1, 20) self.assertEqual(len(self.data_layer.sdcard_files()), previous_number_of_pictures - 1)
class test_main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.browser = Browser(self) self.settings = Settings(self) self.download_manager = DownloadManager(self) self.test_url = self.UTILS.general.get_config_variable( "download_url", "common") self.file_name = "prueba_archivo_con_nombre_muy_largo_de_30MB.rar" self.data_url = "{}/{}".format(self.test_url, self.file_name) self.connect_to_network() self.settings.launch() self.settings.downloads() self.download_manager.clean_downloads_list() def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.UTILS.statusbar.clearAllStatusBarNotifs() self.browser.launch() self.browser.open_url(self.test_url) self.download_manager.download_file(self.file_name) self.UTILS.statusbar.wait_for_notification_toaster_title( "Download complete", timeout=60) time.sleep(5) self.apps.kill_all() time.sleep(2) self.settings.launch() self.settings.downloads() # Check the file is there entry_name = self.download_manager.get_download_entry( self.data_url).find_element(*('css selector', 'p.fileName')) value = self.UTILS.element.get_css_value(entry_name, "text-overflow") is_ellipsis = self.UTILS.element.is_ellipsis_active(entry_name) self.UTILS.test.test( value == "ellipsis" and is_ellipsis, "Download list shows ellipsis(...) for a long entry [{}]".format( self.file_name))
class main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.loop = Loop(self) self.settings = Settings(self) _ = setup_translations(self) self.fxa_user = self.UTILS.general.get_config_variable( "fxa_user", "common") self.fxa_fake_pass = "******" self.expected_error_msg = _("Invalid Password") self.connect_to_network() self.loop.initial_test_checks() # Make sure we're not already logged in self.settings.launch() self.settings.fxa() self.settings.fxa_log_out() self.apps.kill_all() time.sleep(2) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # First, login self.loop.launch() result = self.loop.wizard_or_login() if result: self.loop.firefox_login(self.fxa_user, self.fxa_fake_pass, is_wrong=True) # We're informed of a wrong log in self.UTILS.element.waitForElements( DOM.Loop.ffox_account_error_overlay, "Error overlay") error_msg = self.UTILS.element.getElement( DOM.Loop.ffox_account_error_overlay_title, "Error overlay title") self.UTILS.test.test(error_msg.text == self.expected_error_msg, "Invalid password message is shown") self.UTILS.element.waitForNotElements(DOM.Loop.app_header, "Loop main view")
class test_main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) # Specific for this test. self.browser = Browser(self) self.settings = Settings(self) self.download_manager = DownloadManager(self) self.testURL = self.UTILS.general.get_config_variable("download_url", "common") self.file_names = ["Toast.doc", "Porridge.doc"] self.connect_to_network() self.settings.launch() self.settings.downloads() self.download_manager.clean_downloads_list() self.apps.kill_all() time.sleep(2) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.UTILS.statusbar.clearAllStatusBarNotifs() self.browser.launch() self.browser.open_url(self.testURL) map(self.download_manager.download_file, self.file_names) self.UTILS.statusbar.wait_for_notification_toaster_title("Download complete", timeout=60) time.sleep(5) previous_number_of_pictures = len(self.data_layer.sdcard_files()) self.settings.launch() self.settings.downloads() # Delete All downloads self.download_manager.delete_all_downloads() # Check that picture saved to SD card self.wait_for_condition( lambda m: len(self.data_layer.sdcard_files()) == previous_number_of_pictures - len(self.file_names), 20) self.assertEqual(len(self.data_layer.sdcard_files()), previous_number_of_pictures - len(self.file_names))
class main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.loop = Loop(self) self.settings = Settings(self) self.test_contact = MockContact() self.fxa_user = self.UTILS.general.get_config_variable( "fxa_user", "common") self.fxa_pass = self.UTILS.general.get_config_variable( "fxa_pass", "common") self.test_contact["givenName"] = "This is a very looooooooooooong name" self.test_contact["familyName"] = "Test" self.test_contact["name"] = "{} {}".format( self.test_contact["givenName"], self.test_contact["familyName"]) self.UTILS.general.insertContact(self.test_contact) self.connect_to_network() self.loop.initial_test_checks() self.settings.launch() self.settings.fxa() self.settings.fxa_log_out() self.apps.kill_all() time.sleep(2) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # First, login self.loop.launch() result = self.loop.wizard_or_login() if result: self.loop.firefox_login(self.fxa_user, self.fxa_pass) self.loop.allow_permission_ffox_login() self.UTILS.element.waitForElements(DOM.Loop.app_header, "Loop main view") self.loop.open_address_book() elem = (DOM.Contacts.view_all_contact_specific_contact[0], DOM.Contacts.view_all_contact_specific_contact[1].format( self.test_contact["givenName"])) self.UTILS.element.waitForElements(elem, "Contact in address book")
class main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.loop = Loop(self) self.settings = Settings(self) self.fxa_user = self.UTILS.general.get_config_variable("fxa_user", "common") self.fxa_pass = self.UTILS.general.get_config_variable("fxa_pass", "common") self.connect_to_network() self.loop.initial_test_checks() self.settings.launch() self.settings.fxa() if self.settings.is_fxa_logged_in(): self.settings.fxa_log_out() self.apps.kill_all() time.sleep(2) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): # First, login self.loop.launch() result = self.loop.wizard_or_login() if result: self.loop.firefox_login(self.fxa_user, self.fxa_pass) self.loop.allow_permission_ffox_login() self.UTILS.element.waitForElements(DOM.Loop.app_header, "Loop main view") # Now logout self.loop.open_settings() self.loop.logout() self.apps.kill_all() time.sleep(2) # Now check for login to be prompted self.loop.launch() self.loop.wizard_or_login() self.UTILS.element.waitForElements(DOM.Loop.wizard_login, "Login options prompted")
class test_main(GaiaTestCase): def __init__(self, *args, **kwargs): kwargs['restart'] = True super(test_main, self).__init__(*args, **kwargs) def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.settings = Settings(self) self.wifi_name = self.UTILS.general.get_config_variable("ssid", "wifi") self.wifi_pass = self.UTILS.general.get_config_variable( "password", "wifi") def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.data_layer.disable_wifi() self.UTILS.element.waitForNotElements(DOM.Statusbar.wifi, "Wifi icon in statusbar") self.UTILS.test.test( self.UTILS.network.is_network_type_enabled("wifi") == False, "Wifi is disabled before we start this test.") self.settings.launch() self.settings.wifi() self.settings.connect_to_wifi(self.wifi_name, self.wifi_pass) self.marionette.switch_to_frame() time.sleep(5) self.UTILS.element.waitForElements(DOM.Statusbar.wifi, "Wifi icon in statusbar", True, 20, False) # Disable wifi mode. self.UTILS.home.goHome() self.settings.launch() self.settings.wifi() self.settings.wifi_switch_off() # Data icon is no longer visible in status bar. self.UTILS.element.waitForNotElements(DOM.Statusbar.wifi, "Wifi icon not in statusbar")
class test_main(GaiaTestCase): def setUp(self): # Set up child objects... GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.settings = Settings(self) self.Browser = Browser(self) self.wifi_name = self.UTILS.general.get_config_variable("ssid", "wifi") self.wifi_pass = self.UTILS.general.get_config_variable("password", "wifi") def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.settings.launch() time.sleep(2) self.settings.wifi() self.settings.connect_to_wifi(self.wifi_name, self.wifi_pass) network = {'ssid': self.wifi_name} self.wait_for_condition(lambda m: self.data_layer.is_wifi_connected(network), timeout=30) self.UTILS.iframe.switchToFrame(*DOM.Settings.frame_locator) self.UTILS.element.getElement(DOM.Settings.wifi_advanced_manage, "Manage networks button").tap() self.UTILS.element.waitForElements(DOM.Settings.wifi_advanced_mac, "Mac address") self.UTILS.element.waitForElements(DOM.Settings.wifi_advanced_knownNets, "Known networks") self.UTILS.element.waitForElements(DOM.Settings.wifi_advanced_joinHidden, "Join hidden network button") screenshot = self.UTILS.debug.screenShotOnErr() self.UTILS.reporting.logResult("info", "Screenshot at this point:", screenshot) x = self.UTILS.element.getElements(DOM.Settings.wifi_advanced_knownNets, "Known networks (should only be 1).")[0] x.tap() x = self.UTILS.debug.screenShotOnErr() self.UTILS.reporting.logResult("info", "Screenshot at this point:", x) self.UTILS.element.waitForElements(DOM.Settings.wifi_advanced_forgetBtn, "'Forget network' button") self.UTILS.element.waitForElements(DOM.Settings.wifi_advanced_cancelBtn, "'Cancel' button") forget_btn = self.marionette.find_element(*DOM.Settings.wifi_advanced_forgetBtn) forget_btn.tap()
class test_main(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.UTILS = UTILS(self) self.browser = Browser(self) self.settings = Settings(self) self.download_manager = DownloadManager(self) self.test_url = self.UTILS.general.get_config_variable("download_url", "common") self.file_name = "GOSPEL.mp3" self.data_url = "{}/{}".format(self.test_url, self.file_name) self.connect_to_network() self.UTILS.statusbar.clearAllStatusBarNotifs() # Download and audio file self.settings.launch() self.settings.downloads() self.download_manager.clean_downloads_list() self.browser.launch() self.browser.open_url(self.test_url) self.download_manager.download_file(self.file_name) self.UTILS.statusbar.wait_for_notification_toaster_title("Download complete", timeout=60) self.apps.kill_all() time.sleep(2) def tearDown(self): self.UTILS.reporting.reportResults() GaiaTestCase.tearDown(self) def test_run(self): self.settings.launch() self.settings.downloads() self.download_manager.open_download(self.data_url) cancel_btn = self.UTILS.element.getElement(DOM.DownloadManager.download_file_option_cancel, "Getting Open file button") cancel_btn.tap() self.UTILS.element.waitForElements(DOM.Settings.downloads_header, "Downloads header appears.", True, 20, True)