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


Python AccountSettingsPage.wait_for_ajax方法代码示例

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


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

示例1: LMSLanguageTest

# 需要导入模块: from common.test.acceptance.pages.lms.account_settings import AccountSettingsPage [as 别名]
# 或者: from common.test.acceptance.pages.lms.account_settings.AccountSettingsPage import wait_for_ajax [as 别名]
class LMSLanguageTest(UniqueCourseTest):
    """ Test suite for the LMS Language """
    def setUp(self):
        super(LMSLanguageTest, self).setUp()
        self.dashboard_page = DashboardPage(self.browser)
        self.account_settings = AccountSettingsPage(self.browser)
        AutoAuthPage(self.browser).visit()

    def test_lms_language_change(self):
        """
        Scenario: Ensure that language selection is working fine.
        First I go to the user dashboard page in LMS. I can see 'English' is selected by default.
        Then I choose 'Dummy Language' from drop down (at top of the page).
        Then I visit the student account settings page and I can see the language has been updated to 'Dummy Language'
        in both drop downs.
        After that I select the 'English' language and visit the dashboard page again.
        Then I can see that top level language selector persist its value to 'English'.
        """
        self.dashboard_page.visit()
        language_selector = self.dashboard_page.language_selector
        self.assertEqual(
            get_selected_option_text(language_selector),
            u'English'
        )

        select_option_by_text(language_selector, 'Dummy Language (Esperanto)')
        self.dashboard_page.wait_for_ajax()
        self.account_settings.visit()
        self.assertEqual(self.account_settings.value_for_dropdown_field('pref-lang'), u'Dummy Language (Esperanto)')
        self.assertEqual(
            get_selected_option_text(language_selector),
            u'Dummy Language (Esperanto)'
        )

        # changed back to English language.
        select_option_by_text(language_selector, 'English')
        self.account_settings.wait_for_ajax()
        self.assertEqual(self.account_settings.value_for_dropdown_field('pref-lang'), u'English')

        self.dashboard_page.visit()
        self.assertEqual(
            get_selected_option_text(language_selector),
            u'English'
        )
开发者ID:cmscom,项目名称:edx-platform,代码行数:46,代码来源:test_lms.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_ajax [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):
        """
        Visit the account settings page for the current user, and store the page instance
        as self.account_settings_page.
        """
        # pylint: disable=attribute-defined-outside-init
        self.account_settings_page = AccountSettingsPage(self.browser)
        self.account_settings_page.visit()
        self.account_settings_page.wait_for_ajax()

    def log_in_as_unique_user(self, email=None, full_name=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).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:bryanlandia,项目名称:edx-platform,代码行数:73,代码来源:test_account_settings.py


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