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


Python CardsView.a11y_wheel_cards_view方法代码示例

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


在下文中一共展示了CardsView.a11y_wheel_cards_view方法的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 a11y_wheel_cards_view [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.a11y_wheel_cards_view方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。