本文整理汇总了Python中gaiatest.apps.clock.app.Clock.dismiss_banner方法的典型用法代码示例。如果您正苦于以下问题:Python Clock.dismiss_banner方法的具体用法?Python Clock.dismiss_banner怎么用?Python Clock.dismiss_banner使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gaiatest.apps.clock.app.Clock
的用法示例。
在下文中一共展示了Clock.dismiss_banner方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestClockAddAlarmMultipleTimes
# 需要导入模块: from gaiatest.apps.clock.app import Clock [as 别名]
# 或者: from gaiatest.apps.clock.app.Clock import dismiss_banner [as 别名]
class TestClockAddAlarmMultipleTimes(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.clock = Clock(self.marionette)
self.clock.launch()
def test_clock_add_alarm_multiple_times(self):
""" Add multiple alarm
https://moztrap.mozilla.org/manage/case/1773/
"""
count = 3
for i in range(1, count + 1):
# create a new alarm with the default values that are available
new_alarm = self.clock.tap_new_alarm()
new_alarm.type_alarm_label(' '.join(['alarm', str(i)]))
new_alarm.tap_done()
# verify the banner-countdown message appears
self.assertIn('The alarm is set for',
self.clock.banner_notification)
self.clock.dismiss_banner()
# Ensure the new alarm has been added and is displayed
self.assertEqual(i, len(self.clock.alarms))
示例2: TestClockDeleteAlarm
# 需要导入模块: from gaiatest.apps.clock.app import Clock [as 别名]
# 或者: from gaiatest.apps.clock.app.Clock import dismiss_banner [as 别名]
class TestClockDeleteAlarm(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.clock = Clock(self.marionette)
self.clock.launch()
# create a new alarm with the default values that are available
new_alarm = self.clock.tap_new_alarm()
self.clock = new_alarm.tap_done()
self.clock.dismiss_banner()
def test_clock_delete_alarm(self):
""" Delete alarm
https://moztrap.mozilla.org/manage/case/1783/
"""
# find the origin alarms' number
initial_alarms_count = len(self.clock.alarms)
# edit alarm
edit_alarm = self.clock.alarms[0].tap()
# delete alarm
self.clock = edit_alarm.tap_delete()
# wait alarm item not displayed
self.clock.wait_for_new_alarm_button()
self.wait_for_condition(lambda m: len(self.clock.alarms) != initial_alarms_count)
self.assertEqual(len(self.clock.alarms), initial_alarms_count - 1, "delete alarm failed.")
示例3: TestClockSetAlarm
# 需要导入模块: from gaiatest.apps.clock.app import Clock [as 别名]
# 或者: from gaiatest.apps.clock.app.Clock import dismiss_banner [as 别名]
class TestClockSetAlarm(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.clock = Clock(self.marionette)
self.clock.launch()
def test_clock_set_alarm(self):
new_alarm = self.clock.tap_new_alarm()
# Ensure repeat has the default value
self.assertEquals(new_alarm.alarm_repeat, 'Never')
# Set label
new_alarm.type_alarm_label("TestSetAlarmRepeat")
# Loop the options and select the ones in match list
for option in ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday']:
new_alarm.select_repeat(option)
self.assertEqual('Weekdays', new_alarm.alarm_repeat)
new_alarm.select_repeat('Sunday')
# In this locale, Sunday is the first day of the week; it appears first.
self.assertEqual('Sun, Mon, Tue, Wed, Thu, Fri', new_alarm.alarm_repeat)
new_alarm.select_repeat('Sunday')
self.assertEqual('Weekdays', new_alarm.alarm_repeat)
# Ensure sound has the default value
self.assertEquals(new_alarm.alarm_sound, 'Classic Buzz')
# Set sound
new_alarm.select_sound('Gem Echoes')
self.assertEqual('Gem Echoes', new_alarm.alarm_sound)
# Ensure snooze has the default value
self.assertEquals(new_alarm.alarm_snooze, '5 minutes')
# Set snooze
new_alarm.select_snooze('15 minutes')
self.assertEqual('15 minutes', new_alarm.alarm_snooze)
# Save the alarm
new_alarm.tap_done()
self.clock.dismiss_banner()
# Tap to Edit alarm
edit_alarm = self.clock.alarms[0].tap()
# Verify selected options
self.assertEqual('Weekdays', edit_alarm.alarm_repeat)
self.assertEqual('Gem Echoes', new_alarm.alarm_sound)
self.assertEqual('15 minutes', new_alarm.alarm_snooze)
edit_alarm.tap_done()
self.clock.dismiss_banner()
示例4: TestClockAlarmInLockscreen
# 需要导入模块: from gaiatest.apps.clock.app import Clock [as 别名]
# 或者: from gaiatest.apps.clock.app.Clock import dismiss_banner [as 别名]
class TestClockAlarmInLockscreen(PasscodeTestCase):
_input_passcode = '1337'
def setUp(self):
PasscodeTestCase.setUp(self)
self.set_passcode_to_1337()
self.data_layer.set_setting('lockscreen.passcode-lock.enabled', True)
self.clock = Clock(self.marionette)
self.clock.launch()
def test_clock_set_alarm_in_lockscreen(self):
""" Dismiss alarm in lockscreen
https://moztrap.mozilla.org/manage/cases/15805/
"""
alarm_label_text = 'Test Alarm'
# Set the time on the device so that it starts with 0 seconds
_seconds_since_epoch = self.marionette.execute_script("""
var today = new Date();
var yr = today.getFullYear();
var mth = today.getMonth();
var day = today.getDate();
return new Date(yr, mth, day, 1, 0, 0).getTime();""")
self.data_layer.set_time(_seconds_since_epoch)
alarm = self.clock.switch_view('alarm')
new_alarm = alarm.tap_new_alarm()
new_alarm.type_alarm_label(alarm_label_text)
time_picker = new_alarm.tap_time()
time_picker.add_minute()
time_picker.tap_done()
self.clock = new_alarm.tap_done()
self.clock.dismiss_banner()
self.assertTrue(alarm.alarm_items[0].is_alarm_active)
self.device.lock()
self.alarm_alert = AlarmAlertScreen(self.marionette)
self.alarm_alert.wait_for_alarm_to_trigger()
# Check that the alarm name is the one we set
self.assertEqual(self.alarm_alert.alarm_label, alarm_label_text)
self.alarm_alert.tap_stop_alarm()
self.assertTrue(self.device.is_locked)
示例5: TestClockCreateNewAlarm
# 需要导入模块: from gaiatest.apps.clock.app import Clock [as 别名]
# 或者: from gaiatest.apps.clock.app.Clock import dismiss_banner [as 别名]
class TestClockCreateNewAlarm(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
# Set the time on the device
_seconds_since_epoch = self.marionette.execute_script("""
var today = new Date();
var yr = today.getFullYear();
var mth = today.getMonth();
var day = today.getDate();
return new Date(yr, mth, day, 1, 0, 0).getTime();""")
self.data_layer.set_time(_seconds_since_epoch)
self.clock = Clock(self.marionette)
self.clock.launch()
def test_clock_create_new_alarm(self):
""" Add an alarm and set label of the new alarm
https://moztrap.mozilla.org/manage/case/1772/
https://moztrap.mozilla.org/manage/case/1775/
"""
alarm_label_text = "test4321"
# get the number of alarms set, before adding the new alarm
initial_alarms_count = len(self.clock.alarms)
# create a new alarm with the default values that are available
new_alarm = self.clock.tap_new_alarm()
# Ensure label has the default placeholder and text
self.assertEquals(new_alarm.alarm_label_placeholder, 'Alarm name')
# set label
new_alarm.type_alarm_label(alarm_label_text)
self.clock = new_alarm.tap_done()
# verify the banner-countdown message appears
alarm_msg = self.clock.banner_notification
self.assertTrue('The alarm is set for' in alarm_msg, 'Actual banner message was: "' + alarm_msg + '"')
self.clock.dismiss_banner()
# ensure the new alarm has been added and it is displayed
self.assertTrue(initial_alarms_count < len(self.clock.alarms),
'Alarms count did not increment')
# verify the label of alarm
alarms = self.clock.alarms
self.assertEqual(len(alarms), 1)
self.assertEqual(alarms[0].label, alarm_label_text)
alarm_time = self.clock.alarms[0].time()
# tap to Edit alarm
edit_alarm = alarms[0].tap()
# Set the alarm time to 1 min more than the current time
time_picker = edit_alarm.tap_time()
time_picker.spin_minute()
time_picker.tap_done()
edit_alarm.tap_done()
self.clock.dismiss_banner()
self.assertNotEqual(self.clock.alarms[0].time, alarm_time)
# turn off the alarm
self.clock.alarms[0].tap_checkbox()
self.clock.alarms[0].wait_for_checkbox_to_change_state(False)
self.assertFalse(self.clock.alarms[0].is_alarm_active, 'user should be able to turn on the alarm.')
# turn on the alarm
self.clock.alarms[0].tap_checkbox()
self.clock.dismiss_banner()
self.assertTrue(self.clock.alarms[0].is_alarm_active, 'user should be able to turn off the alarm.')
self.device.touch_home_button()
self.marionette.switch_to_frame()
self.alarm_alert = AlarmAlertScreen(self.marionette)
self.alarm_alert.wait_for_alarm_to_trigger()
# Check that the alarm name is the one we set
self.assertEqual(self.alarm_alert.alarm_label, alarm_label_text)
self.alarm_alert.tap_stop_alarm()
# Switch back to top level now that Clock app is gone
self.wait_for_condition(lambda m: self.apps.displayed_app.name == Homescreen.name)
示例6: TestClockCreateNewAlarm
# 需要导入模块: from gaiatest.apps.clock.app import Clock [as 别名]
# 或者: from gaiatest.apps.clock.app.Clock import dismiss_banner [as 别名]
class TestClockCreateNewAlarm(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.clock = Clock(self.marionette)
self.clock.launch()
def test_clock_create_new_alarm(self):
""" Add an alarm and set label of the new alarm
https://moztrap.mozilla.org/manage/case/1772/
https://moztrap.mozilla.org/manage/case/1775/
"""
alarm_label_text = "test4321"
# get the number of alarms set, before adding the new alarm
initial_alarms_count = len(self.clock.alarms)
# create a new alarm with the default values that are available
new_alarm = self.clock.tap_new_alarm()
# Ensure label has the default placeholder and text
self.assertEquals(new_alarm.alarm_label_placeholder, 'Alarm name')
# set label
new_alarm.type_alarm_label(alarm_label_text)
self.clock = new_alarm.tap_done()
# verify the banner-countdown message appears
alarm_msg = self.clock.banner_notification
self.assertTrue('The alarm is set for' in alarm_msg, 'Actual banner message was: "' + alarm_msg + '"')
self.clock.dismiss_banner()
# ensure the new alarm has been added and is displayed
self.assertTrue(initial_alarms_count < len(self.clock.alarms),
'Alarms count did not increment')
# verify the label of alarm
alarms = self.clock.alarms
self.assertEqual(len(alarms), 1)
self.assertEqual(alarms[0].label, alarm_label_text)
# Tap to Edit alarm
edit_alarm = alarms[0].tap()
# TODO: change alarm time after Bug 946130 is fixed
# edit_alarm.tap_time()
# self.marionette.switch_to_frame()
# edit_alarm.spin_hour()
# edit_alarm.spin_minute()
# edit_alarm.spin_hour24()
edit_alarm.tap_done()
self.clock.dismiss_banner()
# TODO: assert that alarm time has changed after Bug 946130 is fixed
# turn off the alarm
self.clock.alarms[0].tap_checkbox()
self.clock.alarms[0].wait_for_checkbox_to_change_state(False)
self.assertFalse(self.clock.alarms[0].is_alarm_active, 'user should be able to turn on the alarm.')
# turn on the alarm
self.clock.alarms[0].tap_checkbox()
self.clock.dismiss_banner()
self.assertTrue(self.clock.alarms[0].is_alarm_active, 'user should be able to turn off the alarm.')