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


Python AccountSettingsPage.wait_for_page方法代码示例

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


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

示例1: set_birth_year

# 需要导入模块: from common.test.acceptance.pages.lms.account_settings import AccountSettingsPage [as 别名]
# 或者: from common.test.acceptance.pages.lms.account_settings.AccountSettingsPage import wait_for_page [as 别名]
 def set_birth_year(self, birth_year):
     """
     Set birth year for the current user to the specified value.
     """
     account_settings_page = AccountSettingsPage(self.browser)
     account_settings_page.visit()
     account_settings_page.wait_for_page()
     self.assertEqual(
         account_settings_page.value_for_dropdown_field('year_of_birth', str(birth_year)),
         str(birth_year)
     )
开发者ID:Colin-Fredericks,项目名称:edx-platform,代码行数:13,代码来源:test_learner_profile.py

示例2: AccountSettingsTestMixin

# 需要导入模块: from common.test.acceptance.pages.lms.account_settings import AccountSettingsPage [as 别名]
# 或者: from common.test.acceptance.pages.lms.account_settings.AccountSettingsPage import wait_for_page [as 别名]
class AccountSettingsTestMixin(EventsTestMixin, AcceptanceTest):
    """
    Mixin with helper methods to test the account settings page.
    """

    CHANGE_INITIATED_EVENT_NAME = u"edx.user.settings.change_initiated"
    USER_SETTINGS_CHANGED_EVENT_NAME = 'edx.user.settings.changed'
    ACCOUNT_SETTINGS_REFERER = u"/account/settings"

    def visit_account_settings_page(self, gdpr=False):
        """
        Visit the account settings page for the current user, and store the page instance
        as self.account_settings_page.
        """
        self.account_settings_page = AccountSettingsPage(self.browser)
        self.account_settings_page.visit()
        self.account_settings_page.wait_for_ajax()
        # TODO: LEARNER-4422 - delete when we clean up flags
        if gdpr:
            self.account_settings_page.browser.get(self.browser.current_url + "?course_experience.gdpr=1")
            self.account_settings_page.wait_for_page()

    def log_in_as_unique_user(self, email=None, full_name=None, password=None):
        """
        Create a unique user and return the account's username and id.
        """
        username = "test_{uuid}".format(uuid=self.unique_id[0:6])
        auto_auth_page = AutoAuthPage(
            self.browser,
            username=username,
            email=email,
            full_name=full_name,
            password=password
        ).visit()
        user_id = auto_auth_page.get_user_id()
        return username, user_id

    def settings_changed_event_filter(self, event):
        """Filter out any events that are not "settings changed" events."""
        return event['event_type'] == self.USER_SETTINGS_CHANGED_EVENT_NAME

    def expected_settings_changed_event(self, setting, old, new, table=None):
        """A dictionary representing the expected fields in a "settings changed" event."""
        return {
            'username': self.username,
            'referer': self.get_settings_page_url(),
            'event': {
                'user_id': self.user_id,
                'setting': setting,
                'old': old,
                'new': new,
                'truncated': [],
                'table': table or 'auth_userprofile'
            }
        }

    def settings_change_initiated_event_filter(self, event):
        """Filter out any events that are not "settings change initiated" events."""
        return event['event_type'] == self.CHANGE_INITIATED_EVENT_NAME

    def expected_settings_change_initiated_event(self, setting, old, new, username=None, user_id=None):
        """A dictionary representing the expected fields in a "settings change initiated" event."""
        return {
            'username': username or self.username,
            'referer': self.get_settings_page_url(),
            'event': {
                'user_id': user_id or self.user_id,
                'setting': setting,
                'old': old,
                'new': new,
            }
        }

    def get_settings_page_url(self):
        """The absolute URL of the account settings page given the test context."""
        return self.relative_path_to_absolute_uri(self.ACCOUNT_SETTINGS_REFERER)

    def assert_no_setting_changed_event(self):
        """Assert no setting changed event has been emitted thus far."""
        self.assert_no_matching_events_were_emitted({'event_type': self.USER_SETTINGS_CHANGED_EVENT_NAME})
开发者ID:cmscom,项目名称:edx-platform,代码行数:82,代码来源:test_account_settings.py


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