コード例 #1
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()
コード例 #2
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')
コード例 #3
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')
コード例 #4
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])
コード例 #5
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.wait_for_card_ready(search.manifest_url[:-16])
        self.assertEqual(len(cards_view.cards), 1,
                         'Should have 1 card to display')
        self.assertTrue(cards_view.is_app_displayed(search.manifest_url[:-16]),
                        'Should have browser in cards view with title hello')
コード例 #6
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.wait_for_card_ready(search.manifest_url[:-16])
        self.assertEqual(len(cards_view.cards), 1, 'Should have 1 card to display')
        self.assertTrue(cards_view.is_app_displayed(search.manifest_url[:-16]),
            'Should have browser in cards view with title hello')
コード例 #7
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")
コード例 #8
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")
コード例 #9
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])
コード例 #10
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])
コード例 #11
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])
コード例 #12
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])
コード例 #13
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")