def test_notification_bar(self): system = System(self.marionette) # Push a notification self.marionette.execute_script('new Notification("%s", {body: "%s"});' % (self._notification_title, self._notification_body)) system.wait_for_notification_toaster_displayed(for_app='system') system.wait_for_notification_toaster_not_displayed() # Expand the notification bar system.wait_for_status_bar_displayed() utility_tray = system.open_utility_tray() utility_tray.wait_for_notification_container_displayed() notifications = utility_tray.get_notifications(for_app='system') self.assertEqual(1, len(notifications), 'Expected one system notification.') self.assertEqual(self._notification_body, notifications[0].content) # We cannot disable app update yet so let's wait for it to pass if system.is_app_update_notification_displayed: system.wait_for_app_update_to_clear() # Clear the notification by "Clear all" utility_tray.clear_all_notifications() # wait for the notifications to be cleared self.wait_for_condition(lambda m: len(utility_tray.notifications) == 0) # Assert there is no notification is listed in notifications-container self.assertEqual(0, len(utility_tray.notifications))
def test_music_share_ringtone(self): """ https://moztrap.mozilla.org/manage/case/2683/ """ music_app = Music(self.marionette) music_app.launch() music_app.wait_for_music_tiles_displayed() # switch to songs view, and play the first one on the list list_view = music_app.tap_songs_tab() songs = list_view.media self.assertGreater(len(songs), 0, 'The ogg file could not be found') player_view = songs[0].tap_first_song() # wait until the player view is shown, then tap the share button play_time = time.strptime('00:01', '%M:%S') Wait(self.marionette).until(lambda m: player_view.player_elapsed_time >= play_time) activities = player_view.tap_share_button() ringtone = activities.share_to_ringtones() ringtone.tap_save() system = System(self.marionette) self.marionette.switch_to_frame() system.wait_for_notification_toaster_displayed(message="Ringtone set as default.") system.wait_for_notification_toaster_not_displayed() settings = Settings(self.marionette) settings.launch() sound = settings.open_sound_settings() # desktop b2g doesn't have this option visible, see bug 1130538 if sound.ring_tone_selector_visible: self.assertEqual(sound.current_ring_tone, 'MUS_0001')
def test_toggle_airplane_mode(self): settings = Settings(self.marionette) settings.launch() settings.wait_for_airplane_toggle_ready() # Switch on Airplane mode settings.toggle_airplane_mode() # wait for wifi to be disabled, this takes the longest when airplane mode is switched on self.wait_for_condition( lambda s: 'Disabled' in settings.wifi_menu_item_description) # wait for airplane mode icon is diaplayed on status bar self.marionette.switch_to_default_content() system_app = System(self.marionette) system_app.wait_for_airplane_mode_icon_displayed() # check Wifi is disabled self.assertFalse( self.data_layer.is_wifi_connected(self.testvars['wifi']), "WiFi was still connected after switching on Airplane mode") # check that Cell Data is disabled self.assertFalse( self.data_layer.get_setting('ril.data.enabled'), "Cell Data was still connected after switching on Airplane mode") # check GPS is disabled self.assertFalse( self.data_layer.get_setting('geolocation.enabled'), "GPS was still connected after switching on Airplane mode") # switch back to app frame self.apps.switch_to_displayed_app() # Switch off Airplane mode settings.wait_for_airplane_toggle_ready() settings.toggle_airplane_mode() # Wait for wifi to be connected, because this takes the longest to connect after airplane mode is switched off self.wait_for_condition(lambda s: 'Connected to ' + self.testvars[ 'wifi']['ssid'] in settings.wifi_menu_item_description, timeout=40) # check Wifi is enabled self.assertTrue( self.data_layer.is_wifi_connected(self.testvars['wifi']), "WiFi was not connected after switching off Airplane mode") # check that Cell Data is enabled self.assertTrue( self.data_layer.get_setting('ril.data.enabled'), "Cell data was not connected after switching off Airplane mode") # check GPS is enabled self.assertTrue( self.data_layer.get_setting('geolocation.enabled'), "GPS was not enabled after switching off Airplane mode")
class TestNotificationVisibilityAccessibility(GaiaTestCase): # notification data _notification_title = 'TestNotificationBar_TITLE' _notification_body = 'TestNotificationBar_BODY' def setUp(self): GaiaTestCase.setUp(self) self.system = System(self.marionette) def test_a11y_notification_visibility(self): # By default notification toaster should be invisible to the screen reader. self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element( *self.system._notification_toaster_locator))) # Push a notification self.marionette.execute_script('new Notification("%s", {body: "%s"});' % (self._notification_title, self._notification_body)) self.system.wait_for_notification_toaster_displayed() # Now the notification toaster should be visible to the screen reader. self.assertTrue(self.accessibility.is_visible(self.marionette.find_element( *self.system._notification_toaster_locator))) self.system.wait_for_notification_toaster_not_displayed() # Again the notification toaster should be invisible to the screen reader. self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element( *self.system._notification_toaster_locator)))
def setUp(self): GaiaTestCase.setUp(self) self.connect_to_local_area_network() self.homescreen = Homescreen(self.marionette) self.apps.switch_to_displayed_app() self.test_data = { 'name': 'packagedapp1', 'url': self.marionette.absolute_url('webapps/packaged1/manifest.webapp'), 'title': 'Packaged app1'} # Install app self.marionette.execute_script( 'navigator.mozApps.installPackage("%s")' % self.test_data['url']) # Confirm the installation and wait for the app icon to be present confirm_install = ConfirmInstall(self.marionette) confirm_install.tap_confirm() # Wait for the notification to disappear system = System(self.marionette) system.wait_for_system_banner_displayed() system.wait_for_system_banner_not_displayed() self.apps.switch_to_displayed_app() self.homescreen.wait_for_app_icon_present(self.test_data['name'])
def test_browser_save_image(self): """ https://moztrap.mozilla.org/manage/case/6889/ """ # Check that there are no images on sdcard before saving self.assertEqual(0, len(self.data_layer.sdcard_files('.jpeg'))) search = Search(self.marionette) search.launch() browser = search.go_to_url(self.test_url) browser.switch_to_content() # Long tap on the image inside the browser content image = self.marionette.find_element('css selector', 'img') Actions(self.marionette).\ press(image).\ wait(3).\ release().\ wait(1).\ perform() activities = Activities(self.marionette) activities.tap_save_image() system = System(self.marionette) system.wait_for_notification_toaster_displayed() system.wait_for_notification_toaster_not_displayed() self.assertEqual(1, len(self.data_layer.sdcard_files('.jpeg')))
def test_dialer_from_message(self): # Send a SMS to the device _text_message_content = "Automated Test %s" % str(time.time()) # Open first received message self.messages = Messages(self.marionette) self.messages.launch() self.data_layer.send_sms(self.testvars["carrier"]["phone_number"], _text_message_content) self.apps.switch_to_displayed_app() self.messages.wait_for_message_received(timeout=180) # Sometimes tap is done on the notification instead of message header self.marionette.switch_to_frame() system = System(self.marionette) system.wait_for_notification_toaster_not_displayed() self.apps.switch_to_displayed_app() message_thread = self.messages.tap_first_received_message() # Check the phone number keypad = message_thread.tap_call() self.assertEquals(keypad.phone_number, self.testvars["carrier"]["phone_number"])
def test_quick_settings_button(self): system = System(self.marionette) utility_tray = system.open_utility_tray() utility_tray.tap_settings_button() Settings(self.marionette).wait_to_be_displayed()
class TestUtilityTrayVisibilityAccessibility(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.system = System(self.marionette) self.status_bar = StatusBar(self.marionette) self.utility_tray = UtilityTray(self.marionette) def test_a11y_utility_tray_visibility(self): self.system.wait_for_status_bar_displayed() utility_tray_container = self.marionette.find_element( *self.system._utility_tray_locator) # Utility tray is hidden by default. self.assertTrue(self.accessibility.is_hidden(utility_tray_container)) self.status_bar.a11y_wheel_status_bar_time() self.utility_tray.wait_for_notification_container_displayed() # Utility tray should now be visible. self.assertTrue(self.accessibility.is_visible(utility_tray_container)) self.utility_tray.a11y_wheel_utility_tray_grippy() # Utility tray should now be hidden. self.assertTrue(self.accessibility.is_hidden(utility_tray_container))
def setUp(self): GaiaTestCase.setUp(self) self.connect_to_local_area_network() self.homescreen = Homescreen(self.marionette) self.apps.switch_to_displayed_app() self.test_data = { "name": "Mozilla QA WebRT Tester", "url": self.marionette.absolute_url("webapps/mozqa.com/manifest.webapp"), } self.logger.info("Test data: %s" % self.test_data) # Install app self.marionette.execute_script('navigator.mozApps.install("%s")' % self.test_data["url"]) # Confirm the installation and wait for the app icon to be present confirm_install = ConfirmInstall(self.marionette) confirm_install.tap_confirm() # Wait for the notification to disappear system = System(self.marionette) system.wait_for_system_banner_displayed() system.wait_for_system_banner_not_displayed() self.apps.switch_to_displayed_app() self.homescreen.wait_for_app_icon_present(self.test_data["name"])
def setUp(self): GaiaTestCase.setUp(self) self.connect_to_local_area_network() # Turn off geolocation prompt for smart collections self.apps.set_permission("Smart Collections", "geolocation", "deny") self.homescreen = Homescreen(self.marionette) self.apps.switch_to_displayed_app() self.test_data = { "name": "Mozilla QA WebRT Tester", "url": self.marionette.absolute_url("webapps/mozqa.com/manifest.webapp"), "title": "Directory listing for /", } # Install app self.marionette.execute_script('navigator.mozApps.install("%s")' % self.test_data["url"]) # Confirm the installation and wait for the app icon to be present confirm_install = ConfirmInstall(self.marionette) confirm_install.tap_confirm() # Wait for the notification to disappear system = System(self.marionette) system.wait_for_system_banner_displayed() system.wait_for_system_banner_not_displayed() self.apps.switch_to_displayed_app() self.homescreen.wait_for_app_icon_present(self.test_data["name"])
class TestUtilityTrayVisibilityAccessibility(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.system = System(self.marionette) self.status_bar = self.system.status_bar self.utility_tray = UtilityTray(self.marionette) def test_a11y_utility_tray_visibility(self): self.system.wait_for_status_bar_displayed() utility_tray_container = self.marionette.find_element(*self.system._utility_tray_locator) # Utility tray is hidden by default. self.assertTrue(self.accessibility.is_hidden(utility_tray_container)) self.status_bar.a11y_wheel_status_bar_time() self.utility_tray.wait_for_dropped_down() # Utility tray should now be visible. self.assertTrue(self.accessibility.is_visible(utility_tray_container)) self.utility_tray.a11y_wheel_utility_tray_grippy() # Utility tray should now be hidden. self.assertTrue(self.accessibility.is_hidden(utility_tray_container))
def setUp(self): GaiaTestCase.setUp(self) self.connect_to_network() # Turn off geolocation prompt for smart collections self.apps.set_permission('Smart Collections', 'geolocation', 'deny') self.homescreen = Homescreen(self.marionette) self.apps.switch_to_displayed_app() if not self.apps.is_app_installed(self.APP_NAME): # Install app self.marionette.execute_script( 'navigator.mozApps.install("%s")' % self.MANIFEST) # Confirm the installation and wait for the app icon to be present confirm_install = ConfirmInstall(self.marionette) confirm_install.tap_confirm() # Wait for the notification to disappear system = System(self.marionette) system.wait_for_system_banner_displayed() system.wait_for_system_banner_not_displayed() self.apps.switch_to_displayed_app() self.homescreen.wait_for_app_icon_present(self.APP_NAME)
def test_dialer_from_message(self): # Send a SMS to the device _text_message_content = "Automated Test %s" % str(time.time()) # Open first received message self.messages = Messages(self.marionette) self.messages.launch() self.data_layer.send_sms(self.testvars['carrier']['phone_number'], _text_message_content) self.apps.switch_to_displayed_app() self.messages.wait_for_message_received(timeout=180) # Sometimes tap is done on the notification instead of message header self.marionette.switch_to_frame() system = System(self.marionette) system.wait_for_notification_toaster_not_displayed() self.apps.switch_to_displayed_app() message_thread = self.messages.tap_first_received_message() # Check the phone number keypad = message_thread.tap_call() self.assertEquals(keypad.phone_number, self.testvars['carrier']['phone_number'])
def setUp(self): GaiaTestCase.setUp(self) self.connect_to_network() # Turn off geolocation prompt for smart collections self.apps.set_permission('Smart Collections', 'geolocation', 'deny') self.homescreen = Homescreen(self.marionette) self.apps.switch_to_displayed_app() self.test_data = { 'name': 'Mozilla QA WebRT Tester', 'url': self.marionette.absolute_url('webapps/mozqa.com/manifest.webapp'), 'title': 'Directory listing for /'} # Install app self.marionette.execute_script( 'navigator.mozApps.install("%s")' % self.test_data['url']) # Confirm the installation and wait for the app icon to be present confirm_install = ConfirmInstall(self.marionette) confirm_install.tap_confirm() # Wait for the notification to disappear system = System(self.marionette) system.wait_for_system_banner_displayed() system.wait_for_system_banner_not_displayed() self.apps.switch_to_displayed_app() self.homescreen.wait_for_app_icon_present(self.test_data['name'])
class TestSoftwareButtonsVisibilityAccessibility(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.system = System(self.marionette) def test_a11y_software_buttons_visibility(self): self.assertTrue( self.accessibility.is_hidden( self.marionette.find_element( *self.system._software_home_button_locator))) # Enable software button visibility self.data_layer.set_setting('software-button.enabled', True) # # Software buttons should now be visible self.system.wait_for_software_home_button_displayed() self.assertTrue( self.accessibility.is_visible( self.marionette.find_element( *self.system._software_home_button_locator))) # # Disable software button visibility self.data_layer.set_setting('software-button.enabled', False) # # Software buttons should now be invisible self.system.wait_for_software_home_button_not_displayed() self.assertTrue( self.accessibility.is_hidden( self.marionette.find_element( *self.system._software_home_button_locator)))
class TestSoftwareButtonsVisibilityAccessibility(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.system = System(self.marionette) def test_a11y_software_buttons_visibility(self): self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element( *self.system._software_home_button_locator))) # Enable software button visibility self.data_layer.set_setting('software-button.enabled', True) # # Software buttons should now be visible self.system.wait_for_software_home_button_displayed() self.assertTrue(self.accessibility.is_visible(self.marionette.find_element( *self.system._software_home_button_locator))) # # Disable software button visibility self.data_layer.set_setting('software-button.enabled', False) # # Software buttons should now be invisible self.system.wait_for_software_home_button_not_displayed() self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element( *self.system._software_home_button_locator)))
def test_dialer_clear_miss_call_notification(self): """ Pre-requisites: Have a voicemail in the notification bar and a missed call notification Repro Steps: 1) Open the notification panel and tap the missed call notification. 2) After the call log appears, drop down the notification panel again. 3) The notification for the call that was just tapped is no longer present. """ PLIVO_TIMEOUT = 30 plivo_phone_number = self.testvars["plivo"]["phone_number"] # Create a missed call notification from gaiatest.utils.plivo.plivo_util import PlivoUtil self.plivo = PlivoUtil( self.testvars["plivo"]["auth_id"], self.testvars["plivo"]["auth_token"], plivo_phone_number ) self.call_uuid = self.plivo.make_call( to_number=self.testvars["local_phone_numbers"][0].replace("+", ""), timeout=PLIVO_TIMEOUT ) call_screen = CallScreen(self.marionette) call_screen.wait_for_incoming_call() self.plivo.hangup_call(self.call_uuid) Wait(self.plivo, timeout=PLIVO_TIMEOUT).until( lambda p: p.is_call_completed(self.call_uuid), message="Plivo didn't report the call as completed" ) self.call_uuid = None system = System(self.marionette) self.marionette.switch_to_frame() system.wait_for_notification_toaster_displayed() system.wait_for_notification_toaster_not_displayed() # Open the notification panel system.wait_for_status_bar_displayed() utility_tray = system.open_utility_tray() utility_tray.wait_for_notification_container_displayed() # Verify the user sees the missed call event in the notification center notifications = utility_tray.notifications self.assertEqual(len(notifications), 2) self.assertEqual(notifications[0].title, "Missed call") # Remove the first digit (country code) which is not displayed for AT&T/USA - Bug 1088756 self.assertTrue(plivo_phone_number[1:] in notifications[0].content) self.assertEqual(notifications[1].title, "Voicemail") notifications[0].tap_notification() self.marionette.switch_to_frame() system.open_utility_tray() notifications = utility_tray.notifications self.assertEqual(len(notifications), 1) self.assertEqual(notifications[0].title, "Voicemail")
def tap_element_from_system_app(self, element=None, add_statusbar_height=False): # Workaround for bug 1109213, where tapping on the button inside the app itself # makes Marionette spew out NoSuchWindowException errors x = element.rect['x'] + element.rect['width']//2 y = element.rect['y'] + element.rect['height']//2 from gaiatest.apps.system.app import System system = System(self.marionette) if add_statusbar_height: y = y + system.status_bar.height system.tap(x, y)
def test_IMAP_email_notification(self): """ https://moztrap.mozilla.org/manage/case/10744/""" # setup email account self.email.setup_IMAP_email(self.environment.email['imap'], self.environment.email['smtp']) # check account has emails self.email.wait_for_emails_to_sync() self.assertGreater(len(self.email.mails), 0) # Touch home button to exit email app self.device.touch_home_button() # send email to IMAP account mock_email = MockEmail(self.environment.host['smtp']['email'], self.environment.email['imap']['email']) EmailUtil().send(self.environment.host['smtp'], mock_email) self.marionette.switch_to_frame() system = System(self.marionette) # Wait for email notification system.wait_for_notification_toaster_displayed(timeout=60, for_app='email') system.wait_for_notification_toaster_not_displayed() system.wait_for_status_bar_displayed() utility_tray = system.open_utility_tray() notifications = utility_tray.get_notifications(for_app='email') self.assertEqual(1, len(notifications), 'Expected one email notification.') email = notifications[0].tap_notification() email.wait_to_be_displayed() self.apps.switch_to_displayed_app() # Wait for senders email to be shown email.wait_for_senders_email_displayed() # check if the sender's email address is fine self.assertEqual( email.senders_email, mock_email['from'], 'Senders\'s email on the inbox screen is incorrect. ' 'Expected email is %s. Actual email is %s.' % (mock_email['from'], email.senders_email)) # check if the subject is fine self.assertEqual( email.subject, mock_email['subject'], 'Senders\'s email on the inbox screen is incorrect. ' 'Expected subject is %s. Actual subject is %s.' % (mock_email['subject'], email.subject)) # check if the email message is fine self.assertEqual( email.body, mock_email['message'], 'Email message on read email screen is incorrect. ' 'Expected message is "%s". Actual message is ' '"%s".' % (mock_email['message'], email.body))
def test_notification_bar(self): system = System(self.marionette) # Push a notification self.marionette.execute_script( 'navigator.mozNotification.createNotification("%s", "%s").show();' % (self._notification_title, self._notification_body)) system.wait_for_notification_toaster_displayed() system.wait_for_notification_toaster_not_displayed() # Expand the notification bar system.wait_for_status_bar_displayed() utility_tray = system.open_utility_tray() utility_tray.wait_for_notification_container_displayed() # Assert there is one notification is listed in notifications-container notifications = utility_tray.notifications self.assertEqual(1, len(notifications), 'Expected one notification.') # Assert notification is listed in notifications-container self.assertEqual(self._notification_body, notifications[0].content) # Clear the notification by "Clear all" utility_tray.clear_all_notifications() # wait for the notifications to be cleared self.wait_for_condition(lambda m: len(utility_tray.notifications) == 0) # Assert there is no notification is listed in notifications-container self.assertEqual(0, len(utility_tray.notifications))
def test_receive_active_sync_email(self): # setup ActiveSync account email = Email(self.marionette) email.launch() email.setup_active_sync_email(self.testvars['email']['ActiveSync']) # wait for sync to complete email.wait_for_emails_to_sync() # Touch home button to exit email app self.device.touch_home_button() # send email to active sync account mock_email = MockEmail( senders_email=self.testvars['email']['IMAP']['email'], recipients_email=self.testvars['email']['ActiveSync']['email']) EmailUtil().send(self.testvars['email']['IMAP'], mock_email) self.marionette.switch_to_frame() system = System(self.marionette) # Wait for email notification system.wait_for_notification_toaster_displayed(timeout=60) system.wait_for_notification_toaster_not_displayed() # Expand the notification bar system.wait_for_status_bar_displayed() utility_tray = system.open_utility_tray() utility_tray.wait_for_notification_container_displayed() # Assert there is one notification is listed in notifications-container notifications = utility_tray.notifications self.assertEqual(1, len(notifications), 'Expected one notification.') email = notifications[0].tap_notification() self.wait_for_condition( lambda m: self.apps.displayed_app.name == "E-Mail") self.apps.switch_to_displayed_app() # check if the sender's email address is fine self.assertEqual( email.senders_email, mock_email.senders_email, 'Senders\'s email on the inbox screen is incorrect. ' 'Expected email is %s. Actual email is %s.' % (mock_email.senders_email, email.senders_email)) # check if the subject is fine self.assertEqual( email.subject, mock_email.subject, 'Senders\'s email on the inbox scrseen is incorrect. ' 'Expected subject is %s. Actual subject is %s.' % (mock_email.subject, email.subject)) # check if the email message is fine self.assertEqual( email.body, mock_email.message, 'Email message on read email screen is incorrect. ' 'Expected message is "%s". Actual message is ' '"%s".' % (mock_email.message, email.body))
def test_dialer_clear_miss_call_notification(self): """ Pre-requisites: Have a voicemail in the notification bar and a missed call notification Repro Steps: 1) Open the notification panel and tap the missed call notification. 2) After the call log appears, drop down the notification panel again. 3) The notification for the call that was just tapped is no longer present. """ plivo_phone_number = self.testvars['plivo']['phone_number'] # Create a missed call notification from gaiatest.utils.plivo.plivo_util import PlivoUtil self.plivo = PlivoUtil( self.testvars['plivo']['auth_id'], self.testvars['plivo']['auth_token'], plivo_phone_number, ) self.call_uuid = self.plivo.make_call( to_number=self.testvars['local_phone_numbers'][0].replace('+', '')) call_screen = CallScreen(self.marionette) call_screen.wait_for_incoming_call() self.plivo.hangup_call(self.call_uuid) self.plivo.wait_for_call_completed(self.call_uuid) self.call_uuid = None system = System(self.marionette) self.marionette.switch_to_frame() system.wait_for_notification_toaster_displayed() system.wait_for_notification_toaster_not_displayed() # Open the notification panel system.wait_for_status_bar_displayed() utility_tray = system.open_utility_tray() utility_tray.wait_for_notification_container_displayed() # Verify the user sees the missed call event in the notification center notifications = utility_tray.notifications self.assertEqual(len(notifications), 2) self.assertEqual(notifications[0].title, 'Missed call') # Remove the first digit (country code) which is not displayed for AT&T/USA - Bug 1088756 self.assertTrue(plivo_phone_number[1:] in notifications[0].content) self.assertEqual(notifications[1].title, 'Voicemail') notifications[0].tap_notification() self.marionette.switch_to_frame() system.open_utility_tray() notifications = utility_tray.notifications self.assertEqual(len(notifications), 1) self.assertEqual(notifications[0].title, 'Voicemail')
def test_IMAP_email_notification(self): """ https://moztrap.mozilla.org/manage/case/10744/""" # setup email account self.email.setup_IMAP_email(self.testvars['email']['IMAP']) # check account has emails self.email.wait_for_emails_to_sync() self.assertGreater(len(self.email.mails), 0) # Touch home button to exit email app self.device.touch_home_button() # send email to IMAP account mock_email = MockEmail( senders_email=self.testvars['email']['IMAP']['email'], recipients_email=self.testvars['email']['IMAP']['email']) EmailUtil().send(self.testvars['email']['IMAP'], mock_email) self.marionette.switch_to_frame() system = System(self.marionette) # Wait for email notification system.wait_for_notification_toaster_displayed(timeout=60) system.wait_for_notification_toaster_not_displayed() # Expand the notification bar system.wait_for_status_bar_displayed() utility_tray = system.open_utility_tray() utility_tray.wait_for_notification_container_displayed() # Assert there is one notification and is listed in notifications-container notifications = utility_tray.notifications self.assertEqual(1, len(notifications), 'Expected one notification.') email = notifications[0].tap_notification() self.wait_for_condition( lambda m: self.apps.displayed_app.name == self.email.name) self.apps.switch_to_displayed_app() # check if the sender's email address is fine self.assertEqual( email.senders_email, mock_email.senders_email, 'Senders\'s email on the inbox screen is incorrect. ' 'Expected email is %s. Actual email is %s.' % (mock_email.senders_email, email.senders_email)) # check if the subject is fine self.assertEqual( email.subject, mock_email.subject, 'Senders\'s email on the inbox screen is incorrect. ' 'Expected subject is %s. Actual subject is %s.' % (mock_email.subject, email.subject)) # check if the email message is fine self.assertEqual( email.body, mock_email.message, 'Email message on read email screen is incorrect. ' 'Expected message is "%s". Actual message is ' '"%s".' % (mock_email.message, email.body))
def test_cost_control_data_alert_mobile(self): """https://moztrap.mozilla.org/manage/case/8938/""" cost_control = CostControl(self.marionette) cost_control.launch() cost_control.switch_to_ftu() cost_control.run_ftu_accepting_defaults() self.assertTrue(cost_control.is_mobile_data_tracking_on) self.assertFalse(cost_control.is_wifi_data_tracking_on) settings = cost_control.tap_settings() self.assertFalse(settings.is_data_alert_switch_checked) settings.toggle_data_alert_switch() self.assertTrue(settings.is_data_alert_switch_checked) settings.reset_mobile_usage() settings.select_when_use_is_above_unit_and_value(u'MB', '0.1') settings.tap_done() self.assertTrue(cost_control.is_mobile_data_tracking_on) # open browser to get some data downloaded search = Search(self.marionette) search.launch(launch_timeout=30000) browser = search.go_to_url( 'http://mozqa.com/qa-testcase-data/Images/sample_png_02.png') browser.wait_for_page_to_load(180) browser.switch_to_content() Wait(self.marionette, timeout=60).until(lambda m: "sample_png_02.png" in m.title) browser.switch_to_chrome() system = System(self.marionette) utility_tray = system.open_utility_tray() utility_tray.wait_for_notification_container_displayed() # switch to cost control widget usage_iframe = self.marionette.find_element( *self._cost_control_widget_locator) self.marionette.switch_to_frame(usage_iframe) # make sure the color changed # The timeout is increased, because for some reason, it takes some time # before the limit view is shown (the browser has to finish loading?) usage_view = self.marionette.find_element( *self._data_usage_view_locator) Wait(self.marionette, timeout=40).until( lambda m: 'reached-limit' in usage_view.get_attribute('class'), message='Data usage bar did not breach limit') usage_view.tap() self.wait_for_condition( lambda m: self.apps.displayed_app.name == cost_control.name)
def tap_element_from_system_app(self, element=None, add_statusbar_height=False, x=None, y=None): # Workaround for bug 1109213, where tapping on the button inside the app itself # makes Marionette spew out NoSuchWindowException errors cx = element.rect['x'] cy = element.rect['y'] cx += element.rect['width']//2 if x is None else x cy += element.rect['height']//2 if y is None else y from gaiatest.apps.system.app import System system = System(self.marionette) if add_statusbar_height: cy = cy + system.status_bar.height system.tap(cx, cy)
def test_sms_notification(self): _text_message_content = "Automated Test %s" % str(time.time()) system = System(self.marionette) # Send a SMS to the device self.data_layer.send_sms(self.testvars['carrier']['phone_number'], _text_message_content) system.wait_for_notification_toaster_displayed() system.wait_for_notification_toaster_not_displayed() self.assertTrue(self.apps.running_apps[1].name == "Messages")
def test_quick_settings_button(self): system = System(self.marionette) # Expand the utility tray utility_tray = system.open_utility_tray() utility_tray.wait_for_notification_container_displayed() #tap the settings button utility_tray.tap_settings_button() #wait for and assert that settings app is launched self.wait_for_condition(lambda m: self.apps.displayed_app.name == "Settings")
def test_launch_rocketbar_search(self): # Tests a search with a common string. # Asserts that the title and shortcuts are listed test_string = u"News" search_panel = System(self.marionette).tap_search_bar() search_panel.type_into_search_box(test_string) search_panel.wait_for_search_results_to_load(3) self.assertGreater(len(search_panel.link_results), 0)
def test_quick_settings_button(self): system = System(self.marionette) # Expand the utility tray utility_tray = system.open_utility_tray() utility_tray.wait_for_notification_container_displayed() #tap the settings button utility_tray.tap_settings_button() #wait for and assert that settings app is launched self.wait_for_condition( lambda m: self.apps.displayed_app.name == "Settings")
def test_quick_settings_button(self): system = System(self.marionette) # Expand the utility tray utility_tray = system.open_utility_tray() utility_tray.wait_for_notification_container_displayed() #tap the settings button utility_tray.tap_settings_button() #wait for and assert that settings app is launched from gaiatest.apps.settings.app import Settings Settings(self.marionette).wait_to_be_displayed()
def install_link(self): element = Wait(self.marionette, timeout=20, interval=1).until( expected.element_present(*self._addon_install_locator)) Wait(self.marionette).until(expected.element_displayed(element)) element.tap() confirm_install = ConfirmInstall(self.marionette) confirm_install.tap_confirm() system = System(self.marionette) system.wait_for_system_banner_displayed() system.wait_for_system_banner_not_displayed() self.apps.switch_to_displayed_app()
def test_notification_bar(self): system = System(self.marionette) # Push a notification self.marionette.execute_script('navigator.mozNotification.createNotification("%s", "%s").show();' % (self._notification_title, self._notification_body)) system.wait_for_notification_toaster_displayed() system.wait_for_notification_toaster_not_displayed() # Expand the notification bar system.wait_for_status_bar_displayed() utility_tray = system.open_utility_tray() utility_tray.wait_for_notification_container_displayed() # Assert there is one notification is listed in notifications-container notifications = utility_tray.notifications self.assertEqual(1, len(notifications), 'Expected one notification.') # Assert notification is listed in notifications-container self.assertEqual(self._notification_body, notifications[0].content) # Clear the notification by "Clear all" utility_tray.clear_all_notifications() # wait for the notifications to be cleared self.wait_for_condition(lambda m: len(utility_tray.notifications) == 0) # Assert there is no notification is listed in notifications-container self.assertEqual(0, len(utility_tray.notifications))
def test_IMAP_email_notification(self): """ https://moztrap.mozilla.org/manage/case/10744/""" # setup email account self.email.setup_IMAP_email(self.testvars['email']['IMAP']) # check account has emails self.email.wait_for_emails_to_sync() self.assertGreater(len(self.email.mails), 0) # Touch home button to exit email app self.device.touch_home_button() # send email to IMAP account mock_email = MockEmail(senders_email=self.testvars['email']['IMAP']['email'], recipients_email=self.testvars['email']['IMAP']['email']) EmailUtil().send(self.testvars['email']['IMAP'], mock_email) self.marionette.switch_to_frame() system = System(self.marionette) # Wait for email notification system.wait_for_notification_toaster_displayed(timeout=60) system.wait_for_notification_toaster_not_displayed() # Expand the notification bar system.wait_for_status_bar_displayed() utility_tray = system.open_utility_tray() utility_tray.wait_for_notification_container_displayed() # Assert there is one notification and is listed in notifications-container notifications = utility_tray.notifications self.assertEqual(1, len(notifications), 'Expected one notification.') email = notifications[0].tap_notification() self.wait_for_condition(lambda m: self.apps.displayed_app.name == self.email.name) self.apps.switch_to_displayed_app() # Wait for senders email to be shown email.wait_for_senders_email_displayed() # check if the sender's email address is fine self.assertEqual(email.senders_email, mock_email.senders_email, 'Senders\'s email on the inbox screen is incorrect. ' 'Expected email is %s. Actual email is %s.' % ( mock_email.senders_email, email.senders_email)) # check if the subject is fine self.assertEqual(email.subject, mock_email.subject, 'Senders\'s email on the inbox screen is incorrect. ' 'Expected subject is %s. Actual subject is %s.' % ( mock_email.subject, email.subject)) # check if the email message is fine self.assertEqual(email.body, mock_email.message, 'Email message on read email screen is incorrect. ' 'Expected message is "%s". Actual message is ' '"%s".' % (mock_email.message, email.body))
def test_receive_active_sync_email(self): # setup ActiveSync account email = Email(self.marionette) email.launch() email.setup_active_sync_email( self.testvars['email']['ActiveSync']) # wait for sync to complete email.wait_for_emails_to_sync() # Touch home button to exit email app self.device.touch_home_button() # send email to active sync account mock_email = MockEmail(senders_email=self.testvars['email']['IMAP']['email'], recipients_email=self.testvars['email']['ActiveSync']['email']) EmailUtil().send(self.testvars['email']['IMAP'], mock_email) self.marionette.switch_to_frame() system = System(self.marionette) # Wait for email notification system.wait_for_notification_toaster_displayed(timeout=30) system.wait_for_notification_toaster_not_displayed() # Expand the notification bar system.wait_for_status_bar_displayed() utility_tray = system.open_utility_tray() utility_tray.wait_for_notification_container_displayed() # Assert there is one notification is listed in notifications-container notifications = utility_tray.notifications self.assertEqual(1, len(notifications), 'Expected one notification.') email = notifications[0].tap_notification() self.apps.switch_to_displayed_app() # check if the sender's email address is fine self.assertEqual(email.senders_email, mock_email.senders_email, 'Senders\'s email on the inbox screen is incorrect. ' 'Expected email is %s. Actual email is %s.' % ( mock_email.senders_email, email.senders_email)) # check if the subject is fine self.assertEqual(email.subject, mock_email.subject, 'Senders\'s email on the inbox scrseen is incorrect. ' 'Expected subject is %s. Actual subject is %s.' % ( mock_email.subject, email.subject)) # check if the email message is fine self.assertEqual(email.body, mock_email.message, 'Email message on read email screen is incorrect. ' 'Expected message is "%s". Actual message is ' '"%s".' % (mock_email.message, email.body))
class TestUtilityTraySettingsAccessibility(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.system = System(self.marionette) def test_a11y_utility_tray_settings(self): self.system.wait_for_status_bar_displayed() utility_tray = self.system.open_utility_tray() settings = utility_tray.a11y_click_quick_settings_full_app() # Make sure that Settings is the currently displayed app. Wait(self.marionette).until(lambda m: self.apps.displayed_app.name == settings.name)
def test_sms_notification(self): _text_message_content = "Automated Test %s" % str(time.time()) system = System(self.marionette) # Send a SMS to the device self.data_layer.send_sms(self.testvars['carrier']['phone_number'], _text_message_content) # We will wait upto 300 seconds for the SMS to arrive due to network latency system.wait_for_notification_toaster_displayed(timeout=300, message="Notification did not appear. SMS database dump: %s " % self.data_layer.get_all_sms()) system.wait_for_notification_toaster_not_displayed() self.assertTrue(any("Messages" in app.name for app in self.apps.running_apps()))
class TestUtilityTraySettingsAccessibility(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.system = System(self.marionette) def test_a11y_utility_tray_settings(self): self.system.wait_for_status_bar_displayed() utility_tray = self.system.open_utility_tray() utility_tray.wait_for_notification_container_displayed() settings = utility_tray.a11y_click_quick_settings_full_app() # Make sure that Settings is the currently displayed app. self.assertEquals(self.apps.displayed_app.name, settings.name)
def test_cost_control_data_alert_mobile(self): """https://moztrap.mozilla.org/manage/case/8938/""" cost_control = CostControl(self.marionette) cost_control.launch() cost_control.switch_to_ftu() cost_control.run_ftu_accepting_defaults() self.assertTrue(cost_control.is_mobile_data_tracking_on) self.assertFalse(cost_control.is_wifi_data_tracking_on) settings = cost_control.tap_settings() self.assertFalse(settings.is_data_alert_switch_checked) settings.toggle_data_alert_switch() self.assertTrue(settings.is_data_alert_switch_checked) settings.reset_mobile_usage() settings.select_when_use_is_above_unit_and_value(u'MB', '0.1') settings.tap_done() self.assertTrue(cost_control.is_mobile_data_tracking_on) # open browser to get some data downloaded search = Search(self.marionette) search.launch(launch_timeout=30000) browser = search.go_to_url('http://mozqa.com/qa-testcase-data/Images/sample_png_02.png') browser.wait_for_page_to_load(180) browser.switch_to_content() Wait(self.marionette, timeout=60).until(lambda m: "sample_png_02.png" in m.title) browser.switch_to_chrome() system = System(self.marionette) utility_tray = system.open_utility_tray() utility_tray.wait_for_notification_container_displayed() # switch to cost control widget usage_iframe = self.marionette.find_element(*self._cost_control_widget_locator) self.marionette.switch_to_frame(usage_iframe) # make sure the color changed # The timeout is increased, because for some reason, it takes some time # before the limit view is shown (the browser has to finish loading?) usage_view = self.marionette.find_element(*self._data_usage_view_locator) Wait(self.marionette, timeout=40).until(lambda m: 'reached-limit' in usage_view.get_attribute('class'), message='Data usage bar did not breach limit') usage_view.tap() self.wait_for_condition(lambda m: self.apps.displayed_app.name == cost_control.name)
def test_sms_notification(self): """ https://moztrap.mozilla.org/manage/case/1322/ """ _text_message_content = "Automated Test %s" % str(time.time()) system = System(self.marionette) self.data_layer.send_sms(self.environment.phone_numbers[0], _text_message_content, skip_verification=True) # We will wait upto 300 seconds for the SMS to arrive due to network latency system.wait_for_notification_toaster_displayed(timeout=300) system.wait_for_notification_toaster_not_displayed() self.assertTrue(any("Messages" in app.name for app in self.apps.running_apps()))
def test_cell_data_for_one_sim_in_dsds_device(self): """ https://moztrap.mozilla.org/manage/case/1373/ """ settings = Settings(self.marionette) settings.launch() cell_and_data_settings = settings.open_cell_and_data_dual_sim() self.assertNotEqual(cell_and_data_settings.carrier_name, '') cell_data_prompt = cell_and_data_settings.enable_data() cell_data_prompt.turn_on() self.wait_for_condition( lambda m: cell_and_data_settings.is_data_toggle_checked) status_bar = System(self.marionette).status_bar.minimized status_bar.wait_for_data_to_be_connected()
def test_enable_cell_data_via_settings_app(self): """ https://moztrap.mozilla.org/manage/case/1373/ """ settings = Settings(self.marionette) settings.launch() cell_and_data_settings = settings.open_cell_and_data() self.assertNotEqual(cell_and_data_settings.carrier_name, '') self.assertFalse(cell_and_data_settings.is_data_toggle_checked) cell_data_prompt = cell_and_data_settings.enable_data() self.assertTrue(cell_and_data_settings.is_data_toggle_checked) cell_data_prompt.turn_on() status_bar = System(self.marionette).status_bar.minimized status_bar.wait_for_data_to_be_connected()
def is_keyboard_displayed(self): input_window = self.marionette.find_element( *self._input_window_locator) # if we have software buttons, keyboard's y will not be 0 but the minus height of the button container. expected_y = -System(self.marionette).software_buttons_height return (input_window.is_displayed() and (int(input_window.location['y']) == expected_y))
def setUp(self): GaiaTestCase.setUp(self) try: self.testvars['plivo'] except KeyError: raise SkipTest('Plivo account details not present in test variables') plivo = PlivoUtil( self.testvars['plivo']['auth_id'], self.testvars['plivo']['auth_token'], self.testvars['plivo']['phone_number'] ) plivo.send_sms(to_number=self.environment.phone_numbers[0].replace('+', ''), message=self._generate_text()) system = System(self.marionette) system.wait_for_notification_toaster_displayed(timeout=300)
def test_gallery_view(self): """ https://moztrap.mozilla.org/manage/case/14645/ """ screen_width = System(self.marionette).screen_width screen_height = System(self.marionette).screen_height_without_software_home_button gallery = Gallery(self.marionette) gallery.launch() gallery.wait_for_files_to_load(1) image = gallery.tap_first_gallery_item() self.assertIsNotNone(image.current_image_source) # Check that there are 5 options displayed beneath the picture self.assertEqual(len(image.photo_toolbar_options), 5) # Verify that the screen orientation is in portrait mode self.assertTrue(image.is_photo_toolbar_displayed) self.assertEqual('portrait-primary', self.device.screen_orientation) self.assertEqual(screen_width, image.photo_toolbar_width) # Change the screen orientation to landscape mode and verify that the screen is in landscape mode self.device.change_orientation('landscape-primary') # Here we sleep only to give visual feedback when observing the test run time.sleep(1) self.assertTrue(image.is_photo_toolbar_displayed) self.assertEqual('landscape-primary', self.device.screen_orientation) self.assertEqual(screen_height, image.photo_toolbar_width) # Unlock the screen so that it can be changed back to portrait mode self.marionette.execute_script('window.screen.mozUnlockOrientation()') # Change the screen orientation back to portrait-primary and verify the screen is in portrait mode self.device.change_orientation('portrait-primary') # Here we sleep only to give visual feedback when observing the test run time.sleep(1) self.assertTrue(image.is_photo_toolbar_displayed) self.assertEqual('portrait-primary', self.device.screen_orientation) self.assertEqual(screen_width, image.photo_toolbar_width)
class TestUtilityTrayNotificationsAccessibility(GaiaTestCase): def setUp(self): GaiaTestCase.setUp(self) self.system = System(self.marionette) def test_a11y_utility_tray_notifications(self): self.system.wait_for_status_bar_displayed() utility_tray = self.system.open_utility_tray() self.marionette.execute_script( 'new Notification("Title", {body: "Body"});') # Assert there is one notification is listed in notifications-container notifications = utility_tray.notifications self.assertEqual(1, len(notifications), 'Expected one notification.') # Clear the notification by "Clear all" utility_tray.a11y_clear_all_notifications() # wait for the notifications to be cleared self.wait_for_condition(lambda m: len(utility_tray.notifications) == 0)
def setUp(self): GaiaTestCase.setUp(self) self.connect_to_local_area_network() self.homescreen = Homescreen(self.marionette) self.apps.switch_to_displayed_app() self.test_data = { 'name': 'Mozilla QA WebRT Tester', 'url': self.marionette.absolute_url('webapps/mozqa.com/manifest.webapp') } self.logger.info('Test data: %s' % self.test_data) # Install app self.marionette.execute_script('navigator.mozApps.install("%s")' % self.test_data['url']) # Confirm the installation and wait for the app icon to be present confirm_install = ConfirmInstall(self.marionette) confirm_install.tap_confirm() # Wait for the notification to disappear system = System(self.marionette) system.wait_for_system_banner_displayed() system.wait_for_system_banner_not_displayed() self.apps.switch_to_displayed_app() self.homescreen.wait_for_app_icon_present(self.test_data['name'])
def test_dialer_miss_call_from_known_contact_notification(self): """ https://moztrap.mozilla.org/manage/case/9294/ """ PLIVO_TIMEOUT = 30 self.device.lock() from gaiatest.utils.plivo.plivo_util import PlivoUtil self.plivo = PlivoUtil(self.testvars['plivo']['auth_id'], self.testvars['plivo']['auth_token'], self.testvars['plivo']['phone_number']) self.call_uuid = self.plivo.make_call( to_number=self.testvars['local_phone_numbers'][0].replace('+', ''), timeout=PLIVO_TIMEOUT) call_screen = CallScreen(self.marionette) call_screen.wait_for_incoming_call_with_locked_screen() self.plivo.hangup_call(self.call_uuid) Wait(self.plivo, timeout=PLIVO_TIMEOUT).until( lambda p: p.is_call_completed(self.call_uuid), message="Plivo didn't report the call as completed") self.call_uuid = None # Verify the user sees a missed call notification message # and the known contacts info is shown. system = System(self.marionette) self.marionette.switch_to_frame() system.wait_for_notification_toaster_displayed() lock_screen = LockScreen(self.marionette) notifications = lock_screen.notifications self.assertEqual(notifications[0].title, 'Missed call') self.assertTrue(self.contact.givenName in notifications[0].content) system.wait_for_notification_toaster_not_displayed() # Verify the user sees the missed call event in the notification center # and the known contacts info is shown. self.device.unlock() system.wait_for_status_bar_displayed() utility_tray = system.open_utility_tray() utility_tray.wait_for_notification_container_displayed() notifications = utility_tray.notifications self.assertEqual(notifications[0].title, 'Missed call') self.assertTrue(self.contact.givenName in notifications[0].content)
def setUp(self): GaiaTestCase.setUp(self) self.connect_to_network() # Turn off geolocation prompt for smart collections self.apps.set_permission('Smart Collections', 'geolocation', 'deny') self.homescreen = Homescreen(self.marionette) self.apps.switch_to_displayed_app() if not self.apps.is_app_installed(self.APP_NAME): # Install app self.marionette.execute_script('navigator.mozApps.install("%s")' % self.MANIFEST) # Confirm the installation and wait for the app icon to be present confirm_install = ConfirmInstall(self.marionette) confirm_install.tap_confirm() # Wait for the notification to disappear system = System(self.marionette) system.wait_for_system_banner_displayed() system.wait_for_system_banner_not_displayed() self.apps.switch_to_displayed_app() self.homescreen.wait_for_app_icon_present(self.APP_NAME)
def setUp(self): GaiaTestCase.setUp(self) self.connect_to_local_area_network() # Turn off geolocation prompt for smart collections self.apps.set_permission('Smart Collections', 'geolocation', 'deny') self.homescreen = Homescreen(self.marionette) self.apps.switch_to_displayed_app() self.test_data = { 'name': 'Mozilla QA WebRT Tester', 'url': self.marionette.absolute_url('webapps/mozqa.com/manifest.webapp'), 'title': 'Directory listing for /' } # Install app self.marionette.execute_script('navigator.mozApps.install("%s")' % self.test_data['url']) # Confirm the installation and wait for the app icon to be present confirm_install = ConfirmInstall(self.marionette) confirm_install.tap_confirm() # Wait for the notification to disappear system = System(self.marionette) system.wait_for_system_banner_displayed() system.wait_for_system_banner_not_displayed() self.apps.switch_to_displayed_app() self.homescreen.wait_for_app_icon_present(self.test_data['name'])
def setUp(self): GaiaTestCase.setUp(self) self.connect_to_local_area_network() self.homescreen = Homescreen(self.marionette) self.apps.switch_to_displayed_app() self.test_data = { 'name': 'packagedapp1', 'url': self.marionette.absolute_url('webapps/packaged1/manifest.webapp'), 'title': 'Packaged app1' } # Install app self.marionette.execute_script( 'navigator.mozApps.installPackage("%s")' % self.test_data['url']) # Confirm the installation and wait for the app icon to be present confirm_install = ConfirmInstall(self.marionette) confirm_install.tap_confirm() # Wait for the notification to disappear system = System(self.marionette) system.wait_for_system_banner_displayed() system.wait_for_system_banner_not_displayed() self.apps.switch_to_displayed_app() self.homescreen.wait_for_app_icon_present(self.test_data['name'])
def test_music_share_ringtone(self): """ https://moztrap.mozilla.org/manage/case/2683/ """ music_app = Music(self.marionette) music_app.launch() music_app.wait_for_music_tiles_displayed() # switch to songs view, and play the first one on the list list_view = music_app.tap_songs_tab() songs = list_view.media self.assertGreater(len(songs), 0, 'The ogg file could not be found') player_view = songs[0].tap_first_song() # wait until the player view is shown, then tap the share button play_time = time.strptime('00:01', '%M:%S') Wait(self.marionette).until(lambda m: player_view.player_elapsed_time >= play_time) activities = player_view.tap_share_button() ringtone = activities.share_to_ringtones() ringtone.tap_save() system = System(self.marionette) self.marionette.switch_to_frame() system.wait_for_notification_toaster_displayed(message="Ringtone set as default.") system.wait_for_notification_toaster_not_displayed() settings = Settings(self.marionette) settings.launch() sound = settings.open_sound() # desktop b2g doesn't have this option visible, see bug 1130538 if sound.ring_tone_selector_visible: self.assertEqual(sound.current_ring_tone, 'MUS_0001')
class TestNotificationVisibilityAccessibility(GaiaTestCase): # notification data _notification_title = 'TestNotificationBar_TITLE' _notification_body = 'TestNotificationBar_BODY' def setUp(self): GaiaTestCase.setUp(self) self.system = System(self.marionette) def test_a11y_notification_visibility(self): # By default notification toaster should be invisible to the screen reader. self.assertTrue( self.accessibility.is_hidden( self.marionette.find_element( *self.system._notification_toaster_locator))) # Push a notification self.marionette.execute_script( 'new Notification("%s", {body: "%s"});' % (self._notification_title, self._notification_body)) self.system.wait_for_notification_toaster_displayed() # Now the notification toaster should be visible to the screen reader. self.assertTrue( self.accessibility.is_visible( self.marionette.find_element( *self.system._notification_toaster_locator))) self.system.wait_for_notification_toaster_not_displayed() # Again the notification toaster should be invisible to the screen reader. self.assertTrue( self.accessibility.is_hidden( self.marionette.find_element( *self.system._notification_toaster_locator)))