当前位置: 首页>>代码示例>>Python>>正文


Python Calendar.tap_add_event_button方法代码示例

本文整理汇总了Python中gaiatest.apps.calendar.app.Calendar.tap_add_event_button方法的典型用法代码示例。如果您正苦于以下问题:Python Calendar.tap_add_event_button方法的具体用法?Python Calendar.tap_add_event_button怎么用?Python Calendar.tap_add_event_button使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gaiatest.apps.calendar.app.Calendar的用法示例。


在下文中一共展示了Calendar.tap_add_event_button方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_that_new_event_appears_on_all_calendar_views

# 需要导入模块: from gaiatest.apps.calendar.app import Calendar [as 别名]
# 或者: from gaiatest.apps.calendar.app.Calendar import tap_add_event_button [as 别名]
    def test_that_new_event_appears_on_all_calendar_views(self):

        # We get the actual time of the device
        _seconds_since_epoch = self.marionette.execute_script("return Date.now();")
        now = datetime.fromtimestamp(_seconds_since_epoch / 1000)

        # We know that the default event time will be rounded up 1 hour
        event_start_date_time = now + timedelta(hours=1)

        event_title = 'Event Title %s' % str(event_start_date_time.time())
        event_location = 'Event Location %s' % str(event_start_date_time.time())

        calendar = Calendar(self.marionette)
        calendar.launch()
        new_event = calendar.tap_add_event_button()

        # create a new event
        new_event.fill_event_title(event_title)
        new_event.fill_event_location(event_location)

        new_event.tap_save_event()

        # assert that the event is displayed as expected in month view
        self.assertIn(event_title, calendar.displayed_events_in_month_view(event_start_date_time))
        self.assertIn(event_location, calendar.displayed_events_in_month_view(event_start_date_time))

        # switch to the week display
        calendar.tap_week_display_button()
        self.assertIn(event_title, calendar.displayed_events_in_week_view(event_start_date_time))

        # switch to the day display
        calendar.tap_day_display_button()
        self.assertIn(event_title, calendar.displayed_events_in_day_view(event_start_date_time))
        self.assertIn(event_location, calendar.displayed_events_in_day_view(event_start_date_time))
开发者ID:AnandMoorthy,项目名称:gaia,代码行数:36,代码来源:test_calendar_new_event_appears_on_all_calendar_views.py

示例2: test_that_new_event_appears_on_all_calendar_views

# 需要导入模块: from gaiatest.apps.calendar.app import Calendar [as 别名]
# 或者: from gaiatest.apps.calendar.app.Calendar import tap_add_event_button [as 别名]
    def test_that_new_event_appears_on_all_calendar_views(self):

        event_title = 'Event Title %s' % str(self.today.time())
        event_location = 'Event Location %s' % str(self.today.time())
        event_start_date_time = self.today.replace(hour=1, minute=0, second=0)
        event_end_date_time = self.today.replace(hour=2, minute=0, second=0)
        EVENT_DATE_TIME_TO_STRING_PATTERN = '%H:%M:%S'

        calendar = Calendar(self.marionette)
        calendar.launch()
        new_event = calendar.tap_add_event_button()

        # create a new event
        new_event.fill_event_title(event_title)
        new_event.fill_event_location(event_location)
        new_event.fill_event_start_time(event_start_date_time.strftime(EVENT_DATE_TIME_TO_STRING_PATTERN))
        new_event.fill_event_end_time(event_end_date_time.strftime(EVENT_DATE_TIME_TO_STRING_PATTERN))
        new_event.tap_save_event()

        # assert that the event is displayed as expected in month view
        self.assertIn(event_title, calendar.displayed_events_in_month_view(event_start_date_time))
        self.assertIn(event_location, calendar.displayed_events_in_month_view(event_start_date_time))

        # switch to the week display
        calendar.click_week_display_button()
        self.assertIn(event_title, calendar.displayed_events_in_week_view(event_start_date_time))

        # switch to the day display
        calendar.click_day_display_button()
        self.assertIn(event_title, calendar.displayed_events_in_day_view(event_start_date_time))
        self.assertIn(event_location, calendar.displayed_events_in_day_view(event_start_date_time))
开发者ID:Allan019,项目名称:gaia,代码行数:33,代码来源:test_calendar_new_event_appears_on_all_calendar_views.py

示例3: test_that_new_event_appears_on_all_calendar_views

# 需要导入模块: from gaiatest.apps.calendar.app import Calendar [as 别名]
# 或者: from gaiatest.apps.calendar.app.Calendar import tap_add_event_button [as 别名]
    def test_that_new_event_appears_on_all_calendar_views(self):
        """
        https://moztrap.mozilla.org/manage/case/6118/
        """

        # We get the actual time of the device
        _seconds_since_epoch = self.marionette.execute_script("return Date.now();")
        now = datetime.fromtimestamp(_seconds_since_epoch / 1000)

        event_title = 'Event Title %s' % str(now.time())
        event_location = 'Event Location %s' % str(now.time())

        calendar = Calendar(self.marionette)
        calendar.launch()
        new_event = calendar.tap_add_event_button()

        # create a new event
        new_event.fill_event_title(event_title)
        new_event.fill_event_location(event_location)

        event_start_date = new_event.tap_save_event()

        # assert that the event is displayed as expected in month view
        self.assertIn(event_title, calendar.displayed_events_in_month_view())
        self.assertIn(event_location, calendar.displayed_events_in_month_view())

        # switch to the week display
        calendar.tap_week_display_button()
        self.assertIn(event_title, calendar.displayed_events_in_week_view(event_start_date))

        # switch to the day display
        calendar.tap_day_display_button()
        self.assertIn(event_title, calendar.displayed_events_in_day_view(event_start_date))
        self.assertIn(event_location, calendar.displayed_events_in_day_view(event_start_date))
开发者ID:Archaeopteryx,项目名称:gaia,代码行数:36,代码来源:test_calendar_new_event_appears_on_all_calendar_views.py

示例4: test_lock_screen_open_calendar_notification

# 需要导入模块: from gaiatest.apps.calendar.app import Calendar [as 别名]
# 或者: from gaiatest.apps.calendar.app.Calendar import tap_add_event_button [as 别名]
    def test_lock_screen_open_calendar_notification(self):

        _seconds_since_epoch = self.marionette.execute_script("return Date.now();")
        now = datetime.fromtimestamp((_seconds_since_epoch + 60*1000*2) / 1000)

        event_title = '%s' % str(now.time())
        event_location = '%s' % str(now.time())

        base = Base(self.marionette)
        base.apps.launch('Calendar')
        
        calendar = Calendar(self.marionette)
        new_event = calendar.tap_add_event_button()
        
        # create a new event
        
        # input event title & location
        _event_title_input_locator = (By.XPATH, "//input[@data-l10n-id='event-title']")
        _event_location_input_locator = (By.XPATH, "//input[@data-l10n-id='event-location']")
        
        title_field = self.marionette.find_element(*_event_title_input_locator)
        title_field.send_keys(event_title)
        
        location_field = self.marionette.find_element(*_event_location_input_locator)
        location_field.send_keys(event_title)  
        
        # select event time
        m = self.marionette
        start = m.find_element("css selector",'span[id="start-time-locale"]')
        start.tap()
        
        current_minute = self.marionette.execute_script("var d = new Date(); return d.getMinutes()")
        current_hour   = self.marionette.execute_script("var h = new Date(); return h.getHours()")
        time_picker = TimePicker(self.marionette)
        
        # pick the event time
        num = int(current_minute)+2
        if num <58:
            for no in range(num):
                time_picker._flick_menu_up(time_picker._minutes_picker_locator)
        else:
            time_picker._flick_menu_up(time_picker._minutes_picker_locator)
                
        if int(current_hour) == 11:
            time_picker.spin_hour24()
            
        if int(current_hour) == 12:
            for no in range(11):
                time_picker._flick_menu_up(time_picker._hour_picker_locator)
        else:
            time_picker._flick_menu_down(time_picker._hour_picker_locator)

        for item in m.find_elements("css selector",'button.value-selector-confirm'):
            if item.is_displayed() == True:
                item.tap()
        self.apps.switch_to_displayed_app()
        
        # select the remind me timing
        _select_timing_locator = (By.CSS_SELECTOR, 'span[class="button icon icon-dialog"] > select[name="alarm[]"]')
        self.wait_for_element_displayed(*_select_timing_locator)        
        display_item = self.marionette.find_element(*_select_timing_locator)
        self.marionette.execute_script("arguments[0].scrollIntoView(false);", [display_item])
        display_item.tap()
        
        #switch to frame
        self.marionette.switch_to_frame()
        options = self.marionette.find_elements(By.CSS_SELECTOR, 'ol[class="value-selector-options-container"] > li')
        
        for li in options:
            if li.text == 'At time of event':
                li.tap()
                break
        
        for item in m.find_elements(By.CSS_SELECTOR, 'button.value-option-confirm'):
            if item.is_displayed() == True:
                item.tap()
        self.apps.switch_to_displayed_app()
        
        # save the event
        event_start_date_time = new_event.tap_save_event()
        
        # wait for event pop-up
        self.device.lock()
        self.device.turn_screen_off()
        
        #lock_screen = LockScreen(self.marionette)
        self.wait_for_element_displayed(By.CSS_SELECTOR, '#notifications-lockscreen-container > div.notification', timeout=120)
        
        #Click notification
        notifications = self.marionette.find_elements(By.CSS_SELECTOR, '#notifications-lockscreen-container div[class="notification"]')

        for no in notifications:
            if event_title in no.text:
                no.tap()
                open = self.marionette.find_element(By.CSS_SELECTOR, '#notifications-lockscreen-container span[class="button-actionable"]')
                open.tap()
                break;
        
        self.wait_for_condition(lambda m: self.apps.displayed_app.name == 'Calendar')
        self.assertEqual(self.apps.displayed_app.name, 'Calendar')
开发者ID:gerrycfchang,项目名称:ActOnLock,代码行数:102,代码来源:test_open_calendar_notification.py


注:本文中的gaiatest.apps.calendar.app.Calendar.tap_add_event_button方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。