예제 #1
0
class TestCalendarSettingsViewAccessibility(GaiaTestCase):
    def setUp(self):
        GaiaTestCase.setUp(self)

        self.calendar = Calendar(self.marionette)
        self.calendar.launch()
        self.calendar.a11y_click_settings()

    def test_a11y_calendar_settings_view(self):

        settings = self.calendar.settings

        # Check that the local calencar is checked
        self.assertTrue(
            self.marionette.find_element(
                *settings._calendar_local_checkbox_locator).get_attribute(
                    'checked'))
        self.assertTrue(
            self.marionette.find_element(*settings._calendar_local_locator).
            get_attribute('aria-selected') == 'true')

        # Uncheck the local calendar
        self.accessibility.click(
            self.marionette.find_element(*settings._calendar_local_locator))

        # Check that the local calendar is unchecked
        self.wait_for_condition(lambda m: not m.find_element(
            *settings._calendar_local_checkbox_locator).get_attribute('checked'
                                                                      ))
        self.wait_for_condition(lambda m: not m.find_element(
            *settings._calendar_local_locator).get_attribute('aria-selected'))
class TestCalendarMonthViewSelectDayAccessibility(GaiaTestCase):

    def setUp(self):
        GaiaTestCase.setUp(self)

        self.today = datetime.date.today()
        self.previous_day = self.today - datetime.timedelta(days=1)
        self.next_day = self.today + datetime.timedelta(days=1)

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

    def test_a11y_calendar_month_view_select_day(self):

        WEEKDAY_MONTH_DAY_PATTERN = '%A, %b %-d'

        # By default current date event list should be rendered.
        self.assertEquals(self.today.strftime(WEEKDAY_MONTH_DAY_PATTERN).upper(),
                          self.calendar.event_list_date)

        # Click on another day in the grid.
        other_day = self.calendar.a11y_click_other_day(self.next_day, self.previous_day)

        # Other day date's event list should be rendered.
        self.assertEquals(other_day.strftime(WEEKDAY_MONTH_DAY_PATTERN).upper(),
                          self.calendar.event_list_date)
예제 #3
0
class TestCalendarSettingsViewAccessibility(GaiaTestCase):

    def setUp(self):
        GaiaTestCase.setUp(self)

        self.calendar = Calendar(self.marionette)
        self.calendar.launch()
        self.calendar.a11y_click_settings()

    def test_a11y_calendar_settings_view(self):

        settings = self.calendar.settings

        # Check that the local calencar is checked
        self.assertTrue(self.marionette.find_element(
            *settings._calendar_local_checkbox_locator).get_attribute('checked'))
        self.assertTrue(self.marionette.find_element(
            *settings._calendar_local_locator).get_attribute('aria-selected') == 'true')

        # Uncheck the local calendar
        self.accessibility.click(self.marionette.find_element(*settings._calendar_local_locator))

        # Check that the local calendar is unchecked
        settings.wait_for_calendar_unchecked()
        settings.wait_for_a11y_calendar_unchecked()
class TestCalendarMonthViewSelectDayAccessibility(GaiaTestCase):
    def setUp(self):
        GaiaTestCase.setUp(self)

        self.today = datetime.date.today()
        self.previous_day = self.today - datetime.timedelta(days=1)
        self.next_day = self.today + datetime.timedelta(days=1)

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

    def test_a11y_calendar_month_view_select_day(self):

        WEEKDAY_MONTH_DAY_PATTERN = '%A, %b %-d'

        # By default current date event list should be rendered.
        self.assertEquals(
            self.today.strftime(WEEKDAY_MONTH_DAY_PATTERN).upper(),
            self.calendar.event_list_date)

        # Click on another day in the grid.
        other_day = self.calendar.a11y_click_other_day(self.next_day,
                                                       self.previous_day)

        # Other day date's event list should be rendered.
        self.assertEquals(
            other_day.strftime(WEEKDAY_MONTH_DAY_PATTERN).upper(),
            self.calendar.event_list_date)
예제 #5
0
    def setUp(self):
        GaiaTestCase.setUp(self)

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

        self.event_title = 'title'
        self.calendar.a11y_create_event(self.event_title)
    def setUp(self):
        GaiaTestCase.setUp(self)

        self.today = datetime.date.today()
        # Determine the name and the year of the next month
        self.next_month_year = self.today.replace(day=1) + datetime.timedelta(days=32)

        self.calendar = Calendar(self.marionette)
        self.calendar.launch()
    def setUp(self):
        GaiaTestCase.setUp(self)

        self.today = datetime.date.today()
        self.previous_day = self.today - datetime.timedelta(days=1)
        self.next_day = self.today + datetime.timedelta(days=1)

        self.calendar = Calendar(self.marionette)
        self.calendar.launch()
예제 #8
0
    def setUp(self):
        GaiaTestCase.setUp(self)

        self.calendar = Calendar(self.marionette)
        self.calendar.launch()
        self.clock = Clock(self.marionette)
        self.clock.launch()

        # Switch to top level frame before starting the test
        self.marionette.switch_to_frame()
예제 #9
0
    def test_check_today_date(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)

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

        self.assertEquals(now.strftime('%B %Y'), calendar.current_month_year)
        self.assertIn(now.strftime('%a %b %d %Y'), calendar.current_month_day)
예제 #10
0
    def test_check_today_date(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)

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

        self.assertEquals(now.strftime('%B %Y'), calendar.current_month_year)
        self.assertIn(now.strftime('%a %b %d %Y'), calendar.current_month_day)
    def setUp(self):
        GaiaTestCase.setUp(self)

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

        self.views = {
            'time_views': self.marionette.find_element(*self.calendar._time_views_locator),
            'current_day': self.marionette.find_element(
                *self.calendar._current_months_day_locator),
            'month': self.marionette.find_element(
                *self.calendar._current_monthly_calendar_locator),
            'day': self.marionette.find_element(*self.calendar._day_view_locator),
            'week': self.marionette.find_element(*self.calendar._week_view_locator),
            'settings': self.marionette.find_element(*self.calendar._settings_locator),
            'advanced_settings': self.marionette.find_element(
                *self.calendar._advanced_settings_view_locator),
            'modify_event': self.marionette.find_element(*self.calendar._modify_event_view_locator),
            'event': self.marionette.find_element(*self.calendar._event_view_locator),
            'create_account': self.marionette.find_element(
                *self.calendar._create_account_view_locator),
            'modify_account': self.marionette.find_element(
                *self.calendar._modify_account_view_locator)
        }

        self.event_title = 'title'
        new_event = self.calendar.a11y_click_add_event_button()
        # create a new event
        new_event.a11y_fill_event_title(self.event_title)
        new_event.a11y_click_save_event()
        self.calendar.wait_for_events(1)
    def setUp(self):
        GaiaTestCase.setUp(self)

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

        self.views = {
            'time_views': self.marionette.find_element(*self.calendar._time_views_locator),
            'current_day': self.marionette.find_element(
                *self.calendar._current_month_day_agenda_locator),
            'month': self.marionette.find_element(
                *self.calendar._current_monthly_calendar_locator),
            'day': self.marionette.find_element(*self.calendar._day_view_locator),
            'week': self.marionette.find_element(*self.calendar._week_view_locator),
            'settings': self.marionette.find_element(*self.calendar._settings_locator),
            'advanced_settings': self.marionette.find_element(
                *self.calendar._advanced_settings_view_locator),
            'modify_event': self.marionette.find_element(*self.calendar._modify_event_view_locator),
            'event': self.marionette.find_element(*self.calendar._event_view_locator),
            'create_account': self.marionette.find_element(
                *self.calendar._create_account_view_locator),
            'modify_account': self.marionette.find_element(
                *self.calendar._modify_account_view_locator)
        }

        self.event_title = 'title'
        self.calendar.a11y_create_event(self.event_title)
    def setUp(self):
        GaiaTestCase.setUp(self)

        self.today = datetime.date.today()
        self.next_day = self.today + datetime.timedelta(days=1)

        self.calendar = Calendar(self.marionette)
        self.calendar.launch()
예제 #14
0
    def setUp(self):
        GaiaTestCase.setUp(self)

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

        self.event_title = 'title'
        self.calendar.a11y_create_event(self.event_title)
예제 #15
0
class TestCardsView(GaiaTestCase):


    def setUp(self):
        GaiaTestCase.setUp(self)

        self.calendar = Calendar(self.marionette)
        self.calendar.launch()
        self.clock = Clock(self.marionette)
        self.clock.launch()

        # Switch to top level frame before starting the test
        self.marionette.switch_to_frame()

    def test_that_app_can_be_launched_from_cards_view(self):
        """
        https://moztrap.mozilla.org/manage/case/2462/
        """

        cards_view = CardsView(self.marionette)
        self.assertFalse(cards_view.is_displayed, 'Cards view not expected to be visible')

        # Pull up the cards view
        self.device.hold_home_button()
        cards_view.wait_for_cards_view()

        # Wait for first app ready
        cards_view.cards[1].wait_for_centered()

        self.assertIn(cards_view.cards[0].manifest_url, self.calendar.manifest_url)
        self.assertTrue(cards_view.cards[0].is_displayed,
                            '%s app should be present in cards view' % cards_view.cards[1].title)
        self.assertIn(cards_view.cards[1].manifest_url, self.clock.manifest_url)
        self.assertTrue(cards_view.cards[1].is_displayed,
                            '%s app should be present in cards view' % cards_view.cards[1].title)

        cards_view.swipe_to_previous_app()

        # Wait for previous app ready
        cards_view.cards[0].wait_for_centered()
        cards_view.cards[0].tap()

        cards_view.wait_for_cards_view_not_displayed()

        self.calendar.wait_to_be_displayed()
    def setUp(self):
        GaiaTestCase.setUp(self)

        self.event_title = 'title'
        self.event_location = 'location'

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

        new_event = self.calendar.a11y_click_add_event_button()

        # create a new event
        new_event.a11y_fill_event_title(self.event_title)
        new_event.a11y_fill_event_location(self.event_location)

        new_event.a11y_click_save_event()

        self.calendar.wait_for_events(1)
예제 #17
0
    def setUp(self):
        GaiaTestCase.setUp(self)

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

        self.views = {
            'time_views':
            self.marionette.find_element(*self.calendar._time_views_locator),
            'current_day':
            self.marionette.find_element(
                *self.calendar._current_month_day_agenda_locator),
            'month':
            self.marionette.find_element(
                *self.calendar._current_monthly_calendar_locator),
            'day':
            self.marionette.find_element(*self.calendar._day_view_locator),
            'week':
            self.marionette.find_element(*self.calendar._week_view_locator),
            'settings':
            self.marionette.find_element(*self.calendar._settings_locator),
            'advanced_settings':
            self.marionette.find_element(
                *self.calendar._advanced_settings_view_locator),
            'modify_event':
            self.marionette.find_element(
                *self.calendar._modify_event_view_locator),
            'event':
            self.marionette.find_element(*self.calendar._event_view_locator),
            'create_account':
            self.marionette.find_element(
                *self.calendar._create_account_view_locator),
            'modify_account':
            self.marionette.find_element(
                *self.calendar._modify_account_view_locator)
        }

        self.event_title = 'title'
        new_event = self.calendar.a11y_click_add_event_button()
        # create a new event
        new_event.a11y_fill_event_title(self.event_title)
        new_event.a11y_click_save_event()
        self.calendar.wait_for_events(1)
class TestCalendarMonthViewWheelAccessibility(GaiaTestCase):

    def setUp(self):
        GaiaTestCase.setUp(self)

        self.today = datetime.date.today()
        # Determine the name and the year of the next month
        self.next_month_year = self.today.replace(day=1) + datetime.timedelta(days=32)

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

    def test_a11y_calendar_month_view_wheel(self):

        MONTH_YEAR_PATTERN = '%b %Y'

        # Swipe left with 2 fingers.
        self.calendar.a11y_wheel_to_next_month()

        # Check that the grid updated to the next month.
        self.assertEquals(self.next_month_year.strftime(MONTH_YEAR_PATTERN),
                          self.calendar.current_month_year)

        # Swipe right with 2 fingers.
        self.calendar.a11y_wheel_to_previous_month()

        # Check that we moved back to the current month.
        self.assertEquals(self.today.strftime(MONTH_YEAR_PATTERN), self.calendar.current_month_year)
class TestCalendarMonthViewSelectEventAccessibility(GaiaTestCase):
    def setUp(self):
        GaiaTestCase.setUp(self)

        self.event_title = "title"
        self.event_location = "location"

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

        new_event = self.calendar.a11y_click_add_event_button()

        # create a new event
        new_event.a11y_fill_event_title(self.event_title)
        new_event.a11y_fill_event_location(self.event_location)

        new_event.a11y_click_save_event()

        self.calendar.wait_for_events(1)

    def test_a11y_calendar_month_view_select_event(self):

        event = self.calendar.event(self.event_title)
        # Make sure that the title and the location are correct
        self.assertEquals(event.title, self.event_title)
        self.assertEquals(event.location, self.event_location)

        event_detail = event.a11y_click()

        # Make sure that the title and the location correspond to the selected event.
        # Note: title and location are populated asynchronously
        Wait(self.marionette).until(lambda m: self.event_title == event_detail.title)
        Wait(self.marionette).until(lambda m: self.event_location == event_detail.location)
class TestCalendarMonthViewSelectEventAccessibility(GaiaTestCase):
    def setUp(self):
        GaiaTestCase.setUp(self)

        self.event_title = 'title'
        self.event_location = 'location'

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

        new_event = self.calendar.a11y_click_add_event_button()

        # create a new event
        new_event.a11y_fill_event_title(self.event_title)
        new_event.a11y_fill_event_location(self.event_location)

        new_event.a11y_click_save_event()

        self.calendar.wait_for_events(1)

    def test_a11y_calendar_month_view_select_event(self):

        event = self.calendar.event(self.event_title)
        # Make sure that the title and the location are correct
        self.assertEquals(event.title, self.event_title)
        self.assertEquals(event.location, self.event_location)

        event_detail = event.a11y_click()

        # Make sure that the title and the location correspond to the selected event.
        # Note: title and location are populated asynchronously
        Wait(self.marionette).until(
            lambda m: self.event_title == event_detail.title)
        Wait(self.marionette).until(
            lambda m: self.event_location == event_detail.location)
예제 #21
0
    def setUp(self):
        GaiaTestCase.setUp(self)

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

        self.views = {
            'time_views':
            self.marionette.find_element(*self.calendar._time_views_locator),
            'current_day':
            self.marionette.find_element(
                *self.calendar._current_month_day_agenda_locator),
            'month':
            self.marionette.find_element(
                *self.calendar._current_monthly_calendar_locator),
            'day':
            self.marionette.find_element(*self.calendar._day_view_locator),
            'week':
            self.marionette.find_element(*self.calendar._week_view_locator),
            'settings':
            self.marionette.find_element(*self.calendar._settings_locator),
            'advanced_settings':
            self.marionette.find_element(
                *self.calendar._advanced_settings_view_locator),
            'modify_event':
            self.marionette.find_element(
                *self.calendar._modify_event_view_locator),
            'event':
            self.marionette.find_element(*self.calendar._event_view_locator),
            'create_account':
            self.marionette.find_element(
                *self.calendar._create_account_view_locator),
            'modify_account':
            self.marionette.find_element(
                *self.calendar._modify_account_view_locator)
        }

        self.event_title = 'title'
        self.calendar.a11y_create_event(self.event_title)
    def test_calendar_flick_through_months(self):
        # https://bugzilla.mozilla.org/show_bug.cgi?id=937085

        MONTH_YEAR_PATTERN = '%B %Y'

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

        calendar.flick_to_next_month()
        self.assertEquals(self.next_month_year.strftime(MONTH_YEAR_PATTERN),
                          calendar.current_month_year)

        calendar.flick_to_previous_month()
        self.assertEquals(self.today.strftime(MONTH_YEAR_PATTERN),
                          calendar.current_month_year)
예제 #23
0
    def test_calendar_flick_through_months(self):
        """https://bugzilla.mozilla.org/show_bug.cgi?id=937085"""

        MONTH_YEAR_PATTERN = '%b %Y'

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

        calendar.flick_to_next_month()
        self.assertEquals(self.next_month_year.strftime(MONTH_YEAR_PATTERN),
                          calendar.current_month_year)

        calendar.flick_to_previous_month()
        self.assertEquals(self.today.strftime(MONTH_YEAR_PATTERN), calendar.current_month_year)
예제 #24
0
class TestCalendarDayViewAccessibility(GaiaTestCase):
    def setUp(self):
        GaiaTestCase.setUp(self)

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

        self.event_title = 'title'
        self.calendar.a11y_create_event(self.event_title)

    def test_a11y_calendar_day_view(self):

        self.calendar.a11y_click_day_display_button()

        # Click on the all day section to create an event.
        self.wait_for_element_displayed(
            *self.calendar._day_view_all_day_button)
        self.accessibility.click(
            self.marionette.find_element(
                *self.calendar._day_view_all_day_button))

        # wait for new event
        new_event = self.calendar.wait_for_new_event()
        self.assertTrue(
            self.accessibility.is_visible(
                self.marionette.find_element(
                    *self.calendar._modify_event_view_locator)))

        # close new event
        new_event.a11y_click_close_button()
        self.assertTrue(
            self.accessibility.is_visible(
                self.marionette.find_element(
                    *self.calendar._day_view_locator)))

        # open existing event detail
        event_detail = self.calendar.a11y_click_day_view_event()
        self.assertTrue(
            self.accessibility.is_visible(
                self.marionette.find_element(
                    *self.calendar._event_view_locator)))
        # Make sure that the title and the location correspond to the selected event.
        self.assertEquals(event_detail.title, self.event_title)
    def setUp(self):
        GaiaTestCase.setUp(self)

        self.event_title = "title"
        self.event_location = "location"

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

        new_event = self.calendar.a11y_click_add_event_button()

        # create a new event
        new_event.a11y_fill_event_title(self.event_title)
        new_event.a11y_fill_event_location(self.event_location)

        new_event.a11y_click_save_event()

        self.calendar.wait_for_events(1)
class TestCalendarDayViewAccessibility(GaiaTestCase):

    def setUp(self):
        GaiaTestCase.setUp(self)

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

        self.event_title = 'title'
        self.calendar.a11y_create_event(self.event_title)

    def test_a11y_calendar_day_view(self):

        self.calendar.a11y_click_day_display_button()

        # Click on the all day section to create an event.
        element = Wait(self.marionette).until(
                       expected.element_present(*self.calendar._day_view_all_day_button))
        Wait(self.marionette).until(expected.element_displayed(element))
        self.accessibility.click(element)

        # wait for new event
        new_event = self.calendar.wait_for_new_event()
        self.assertTrue(self.accessibility.is_visible(self.marionette.find_element(
            *self.calendar._modify_event_view_locator)))

        # close new event
        new_event.a11y_click_close_button()
        self.assertTrue(self.accessibility.is_visible(self.marionette.find_element(
            *self.calendar._day_view_locator)))

        # open existing event detail
        event_detail = self.calendar.a11y_click_day_view_event()
        self.assertTrue(self.accessibility.is_visible(self.marionette.find_element(
            *self.calendar._event_view_locator)))
        # Make sure that the title and the location correspond to the selected event.
        self.assertEquals(event_detail.title, self.event_title)
class TestCalendarViewsVisibilityAccessibility(GaiaTestCase):

    def setUp(self):
        GaiaTestCase.setUp(self)

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

        self.views = {
            'time_views': self.marionette.find_element(*self.calendar._time_views_locator),
            'current_day': self.marionette.find_element(
                *self.calendar._current_months_day_locator),
            'month': self.marionette.find_element(
                *self.calendar._current_monthly_calendar_locator),
            'day': self.marionette.find_element(*self.calendar._day_view_locator),
            'week': self.marionette.find_element(*self.calendar._week_view_locator),
            'settings': self.marionette.find_element(*self.calendar._settings_locator),
            'advanced_settings': self.marionette.find_element(
                *self.calendar._advanced_settings_view_locator),
            'modify_event': self.marionette.find_element(*self.calendar._modify_event_view_locator),
            'event': self.marionette.find_element(*self.calendar._event_view_locator),
            'create_account': self.marionette.find_element(
                *self.calendar._create_account_view_locator),
            'modify_account': self.marionette.find_element(
                *self.calendar._modify_account_view_locator)
        }

        self.event_title = 'title'
        new_event = self.calendar.a11y_click_add_event_button()
        # create a new event
        new_event.a11y_fill_event_title(self.event_title)
        new_event.a11y_click_save_event()
        self.calendar.wait_for_events(1)

    def test_a11y_calendar_views_visibility(self):

        def test_a11y_visible(*visible):
            for key, view in self.views.iteritems():
                if key in visible:
                    self.assertTrue(self.accessibility.is_visible(view))
                else:
                    self.assertTrue(self.accessibility.is_hidden(view))

        # Default
        test_a11y_visible('time_views', 'current_day', 'month')

        # Settings
        self.calendar.a11y_click_settings()
        test_a11y_visible('settings')

        # Advanced settings
        self.accessibility.click(self.marionette.find_element(
            *self.calendar.settings._advanced_settings_button_locator))
        test_a11y_visible('advanced_settings')

        # Create account
        self.accessibility.click(self.marionette.find_element(
            *self.calendar._create_account_button_locator))
        test_a11y_visible('create_account')

        # Modify account
        self.accessibility.click(self.calendar.account('caldav'))
        test_a11y_visible('modify_account')

        # Create account
        self.calendar.a11y_click_modify_account_back()
        test_a11y_visible('create_account')

        # Advanced settings
        self.calendar.a11y_click_create_account_back()
        test_a11y_visible('advanced_settings')

        # Settings
        self.accessibility.click(self.marionette.find_element(
            *self.calendar._advanced_settings_done_button_locator))
        test_a11y_visible('settings')

        # Default
        self.calendar.a11y_click_close_settings()
        test_a11y_visible('time_views', 'current_day', 'month')

        # Week
        self.calendar.a11y_click_week_display_button()
        test_a11y_visible('time_views', 'week')

        # Day
        self.calendar.a11y_click_day_display_button()
        test_a11y_visible('time_views', 'day')

        # Month
        self.calendar.a11y_click_month_display_button()
        test_a11y_visible('time_views', 'current_day', 'month')

        # New event
        new_event = self.calendar.a11y_click_add_event_button()
        test_a11y_visible('modify_event')

        # Month
        new_event.a11y_click_close_button()
        test_a11y_visible('time_views', 'current_day', 'month')

        # View event
        event = self.calendar.event(self.event_title)
        event.a11y_click()
        test_a11y_visible('event')
    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')
예제 #29
0
    def test_calendar_new_event_appears_on_all_calendar_views(self):
        """https://moztrap.mozilla.org/manage/case/6118/"""

        event_title = 'Event Title Goes here'
        event_location = 'Event Location Goes here'

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

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

        event_start_date_time = 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))
        self.take_screenshot()

        # switch to the week display
        calendar.tap_week_display_button()

        self.assertIn(
            event_title,
            calendar.displayed_events_in_week_view(event_start_date_time))
        Wait(self.marionette).until(
            lambda m: expected.element_displayed(*self._created_event_locator))
        self.take_screenshot()

        # 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))
        self.take_screenshot()
예제 #30
0
    def setUp(self):
        GaiaTestCase.setUp(self)

        self.calendar = Calendar(self.marionette)
        self.calendar.launch()
        self.calendar.a11y_click_settings()
예제 #31
0
    def test_calendar_flick(self):
        """https://bugzilla.mozilla.org/show_bug.cgi?id=937085"""

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

        calendar.flick_to_next_month()
        self.take_screenshot()

        calendar.flick_to_previous_month()
        self.take_screenshot()

        calendar.flick_to_previous_month()
        self.take_screenshot()

        calendar.tap_week_display_button()
        self.take_screenshot()
        self.scroll(calendar._week_view_locator, 'up', 300)
        self.take_screenshot()
        self.scroll(calendar._week_view_locator, 'down', 300)
        self.take_screenshot()
        self.scroll(calendar._week_view_locator, 'left', 100)
        self.take_screenshot()
        self.scroll(calendar._week_view_locator, 'right', 100)
        self.take_screenshot()

        calendar.tap_day_display_button()
        self.take_screenshot()
        self.scroll(calendar._day_view_locator, 'up', 300)
        self.take_screenshot()
        self.scroll(calendar._day_view_locator, 'down', 300)
        self.take_screenshot()
        self.scroll(calendar._day_view_locator, 'left', 100)
        self.take_screenshot()
        self.scroll(calendar._day_view_locator, 'right', 100)
        self.scroll(calendar._day_view_locator, 'right', 100)
        self.take_screenshot()
예제 #32
0
    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_time = 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))
    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))
예제 #34
0
    def test_calendar_flick(self):
        """https://bugzilla.mozilla.org/show_bug.cgi?id=937085"""

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

        calendar.flick_to_next_month()
        self.take_screenshot()

        calendar.flick_to_previous_month()
        self.take_screenshot()

        calendar.flick_to_previous_month()
        self.take_screenshot()

        calendar.tap_week_display_button()
        self.take_screenshot()
        self.scroll(calendar._week_view_locator, 'up', 300)
        self.take_screenshot()
        self.scroll(calendar._week_view_locator, 'down', 300)
        self.take_screenshot()
        self.scroll(calendar._week_view_locator, 'left', 100)
        self.take_screenshot()
        self.scroll(calendar._week_view_locator, 'right', 100)
        self.take_screenshot()

        calendar.tap_day_display_button()
        self.take_screenshot()
        self.scroll(calendar._day_view_locator, 'up', 300)
        self.take_screenshot()
        self.scroll(calendar._day_view_locator, 'down', 300)
        self.take_screenshot()
        self.scroll(calendar._day_view_locator, 'left', 100)
        self.take_screenshot()
        self.scroll(calendar._day_view_locator, 'right', 100)
        self.scroll(calendar._day_view_locator, 'right', 100)
        self.take_screenshot()
예제 #35
0
    def test_calendar_new_event_appears_on_all_calendar_views(self):
        """https://moztrap.mozilla.org/manage/case/6118/"""

        event_title = 'Event Title Goes here'
        event_location = 'Event Location Goes here'

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

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

        event_start_date_time = 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))
        self.take_screenshot()

        # switch to the week display
        calendar.tap_week_display_button()

        self.assertIn(event_title, calendar.displayed_events_in_week_view(event_start_date_time))
        Wait(self.marionette).until(lambda m: self.is_element_displayed(*self._created_event_locator))
        self.take_screenshot()

        # 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))
        self.take_screenshot()
    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))
    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))
    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))
예제 #39
0
    def test_calendar_flick(self):
        """https://bugzilla.mozilla.org/show_bug.cgi?id=937085"""

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

        calendar.flick_to_next_month()
        self.take_screenshot()

        calendar.flick_to_previous_month()
        self.take_screenshot()

        calendar.flick_to_previous_month()
        self.take_screenshot()

        calendar.tap_week_display_button()
        time.sleep(3)  # auto-scrolls when week view is entered, wait until scroll bar disappears
        self.take_screenshot()
        GaiaImageCompareTestCase.scroll(self.marionette, 'down',
                                        300, locator=calendar._week_view_locator)
        time.sleep(1)  # wait until scroll bar disappears

        self.take_screenshot()
        GaiaImageCompareTestCase.scroll(self.marionette, 'up',
                                        300, locator=calendar._week_view_locator)
        time.sleep(1)  # wait until scroll bar disappears
        self.take_screenshot()
        GaiaImageCompareTestCase.scroll(self.marionette, 'right',
                                        100, locator=calendar._week_view_locator)
        time.sleep(1)  # wait until scroll bar disappears
        self.take_screenshot()
        GaiaImageCompareTestCase.scroll(self.marionette, 'left',
                                        100, locator=calendar._week_view_locator)
        time.sleep(1)  # wait until scroll bar disappears
        self.take_screenshot()

        calendar.tap_day_display_button()
        time.sleep(1)  # wait until scroll bar disappears
        self.take_screenshot()
        GaiaImageCompareTestCase.scroll(self.marionette, 'down',
                                        300, locator=calendar._day_view_locator)
        time.sleep(1)  # wait until scroll bar disappears
        self.take_screenshot()
        GaiaImageCompareTestCase.scroll(self.marionette, 'up',
                                        300, locator=calendar._day_view_locator)
        time.sleep(1)  # wait until scroll bar disappears
        self.take_screenshot()
        GaiaImageCompareTestCase.scroll(self.marionette, 'right',
                                        100, locator=calendar._day_view_locator)
        time.sleep(1)  # wait until scroll bar disappears
        self.take_screenshot()
        GaiaImageCompareTestCase.scroll(self.marionette, 'left',
                                        100, locator=calendar._day_view_locator)
        GaiaImageCompareTestCase.scroll(self.marionette, 'left',
                                        100, locator=calendar._day_view_locator)
        time.sleep(1)  # wait until scroll bar disappears
        self.take_screenshot()
class TestCalendarViewsVisibilityAccessibility(GaiaTestCase):
    def setUp(self):
        GaiaTestCase.setUp(self)

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

        self.views = {
            'time_views':
            self.marionette.find_element(*self.calendar._time_views_locator),
            'current_day':
            self.marionette.find_element(
                *self.calendar._current_months_day_locator),
            'month':
            self.marionette.find_element(
                *self.calendar._current_monthly_calendar_locator),
            'day':
            self.marionette.find_element(*self.calendar._day_view_locator),
            'week':
            self.marionette.find_element(*self.calendar._week_view_locator),
            'settings':
            self.marionette.find_element(*self.calendar._settings_locator),
            'advanced_settings':
            self.marionette.find_element(
                *self.calendar._advanced_settings_view_locator),
            'modify_event':
            self.marionette.find_element(
                *self.calendar._modify_event_view_locator),
            'event':
            self.marionette.find_element(*self.calendar._event_view_locator)
        }

        self.event_title = 'title'
        new_event = self.calendar.a11y_click_add_event_button()
        # create a new event
        new_event.a11y_fill_event_title(self.event_title)
        new_event.a11y_click_save_event()
        self.calendar.wait_for_events(1)

    def test_a11y_calendar_views_visibility(self):
        def test_a11y_visible(*visible):
            for key, view in self.views.iteritems():
                if key in visible:
                    self.assertTrue(self.accessibility.is_visible(view))
                else:
                    self.assertTrue(self.accessibility.is_hidden(view))

        # Default
        test_a11y_visible('time_views', 'current_day', 'month')

        # Settings
        self.calendar.a11y_click_settings()
        test_a11y_visible('settings')

        # Advanced settings
        self.accessibility.click(
            self.marionette.find_element(
                *self.calendar.settings._advanced_settings_button_locator))
        test_a11y_visible('advanced_settings')

        # Settings
        self.accessibility.click(
            self.marionette.find_element(
                *self.calendar._advanced_settings_done_button_locator))
        test_a11y_visible('settings')

        # Default
        self.calendar.a11y_click_close_settings()
        test_a11y_visible('time_views', 'current_day', 'month')

        # Week
        self.calendar.a11y_click_week_display_button()
        test_a11y_visible('time_views', 'week')

        # Day
        self.calendar.a11y_click_day_display_button()
        test_a11y_visible('time_views', 'day')

        # Month
        self.calendar.a11y_click_month_display_button()
        test_a11y_visible('time_views', 'current_day', 'month')

        # New event
        new_event = self.calendar.a11y_click_add_event_button()
        test_a11y_visible('modify_event')

        # Month
        new_event.a11y_click_close_button()
        test_a11y_visible('time_views', 'current_day', 'month')

        # View event
        event = self.calendar.event(self.event_title)
        event.a11y_click()
        test_a11y_visible('event')
예제 #41
0
    def setUp(self):
        GaiaTestCase.setUp(self)

        self.calendar = Calendar(self.marionette)
        self.calendar.launch()
        self.calendar.a11y_click_settings()
예제 #42
0
    def test_check_today_date(self):
        calendar = Calendar(self.marionette)
        calendar.launch()

        self.assertEquals(self.today.strftime('%B %Y'), calendar.current_month_year)
        self.assertIn(self.today.strftime('%a %b %d %Y'), calendar.current_month_day)
예제 #43
0
    def test_calendar_flick(self):
        """https://bugzilla.mozilla.org/show_bug.cgi?id=937085"""

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

        calendar.flick_to_next_month()
        self.take_screenshot()

        calendar.flick_to_previous_month()
        self.take_screenshot()

        calendar.flick_to_previous_month()
        self.take_screenshot()

        calendar.tap_week_display_button()
        time.sleep(
            3
        )  # auto-scrolls when week view is entered, wait until scroll bar disappears
        self.take_screenshot()
        GaiaImageCompareTestCase.scroll(self.marionette,
                                        'down',
                                        300,
                                        locator=calendar._week_view_locator)
        time.sleep(1)  # wait until scroll bar disappears

        self.take_screenshot()
        GaiaImageCompareTestCase.scroll(self.marionette,
                                        'up',
                                        300,
                                        locator=calendar._week_view_locator)
        time.sleep(1)  # wait until scroll bar disappears
        self.take_screenshot()
        GaiaImageCompareTestCase.scroll(self.marionette,
                                        'right',
                                        100,
                                        locator=calendar._week_view_locator)
        time.sleep(1)  # wait until scroll bar disappears
        self.take_screenshot()
        GaiaImageCompareTestCase.scroll(self.marionette,
                                        'left',
                                        100,
                                        locator=calendar._week_view_locator)
        time.sleep(1)  # wait until scroll bar disappears
        self.take_screenshot()

        calendar.tap_day_display_button()
        time.sleep(1)  # wait until scroll bar disappears
        self.take_screenshot()
        GaiaImageCompareTestCase.scroll(self.marionette,
                                        'down',
                                        300,
                                        locator=calendar._day_view_locator)
        time.sleep(1)  # wait until scroll bar disappears
        self.take_screenshot()
        GaiaImageCompareTestCase.scroll(self.marionette,
                                        'up',
                                        300,
                                        locator=calendar._day_view_locator)
        time.sleep(1)  # wait until scroll bar disappears
        self.take_screenshot()
        GaiaImageCompareTestCase.scroll(self.marionette,
                                        'right',
                                        100,
                                        locator=calendar._day_view_locator)
        time.sleep(1)  # wait until scroll bar disappears
        self.take_screenshot()
        GaiaImageCompareTestCase.scroll(self.marionette,
                                        'left',
                                        100,
                                        locator=calendar._day_view_locator)
        GaiaImageCompareTestCase.scroll(self.marionette,
                                        'left',
                                        100,
                                        locator=calendar._day_view_locator)
        time.sleep(1)  # wait until scroll bar disappears
        self.take_screenshot()