本文整理汇总了Python中gaiatest.apps.system.app.System类的典型用法代码示例。如果您正苦于以下问题:Python System类的具体用法?Python System怎么用?Python System使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了System类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_dialer_from_message
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"])
示例2: test_music_share_ringtone
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')
示例3: TestUtilityTrayVisibilityAccessibility
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))
示例4: setUp
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'])
示例5: setUp
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)
示例6: TestNotificationVisibilityAccessibility
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)))
示例7: test_browser_save_image
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')))
示例8: TestSoftwareButtonsVisibilityAccessibility
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)))
示例9: setUp
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'])
示例10: test_quick_settings_button
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()
示例11: test_notification_bar
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))
示例12: tap_element_from_system_app
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)
示例13: test_dialer_clear_miss_call_notification
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')
示例14: test_sms_notification
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")
示例15: test_quick_settings_button
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")