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


Python AdvancedSettingsPage.refresh_and_wait_for_load方法代码示例

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


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

示例1: AdvancedSettingsValidationTest

# 需要导入模块: from common.test.acceptance.pages.studio.settings_advanced import AdvancedSettingsPage [as 别名]
# 或者: from common.test.acceptance.pages.studio.settings_advanced.AdvancedSettingsPage import refresh_and_wait_for_load [as 别名]
class AdvancedSettingsValidationTest(StudioCourseTest):
    """
    Tests for validation feature in Studio's advanced settings tab
    """
    def setUp(self):
        super(AdvancedSettingsValidationTest, self).setUp()
        self.advanced_settings = AdvancedSettingsPage(
            self.browser,
            self.course_info['org'],
            self.course_info['number'],
            self.course_info['run']
        )

        self.type_fields = ['Course Display Name', 'Advanced Module List', 'Discussion Topic Mapping',
                            'Maximum Attempts', 'Course Announcement Date']

        # Before every test, make sure to visit the page first
        self.advanced_settings.visit()

    def test_modal_shows_one_validation_error(self):
        """
        Test that advanced settings don't save if there's a single wrong input,
        and that it shows the correct error message in the modal.
        """

        # Feed an integer value for String field.
        # .set method saves automatically after setting a value
        course_display_name = self.advanced_settings.get('Course Display Name')
        self.advanced_settings.set('Course Display Name', 1)
        self.advanced_settings.wait_for_modal_load()

        # Test Modal
        self.check_modal_shows_correct_contents(['Course Display Name'])
        self.advanced_settings.refresh_and_wait_for_load()

        self.assertEquals(
            self.advanced_settings.get('Course Display Name'),
            course_display_name,
            'Wrong input for Course Display Name must not change its value'
        )

    def test_modal_shows_multiple_validation_errors(self):
        """
        Test that advanced settings don't save with multiple wrong inputs
        """

        # Save original values and feed wrong inputs
        original_values_map = self.get_settings_fields_of_each_type()
        self.set_wrong_inputs_to_fields()
        self.advanced_settings.wait_for_modal_load()

        # Test Modal
        self.check_modal_shows_correct_contents(self.type_fields)
        self.advanced_settings.refresh_and_wait_for_load()

        for key, val in original_values_map.iteritems():
            self.assertEquals(
                self.advanced_settings.get(key),
                val,
                'Wrong input for Advanced Settings Fields must not change its value'
            )

    def test_undo_changes(self):
        """
        Test that undo changes button in the modal resets all settings changes
        """

        # Save original values and feed wrong inputs
        original_values_map = self.get_settings_fields_of_each_type()
        self.set_wrong_inputs_to_fields()

        # Let modal popup
        self.advanced_settings.wait_for_modal_load()

        # Click Undo Changes button
        self.advanced_settings.undo_changes_via_modal()

        # Check that changes are undone
        for key, val in original_values_map.iteritems():
            self.assertEquals(
                self.advanced_settings.get(key),
                val,
                'Undoing Should revert back to original value'
            )

    def test_manual_change(self):
        """
        Test that manual changes button in the modal keeps settings unchanged
        """
        inputs = {"Course Display Name": 1,
                  "Advanced Module List": 1,
                  "Discussion Topic Mapping": 1,
                  "Maximum Attempts": '"string"',
                  "Course Announcement Date": '"string"',
                  }

        self.set_wrong_inputs_to_fields()
        self.advanced_settings.wait_for_modal_load()
        self.advanced_settings.trigger_manual_changes()

#.........这里部分代码省略.........
开发者ID:AlexxNica,项目名称:edx-platform,代码行数:103,代码来源:test_studio_settings.py

示例2: AdvancedSettingsValidationTest

# 需要导入模块: from common.test.acceptance.pages.studio.settings_advanced import AdvancedSettingsPage [as 别名]
# 或者: from common.test.acceptance.pages.studio.settings_advanced.AdvancedSettingsPage import refresh_and_wait_for_load [as 别名]
class AdvancedSettingsValidationTest(StudioCourseTest):
    """
    Tests for validation feature in Studio's advanced settings tab
    """
    course_name_key = 'Course Display Name'
    course_name_value = 'Test Name'

    def setUp(self):
        super(AdvancedSettingsValidationTest, self).setUp()
        self.advanced_settings = AdvancedSettingsPage(
            self.browser,
            self.course_info['org'],
            self.course_info['number'],
            self.course_info['run']
        )

        self.type_fields = ['Course Display Name', 'Advanced Module List', 'Discussion Topic Mapping',
                            'Maximum Attempts', 'Course Announcement Date']

        # Before every test, make sure to visit the page first
        self.advanced_settings.visit()

    def test_course_author_sees_default_advanced_settings(self):
        """
        Scenario: Test that advanced settings have the default settings
            Given a staff logs in to studio
            When this user goes to advanced settings page
                Then this user sees 'Allow Anonymous Discussion Posts' as true
                And 'Enable Timed Exams' as false
                And 'Maximum Attempts' as null
        """
        anonymous_discussion_setting = self.advanced_settings.get('Allow Anonymous Discussion Posts')
        timed_exam_settings = self.advanced_settings.get('Enable Timed Exams')
        max_attempts = self.advanced_settings.get('Maximum Attempts')
        page_default_settings = [
            anonymous_discussion_setting,
            timed_exam_settings,
            max_attempts
        ]
        default_anonymous_discussion_setting = 'true'
        default_timed_exam_settings = 'false'
        default_max_attempts = 'null'
        expected_default_settings = [
            default_anonymous_discussion_setting,
            default_timed_exam_settings,
            default_max_attempts
        ]
        self.assertEqual(
            page_default_settings,
            expected_default_settings
        )

    def test_keys_appear_alphabetically(self):
        """
        Scenario: Test that advanced settings have all the keys in alphabetic order
            Given a staff logs in to studio
            When this user goes to advanced settings page
                Then he sees all the advanced setting keys in alphabetic order
        """

        key_names = self.advanced_settings.key_names
        self.assertEqual(key_names, sorted(key_names))

    def test_cancel_editing_key_value(self):
        """
        Scenario: Test that advanced settings does not save the key value, if cancel
        is clicked from notification bar
            Given a staff logs in to studio
            When this user goes to advanced settings page and enters and new course name
                Then he clicks 'cancel' buttin when asked to save changes
            When this user reloads the page
                And then he does not see any change in the original course name
        """

        original_course_display_name = self.advanced_settings.get(self.course_name_key)
        new_course_name = 'New Course Name'
        type_in_codemirror(self.advanced_settings, 16, new_course_name)
        self.advanced_settings.cancel()
        self.advanced_settings.refresh_and_wait_for_load()
        self.assertNotEqual(
            original_course_display_name,
            new_course_name,
            (
                'original course name:{} can not not be equal to unsaved course name {}'.format(
                    original_course_display_name,
                    new_course_name
                )
            )
        )
        self.assertEqual(
            self.advanced_settings.get(self.course_name_key),
            original_course_display_name,
            (
                'course name from the page should be same as original_course_display_name:{}'.format(
                    original_course_display_name
                )
            )
        )

    def test_editing_key_value(self):
#.........这里部分代码省略.........
开发者ID:cmscom,项目名称:edx-platform,代码行数:103,代码来源:test_studio_settings.py


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