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


Python HomePage.go_to_login_page方法代码示例

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


在下文中一共展示了HomePage.go_to_login_page方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: TestAddNotifications

# 需要导入模块: from pages.home_page import HomePage [as 别名]
# 或者: from pages.home_page.HomePage import go_to_login_page [as 别名]

#.........这里部分代码省略.........
        Scenario: When user adds notification in first namespace, it does not change
        unread notification count in other namespace
        Given that I am on the notification home page
        And all name spaces have been initialized to 0 count
        When I add notifications in any namespace
        Then the unread notification count in other namespace remains unchanged
        """
        self.login()
        for namespace in self.namespaces:
            self.logged_in_home_page.set_namespace(namespace)
            self.logged_in_home_page.show_notifications_container()
            self.logged_in_home_page.verify_notifications_container_is_visible()
            self.logged_in_home_page.mark_as_read()
            display_notification_count = self.logged_in_home_page.get_notifications_count()
            self.assertEqual(display_notification_count, 0)
        self.logged_in_home_page.set_namespace(self.namespaces[1])
        self.logged_in_home_page.add_notification()
        self.logged_in_home_page.show_notifications_container()
        self.logged_in_home_page.verify_notifications_container_is_visible()
        unread_notification_count_for_namespace_2 = self.logged_in_home_page.return_unread_notifications_count()
        self.assertEqual(unread_notification_count_for_namespace_2, 1)
        self.logged_in_home_page.set_namespace(self.namespaces[0])
        self.logged_in_home_page.show_notifications_container()
        self.logged_in_home_page.verify_notifications_container_is_visible()
        unread_notification_count_for_namespace_1 = self.logged_in_home_page.return_unread_notifications_count()
        self.assertEqual(unread_notification_count_for_namespace_1, 0)

    def test_19_namespace_three(self):
        """
        Scenario: When user marks notifications in first namespace as read, it does not change
        notifications status in 2nd namespace
        Given that I am on the notification home page
        And all name spaces have some notifications
        When I mark notifications as read in one name space
        Then the notification status in other namespace remains unchanged
        """
        self.login()
        for namespace in self.namespaces:
            self.logged_in_home_page.set_namespace(namespace)
            self.logged_in_home_page.add_notification()
        self.logged_in_home_page.set_namespace(self.namespaces[0])
        self.logged_in_home_page.show_notifications_container()
        self.logged_in_home_page.verify_notifications_container_is_visible()
        self.logged_in_home_page.mark_as_read()
        notification_count_for_namespace_1 = self.logged_in_home_page.get_notifications_count()
        self.assertEqual(notification_count_for_namespace_1, 0)
        self.logged_in_home_page.set_namespace(self.namespaces[1])
        notification_count_for_namespace_2 = self.logged_in_home_page.get_notifications_count()
        self.assertTrue(notification_count_for_namespace_2 > 0)

    def test_20_close_icon(self):
        """
        Scenario: When user clicks on close icon of any notification, it should remain on current
        page and notification count along with unread count should decrease by 1
        Given that I am on the notification home page
        And there are some notifications present
        When I click on any notification's close icon
        Then it should stay on the same page
        And the notification count should decrease by one
        And unread notification count should also decrease by one
        """
        self.login()
        self.logged_in_home_page.show_notifications_container()
        self.logged_in_home_page.verify_notifications_container_is_visible()
        self.logged_in_home_page.mark_as_read()
        self.logged_in_home_page.hide_notification_container()
        self.logged_in_home_page.verify_notifications_container_is_invisible()
        for key in self.notification_dict:
            self.logged_in_home_page.select_notification_type(key)
            self.logged_in_home_page.add_notification()
            initial_notification_count = self.logged_in_home_page.get_notifications_count()
            self.assertEqual(initial_notification_count, 1)
            self.logged_in_home_page.show_notifications_container()
            self.logged_in_home_page.verify_notifications_container_is_visible()
            initial_unread_notification_count = self.logged_in_home_page.return_unread_notifications_count()
            self.assertEqual(initial_unread_notification_count, 1)
            self.logged_in_home_page.verify_notifications_container_is_visible()
            self.logged_in_home_page.close_notification()
            self.assertTrue(self.logged_in_home_page.is_browser_on_page())
            final_unread_notification_count = self.logged_in_home_page.return_unread_notifications_count()
            self.assertEqual(final_unread_notification_count, 0)
            final_notification_count = self.logged_in_home_page.get_notifications_count()
            self.assertEqual(final_notification_count, 0)
            self.logged_in_home_page.hide_notification_container()
            self.logged_in_home_page.verify_notifications_container_is_invisible()

    def login(self):
        """
        Go to home page and login using correct credentials
        """
        self.home_page.visit()
        self.home_page.go_to_login_page()
        login_result = self.login_page.login_to_application(user_name, password)
        if login_result == 'User not registered':
            self.home_page.go_to_registration_page()
            self.registration_page.register(user_name, user_email, password)
            self.registration_success.go_to_login_page()
            self.login_page.login_to_application(user_name, password)
            self.assertTrue(self.logged_in_home_page.is_browser_on_page())
        self.assertTrue(self.logged_in_home_page.is_browser_on_page())
开发者ID:muhhshoaib,项目名称:edx-notifications,代码行数:104,代码来源:test_notifications.py


注:本文中的pages.home_page.HomePage.go_to_login_page方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。