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


Python container.ContainerPage类代码示例

本文整理汇总了Python中common.test.acceptance.pages.studio.container.ContainerPage的典型用法代码示例。如果您正苦于以下问题:Python ContainerPage类的具体用法?Python ContainerPage怎么用?Python ContainerPage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: test_use_group_configuration

    def test_use_group_configuration(self):
        """
        Scenario: Ensure that the group configuration can be used by split_module correctly
        Given I have a course without group configurations
        When I create new group configuration
        And I set new name and add a new group, save the group configuration
        And I go to the unit page in Studio
        And I add new advanced module "Content Experiment"
        When I assign created group configuration to the module
        Then I see the module has correct groups
        """
        self.page.visit()
        # Create new group configuration
        self.page.create_experiment_group_configuration()
        config = self.page.experiment_group_configurations[0]
        config.name = "New Group Configuration Name"
        # Add new group
        config.add_group()
        config.groups[2].name = "New group"
        # Save the configuration
        config.save()

        split_test = self._add_split_test_to_vertical(number=0)

        container = ContainerPage(self.browser, split_test.locator)
        container.visit()
        container.edit()
        component_editor = ComponentEditorView(self.browser, container.locator)
        component_editor.set_select_value_and_save('Group Configuration', 'New Group Configuration Name')
        self.verify_groups(container, ['Group A', 'Group B', 'New group'], [])
开发者ID:Colin-Fredericks,项目名称:edx-platform,代码行数:30,代码来源:test_studio_split_test.py

示例2: DiscussionComponentTest

class DiscussionComponentTest(ContainerBase):
    """
    Feature: CMS.Component Adding
    As a course author, I want to be able to add and edit Discussion component
    """
    def setUp(self, is_staff=True):
        """
        Create a course with a section, subsection, and unit to which to add the component.
        """
        super(DiscussionComponentTest, self).setUp(is_staff=is_staff)
        self.component = 'discussion'
        self.unit = self.go_to_unit_page()
        self.container_page = ContainerPage(self.browser, None)
        # Add Discussion component
        add_component(self.container_page, 'discussion', self.component)
        self.component = self.unit.xblocks[1]
        self.container_page.edit()
        self.discussion_editor = DiscussionComponentEditor(self.browser, self.component.locator)

    def populate_course_fixture(self, course_fixture):
        """
        Adds a course fixture
        """
        course_fixture.add_children(
            XBlockFixtureDesc('chapter', 'Test Section').add_children(
                XBlockFixtureDesc('sequential', 'Test Subsection').add_children(
                    XBlockFixtureDesc('vertical', 'Test Unit')
                )
            )
        )

    def test_view_discussion_component_metadata(self):
        """
        Scenario: Staff user can view discussion component metadata
            Given I am in Studio and I have added a Discussion component
            When I edit Discussion component
            Then I see three settings and their expected values
        """

        field_values = self.discussion_editor.edit_discussion_field_values
        self.assertEqual(
            field_values,
            ['Discussion', 'Week 1', 'Topic-Level Student-Visible Label']
        )

    def test_edit_discussion_component(self):
        """
        Scenario: Staff user can modify display name
            Given I am in Studio and I have added a Discussion component
            When I open Discussion component's edit dialogue
            Then I can modify the display name
            And My display name change is persisted on save
        """

        field_name = 'Display Name'
        new_name = 'Test Name'
        self.discussion_editor.set_field_val(field_name, new_name)
        self.discussion_editor.save()
        component_name = self.unit.xblock_titles[0]
        self.assertEqual(component_name, new_name)
开发者ID:cmscom,项目名称:edx-platform,代码行数:60,代码来源:test_studio_discussion_component.py

示例3: test_easy_access_from_experiment

    def test_easy_access_from_experiment(self):
        """
        Scenario: When a Content Experiment uses a Group Configuration,
        ensure that the link to that Group Configuration works correctly.

        Given I have a course with two Group Configurations
        And Content Experiment is assigned to one Group Configuration
        Then I see a link to Group Configuration
        When I click on the Group Configuration link
        Then I see the Group Configurations page
        And I see that appropriate Group Configuration is expanded.
        """
        # Create a new group configurations
        self.course_fixture._update_xblock(self.course_fixture._course_location, {
            "metadata": {
                u"user_partitions": [
                    create_user_partition_json(
                        0,
                        "Name",
                        "Description.",
                        [Group("0", "Group A"), Group("1", "Group B")]
                    ),
                    create_user_partition_json(
                        1,
                        'Name of second Group Configuration',
                        'Second group configuration.',
                        [Group("0", 'Alpha'), Group("1", 'Beta'), Group("2", 'Gamma')]
                    ),
                ],
            },
        })

        # Assign newly created group configuration to unit
        vertical = self.course_fixture.get_nested_xblocks(category="vertical")[0]
        self.course_fixture.create_xblock(
            vertical.locator,
            XBlockFixtureDesc('split_test', 'Test Content Experiment', metadata={'user_partition_id': 1})
        )

        unit = ContainerPage(self.browser, vertical.locator)
        unit.visit()
        experiment = unit.xblocks[0]

        group_configuration_link_name = experiment.group_configuration_link_name

        experiment.go_to_group_configuration_page()
        self.page.wait_for_page()

        # Appropriate Group Configuration is expanded.
        self.assertFalse(self.page.experiment_group_configurations[0].is_expanded)
        self.assertTrue(self.page.experiment_group_configurations[1].is_expanded)

        self.assertEqual(
            group_configuration_link_name,
            self.page.experiment_group_configurations[1].name
        )
开发者ID:Colin-Fredericks,项目名称:edx-platform,代码行数:56,代码来源:test_studio_split_test.py

示例4: test_split_test_LMS_staff_view

    def test_split_test_LMS_staff_view(self):
        """
        Scenario: Ensure that split test is correctly rendered in LMS staff mode as it is
                  and after inactive group removal.

        Given I have a course with group configurations and split test that assigned to first group configuration
        Then I publish split test and view it in LMS in staff view
        And it is rendered correctly
        Then I go to group configuration and delete group
        Then I publish split test and view it in LMS in staff view
        And it is rendered correctly
        Then I go to split test and delete inactive vertical
        Then I publish unit and view unit in LMS in staff view
        And it is rendered correctly
        """

        config, split_test = self.create_group_configuration_experiment([Group("0", "Group A"), Group("1", "Group B"), Group("2", "Group C")], True)
        container = ContainerPage(self.browser, split_test.locator)

        # render in LMS correctly
        courseware_page = CoursewarePage(self.browser, self.course_id)
        self.publish_unit_and_verify_groups_in_lms(courseware_page, [u'Group A', u'Group B', u'Group C'])

        # I go to group configuration and delete group
        self.page.visit()
        self.page.q(css='.group-toggle').first.click()
        config.edit()
        config.groups[2].remove()
        config.save()
        self.page.q(css='.group-toggle').first.click()
        self._assert_fields(config, name="Name", description="Description", groups=["Group A", "Group B"])
        self.browser.close()
        self.browser.switch_to_window(self.browser.window_handles[0])

        # render in LMS to see how inactive vertical is rendered
        self.publish_unit_and_verify_groups_in_lms(
            courseware_page,
            [u'Group A', u'Group B', u'Group ID 2 (inactive)'],
            publish=False
        )

        self.browser.close()
        self.browser.switch_to_window(self.browser.window_handles[0])

        # I go to split test and delete inactive vertical
        container.visit()
        container.delete(0)

        # render in LMS again
        self.publish_unit_and_verify_groups_in_lms(courseware_page, [u'Group A', u'Group B'])
开发者ID:Colin-Fredericks,项目名称:edx-platform,代码行数:50,代码来源:test_studio_split_test.py

示例5: setUp

 def setUp(self, is_staff=True):
     """
     Create a course with a section, subsection, and unit to which to add the component.
     """
     super(HTMLComponentEditorTests, self).setUp(is_staff=is_staff)
     self.unit = self.go_to_unit_page()
     self.container_page = ContainerPage(self.browser, None)
     self.xblock_wrapper = XBlockWrapper(self.browser, None)
     self.component = None
     self.html_editor = None
     self.iframe = None
开发者ID:digitalsatori,项目名称:edx-platform,代码行数:11,代码来源:test_studio_html_editor.py

示例6: setUp

 def setUp(self, is_staff=True):
     """
     Create a course with a section, subsection, and unit to which to add the component.
     """
     super(DiscussionComponentTest, self).setUp(is_staff=is_staff)
     self.component = 'discussion'
     self.unit = self.go_to_unit_page()
     self.container_page = ContainerPage(self.browser, None)
     # Add Discussion component
     add_component(self.container_page, 'discussion', self.component)
     self.component = self.unit.xblocks[1]
     self.container_page.edit()
     self.discussion_editor = DiscussionComponentEditor(self.browser, self.component.locator)
开发者ID:cmscom,项目名称:edx-platform,代码行数:13,代码来源:test_studio_discussion_component.py

示例7: setUp

 def setUp(self, is_staff=True):
     """
     Create a course with a section, subsection, and unit to which to add the component.
     """
     super(ProblemComponentEditor, self).setUp(is_staff=is_staff)
     self.component = 'Blank Common Problem'
     self.unit = self.go_to_unit_page()
     self.container_page = ContainerPage(self.browser, None)
     # Add a Problem
     add_component(self.container_page, 'problem', self.component)
     self.component = self.unit.xblocks[1]
     self.container_page.edit()
     self.problem_editor = ProblemXBlockEditorView(self.browser, self.component.locator)
开发者ID:digitalsatori,项目名称:edx-platform,代码行数:13,代码来源:test_studio_problem_editor.py

示例8: _studio_add_content

    def _studio_add_content(self, studio_course_outline, html_content):
        """
        Add content to first section on studio course page.
        """
        # create a unit in course outline
        studio_course_outline.visit()
        subsection = studio_course_outline.section_at(0).subsection_at(0)
        subsection.expand_subsection()
        subsection.add_unit()

        # got to unit and create an HTML component and save (not publish)
        unit_page = ContainerPage(self.browser, None)
        unit_page.wait_for_page()
        add_html_component(unit_page, 0)
        unit_page.wait_for_element_presence('.edit-button', 'Edit button is visible')
        click_css(unit_page, '.edit-button', 0, require_notification=False)
        unit_page.wait_for_element_visibility('.modal-editor', 'Modal editor is visible')
        type_in_codemirror(unit_page, 0, html_content)
        click_css(unit_page, '.action-save', 0)
开发者ID:digitalsatori,项目名称:edx-platform,代码行数:19,代码来源:test_lms_dashboard_search.py

示例9: _studio_add_content

    def _studio_add_content(self, section_index):
        """
        Add content on studio course page under specified section
        """

        self._auto_auth(self.STAFF_USERNAME, self.STAFF_EMAIL, True)
        # create a unit in course outline
        self.studio_course_outline.visit()
        subsection = self.studio_course_outline.section_at(section_index).subsection_at(0)
        subsection.expand_subsection()
        subsection.add_unit()

        # got to unit and create an HTML component and save (not publish)
        unit_page = ContainerPage(self.browser, None)
        unit_page.wait_for_page()
        add_html_component(unit_page, 0)
        unit_page.wait_for_element_presence('.edit-button', 'Edit button is visible')
        click_css(unit_page, '.edit-button', 0, require_notification=False)
        unit_page.wait_for_element_visibility('.modal-editor', 'Modal editor is visible')
        type_in_codemirror(unit_page, 0, self.HTML_CONTENT)
        click_css(unit_page, '.action-save', 0)
开发者ID:digitalsatori,项目名称:edx-platform,代码行数:21,代码来源:test_lms_courseware_search.py

示例10: test_container_page_active_verticals_names_are_synced

    def test_container_page_active_verticals_names_are_synced(self):
        """
        Scenario: Ensure that the Content Experiment display synced vertical names and correct groups.
        Given I have a course with group configuration
        And I go to the Group Configuration page in Studio
        And I edit the name of the group configuration, add new group and remove old one
        And I change the name for the group "New group" to "Second Group"
        And I go to the Container page in Studio
        And I edit the Content Experiment
        Then I see the group configuration name is changed in `Group Configuration` dropdown
        And the group configuration name is changed on container page
        And I see the module has 2 active groups and one inactive
        And I see "Add missing groups" link exists
        When I click on "Add missing groups" link
        The I see the module has 3 active groups and one inactive
        """
        self.course_fixture._update_xblock(self.course_fixture._course_location, {
            "metadata": {
                u"user_partitions": [
                    create_user_partition_json(
                        0,
                        'Name of the Group Configuration',
                        'Description of the group configuration.',
                        [Group("0", 'Group A'), Group("1", 'Group B'), Group("2", 'Group C')]
                    ),
                ],
            },
        })

        # Add split test to vertical and assign newly created group configuration to it
        split_test = self._add_split_test_to_vertical(number=0, group_configuration_metadata={'user_partition_id': 0})

        self.page.visit()
        config = self.page.experiment_group_configurations[0]
        config.edit()
        config.name = "Second Group Configuration Name"
        # `Group C` -> `Second Group`
        config.groups[2].name = "Second Group"
        # Add new group
        config.add_group()  # Group D
        # Remove Group A
        config.groups[0].remove()
        # Save the configuration
        config.save()

        container = ContainerPage(self.browser, split_test.locator)
        container.visit()
        container.edit()
        component_editor = ComponentEditorView(self.browser, container.locator)
        self.assertEqual(
            "Second Group Configuration Name",
            component_editor.get_selected_option_text('Group Configuration')
        )
        component_editor.cancel()
        self.assertIn(
            "Second Group Configuration Name",
            container.get_xblock_information_message()
        )
        self.verify_groups(
            container, ['Group B', 'Second Group'], ['Group ID 0'],
            verify_missing_groups_not_present=False
        )
        # Click the add button and verify that the groups were added on the page
        container.add_missing_groups()
        self.verify_groups(container, ['Group B', 'Second Group', 'Group D'], ['Group ID 0'])
开发者ID:Colin-Fredericks,项目名称:edx-platform,代码行数:65,代码来源:test_studio_split_test.py

示例11: ProblemComponentEditor

class ProblemComponentEditor(ContainerBase):
    """
    Feature: CMS.Component Adding
    As a course author, I want to be able to add and edit Problem
    """

    def setUp(self, is_staff=True):
        """
        Create a course with a section, subsection, and unit to which to add the component.
        """
        super(ProblemComponentEditor, self).setUp(is_staff=is_staff)
        self.component = 'Blank Common Problem'
        self.unit = self.go_to_unit_page()
        self.container_page = ContainerPage(self.browser, None)
        # Add a Problem
        add_component(self.container_page, 'problem', self.component)
        self.component = self.unit.xblocks[1]
        self.container_page.edit()
        self.problem_editor = ProblemXBlockEditorView(self.browser, self.component.locator)

    def populate_course_fixture(self, course_fixture):
        """
        Adds a course fixture
        """
        course_fixture.add_children(
            XBlockFixtureDesc('chapter', 'Test Section').add_children(
                XBlockFixtureDesc('sequential', 'Test Subsection').add_children(
                    XBlockFixtureDesc('vertical', 'Test Unit')
                )
            )
        )

    def test_user_can_view_metadata(self):
        """
        Scenario: User can view metadata
        Given I have created a Blank Common Problem
        When I edit and select Settings
        Then I see the advanced settings and their expected values
        And Edit High Level Source is not visible
        """
        expected_default_settings = {
            'Display Name': u'Blank Common Problem',
            'Matlab API key': u'',
            'Maximum Attempts': u'',
            'Problem Weight': u'',
            'Randomization': u'Never',
            'Show Answer': u'Finished',
            'Show Answer: Number of Attempts': u'0',
            'Show Reset Button': u'False',
            'Timer Between Attempts': u'0'
        }
        self.problem_editor.open_settings()
        settings = self.problem_editor.get_settings()
        self.assertEqual(expected_default_settings, settings)
        self.assertFalse(self.problem_editor.is_latex_compiler_present())

    def test_user_can_modify_string_values(self):
        """
        Given I have created a Blank Common Problem
        When I edit and select Settings
        Then I can modify the display name
        And my display name change is persisted on save
        """
        self.problem_editor.open_settings()
        self.problem_editor.set_field_val('Display Name', 'New Name')
        self.problem_editor.save()
        component_name = self.unit.xblock_titles[0]
        self.assertEqual(component_name, 'New Name', 'Component Name is not same as the new name')

    def test_user_can_specify_special_characters(self):
        """
        Scenario: User can specify special characters in String values
        Given I have created a Blank Common Problem
        When I edit and select Settings
        Then I can specify special characters in the display name
        And my special characters are persisted on save
        """
        self.problem_editor.open_settings()
        self.problem_editor.set_field_val('Display Name', '&&&')
        self.problem_editor.save()
        component_name = self.unit.xblock_titles[0]
        self.assertEqual(component_name, '&&&', 'Component Name is not same as the new name')

    def test_user_can_revert_display_name_to_unset(self):
        """
        Scenario: User can revert display name to unset
        Given I have created a Blank Common Problem
        When I edit and select Settings
            Then I can revert the display name to unset
        And my display name is unset on save
        """
        self.problem_editor.open_settings()
        self.problem_editor.set_field_val('Display Name', 'New Name')
        self.problem_editor.save()

        # reopen settings
        self.container_page.edit()
        self.problem_editor.open_settings()

        self.problem_editor.revert_setting(display_name=True)
#.........这里部分代码省略.........
开发者ID:digitalsatori,项目名称:edx-platform,代码行数:101,代码来源:test_studio_problem_editor.py

示例12: HTMLComponentEditorTests

class HTMLComponentEditorTests(ContainerBase):
    """
    Feature: CMS.Component Adding
    As a course author, I want to be able to add and edit HTML component
    """
    shard = 18

    def setUp(self, is_staff=True):
        """
        Create a course with a section, subsection, and unit to which to add the component.
        """
        super(HTMLComponentEditorTests, self).setUp(is_staff=is_staff)
        self.unit = self.go_to_unit_page()
        self.container_page = ContainerPage(self.browser, None)
        self.xblock_wrapper = XBlockWrapper(self.browser, None)
        self.component = None
        self.html_editor = None
        self.iframe = None

    def populate_course_fixture(self, course_fixture):
        """
        Adds a course fixture
        """
        course_fixture.add_children(
            XBlockFixtureDesc('chapter', 'Test Section').add_children(
                XBlockFixtureDesc('sequential', 'Test Subsection').add_children(
                    XBlockFixtureDesc('vertical', 'Test Unit')
                )
            )
        )

    def _add_content(self, content):
        """
        Set and save content in editor and assert its presence in container page's html

        Args:
            content(str): Verifiable content
        """
        self.html_editor.set_raw_content(content)
        self.html_editor.save_content()
        self.container_page.wait_for_page()

    def _add_component(self, sub_type):
        """
        Add sub-type of HTML component in studio

        Args:
            sub_type(str): Sub-type of HTML component
        """
        add_component(self.container_page, 'html', sub_type)
        self.component = self.unit.xblocks[1]
        self.html_editor = HtmlXBlockEditorView(self.browser, self.component.locator)
        self.iframe = HTMLEditorIframe(self.browser, self.component.locator)

    def test_user_can_view_metadata(self):
        """
        Scenario: User can view metadata
        Given I have created a Blank HTML Page
            And I edit and select Settings
                Then I see the HTML component settings
        """

        # Add HTML Text type component
        self._add_component('Text')
        self.container_page.edit()
        self.html_editor.open_settings_tab()
        display_name_value = self.html_editor.get_default_settings()[0]
        display_name_key = self.html_editor.keys[0]
        self.assertEqual(
            ['Display Name', 'Text'],
            [display_name_key, display_name_value],
            "Settings not found"
        )
        editor_value = self.html_editor.get_default_settings()[1]
        editor_key = self.html_editor.keys[1]
        self.assertEqual(
            ['Editor', 'Visual'],
            [editor_key, editor_value],
            "Settings not found"
        )

    def test_user_can_modify_display_name(self):
        """
        Scenario: User can modify display name
        Given I have created a Blank HTML Page
            And I edit and select Settings
        Then I can modify the display name
            And my display name change is persisted on save
        """
        # Add HTML Text type component
        self._add_component('Text')
        self.container_page.edit()
        self.html_editor.open_settings_tab()
        self.html_editor.set_field_val('Display Name', 'New Name')
        self.html_editor.save_settings()
        component_name = self.unit.xblock_titles[0]
        self.assertEqual(component_name, 'New Name', "Component name is not as edited")

    def test_link_plugin_sets_url_correctly(self):
        """
#.........这里部分代码省略.........
开发者ID:digitalsatori,项目名称:edx-platform,代码行数:101,代码来源:test_studio_html_editor.py


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