當前位置: 首頁>>代碼示例>>Python>>正文


Python CardsView.is_app_a11y_visible方法代碼示例

本文整理匯總了Python中gaiatest.apps.system.regions.cards_view.CardsView.is_app_a11y_visible方法的典型用法代碼示例。如果您正苦於以下問題:Python CardsView.is_app_a11y_visible方法的具體用法?Python CardsView.is_app_a11y_visible怎麽用?Python CardsView.is_app_a11y_visible使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在gaiatest.apps.system.regions.cards_view.CardsView的用法示例。


在下文中一共展示了CardsView.is_app_a11y_visible方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_a11y_cards_view

# 需要導入模塊: from gaiatest.apps.system.regions.cards_view import CardsView [as 別名]
# 或者: from gaiatest.apps.system.regions.cards_view.CardsView import is_app_a11y_visible [as 別名]
    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])
開發者ID:4gh,項目名稱:gaia,代碼行數:94,代碼來源:test_a11y_cards_view.py


注:本文中的gaiatest.apps.system.regions.cards_view.CardsView.is_app_a11y_visible方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。