Ir a la última revisión | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |
@core @core_course @core_courseformatFeature: Course index depending on roleIn order to quickly access the course structureAs a userI need to see the current course structure in the course index.Background:Given the following "users" exist:| username | firstname | lastname | email || teacher1 | Teacher | 1 | teacher1@example.com || student1 | Student | 1 | student1@example.com |And the following "course" exists:| fullname | Course 1 || shortname | C1 || category | 0 || enablecompletion | 1 || numsections | 4 || initsections | 1 |And the following "activities" exist:| activity | name | intro | course | idnumber | section || assign | Activity sample 1 | Test assignment description | C1 | sample1 | 1 || book | Activity sample 2 | | C1 | sample2 | 2 || choice | Activity sample 3 | Test choice description | C1 | sample3 | 3 |And the following "course enrolments" exist:| user | course | role || student1 | C1 | student || teacher1 | C1 | editingteacher |# The course index is hidden by default in small devices.And I change window size to "large"@javascriptScenario: Course index is present on course pages.Given I am on the "C1" "Course" page logged in as "teacher1"And the "multilang" filter is "on"And the "multilang" filter applies to "content and headings"# Course index is visible on Course main pageWhen I am on the "C1" "Course" page logged in as "teacher1"And "courseindex-content" "region" should be visible# Course index is visible on Settings pageAnd I am on the "C1" "course editing" pageAnd "courseindex-content" "region" should be visible# Course index is visible on Participants pageAnd I am on the "C1" "enrolled users" pageAnd "courseindex-content" "region" should be visible# Course index is visible on Enrolment methods pageAnd I am on the "C1" "enrolment methods" pageAnd "courseindex-content" "region" should be visible# Course index is visible on Groups pageAnd I am on the "C1" "groups" pageAnd "courseindex-content" "region" should be visible# Course index is visible on Permissions pageAnd I am on the "C1" "permissions" pageAnd "courseindex-content" "region" should be visible# Course index is visible on Activity edition pageAnd I am on the "Activity sample 1" "assign activity editing" pageAnd "courseindex-content" "region" should be visibleAnd I set the field "Assignment name" in the "General" "fieldset" to "<span lang=\"en\" class=\"multilang\">Activity</span><span lang=\"de\" class=\"multilang\">Aktivität</span> sample 1"And I press "Save and display"# Course index is visible on Activity pageAnd "courseindex-content" "region" should be visibleAnd I should see "Activity sample 1" in the "courseindex-content" "region"@javascriptScenario: Course index as a teacherGiven I log in as "teacher1"When I am on "Course 1" course homepageThen I should see "Section 1" in the "courseindex-content" "region"And I should see "Section 2" in the "courseindex-content" "region"And I should see "Section 3" in the "courseindex-content" "region"And I should see "Activity sample 1" in the "courseindex-content" "region"And I should see "Activity sample 2" in the "courseindex-content" "region"And I should see "Activity sample 3" in the "courseindex-content" "region"@javascriptScenario: Teacher can see hiden activities and sectionsGiven I log in as "admin"And I am on "Course 1" course homepage with editing mode onAnd I hide section "2"And I open "Activity sample 3" actions menuAnd I choose "Hide" in the open action menuAnd I log outAnd I log in as "teacher1"When I am on "Course 1" course homepageThen I should see "Section 1" in the "courseindex-content" "region"And I should see "Section 2" in the "courseindex-content" "region"And I should see "Section 3" in the "courseindex-content" "region"And I should see "Activity sample 1" in the "courseindex-content" "region"And I should see "Activity sample 2" in the "courseindex-content" "region"And I should see "Activity sample 3" in the "courseindex-content" "region"@javascriptScenario: Students can only see visible activies and sectionsGiven I log in as "admin"And I am on "Course 1" course homepage with editing mode onAnd I hide section "2"And I open "Activity sample 3" actions menuAnd I choose "Hide" in the open action menuAnd I log outAnd I log in as "student1"When I am on "Course 1" course homepageThen I should see "Section 1" in the "courseindex-content" "region"And I should not see "Section 2" in the "courseindex-content" "region"And I should see "Section 3" in the "courseindex-content" "region"And I should see "Activity sample 1" in the "courseindex-content" "region"And I should not see "Activity sample 2" in the "courseindex-content" "region"And I should not see "Activity sample 3" in the "courseindex-content" "region"@javascriptScenario: Delete an activity as a teacherGiven I log in as "teacher1"And I am on "Course 1" course homepage with editing mode onWhen I delete "Activity sample 2" activityThen I should not see "Activity sample 2" in the "courseindex-content" "region"@javascriptScenario: Highlight sections are represented in the course index.Given I log in as "teacher1"And I am on "Course 1" course homepage with editing mode onAnd I turn section "2" highlighting on# Current section is only marked visually in the course index.And the "class" attribute of "#courseindex-content [data-for='section'][data-number='2']" "css_element" should contain "current"And I should not see "Highlighted" in the "#courseindex-content [data-for='section'][data-number='1']" "css_element"And I should see "Highlighted" in the "#courseindex-content [data-for='section'][data-number='2']" "css_element"When I turn section "1" highlighting on# Current section is only marked visually in the course index.Then the "class" attribute of "#courseindex-content [data-for='section'][data-number='1']" "css_element" should contain "current"And I should see "Highlighted" in the "#courseindex-content [data-for='section'][data-number='1']" "css_element"And I should not see "Highlighted" in the "#courseindex-content [data-for='section'][data-number='2']" "css_element"@javascriptScenario: Course index togglingGiven the following "activities" exist:| activity | name | course | idnumber | section || book | Second activity in section 1 | C1 | sample4 | 1 |When I am on the "Course 1" course page logged in as teacher1# Sections should be opened by default.Then I should see "Section 1" in the "courseindex-content" "region"And I should see "Activity sample 1" in the "courseindex-content" "region"And I should see "Second activity in section 1" in the "courseindex-content" "region"And I should see "Section 2" in the "courseindex-content" "region"And I should see "Activity sample 2" in the "courseindex-content" "region"And I should see "Section 3" in the "courseindex-content" "region"And I should see "Activity sample 3" in the "courseindex-content" "region"# Collapse a section 1 via chevron.And I click on "Collapse" "link" in the ".courseindex-section[data-number='1']" "css_element"And I should see "Section 1" in the "courseindex-content" "region"And I should not see "Activity sample 1" in the "courseindex-content" "region"And I should not see "Second activity in section 1" in the "courseindex-content" "region"And I should see "Section 2" in the "courseindex-content" "region"And I should see "Activity sample 2" in the "courseindex-content" "region"And I should see "Section 3" in the "courseindex-content" "region"And I should see "Activity sample 3" in the "courseindex-content" "region"# Expand section 1 via section name.And I click on "Section 1" "link" in the "courseindex-content" "region"And I should see "Section 1" in the "courseindex-content" "region"And I should see "Activity sample 1" in the "courseindex-content" "region"And I should see "Second activity in section 1" in the "courseindex-content" "region"And I should see "Section 2" in the "courseindex-content" "region"And I should see "Activity sample 2" in the "courseindex-content" "region"And I should see "Section 3" in the "courseindex-content" "region"And I should see "Activity sample 3" in the "courseindex-content" "region"# Collapse a section 2 via chevron.And I click on "Collapse" "link" in the ".courseindex-section[data-number='2']" "css_element"And I should see "Section 1" in the "courseindex-content" "region"And I should see "Activity sample 1" in the "courseindex-content" "region"And I should see "Second activity in section 1" in the "courseindex-content" "region"And I should see "Section 2" in the "courseindex-content" "region"And I should not see "Activity sample 2" in the "courseindex-content" "region"And I should see "Section 3" in the "courseindex-content" "region"And I should see "Activity sample 3" in the "courseindex-content" "region"# Expand section 2 via chevron.And I click on "Expand" "link" in the ".courseindex-section[data-number='2']" "css_element"And I should see "Section 1" in the "courseindex-content" "region"And I should see "Activity sample 1" in the "courseindex-content" "region"And I should see "Second activity in section 1" in the "courseindex-content" "region"And I should see "Section 2" in the "courseindex-content" "region"And I should see "Activity sample 2" in the "courseindex-content" "region"And I should see "Section 3" in the "courseindex-content" "region"And I should see "Activity sample 3" in the "courseindex-content" "region"# Click a section name does not collapse the section.And I click on "Section 2" "link" in the "courseindex-content" "region"And I should see "Section 1" in the "courseindex-content" "region"And I should see "Activity sample 1" in the "courseindex-content" "region"And I should see "Second activity in section 1" in the "courseindex-content" "region"And I should see "Section 2" in the "courseindex-content" "region"And I should see "Activity sample 2" in the "courseindex-content" "region"And I should see "Section 3" in the "courseindex-content" "region"And I should see "Activity sample 3" in the "courseindex-content" "region"@javascriptScenario: Course index toggling all sectionsWhen I am on the "Course 1" course page logged in as teacher1# Sections should be opened by default.Then I should see "Section 1" in the "courseindex-content" "region"And I should see "Activity sample 1" in the "courseindex-content" "region"And I should see "Section 2" in the "courseindex-content" "region"And I should see "Activity sample 2" in the "courseindex-content" "region"And I should see "Section 3" in the "courseindex-content" "region"And I should see "Activity sample 3" in the "courseindex-content" "region"# Collapse all sectionsAnd I click on "Course index options" "button" in the "#courseindexdrawercontrols" "css_element"And I click on "Collapse all" "link" in the "#courseindexdrawercontrols" "css_element"And I should see "Section 1" in the "courseindex-content" "region"And I should not see "Activity sample 1" in the "courseindex-content" "region"And I should see "Section 2" in the "courseindex-content" "region"And I should not see "Activity sample 2" in the "courseindex-content" "region"And I should see "Section 3" in the "courseindex-content" "region"And I should not see "Activity sample 3" in the "courseindex-content" "region"# Expand all sectionsAnd I click on "Course index options" "button" in the "#courseindexdrawercontrols" "css_element"And I click on "Expand all" "link" in the "#courseindexdrawercontrols" "css_element"And I should see "Section 1" in the "courseindex-content" "region"And I should see "Activity sample 1" in the "courseindex-content" "region"And I should see "Section 2" in the "courseindex-content" "region"And I should see "Activity sample 2" in the "courseindex-content" "region"And I should see "Section 3" in the "courseindex-content" "region"And I should see "Activity sample 3" in the "courseindex-content" "region"@javascriptScenario: Course index section preferencesWhen I am on the "C1" "Course" page logged in as "teacher1"Then I should see "Section 1" in the "courseindex-content" "region"And I should see "Activity sample 1" in the "courseindex-content" "region"And I should see "Section 2" in the "courseindex-content" "region"And I should see "Activity sample 2" in the "courseindex-content" "region"And I should see "Section 3" in the "courseindex-content" "region"And I should see "Activity sample 3" in the "courseindex-content" "region"# Collapse section 1.And I click on "Collapse" "link" in the ".courseindex-section[data-number='1']" "css_element"And I reload the pageAnd I should see "Section 1" in the "courseindex-content" "region"And I should not see "Activity sample 1" in the "courseindex-content" "region"And I should see "Section 2" in the "courseindex-content" "region"And I should see "Activity sample 2" in the "courseindex-content" "region"And I should see "Section 3" in the "courseindex-content" "region"And I should see "Activity sample 3" in the "courseindex-content" "region"# Collapse section 3.And I click on "Collapse" "link" in the ".courseindex-section[data-number='3']" "css_element"And I reload the pageAnd I should see "Section 1" in the "courseindex-content" "region"And I should not see "Activity sample 1" in the "courseindex-content" "region"And I should see "Section 2" in the "courseindex-content" "region"And I should see "Activity sample 2" in the "courseindex-content" "region"And I should see "Section 3" in the "courseindex-content" "region"And I should not see "Activity sample 3" in the "courseindex-content" "region"# Delete section 1And I turn editing mode onAnd I delete section "1"And I click on "Delete" "button" in the ".modal" "css_element"And I reload the pageAnd I should not see "Activity sample 1" in the "courseindex-content" "region"And I should see "Section 2" in the "courseindex-content" "region"And I should see "Activity sample 2" in the "courseindex-content" "region"And I should see "Section 3" in the "courseindex-content" "region"And I should not see "Activity sample 3" in the "courseindex-content" "region"@javascriptScenario: Adding section should alter the course indexGiven I log in as "teacher1"And I am on "Course 1" course homepage with editing mode onWhen I click on "Add section" "link" in the "course-addsection" "region"Then I should see "New section" in the "courseindex-content" "region"@javascriptScenario: Remove a section should alter the course indexGiven I log in as "teacher1"And I am on "Course 1" course homepage with editing mode onWhen I delete section "4"And I click on "Delete" "button" in the ".modal" "css_element"Then I should not see "Section 4" in the "courseindex-content" "region"@javascriptScenario: Delete a previous section should alter the course index unnamed sectionsGiven I log in as "teacher1"And I am on "Course 1" course homepage with editing mode onWhen I delete section "1"And I click on "Delete" "button" in the ".modal" "css_element"Then I should not see "Section 1" in the "courseindex-content" "region"And I should not see "Activity sample 1" in the "courseindex-content" "region"@javascriptScenario: Course index locked activity linkGiven the following config values are set as admin:| enableavailability | 1 |And I log in as "teacher1"And I am on "Course 1" course homepage with editing mode onAnd I navigate to "Settings" in current page administrationAnd I expand all fieldsetsAnd I set the field "Course layout" to "Show one section per page"And I click on "Save and display" "button"# Add access restriction to Activity sample 3.And I open "Activity sample 3" actions menuAnd I click on "Edit settings" "link" in the "Activity sample 3" activityAnd I expand all fieldsetsAnd I click on "Add restriction..." "button"And I click on "Date" "button" in the "Add restriction..." "dialogue"And I set the following fields to these values:| x[day] | 31 || x[month] | 12 || x[year] | ## +1 year ## %Y ## |And I press "Save and return to course"And I log out# Check course index link goes to the specific section.When I log in as "student1"And I am on "Course 1" course homepageAnd I click on "Section 1" "link" in the "region-main" "region"And I should not see "Activity sample 3" in the "region-main" "region"And I click on "Activity sample 3" "link" in the "courseindex-content" "region"Then I should see "Activity sample 3" in the "region-main" "region"@javascriptScenario Outline: Course index is displayed by default depending on the screen size.When I change window size to "<device>"And I am on the "C1" "Course" page logged in as "student1"Then "courseindex-content" "region" should <bydefault> visibleAnd I reload the pageAnd "courseindex-content" "region" should <bydefault> visible# Check whenever preferences are saved.And I click on "<action1> course index" "button"And I reload the pageAnd "courseindex-content" "region" should <visible1> visibleAnd I click on "<action2> course index" "button"And I reload the pageAnd "courseindex-content" "region" should <visible2> visibleExamples:| device | bydefault | action1 | visible1 | action2 | visible2 || large | be | Close | not be | Open | be || tablet | not be | Open | not be | Open | not be || mobile | not be | Open | not be | Open | not be |@javascriptScenario: Course index is refreshed when we change role.When I am on the "C1" "Course" page logged in as "teacher1"And I turn editing mode onAnd I hide section "1"And I turn editing mode offAnd I should see "Section 1" in the "courseindex-content" "region"And I follow "Switch role to..." in the user menuAnd I press "Student"Then I should not see "Section 1" in the "courseindex-content" "region"@javascriptScenario: Course index behaviour for activities without url# Add a label to the course (labels doesn't have URL, because they can't be displayed in a separate page).Given the following "activities" exist:| activity | name | intro | course | idnumber | section || label | Activity sample 4 | Test label | C1 | sample4 | 2 |# Check resources without URL, as labels, are displayed in the CI and the link goes to the main page when it is clicked.When I am on the "sample1" "Activity" page logged in as "student1"Then I should see "Activity sample 4" in the "#courseindex" "css_element"And I click on "Activity sample 4" "link" in the "#courseindex" "css_element"And I should see "Test label" in the "region-main" "region"And I should see "Activity sample 2" in the "region-main" "region"# Check resources without URL, as labels, are displayed for teachers too, and the link is working even when edit mode is on.And I am on the "sample1" "Activity" page logged in as "teacher1"And I should see "Activity sample 4" in the "#courseindex" "css_element"And I turn editing mode onAnd I should see "Activity sample 4" in the "#courseindex" "css_element"And I click on "Activity sample 4" "link" in the "#courseindex" "css_element"And I should see "Test label" in the "region-main" "region"And I should see "Activity sample 2" in the "region-main" "region"@javascriptScenario: Course index behaviour for labels with name or without name# Add two labels to the course (one with name and one without name).Given the following "activities" exist:| activity | name | intro | course | idnumber | section || label | Activity sample 5 | Test label 1 | C1 | sample4 | 2 || label | | Test label 2 | C1 | sample5 | 2 |When I am on the "Course 1" course page logged in as teacher1And I should see "Section 2" in the "courseindex-content" "region"# Label name should be displayed if it is set.And I should see "Activity sample 5" in the "courseindex-content" "region"# Label intro text should be displayed if label name is not set.And I should see "Test label 2" in the "courseindex-content" "region"@javascriptScenario: Change the section name inline in section pageWhen I am on the "Course 1 > Section 2" "course > section" page logged in as "teacher1"And I turn editing mode onWhen I set the field "Edit section name" in the "page-header" "region" to "Custom section name"Then I should see "Custom section name" in the "courseindex-content" "region"