コード例 #1
0
    def setUp(self):
        GaiaTestCase.setUp(self)
        self.cards_view = CardsView(self.marionette)

        # Launch the Clock app as a basic, reliable
        # app to test against in Cards View
        self.app = self.apps.launch(self._app_under_test)
コード例 #2
0
class TestCardsViewTwoApps(GaiaTestCase):

    def setUp(self):
        GaiaTestCase.setUp(self)
        self.cards_view = CardsView(self.marionette)

        self.clock = Clock(self.marionette)
        self.clock.launch()
        self.gallery = Gallery(self.marionette)
        self.gallery.launch(empty=True)

    def test_kill_app_from_cards_view(self):
        """https://moztrap.mozilla.org/manage/case/1917/"""

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

        # Wait for first app ready
        self.cards_view.cards[1].wait_for_centered()
        self.assertIn(self.cards_view.cards[1].manifest_url, self.gallery.manifest_url)

        # Close the current apps from the cards view
        self.cards_view.cards[1].close()
        self.cards_view.cards[0].close()

        # If successfully killed, the apps should no longer appear in the cards view and the "No recent apps" message should be displayed
        self.assertEqual(len(self.cards_view.cards), 0, 'Should have no cards to display')
コード例 #3
0
    def test_launch_manifest(self):
        search = Search(self.marionette)
        search.launch()

        self.device.touch_home_button()

        search.launch()

        browser = search.go_to_url(self.test_url)
        browser.switch_to_content()
        Wait(self.marionette).until(lambda m: m.title == 'Mozilla')

        self.device.touch_home_button()

        # This should open the previous opened browser window
        search.launch()

        browser = search.go_to_url('data:text/html;charset=utf-8,<title>hello</title>')
        browser.switch_to_content()
        Wait(self.marionette).until(lambda m: m.title == 'hello')
        browser.switch_to_chrome()

        # This shouldn't do anything
        search.launch()

        self.device.hold_home_button()
        cards_view = CardsView(self.marionette)
        cards_view.wait_for_cards_view()
        cards_view.cards[0].wait_for_centered()
        self.assertEqual(len(cards_view.cards), 1, 'Should have 1 card to display')
        self.assertTrue(cards_view.cards[0].is_displayed)
        self.assertEqual(cards_view.cards[0].title, 'hello')
コード例 #4
0
    def test_launch_manifest(self):
        search = Search(self.marionette)
        search.launch()

        self.device.touch_home_button()

        search.launch()

        browser = search.go_to_url(self.test_url)
        browser.switch_to_content()
        Wait(self.marionette).until(lambda m: m.title == 'Mozilla')

        self.device.touch_home_button()

        # This should open the previous opened browser window
        search.launch()

        browser = search.go_to_url(
            'data:text/html;charset=utf-8,<title>hello</title>')
        browser.switch_to_content()
        Wait(self.marionette).until(lambda m: m.title == 'hello')
        browser.switch_to_chrome()

        # This shouldn't do anything
        search.launch()

        self.device.hold_home_button()
        cards_view = CardsView(self.marionette)
        cards_view.wait_for_cards_view()
        cards_view.cards[0].wait_for_centered()
        self.assertEqual(len(cards_view.cards), 1,
                         'Should have 1 card to display')
        self.assertTrue(cards_view.cards[0].is_displayed)
        self.assertEqual(cards_view.cards[0].title, 'hello')
コード例 #5
0
    def test_only_one_header_displayed(self):
        """ https://bugzilla.mozilla.org/show_bug.cgi?id=1116087 """

        self.email.setup_IMAP_email(self.environment.email['imap'],
                                    self.environment.email['smtp'])
        self.email.wait_for_emails_to_sync()
        self.assertGreater(len(self.email.mails), 0)

        email_header_list = self.marionette.find_elements(*self.email.emails_list_header_locator)
        self.assertEqual(len(email_header_list), 1, 'Should have only 1 list-header')

        self.device.hold_home_button()
        cards_view = CardsView(self.marionette)
        cards_view.wait_for_cards_view()
        cards_view.cards[0].wait_for_centered()
        cards_view.cards[0].close()

        self.assertEqual(len(cards_view.cards), 0, 'Should have no cards left to display')
        Homescreen(self.marionette).wait_to_be_displayed()

        self.email.launch()
        self.email.wait_for_emails_to_sync()
        self.assertGreater(len(self.email.mails), 0)

        email_header_list = self.marionette.find_elements(*self.email.emails_list_header_locator)
        self.assertEqual(len(email_header_list), 1, 'Should have only 1 list-header')
コード例 #6
0
    def setUp(self):
        GaiaTestCase.setUp(self)
        self.cards_view = CardsView(self.marionette)

        # Launch the test apps
        for app in self._test_apps:
            self.apps.launch(app)
コード例 #7
0
    def setUp(self):
        GaiaTestCase.setUp(self)
        self.cards_view = CardsView(self.marionette)

        self.clock = Clock(self.marionette)
        self.clock.launch()
        self.gallery = Gallery(self.marionette)
        self.gallery.launch(empty=True)
コード例 #8
0
    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_cards_view_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 till it really displayed
        _cards_view_locator = ('id', 'cards-view')
        self.wait_for_condition(
            lambda m: m.find_element(*_cards_view_locator).is_displayed())

        time.sleep(5)
        cards = self.marionette.find_elements('css selector',
                                              'ul#cards-list li.card')
        cards_num = len(cards)

        current = -1
        for i in range(cards_num):
            # parse the cards for the displayed card
            for attr in cards[i].get_attribute('style').split(';'):
                if 'opacity: 1' in attr:
                    current = i

        # if there is cards, don't run
        if current != -1:
            choose = random.randint(0, cards_num - 1)
            card_name = self.marionette.find_elements(
                'css selector', 'ul#cards-list li.card')[choose].text

            current_frame = self.apps.displayed_app.frame
            final_x_position = current_frame.size['width']
            # start swipe from center of window
            start_x_position = final_x_position // 2
            start_y_position = current_frame.size['height'] // 2

            # swipe forward to get another app card
            move = choose - current
            if move > 0:
                final_x_position = final_x_position * (-1)
            if move != 0:
                for i in range(abs(move)):
                    Actions(self.marionette).flick(current_frame,
                                                   start_x_position,
                                                   start_y_position,
                                                   final_x_position,
                                                   start_y_position).perform()

            self.wait_for_condition(lambda m: 'opacity: 1;' in m.find_elements(
                'css selector', 'ul#cards-list li.card')[choose].get_attribute(
                    'style'))
            self.marionette.find_elements(
                'css selector', 'ul#cards-list li.card')[choose].tap()
            self.assertEqual(self.apps.displayed_app.name, card_name)
    def setUp(self):
        GaiaMtbfTestCase.setUp(self)
        self.cards_view = CardsView(self.marionette)

        # Launch the test apps
        for app in self._test_apps:
            self.apps.launch(app)
            # Let's wait a bit for the app to fully launch
            time.sleep(2)
コード例 #10
0
    def test_only_one_header_displayed(self):
        """ https://bugzilla.mozilla.org/show_bug.cgi?id=1116087 """

        self.email.setup_IMAP_email(self.testvars['email']['IMAP'])
        self.email.wait_for_emails_to_sync()
        self.assertGreater(len(self.email.mails), 0)

        email_header_list = self.marionette.find_elements(
            *self.email.emails_list_header_locator)
        self.assertEqual(len(email_header_list), 1,
                         'Should have only 1 list-header')

        self.device.hold_home_button()
        cards_view = CardsView(self.marionette)
        cards_view.wait_for_cards_view()
        cards_view.wait_for_card_ready(self.email.name)
        cards_view.close_app(self.email.name)

        self.assertFalse(
            cards_view.is_app_displayed(self.email.name),
            '%s app should not be present in cards view' % self.email.name)
        self.assertEqual(len(cards_view.cards), 0,
                         'Should have no cards left to display')
        Wait(self.marionette).until(
            lambda m: self.apps.displayed_app.name == Homescreen.name)

        self.email.launch()
        self.email.wait_for_emails_to_sync()
        self.assertGreater(len(self.email.mails), 0)

        email_header_list = self.marionette.find_elements(
            *self.email.emails_list_header_locator)
        self.assertEqual(len(email_header_list), 1,
                         'Should have only 1 list-header')
コード例 #11
0
    def setUp(self):
        GaiaImageCompareTestCase.setUp(self)
        self.cards_view = CardsView(self.marionette)

        # Launch the test apps
        for app in self._test_apps:
            self.apps.launch(app)

            # 10 seconds for the actual user using the app a bit, and going back to homescreen
            time.sleep(10)
            self.device.touch_home_button()
コード例 #12
0
    def setUp(self):
        GaiaImageCompareTestCase.setUp(self)
        self.cards_view = CardsView(self.marionette)

        self.contacts = Contacts(self.marionette)
        self.contacts.launch()
        self.gallery = Gallery(self.marionette)
        self.gallery.launch(empty=True)

        # 10 seconds for the actual user using the app a bit, and going back to homescreen
        time.sleep(10)
        self.device.touch_home_button()
コード例 #13
0
    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()
コード例 #14
0
class TestCardsViewTwoApps(GaiaTestCase):

    _test_apps = ["Clock", "Gallery"]

    def setUp(self):
        GaiaTestCase.setUp(self)
        self.cards_view = CardsView(self.marionette)

        # Launch the test apps
        for app in self._test_apps:
            self.apps.launch(app)

    def test_kill_app_from_cards_view(self):
        # https://moztrap.mozilla.org/manage/case/1917/

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

        # Close the current apps from the cards view
        self.cards_view.close_app(self._test_apps[1])
        self.cards_view.close_app(self._test_apps[0])

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

        # If successfully killed, the apps should no longer appear in the cards view and the "No recent apps" message should be displayed
        self.assertFalse(self.cards_view.is_app_present(self._test_apps[1]),
                         "Killed app not expected to appear in cards view")

        self.assertFalse(self.cards_view.is_app_present(self._test_apps[0]),
                         "Killed app not expected to appear in cards view")

        self.assertEqual(self.cards_view.no_recent_apps_message, "No recent apps")
コード例 #15
0
    def test_only_one_header_displayed(self):
        """ https://bugzilla.mozilla.org/show_bug.cgi?id=1116087 """

        self.email.setup_IMAP_email(self.testvars['email']['imap'],
                                    self.testvars['email']['smtp'])
        self.email.wait_for_emails_to_sync()
        self.assertGreater(len(self.email.mails), 0)

        email_header_list = self.marionette.find_elements(*self.email.emails_list_header_locator)
        self.assertEqual(len(email_header_list), 1, 'Should have only 1 list-header')

        self.device.hold_home_button()
        cards_view = CardsView(self.marionette)
        cards_view.wait_for_cards_view()
        cards_view.wait_for_card_ready(self.email.name)
        cards_view.close_app(self.email.name)

        self.assertFalse(cards_view.is_app_displayed(self.email.name),
                             '%s app should not be present in cards view' % self.email.name)
        self.assertEqual(len(cards_view.cards), 0, 'Should have no cards left to display')
        Wait(self.marionette).until(lambda m: self.apps.displayed_app.name == Homescreen.name)

        self.email.launch()
        self.email.wait_for_emails_to_sync()
        self.assertGreater(len(self.email.mails), 0)

        email_header_list = self.marionette.find_elements(*self.email.emails_list_header_locator)
        self.assertEqual(len(email_header_list), 1, 'Should have only 1 list-header')
コード例 #16
0
class TestCardsViewTwoApps(GaiaTestCase):

    _test_apps = ["Clock", "Gallery"]

    def setUp(self):
        GaiaTestCase.setUp(self)
        self.cards_view = CardsView(self.marionette)

        # Launch the test apps
        for app in self._test_apps:
            self.apps.launch(app)
            # Let's wait a bit for the app to fully launch
            time.sleep(2)

    def test_kill_app_from_cards_view(self):
        """https://moztrap.mozilla.org/manage/case/1917/"""

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

        # Wait for first app ready
        self.cards_view.wait_for_card_ready(self._test_apps[1])

        # Close the current apps from the cards view
        self.cards_view.close_app(self._test_apps[1])
        self.cards_view.close_app(self._test_apps[0])

        # If successfully killed, the apps should no longer appear in the cards view and the "No recent apps" message should be displayed
        self.assertFalse(self.cards_view.is_app_present(self._test_apps[1]),
                         "Killed app not expected to appear in cards view")

        self.assertFalse(self.cards_view.is_app_present(self._test_apps[0]),
                         "Killed app not expected to appear in cards view")
コード例 #17
0
    def test_a11y_cards_view_status_bar_visibility(self):

        cards_view = CardsView(self.marionette)
        status_bar = System(self.marionette).status_bar

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

        # Wait for the app card ready
        cards_view.cards[0].wait_for_centered()

        # Statusbar icons should be invisible to the screen reader.
        self.wait_for_condition(lambda m: status_bar.is_status_bar_maximized_wrapper_a11y_hidden)
        self.wait_for_condition(lambda m: status_bar.is_status_bar_minimized_wrapper_a11y_hidden)
コード例 #18
0
    def setUp(self):
        GaiaTestCase.setUp(self)
        self.cards_view = CardsView(self.marionette)

        # Launch the test apps
        for app in self._test_apps:
            self.apps.launch(app)
コード例 #19
0
    def setUp(self):
        GaiaTestCase.setUp(self)
        self.cards_view = CardsView(self.marionette)

        # Launch the Clock app as a basic, reliable
        # app to test against in Cards View
        self.app = self.apps.launch(self._app_under_test)
コード例 #20
0
    def close_app(self):
        from gaiatest.apps.system.regions.cards_view import CardsView
        self.cards_view = CardsView(self.marionette)

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

        # Wait for first app ready
        self.cards_view.wait_for_card_ready(self.app_under_test.lower())

        # Close the current apps from the cards view
        self.cards_view.close_app("search")

        # Sleep a bit
        time.sleep(5)
コード例 #21
0
    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_cards_view_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 till it really displayed
        _cards_view_locator = ('id', 'cards-view')
        self.wait_for_condition(lambda m: m.find_element(*_cards_view_locator).is_displayed())

        time.sleep(5)
        cards = self.marionette.find_elements('css selector', 'ul#cards-list li.card')
        cards_num = len(cards)

        current = -1
        for i in range(cards_num):
            # parse the cards for the displayed card
            for attr in cards[i].get_attribute('style').split(';'):
                if 'opacity: 1' in attr:
                    current = i

        # if there is cards, don't run
        if current != -1:
            choose = random.randint(0, cards_num - 1)
            card_name = self.marionette.find_elements('css selector', 'ul#cards-list li.card')[choose].text

            current_frame = self.apps.displayed_app.frame
            final_x_position = current_frame.size['width']
            # start swipe from center of window
            start_x_position = final_x_position // 2
            start_y_position = current_frame.size['height'] // 2

            # swipe forward to get another app card
            move = choose - current
            if move > 0:
                final_x_position = final_x_position * (-1)
            if move != 0:
                for i in range(abs(move)):
                    Actions(self.marionette).flick(current_frame, start_x_position, start_y_position, final_x_position, start_y_position).perform()

            self.wait_for_condition(lambda m: 'opacity: 1;' in m.find_elements('css selector', 'ul#cards-list li.card')[choose].get_attribute('style'))
            self.marionette.find_elements('css selector', 'ul#cards-list li.card')[choose].tap()
            self.assertEqual(self.apps.displayed_app.name, card_name)
コード例 #22
0
    def test_a11y_cards_view_status_bar_visibility(self):

        cards_view = CardsView(self.marionette)
        status_bar = System(self.marionette).status_bar

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

        # Wait for the app card ready
        cards_view.cards[0].wait_for_centered()

        # Statusbar icons should be invisible to the screen reader.
        self.wait_for_condition(
            lambda m: status_bar.is_status_bar_maximized_wrapper_a11y_hidden)
        self.wait_for_condition(
            lambda m: status_bar.is_status_bar_minimized_wrapper_a11y_hidden)
コード例 #23
0
    def test_that_app_can_be_launched_from_cards_view(self):
        # https://bugzilla.mozilla.org/show_bug.cgi?id=943338
        cards_view = CardsView(self.marionette)
        self.assertFalse(cards_view.is_cards_view_displayed, 'Cards view not expected to be visible')

        # Pull up the cards view
        cards_view.open_cards_view()

        for app in self._test_apps:
            self.assertTrue(cards_view.is_app_displayed(app),
                            '%s app should be visible in cards view' % app)

        cards_view.swipe_to_next_app()
        cards_view.tap_app(self._test_apps[0])
        cards_view.wait_for_cards_view_not_displayed()

        self.assertEqual(self.apps.displayed_app.name, self._test_apps[0])
コード例 #24
0
class TestCardsViewThreeApps(GaiaTestCase):

    _test_apps = ["Clock", "Gallery", "Calendar"]

    def setUp(self):
        GaiaTestCase.setUp(self)
        self.cards_view = CardsView(self.marionette)

        # Launch the test apps
        for app in self._test_apps:
            self.apps.launch(app)

    def test_cards_view(self):
        # https://moztrap.mozilla.org/manage/case/1909/

        # Switch to top level frame before dispatching the event
        self.marionette.switch_to_frame()

        self.assertFalse(self.cards_view.is_cards_view_displayed, "Cards view not expected to be visible")

        # Pull up the cards view
        self.cards_view.open_cards_view()

        self.assertFalse(self.cards_view.is_app_displayed(self._test_apps[0]),
            "First opened app should not be visible in cards view")

        self.assertTrue(self.cards_view.is_app_displayed(self._test_apps[1]),
            "Second app opened should be visible in cards view")

        self.assertTrue(self.cards_view.is_app_displayed(self._test_apps[2]),
            "Third app opened should be visible in cards view")

        self.cards_view.exit_cards_view()
コード例 #25
0
class TestCardsView(GaiaTestCase):

    _app_under_test = "Clock"

    def setUp(self):
        GaiaTestCase.setUp(self)
        self.cards_view = CardsView(self.marionette)

        # Launch the Clock app as a basic, reliable
        # app to test against in Cards View
        self.app = self.apps.launch(self._app_under_test)

    def test_kill_app_from_cards_view(self):
        # https://moztrap.mozilla.org/manage/case/1917/
        # Switch to top level frame before dispatching the event
        self.marionette.switch_to_frame()

        # Pull up the cards view
        self.cards_view.open_cards_view()

        # Close the current app from cards view
        self.cards_view.close_app(self._app_under_test)

        self.marionette.switch_to_frame()

        # Pull up the cards view again
        self.cards_view.open_cards_view()

        # If successfully killed, the app should no longer appear in the cards view.
        self.assertFalse(self.cards_view.is_app_present(self._app_under_test),
                         "Killed app not expected to appear in cards view")
コード例 #26
0
    def test_cards_view_with_two_apps(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()
        self.take_screenshot(top_frame=True)

        # disabled per Bug 1118390
        #self.change_orientation('landscape-primary')
        #self.take_screenshot()
        #self.change_orientation('portrait-primary')
        #self.take_screenshot()

        # Wait for first app ready
        cards_view.cards[1].wait_for_centered()
        self.assertIn(cards_view.cards[0].manifest_url[:19], self.contacts.manifest_url)
        self.assertIn(cards_view.cards[1].manifest_url, self.gallery.manifest_url)
        cards_view.swipe_to_previous_app()

        # Wait for previous app ready
        cards_view.cards[0].wait_for_centered()
        # sleep inside above method is insufficient
        time.sleep(2)
        self.take_screenshot(top_frame=True)

        cards_view.cards[0].tap()
        cards_view.wait_for_cards_view_not_displayed()
        self.take_screenshot(top_frame=True) #bug 1151571 will cause blank screen capture

        self.assertTrue(self.contacts.is_displayed)
コード例 #27
0
    def setUp(self):
        GaiaTestCase.setUp(self)
        self.cards_view = CardsView(self.marionette)

        # Launch the test apps
        for app in self._test_apps:
            self.apps.launch(app)
            # Let's wait a bit for the app to fully launch
            time.sleep(2)
コード例 #28
0
    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_cards_view_displayed, 'Cards view not expected to be visible')

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

        for app in self._test_apps:
            self.assertTrue(cards_view.is_app_displayed(app),
                            '%s app should be visible in cards view' % app)

        cards_view.swipe_to_next_app()
        cards_view.tap_app(self._test_apps[0])
        cards_view.wait_for_cards_view_not_displayed()

        self.assertEqual(self.apps.displayed_app.name, self._test_apps[0])
コード例 #29
0
    def test_sms_auto_save_draft(self):
        """
        https://moztrap.mozilla.org/manage/case/7806/
        """
        _text_message_content = "Automated Test %s" % str(time.time())

        # launch messages app
        messages = Messages(self.marionette)
        messages.launch()

        # click new message
        new_message = messages.tap_create_new_message()

        self.marionette.switch_to_frame()
        Wait(self.marionette).until(
            lambda m: new_message.keyboard.is_keyboard_displayed)
        self.apps.switch_to_displayed_app()

        new_message.type_message(_text_message_content)
        self.assertEqual(new_message.message, _text_message_content)

        # close message app and leave cards view
        self.device.hold_home_button()

        cards_view = CardsView(self.marionette)
        cards_view.wait_for_cards_view()

        # wait for first app ready
        cards_view.cards[0].wait_for_centered()
        cards_view.cards[0].close()
        self.assertEqual(len(cards_view.cards), 0)

        # wait for homescreen to be displayed
        Homescreen(self.marionette).wait_to_be_displayed()

        # re-open messages app
        messages.launch()
        self.assertTrue(messages.draft_threads[0].is_draft_icon_displayed)
        new_message = messages.draft_threads[0].open()

        # check that last message draft is shown correctly
        self.assertEqual(new_message.message, _text_message_content)
コード例 #30
0
class TestCardsView(GaiaTestCase):

    _app_under_test = "Clock"
    _clock_frame_locator = (By.CSS_SELECTOR, "iframe[mozapp^='app://clock'][mozapp$='manifest.webapp']")

    def setUp(self):
        GaiaTestCase.setUp(self)
        self.cards_view = CardsView(self.marionette)

        # Launch the Clock app as a basic, reliable
        # app to test against in Cards View
        self.app = self.apps.launch(self._app_under_test)

    def test_that_app_can_be_launched_from_cards_view(self):
        # https://github.com/mozilla/gaia-ui-tests/issues/98
        # Switch to top level frame before dispatching the event
        self.marionette.switch_to_frame()

        # Find the cards frame html element
        clock_frame = self.marionette.find_element(*self._clock_frame_locator)

        # Pull up the cards view
        self.cards_view.open_cards_view()

        self.assertFalse(clock_frame.is_displayed(), "Clock frame not expected to be displayed")

        # Launch the app from the cards view
        self.cards_view.tap_app(self._app_under_test)

        self.cards_view.wait_for_cards_view_not_displayed()
        self.assertTrue(clock_frame.is_displayed(), "Clock frame expected to be displayed")
コード例 #31
0
class TestCardsViewTwoApps(GaiaImageCompareTestCase):

    _test_apps = ["Contacts", "Gallery"]

    def setUp(self):
        GaiaImageCompareTestCase.setUp(self)
        self.cards_view = CardsView(self.marionette)

        # Launch the test apps
        for app in self._test_apps:
            self.apps.launch(app)

            # 10 seconds for the actual user using the app a bit, and going back to homescreen
            time.sleep(10)
            self.device.touch_home_button()

    def test_cards_view_kill_apps_with_two_apps(self):
        """https://moztrap.mozilla.org/manage/case/1917/"""

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

        # Wait for first app ready
        self.cards_view.wait_for_card_ready(self._test_apps[1])
        self.take_screenshot()

        # Close the current apps from the cards view
        self.cards_view.close_app(self._test_apps[1])
        self.take_screenshot()
        self.cards_view.close_app(self._test_apps[0])
        self.take_screenshot()

        # If successfully killed, the apps should no longer appear in the cards view
        # and the "No recent apps" message should be displayed
        self.assertFalse(self.cards_view.is_app_present(self._test_apps[1]),
                         "Killed app not expected to appear in cards view")

        self.assertFalse(self.cards_view.is_app_present(self._test_apps[0]),
                         "Killed app not expected to appear in cards view")
コード例 #32
0
ファイル: gaia_test.py プロジェクト: adrm/gaia
class GaiaEnduranceTestCase(GaiaTestCase, EnduranceTestCaseMixin, MemoryEnduranceTestCaseMixin):

    def __init__(self, *args, **kwargs):
        GaiaTestCase.__init__(self, *args, **kwargs)
        EnduranceTestCaseMixin.__init__(self, *args, **kwargs)
        MemoryEnduranceTestCaseMixin.__init__(self, *args, **kwargs)
        kwargs.pop('iterations', None)
        kwargs.pop('checkpoint_interval', None)

    def close_app(self):
        from gaiatest.apps.system.regions.cards_view import CardsView
        self.cards_view = CardsView(self.marionette)

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

        # Wait for first app ready
        self.cards_view.wait_for_card_ready(self.app_under_test.lower())

        # Close the current apps from the cards view
        self.cards_view.close_app("search")

        # Sleep a bit
        time.sleep(5)
コード例 #33
0
class TestCardsView(GaiaTestCase):

    _app_under_test = "Clock"
    _clock_frame_locator = (
        By.CSS_SELECTOR,
        "iframe[mozapp^='app://clock'][mozapp$='manifest.webapp']")

    def setUp(self):
        GaiaTestCase.setUp(self)
        self.cards_view = CardsView(self.marionette)

        # Launch the Clock app as a basic, reliable
        # app to test against in Cards View
        self.app = self.apps.launch(self._app_under_test)

    def test_that_app_can_be_launched_from_cards_view(self):
        # https://github.com/mozilla/gaia-ui-tests/issues/98
        # Switch to top level frame before dispatching the event
        self.marionette.switch_to_frame()

        # Find the cards frame html element
        clock_frame = self.marionette.find_element(*self._clock_frame_locator)

        # Pull up the cards view
        self.cards_view.open_cards_view()

        self.assertFalse(clock_frame.is_displayed(),
                         "Clock frame not expected to be displayed")

        # Launch the app from the cards view
        self.cards_view.tap_app(self._app_under_test)

        self.cards_view.wait_for_cards_view_not_displayed()
        self.assertTrue(clock_frame.is_displayed(),
                        "Clock frame expected to be displayed")
コード例 #34
0
class GaiaEnduranceTestCase(GaiaTestCase, EnduranceTestCaseMixin,
                            MemoryEnduranceTestCaseMixin):
    def __init__(self, *args, **kwargs):
        GaiaTestCase.__init__(self, *args, **kwargs)
        EnduranceTestCaseMixin.__init__(self, *args, **kwargs)
        MemoryEnduranceTestCaseMixin.__init__(self, *args, **kwargs)
        kwargs.pop('iterations', None)
        kwargs.pop('checkpoint_interval', None)

    def close_app(self):
        from gaiatest.apps.system.regions.cards_view import CardsView
        self.cards_view = CardsView(self.marionette)

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

        # Wait for first app ready
        self.cards_view.wait_for_card_ready(self.app_under_test.lower())

        # Close the current apps from the cards view
        self.cards_view.close_app("search")

        # Sleep a bit
        time.sleep(5)
コード例 #35
0
    def test_sms_auto_save_draft(self):
        """
        https://moztrap.mozilla.org/manage/case/7806/
        """
        _text_message_content = "Automated Test %s" % str(time.time())

        # launch messages app
        messages = Messages(self.marionette)
        messages.launch()

        # click new message
        new_message = messages.tap_create_new_message()

        self.marionette.switch_to_frame()
        Wait(self.marionette).until(
            lambda m: new_message.keyboard.is_keyboard_displayed)
        self.apps.switch_to_displayed_app()

        new_message.type_message(_text_message_content)
        self.assertEqual(new_message.message, _text_message_content)

        # close message app and leave cards view
        self.device.hold_home_button()
        from gaiatest.apps.system.regions.cards_view import CardsView
        cards_view = CardsView(self.marionette)
        cards_view.wait_for_cards_view()

        # wait for first app ready
        cards_view.wait_for_card_ready('sms')
        cards_view.close_app('sms')
        self.assertFalse(cards_view.is_app_present('sms'),
                         "Killed app not expected to appear in cards view")

        # wait for homescreen to be displayed
        self.wait_for_condition(
            lambda m: self.apps.displayed_app.name == Homescreen.name)

        # re-open messages app
        messages.launch()
        self.assertTrue(messages.draft_message[0].is_draft_icon_displayed)
        new_message = messages.draft_message[0].tap_draft_message()

        # check that last message draft is shown correctly
        self.assertEqual(new_message.message, _text_message_content)
コード例 #36
0
ファイル: gaia_test.py プロジェクト: adrm/gaia
    def close_app(self):
        from gaiatest.apps.system.regions.cards_view import CardsView
        self.cards_view = CardsView(self.marionette)

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

        # Wait for first app ready
        self.cards_view.wait_for_card_ready(self.app_under_test.lower())

        # Close the current apps from the cards view
        self.cards_view.close_app("search")

        # Sleep a bit
        time.sleep(5)
コード例 #37
0
    def test_browser_private_navigation(self):
        self.device.hold_home_button()

        cards_view = CardsView(self.marionette)
        private_window = cards_view.open_new_private_window()

        browser = private_window.go_to_url(self.test_url)
        browser.switch_to_content()
        Wait(self.marionette).until(lambda m: m.title == 'Mozilla')

        self.device.hold_home_button()

        cards_view = CardsView(self.marionette)
        cards_view.wait_for_cards_view()
        search = cards_view.open_new_browser()
        # This is to switch the marionette context to the browser content
        search.launch()
        self.assertEqual(search.history_items_count, 0)
コード例 #38
0
class TestCardsViewThreeApps(GaiaTestCase):

    _test_apps = ["Clock", "Gallery", "Calendar"]

    def setUp(self):
        GaiaTestCase.setUp(self)
        self.cards_view = CardsView(self.marionette)

        # Launch the test apps
        for app in self._test_apps:
            self.apps.launch(app)

    def test_kill_app_from_cards_view(self):
        # https://moztrap.mozilla.org/manage/case/1917/

        # Switch to top level frame before dispatching the event
        self.marionette.switch_to_frame()

        # Pull up the cards view
        self.cards_view.open_cards_view()

        # Close the current app from the cards view
        self.cards_view.close_app(self._test_apps[2])

        self.marionette.switch_to_frame()

        # Pull up the cards view again
        self.cards_view.open_cards_view()

        # If successfully killed, the app should no longer appear in the cards view.
        self.assertFalse(self.cards_view.is_app_present(self._test_apps[2]),
                         "Killed app not expected to appear in cards view")

        # Check if the remaining 2 apps are visible in the cards view
        self.assertTrue(self.cards_view.is_app_displayed(self._test_apps[0]),
                        "First opened app should be visible in cards view")

        self.assertTrue(self.cards_view.is_app_displayed(self._test_apps[1]),
                        "Second app opened should be visible in cards view")
コード例 #39
0
class TestCardsViewThreeApps(GaiaTestCase):

    _test_apps = ["Clock", "Gallery", "Calendar"]

    def setUp(self):
        GaiaTestCase.setUp(self)
        self.cards_view = CardsView(self.marionette)

        # Launch the test apps
        for app in self._test_apps:
            self.apps.launch(app)

    def test_kill_app_from_cards_view(self):
        # https://moztrap.mozilla.org/manage/case/1917/

        # Switch to top level frame before dispatching the event
        self.marionette.switch_to_frame()

        # Pull up the cards view
        self.cards_view.open_cards_view()

        # Close the current app from the cards view
        self.cards_view.close_app(self._test_apps[2])

        self.marionette.switch_to_frame()

        # Pull up the cards view again
        self.cards_view.open_cards_view()

        # If successfully killed, the app should no longer appear in the cards view.
        self.assertFalse(self.cards_view.is_app_present(self._test_apps[2]),
            "Killed app not expected to appear in cards view")

        # Check if the remaining 2 apps are visible in the cards view
        self.assertTrue(self.cards_view.is_app_displayed(self._test_apps[0]),
            "First opened app should be visible in cards view")

        self.assertTrue(self.cards_view.is_app_displayed(self._test_apps[1]),
            "Second app opened should be visible in cards view")
コード例 #40
0
    def test_sms_auto_save_draft(self):
        """
        https://moztrap.mozilla.org/manage/case/7806/
        """
        _text_message_content = "Automated Test %s" % str(time.time())

        # launch messages app
        messages = Messages(self.marionette)
        messages.launch()

        # click new message
        new_message = messages.tap_create_new_message()

        self.marionette.switch_to_frame()
        Wait(self.marionette).until(lambda m: new_message.keyboard.is_keyboard_displayed)
        self.apps.switch_to_displayed_app()

        new_message.type_message(_text_message_content)
        self.assertEqual(new_message.message, _text_message_content)

        # close message app and leave cards view
        self.device.hold_home_button()
        from gaiatest.apps.system.regions.cards_view import CardsView
        cards_view = CardsView(self.marionette)
        cards_view.wait_for_cards_view()

        # wait for first app ready
        cards_view.wait_for_card_ready('sms')
        cards_view.close_app('sms')
        self.assertFalse(cards_view.is_app_present('sms'),
                         "Killed app not expected to appear in cards view")

        # wait for homescreen to be displayed
        Homescreen(self.marionette).wait_to_be_displayed()

        # re-open messages app
        messages.launch()
        self.assertTrue(messages.draft_threads[0].is_draft_icon_displayed)
        new_message = messages.draft_threads[0].open()

        # check that last message draft is shown correctly
        self.assertEqual(new_message.message, _text_message_content)
class TestCardsViewTwoApps(GaiaMtbfTestCase):

    _test_apps = ["Clock", "Gallery"]

    def setUp(self):
        GaiaMtbfTestCase.setUp(self)
        self.cards_view = CardsView(self.marionette)

        # Launch the test apps
        for app in self._test_apps:
            self.apps.launch(app)
            # Let's wait a bit for the app to fully launch
            time.sleep(2)

    def test_kill_app_from_cards_view(self):
        """https://moztrap.mozilla.org/manage/case/1917/"""

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

        # Wait for first app ready
        self.cards_view.wait_for_card_ready(self._test_apps[1])

        # Close the current apps from the cards view
        self.cards_view.close_app(self._test_apps[1])
        self.cards_view.close_app(self._test_apps[0])

        # If successfully killed, the apps should no longer appear in the cards view and the "No recent apps" message should be displayed
        self.assertFalse(
            self.cards_view.is_app_present(self._test_apps[1]), "Killed app not expected to appear in cards view"
        )

        self.assertFalse(
            self.cards_view.is_app_present(self._test_apps[0]), "Killed app not expected to appear in cards view"
        )

    def tearDown(self):
        self.device.touch_home_button()
        self.device.touch_home_button()
        GaiaMtbfTestCase.tearDown(self)
コード例 #42
0
class TestCardsViewTwoApps(GaiaTestCase):

    _test_apps = ["Clock", "Gallery"]

    def setUp(self):
        GaiaTestCase.setUp(self)
        self.cards_view = CardsView(self.marionette)

        # Launch the test apps
        for app in self._test_apps:
            self.apps.launch(app)

    def test_kill_app_from_cards_view(self):
        # https://moztrap.mozilla.org/manage/case/1917/

        # Switch to top level frame before dispatching the event
        self.marionette.switch_to_frame()

        # Pull up the cards view
        self.cards_view.open_cards_view()

        # Close the current apps from the cards view
        self.cards_view.close_app(self._test_apps[1])
        self.cards_view.close_app(self._test_apps[0])

        self.marionette.switch_to_frame()

        # Pull up the cards view again
        self.cards_view.open_cards_view()

        # If successfully killed, the apps should no longer appear in the cards view and the "No recent apps" message should be displayed
        self.assertFalse(self.cards_view.is_app_present(self._test_apps[1]),
                         "Killed app not expected to appear in cards view")

        self.assertFalse(self.cards_view.is_app_present(self._test_apps[0]),
                         "Killed app not expected to appear in cards view")

        self.assertEqual(self.cards_view.no_recent_apps_message,
                         "No recent apps")
コード例 #43
0
class TestCardsViewTwoApps(GaiaImageCompareTestCase):

    def setUp(self):
        GaiaImageCompareTestCase.setUp(self)
        self.cards_view = CardsView(self.marionette)

        self.contacts = Contacts(self.marionette)
        self.contacts.launch()
        self.gallery = Gallery(self.marionette)
        self.gallery.launch(empty=True)

        # 10 seconds for the actual user using the app a bit, and going back to homescreen
        time.sleep(10)
        self.device.touch_home_button()

    def test_cards_view_kill_apps_with_two_apps(self):
        """https://moztrap.mozilla.org/manage/case/1917/"""

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

        # Wait for first app ready
        self.cards_view.cards[1].wait_for_centered()
        self.take_screenshot(top_frame=True)

        # Close the current apps from the cards view
        self.cards_view.cards[1].close()
        self.cards_view.cards[0].wait_for_centered()
        self.take_screenshot(top_frame=True)
        self.cards_view.cards[0].close()
        self.cards_view.wait_for_cards_view_not_displayed()
        self.take_screenshot(top_frame=True)

        # If successfully killed, the apps should no longer appear in the cards view
        # and the "No recent apps" message should be displayed
        self.device.hold_home_button()
        self.cards_view.wait_for_no_card_displayed()
        self.take_screenshot(top_frame=True)
        self.assertEqual(len(self.cards_view.cards), 0)
        self.assertTrue(self.cards_view.is_no_card_displayed)
コード例 #44
0
    def test_that_app_can_be_launched_from_cards_view(self):
        # https://bugzilla.mozilla.org/show_bug.cgi?id=943338
        cards_view = CardsView(self.marionette)
        self.assertFalse(cards_view.is_cards_view_displayed,
                         'Cards view not expected to be visible')

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

        for app in self._test_apps:
            self.assertTrue(cards_view.is_app_displayed(app),
                            '%s app should be visible in cards view' % app)

        cards_view.swipe_to_next_app()
        cards_view.tap_app(self._test_apps[0])
        cards_view.wait_for_cards_view_not_displayed()

        self.assertEqual(self.apps.displayed_app.name, self._test_apps[0])
コード例 #45
0
ファイル: test_a11y_cards_view.py プロジェクト: 4gh/gaia
    def test_a11y_cards_view(self):

        cards_view = CardsView(self.marionette)
        self.assertTrue(cards_view.is_cards_view_a11y_hidden,
                        'Cards view should not be visible to the screen reader')

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

        # Wait for first app ready
        cards_view.wait_for_card_ready(self._test_apps[2])

        # Only current card should be visible
        self.assertTrue(cards_view.is_app_a11y_visible(self._test_apps[2]))
        self.assertTrue(cards_view.is_app_a11y_hidden(self._test_apps[1]))
        self.assertTrue(cards_view.is_app_a11y_hidden(self._test_apps[0]))

        # Swipe with two fingers right and left and verify card visibility
        cards_view.a11y_wheel_cards_view('right')
        self.assertTrue(cards_view.is_app_a11y_hidden(self._test_apps[2]))
        self.assertTrue(cards_view.is_app_a11y_visible(self._test_apps[1]))
        self.assertTrue(cards_view.is_app_a11y_hidden(self._test_apps[0]))

        cards_view.a11y_wheel_cards_view('right')
        self.assertTrue(cards_view.is_app_a11y_hidden(self._test_apps[2]))
        self.assertTrue(cards_view.is_app_a11y_hidden(self._test_apps[1]))
        self.assertTrue(cards_view.is_app_a11y_visible(self._test_apps[0]))

        # Swipe again even though there's nowhere to swipe to make sure the
        # state does not break
        cards_view.a11y_wheel_cards_view('right')
        self.assertTrue(cards_view.is_app_a11y_hidden(self._test_apps[2]))
        self.assertTrue(cards_view.is_app_a11y_hidden(self._test_apps[1]))
        self.assertTrue(cards_view.is_app_a11y_visible(self._test_apps[0]))

        cards_view.a11y_wheel_cards_view('left')
        self.assertTrue(cards_view.is_app_a11y_hidden(self._test_apps[2]))
        self.assertTrue(cards_view.is_app_a11y_visible(self._test_apps[1]))
        self.assertTrue(cards_view.is_app_a11y_hidden(self._test_apps[0]))

        cards_view.a11y_wheel_cards_view('left')
        self.assertTrue(cards_view.is_app_a11y_visible(self._test_apps[2]))
        self.assertTrue(cards_view.is_app_a11y_hidden(self._test_apps[1]))
        self.assertTrue(cards_view.is_app_a11y_hidden(self._test_apps[0]))

        # Swipe again even though there's nowhere to swipe to make sure the
        # state does not break
        cards_view.a11y_wheel_cards_view('left')
        self.assertTrue(cards_view.is_app_a11y_visible(self._test_apps[2]))
        self.assertTrue(cards_view.is_app_a11y_hidden(self._test_apps[1]))
        self.assertTrue(cards_view.is_app_a11y_hidden(self._test_apps[0]))

        # Assert there are 3 cards
        self.assertEqual(3, len(cards_view.cards), 'Expected 3 cards')

        # Remove a card by swiping with 2 fingers up
        cards_view.a11y_wheel_cards_view('up')

        # Assert there are 2 cards
        cards = cards_view.cards
        self.assertEqual(2, len(cards), 'Expected 2 cards')
        self.assertTrue(cards_view.is_app_a11y_visible(self._test_apps[1]))
        self.assertTrue(cards_view.is_app_a11y_hidden(self._test_apps[0]))

        # Remove a card by clicking its close button
        cards[1].a11y_click_close_button()

        # Assert there is 1 card
        cards = cards_view.cards
        self.assertEqual(1, len(cards), 'Expected 1 card')
        self.assertTrue(cards_view.is_app_a11y_visible(self._test_apps[0]))

        # Open an app by clicking its icon
        cards[0].a11y_click_app_icon()
        cards_view.wait_for_cards_view_not_displayed()
        self.assertEqual(self.apps.displayed_app.name, self._test_apps[0])

        # Switch to top level frame and reopen cards view
        self.marionette.switch_to_frame()
        self.device.hold_home_button()
        cards_view.wait_for_cards_view()
        cards_view.wait_for_card_ready(self._test_apps[0])

        # Assert there is 1 card
        cards = cards_view.cards
        self.assertEqual(1, len(cards), 'Expected 1 card')

        # Open an app by clicking its screenshot view
        cards[0].a11y_click_screenshot_view()
        cards_view.wait_for_cards_view_not_displayed()
        self.assertEqual(self.apps.displayed_app.name, self._test_apps[0])
コード例 #46
0
    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.wait_for_card_ready(self._test_apps[1])

        for app in self._test_apps:
            self.assertTrue(cards_view.is_app_displayed(app), "%s app should be present in cards view" % app)

        cards_view.swipe_to_previous_app()

        # Wait for previous app ready
        cards_view.wait_for_card_ready(self._test_apps[0])
        cards_view.tap_app(self._test_apps[0])

        cards_view.wait_for_cards_view_not_displayed()

        self.assertEqual(self.apps.displayed_app.name, self._test_apps[0])
コード例 #47
0
    def test_a11y_cards_view(self):

        cards_view = CardsView(self.marionette)
        self.assertTrue(
            cards_view.is_cards_view_a11y_hidden,
            'Cards view should not be visible to the screen reader')

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

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

        # Only current card should be visible
        self.assertTrue(cards_view.is_app_a11y_visible(self._test_apps[2]))
        self.assertTrue(cards_view.is_app_a11y_hidden(self._test_apps[1]))
        self.assertTrue(cards_view.is_app_a11y_hidden(self._test_apps[0]))

        # Swipe with two fingers right and left and verify card visibility
        cards_view.a11y_wheel_cards_view('right')
        self.assertTrue(cards_view.is_app_a11y_hidden(self._test_apps[2]))
        self.assertTrue(cards_view.is_app_a11y_visible(self._test_apps[1]))
        self.assertTrue(cards_view.is_app_a11y_hidden(self._test_apps[0]))

        cards_view.a11y_wheel_cards_view('right')
        self.assertTrue(cards_view.is_app_a11y_hidden(self._test_apps[2]))
        self.assertTrue(cards_view.is_app_a11y_hidden(self._test_apps[1]))
        self.assertTrue(cards_view.is_app_a11y_visible(self._test_apps[0]))

        # Swipe again even though there's nowhere to swipe to make sure the
        # state does not break
        cards_view.a11y_wheel_cards_view('right')
        self.assertTrue(cards_view.is_app_a11y_hidden(self._test_apps[2]))
        self.assertTrue(cards_view.is_app_a11y_hidden(self._test_apps[1]))
        self.assertTrue(cards_view.is_app_a11y_visible(self._test_apps[0]))

        cards_view.a11y_wheel_cards_view('left')
        self.assertTrue(cards_view.is_app_a11y_hidden(self._test_apps[2]))
        self.assertTrue(cards_view.is_app_a11y_visible(self._test_apps[1]))
        self.assertTrue(cards_view.is_app_a11y_hidden(self._test_apps[0]))

        cards_view.a11y_wheel_cards_view('left')
        self.assertTrue(cards_view.is_app_a11y_visible(self._test_apps[2]))
        self.assertTrue(cards_view.is_app_a11y_hidden(self._test_apps[1]))
        self.assertTrue(cards_view.is_app_a11y_hidden(self._test_apps[0]))

        # Swipe again even though there's nowhere to swipe to make sure the
        # state does not break
        cards_view.a11y_wheel_cards_view('left')
        self.assertTrue(cards_view.is_app_a11y_visible(self._test_apps[2]))
        self.assertTrue(cards_view.is_app_a11y_hidden(self._test_apps[1]))
        self.assertTrue(cards_view.is_app_a11y_hidden(self._test_apps[0]))

        # Assert there are 3 cards
        self.assertEqual(3, len(cards_view.cards), 'Expected 3 cards')

        # Remove a card by swiping with 2 fingers up
        cards_view.a11y_wheel_cards_view('up')

        # Assert there are 2 cards
        cards = cards_view.cards
        self.assertEqual(2, len(cards), 'Expected 2 cards')
        self.assertTrue(cards_view.is_app_a11y_visible(self._test_apps[1]))
        self.assertTrue(cards_view.is_app_a11y_hidden(self._test_apps[0]))

        # Remove a card by clicking its close button
        cards[1].a11y_click_close_button()

        # Assert there is 1 card
        cards = cards_view.cards
        self.assertEqual(1, len(cards), 'Expected 1 card')
        self.assertTrue(cards_view.is_app_a11y_visible(self._test_apps[0]))

        # Open an app by clicking its icon
        cards[0].a11y_click_app_icon()
        cards_view.wait_for_cards_view_not_displayed()
        self.assertEqual(self.apps.displayed_app.name, self._test_apps[0])

        # Switch to top level frame and reopen cards view
        self.marionette.switch_to_frame()
        self.device.hold_home_button()
        cards_view.wait_for_cards_view()
        cards_view.cards[0].wait_for_centered()

        # Assert there is 1 card
        cards = cards_view.cards
        self.assertEqual(1, len(cards), 'Expected 1 card')

        # Open an app by clicking its screenshot view
        cards[0].a11y_click_screenshot_view()
        cards_view.wait_for_cards_view_not_displayed()
        self.assertEqual(self.apps.displayed_app.name, self._test_apps[0])
コード例 #48
0
class TestCardsView(GaiaTestCase):

    _app_under_test = "Clock"
    _clock_frame_locator = (By.CSS_SELECTOR, "iframe[mozapp^='app://clock'][mozapp$='manifest.webapp']")

    def setUp(self):
        GaiaTestCase.setUp(self)
        self.cards_view = CardsView(self.marionette)

        # Launch the Clock app as a basic, reliable
        # app to test against in Cards View
        self.app = self.apps.launch(self._app_under_test)

    def test_cards_view(self):
        # https://moztrap.mozilla.org/manage/case/1909/
        # Switch to top level frame before dispatching the event
        self.marionette.switch_to_frame()

        # Check that cards view is not displayed
        self.assertFalse(self.cards_view.is_cards_view_displayed, "Cards view not expected to be visible")

        # Pull up the cards view
        self.cards_view.open_cards_view()

        self.assertTrue(self.cards_view.is_app_displayed(self._app_under_test),
            "%s app expected to be visible in cards view" % self._app_under_test)

        self.cards_view.exit_cards_view()

    def test_that_app_can_be_launched_from_cards_view(self):
        # https://github.com/mozilla/gaia-ui-tests/issues/98
        # Switch to top level frame before dispatching the event
        self.marionette.switch_to_frame()

        # Find the cards frame html element
        clock_frame = self.marionette.find_element(*self._clock_frame_locator)

        # Pull up the cards view
        self.cards_view.open_cards_view()

        self.assertFalse(clock_frame.is_displayed(), "Clock frame not expected to be displayed")

        # Launch the app from the cards view
        self.cards_view.tap_app(self._app_under_test)

        self.cards_view.wait_for_cards_view_not_displayed()
        self.assertTrue(clock_frame.is_displayed(), "Clock frame expected to be displayed")

    def test_kill_app_from_cards_view(self):
        # https://moztrap.mozilla.org/manage/case/1917/
        # Switch to top level frame before dispatching the event
        self.marionette.switch_to_frame()

        # Pull up the cards view
        self.cards_view.open_cards_view()

        # Close the current app from cards view
        self.cards_view.close_app(self._app_under_test)

        self.marionette.switch_to_frame()

        # Pull up the cards view again
        self.cards_view.open_cards_view()

        # If successfully killed, the app should no longer appear in the cards view.
        self.assertFalse(self.cards_view.is_app_present(self._app_under_test),
            "Killed app not expected to appear in cards view")
コード例 #49
0
    def test_cards_view_with_two_apps(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()
        card_frame = self.marionette.get_active_frame()
        self.take_screenshot()

        # disabled per Bug 1118390
        #self.change_orientation('landscape-primary')
        #self.take_screenshot()
        #self.change_orientation('portrait-primary')
        #self.take_screenshot()

        # Wait for first app ready
        cards_view.wait_for_card_ready(self._test_apps[1])

        for app in self._test_apps:
            self.assertTrue(cards_view.is_app_displayed(app),
                            '%s app should be present in cards view' % app)
        cards_view.swipe_to_previous_app()

        # Wait for previous app ready
        cards_view.wait_for_card_ready(self._test_apps[0])
        # sleep inside above method is insufficient
        time.sleep(2)
        self.take_screenshot()
        self.marionette.switch_to_frame(frame=card_frame)

        cards_view.tap_app(self._test_apps[0])
        cards_view.wait_for_cards_view_not_displayed()
        self.take_screenshot() #bug 1151571 will cause blank screen capture

        self.assertEqual(self.apps.displayed_app.name, self._test_apps[0])
コード例 #50
0
    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_cards_view_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.wait_for_card_ready(self._test_apps[1])

        for app in self._test_apps:
            self.assertTrue(cards_view.is_app_displayed(app),
                            '%s app should be present in cards view' % app)

        cards_view.swipe_to_previous_app()

        # Wait for previous app ready
        cards_view.wait_for_card_ready(self._test_apps[0])
        cards_view.tap_app(self._test_apps[0])

        cards_view.wait_for_cards_view_not_displayed()

        self.assertEqual(self.apps.displayed_app.name, self._test_apps[0])
コード例 #51
0
    def test_cards_view_with_two_apps(self):
        """https://moztrap.mozilla.org/manage/case/2462/"""

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

        # Pull up the cards view
        self.device.hold_home_button()
        cards_view.wait_for_cards_view()
        card_frame = self.marionette.get_active_frame()
        self.take_screenshot()
        self.change_orientation('landscape-primary')
        self.take_screenshot()
        self.change_orientation('portrait-primary')
        self.take_screenshot()

        # Wait for first app ready
        cards_view.wait_for_card_ready(self._test_apps[1])

        for app in self._test_apps:
            self.assertTrue(cards_view.is_app_displayed(app),
                            '%s app should be present in cards view' % app)
        cards_view.swipe_to_previous_app()

        # Wait for previous app ready
        cards_view.wait_for_card_ready(self._test_apps[0])
        # sleep inside above method is insufficient
        time.sleep(5)
        self.take_screenshot()
        self.marionette.switch_to_frame(frame=card_frame)

        cards_view.tap_app(self._test_apps[0])

        cards_view.wait_for_cards_view_not_displayed()
        self.take_screenshot()

        self.assertEqual(self.apps.displayed_app.name, self._test_apps[0])