Commit cf1cf222 authored by ilya's avatar ilya
Browse files

MDL-66431 core: Fix behat tests.

Move activity creation to data generators. Only fixing those
tests failing due to removing usemodchooser preference.
parent 430746d3
......@@ -18,12 +18,16 @@ Feature: Enable Block blog menu in an activity
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
Given the following "activity" exists:
| activity | assign |
| name | Test assignment 1 |
| intro | Offline text |
| course | C1 |
| idnumber | 0001 |
| section | 1 |
| assignsubmission_file_enabled | 0 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment 1 |
| Description | Offline text |
| assignsubmission_file_enabled | 0 |
And I follow "Test assignment 1"
And I add the "Blog menu" block
And I log out
......
......@@ -18,12 +18,16 @@ Feature: Students can use the recent blog entries block to view recent entries o
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
And the following "activity" exists:
| activity | assign |
| course | C1 |
| idnumber | 0001 |
| name | Test assignment 1 |
| intro | Offline text |
| section | 1 |
| assignsubmission_file_enabled | 0 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment 1 |
| Description | Offline text |
| assignsubmission_file_enabled | 0 |
And I follow "Test assignment 1"
And I add the "Blog menu" block
And I add the "Recent blog entries" block
......
......@@ -14,12 +14,11 @@ Feature: The section links block allows users to quickly navigate around a moodl
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "activities" exist:
| activity | name | intro | course | section | idnumber | assignsubmission_file_enabled |
| assign | Test assignment 1 | Offline text | C1 | 5 | assign1 | 0 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "5" and I fill the form with:
| Assignment name | Test assignment 1 |
| Description | Offline text |
| assignsubmission_file_enabled | 0 |
Scenario: Add the section links block to a course.
Given I add the "Section links" block
......
......@@ -14,15 +14,18 @@ Feature: Block appearances
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "activities" exist:
| activity | name | description | course | idnumber | section |
| survey | Test survey name | Test survey description | C1 | survey1 | 1 |
| book | Test book name | Test book description | C1 | book1 | 1 |
And I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
And I add a "Survey" to section "1" and I fill the form with:
| Name | Test survey name |
And I am on "Course 1" course homepage
And I follow "Test survey name"
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| Survey type | ATTLS (20 item version) |
| Description | Test survey description |
And I add a "Book" to section "1" and I fill the form with:
| Name | Test book name |
| Description | Test book description |
And I press "Save and return to course"
And I am on "Course 1" course homepage with editing mode on
And I follow "Test book name"
And I set the following fields to these values:
| Chapter title | Book title |
......
......@@ -8,6 +8,10 @@ Feature: The context of a block can always be returned to it's original state.
Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "activities" exist:
| activity | name | intro | course | section | idnumber |
| assign | Assignment1 | Description | C1 | 1 | assign1 |
| assign | Assignment2 | Description | C1 | 1 | assign1 |
And I log in as "admin"
When I am on "Course 1" course homepage with editing mode on
And I add the "Tags" block
......@@ -18,9 +22,6 @@ Feature: The context of a block can always be returned to it's original state.
| Display on page types | Any page |
And I press "Save changes"
And I am on "Course 1" course homepage
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Assignment1 |
| Description | Description |
And I follow "Assignment1"
And I configure the "Tags" block
And I set the following fields to these values:
......@@ -32,9 +33,6 @@ Feature: The context of a block can always be returned to it's original state.
And I navigate to course participants
And "Tags" "block" should not exist
And I am on "Course 1" course homepage
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Assignment2 |
| Description | Description |
And I follow "Assignment2"
And I should see "Tags" in the "Tags" "block"
And I configure the "Tags" block
......
......@@ -14,8 +14,25 @@ Feature: Completion with no calendar capabilites
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "activity" exists:
| activity | forum |
| course | C1 |
| idnumber | 00001 |
| name | Test forum name |
| intro | Test forum name description |
| section | 1 |
| completion | 2 |
And I log in as "admin"
And I am on "Course 1" course homepage
And I follow "Test forum name"
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| id_completionexpected_enabled | 1 |
| id_completionexpected_day | 1 |
| id_completionexpected_month | 1 |
| id_completionexpected_year | 2017 |
And I press "Save and return to course"
And I am on "Course 1" course homepage
And I navigate to "Users > Permissions" in current page administration
And I override the system permissions of "Teacher" role with:
| capability | permission |
......@@ -23,17 +40,6 @@ Feature: Completion with no calendar capabilites
And I log out
Scenario: Editing completion date
Given I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
When I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test forum name |
| Description | Test forum description |
| Completion tracking | Show activity as complete when conditions are met |
| id_completionexpected_enabled | 1 |
| id_completionexpected_day | 1 |
| id_completionexpected_month | 1 |
| id_completionexpected_year | 2017 |
And I log out
When I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I follow "Test forum name"
......
......@@ -8,15 +8,11 @@ Feature: Edit completion settings of an activity
Given the following "courses" exist:
| fullname | shortname | enablecompletion |
| Course 1 | C1 | 1 |
And the following "activities" exist:
| activity | course | idnumber | intro | name | completion | completionview |
| page | C1 | p1 | x | TestPage | 2 | 1 |
And I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
And I add a "Page" to section "1" and I fill the form with:
| Name | TestPage |
| Description | x |
| Page content | x |
| Completion tracking | 2 |
| Require view | 1 |
And I am on "Course 1" course homepage
Scenario: Completion is not locked when the activity has not yet been viewed
Given I click on "Edit settings" "link" in the "TestPage" activity
......
......@@ -98,6 +98,10 @@ Feature: Course activity controls works as expected
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "activities" exist:
| activity | name | intro | course | idnumber | section |
| forum | Test forum name 1 | Test forum description 1 | C1 | 0001 | 1 |
| forum | Test forum name 2 | Test forum description 2 | C1 | 0002 | 1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
When I follow <targetpage>
......@@ -107,12 +111,6 @@ Feature: Course activity controls works as expected
And I click on "Delete Recent activity block" "link"
And I press "Yes"
And <belowpage> "section" <should_see_other_sections> exist
And I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test forum name 1 |
| Description | Test forum description 1 |
And I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test forum name 2 |
| Description | Test forum description 2 |
And <belowpage> "section" <should_see_other_sections> exist
And I indent right "Test forum name 1" activity
And <belowpage> "section" <should_see_other_sections> exist
......
......@@ -14,12 +14,12 @@ Feature: General section does not show in navigation when empty
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "activities" exist:
| activity | name | intro | course | idnumber | section |
| forum | Test forum name | Test forum name description | C1 | forum1 | 1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add the "Navigation" block if not present
And I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test forum name |
| Description | Test forum description |
Scenario: General section is visible in navigation when it is not empty
When I move "Test forum name" activity to section "0"
......
......@@ -14,14 +14,18 @@ Feature: Activities can be moved between sections
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "activity" exists:
| activity | forum |
| course | C1 |
| idnumber | 00001 |
| name | Test forum name |
| intro | Test forum description |
| section | 1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add the "Recent activity" block
And I follow "Delete Recent activity block"
And I press "Yes"
And I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test forum name |
| Description | Test forum description |
Scenario: Move activities in a single page course with Javascript disabled
When I move "Test forum name" activity to section "2"
......@@ -39,12 +43,16 @@ Feature: Activities can be moved between sections
Scenario: Move activities in a course section with Javascript disabled using paged mode
Given I navigate to "Edit settings" in current page administration
And the following "activity" exists:
| activity | forum |
| course | C1 |
| idnumber | 00002 |
| name | Second forum name |
| intro | Second forum description |
| section | 1 |
And I set the following fields to these values:
| Course layout | Show one section per page |
And I press "Save and display"
And I add a "Forum" to section "1" and I fill the form with:
| Forum name | Second forum name |
| Description | Second forum description |
And I follow "Topic 1"
When I move "Second forum name" activity to section "1"
Then "Second forum name" "link" should appear before "Test forum name" "link"
......@@ -15,38 +15,40 @@ Feature: Sections can be moved
| user | course | role |
| teacher1 | C1 | editingteacher |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
Scenario: Move up and down a section with Javascript disabled in a single page course
Given I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test forum name |
| Description | Test forum description |
Given the following "activities" exist:
| activity | name | intro | course | idnumber | section |
| forum | Test forum name | Test forum name description | C1 | forum1 | 1 |
And I am on "Course 1" course homepage with editing mode on
When I move down section "1"
Then I should see "Test forum name" in the "Topic 2" "section"
And I move up section "2"
And I should see "Test forum name" in the "Topic 1" "section"
Scenario: Move up and down a section with Javascript disabled in the course home of a course using paged mode
Given I navigate to "Edit settings" in current page administration
Given the following "activities" exist:
| activity | name | intro | course | idnumber | section |
| forum | Test forum name | Test forum name description | C1 | forum1 | 1 |
And I am on "Course 1" course homepage with editing mode on
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| Course layout | Show one section per page |
And I press "Save and display"
And I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test forum name |
| Description | Test forum description |
When I move down section "1"
Then I should see "Test forum name" in the "Topic 2" "section"
And I move up section "2"
And I should see "Test forum name" in the "Topic 1" "section"
Scenario: Sections can not be moved with Javascript disabled in a section page of a course using paged mode
Given I navigate to "Edit settings" in current page administration
Given the following "activities" exist:
| activity | name | intro | course | idnumber | section |
| forum | Test forum name | Test forum name description | C1 | forum1 | 2 |
And I am on "Course 1" course homepage with editing mode on
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| Course layout | Show one section per page |
And I press "Save and display"
And I add a "Forum" to section "2" and I fill the form with:
| Forum name | Test forum name |
| Description | Test forum description |
When I follow "Topic 2"
Then "Topic 1" "section" should not exist
And "Topic 3" "section" should not exist
......
......@@ -28,6 +28,7 @@ Feature: Restrict activities availability
Then I should see "Test glossary name"
And I should see "Test chat name"
@javascript
Scenario: Activities can not be added when the admin restricts the permissions
Given I log in as "admin"
And I set the following system permissions of "Teacher" role:
......@@ -39,5 +40,6 @@ Feature: Restrict activities availability
And I log out
And I log in as "teacher1"
When I am on "Course 1" course homepage with editing mode on
Then the "Add a resource to section 'Topic 1'" select box should not contain "Chat"
Then the "Add an activity to section 'Topic 1'" select box should not contain "Glossary"
And I press "Add an activity or resource"
Then "Add a new Chat" "link" should not exist in the "Add an activity or resource" "dialogue"
Then "Add a new Glossary" "link" should not exist in the "Add an activity or resource" "dialogue"
......@@ -15,11 +15,15 @@ Feature: Guest users can auto-enrol themself in courses where guest access is al
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "activity" exists:
| activity | forum |
| course | C1 |
| idnumber | 0001 |
| name | Test forum name |
| intro | Test forum description |
| section | 1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test forum name |
| Description | Test forum description |
Scenario: Allow guest access without password
Given I navigate to "Users > Enrolment methods" in current page administration
......
......@@ -14,6 +14,9 @@ Feature: Check that the page listing the shared external tools is functioning as
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "activities" exist:
| activity | name | intro | course | idnumber | section |
| assign | Test assignment name | Submit your online text | C1 | assign1 | 1 |
And I log in as "admin"
And I navigate to "Plugins > Enrolments > Manage enrol plugins" in site administration
And I click on "Enable" "link" in the "Publish as LTI tool" "table_row"
......@@ -22,9 +25,6 @@ Feature: Check that the page listing the shared external tools is functioning as
Scenario: I want to edit an external tool
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment name |
| Description | Submit your online text |
And I navigate to "Users > Enrolment methods" in current page administration
And I select "Publish as LTI tool" from the "Add method" singleselect
And I set the following fields to these values:
......
......@@ -16,12 +16,27 @@ Feature: Marking guides can be created and edited
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activity" exists:
| activity | assign |
| course | C1 |
| idnumber | assign1 |
| name | Test assignment 1 name |
| intro | Test assignment description |
| section | 1 |
| assignsubmission_file_enabled | 1 |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_maxfiles | 1 |
| assignsubmission_file_maxsizebytes | 1000 |
| assignfeedback_comments_enabled | 1 |
| assignfeedback_file_enabled | 1 |
| assignfeedback_comments_commentinline | 1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment 1 name |
| Description | Test assignment description |
And I am on "Course 1" course homepage
And I follow "Test assignment 1 name"
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| Grading method | Marking guide |
And I press "Save and return to course"
# Defining a marking guide
When I go to "Test assignment 1 name" advanced grading definition page
And I set the following fields to these values:
......
......@@ -14,12 +14,17 @@ Feature: Reuse my rubrics in other activities
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "activities" exist:
| activity | name | intro | course | section | idnumber |
| assign | Test assignment 1 name | Test assignment 1 description | C1 | 1 | assign1 |
| assign | Test assignment 2 name | Test assignment 2 description | C1 | 1 | assign1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment 1 name |
| Description | Test assignment 1 description |
And I am on "Course 1" course homepage
And I follow "Test assignment 1"
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| Grading method | Rubric |
And I press "Save and return to course"
And I go to "Test assignment 1 name" advanced grading definition page
And I set the following fields to these values:
| Name | Assignment 1 rubric |
......@@ -30,10 +35,12 @@ Feature: Reuse my rubrics in other activities
| Criterion 3 | Level 31 | 31 | Level 32 | 32 | | |
And I press "Save rubric and make it ready"
And I am on "Course 1" course homepage
When I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment 2 name |
| Description | Test assignment 2 description |
And I am on "Course 1" course homepage
And I follow "Test assignment 2"
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| Grading method | Rubric |
And I press "Save and return to course"
And I set "Test assignment 2 name" activity to use "Assignment 1 rubric" grading form
Then I should see "Ready for use"
And I should see "Criterion 1"
......
......@@ -46,14 +46,18 @@ Feature: We can set the grade to pass value
And I press "Cancel"
Scenario: Set a valid grade to pass for an assignment activity using points
When I turn editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test Assignment 1 |
| Description | Submit your online text |
Given the following "activities" exist:
| activity | name | intro | course | section | idnumber |
| assign | Test Assignment 1 | Submit your online text | C1 | 1 | assign1 |
And I am on "Course 1" course homepage with editing mode on
And I follow "Test Assignment 1"
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| assignsubmission_onlinetext_enabled | 1 |
| grade[modgrade_type] | Point |
| grade[modgrade_point] | 50 |
| Grade to pass | 25 |
And I press "Save and return to course"
And I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
And I click on "Edit assign Test Assignment 1" "link"
......@@ -69,13 +73,17 @@ Feature: We can set the grade to pass value
And the field "Grade to pass" matches value "30"
Scenario: Set a valid grade to pass for an assignment activity using scales
When I turn editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test Assignment 1 |
| Description | Submit your online text |
Given the following "activities" exist:
| activity | name | intro | course | section | idnumber |
| assign | Test Assignment 1 | Submit your online text | C1 | 1 | assign1 |
And I am on "Course 1" course homepage with editing mode on
And I follow "Test Assignment 1"
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| grade[modgrade_type] | Scale |
| grade[modgrade_scale] | Test Scale 1 |
| Grade to pass | 3 |
And I press "Save and return to course"
And I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
And I click on "Edit assign Test Assignment 1" "link"
......@@ -89,24 +97,32 @@ Feature: We can set the grade to pass value
And the field "Grade to pass" matches value "4"
Scenario: Set a invalid grade to pass for an assignment activity using scales
When I turn editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test Assignment 1 |
| Description | Submit your online text |
Given the following "activities" exist:
| activity | name | intro | course | section | idnumber |
| assign | Test Assignment 1 | Submit your online text | C1 | 1 | assign1 |
And I am on "Course 1" course homepage with editing mode on
And I follow "Test Assignment 1"
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| grade[modgrade_type] | Scale |
| grade[modgrade_scale] | Test Scale 1 |
| Grade to pass | 10 |
And I press "Save and return to course"
Then I should see "The grade to pass can not be greater than the maximum possible grade 4"
Scenario: Set a valid grade to pass for workshop activity
When I turn editing mode on
And I add a "Workshop" to section "1" and I fill the form with:
| Workshop name | Test Workshop 1 |
| Description | Test workshop |
Given the following "activities" exist:
| activity | name | intro | course | section | idnumber |
| workshop | Test Workshop 1 | Test workshop | C1 | 1 | workshop1 |
And I am on "Course 1" course homepage with editing mode on
And I follow "Test Workshop 1"
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| grade | 80 |
| Submission grade to pass | 40 |
| gradinggrade | 20 |
| Assessment grade to pass | 10 |
And I press "Save and return to course"
And I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
And I click on "Edit workshop Test Workshop 1 (submission)" "link"
......@@ -126,22 +142,31 @@ Feature: We can set the grade to pass value
And the field "Assessment grade to pass" matches value "15"
Scenario: Set an invalid grade to pass for workshop activity
When I turn editing mode on
And I add a "Workshop" to section "1" and I fill the form with:
| Workshop name | Test Workshop 1 |
| Description | Test workshop |
Given the following "activities" exist:
| activity | name | intro | course | section | idnumber |
| workshop | Test Workshop 1 | Test workshop | C1 | 1 | workshop1 |
And I am on "Course 1" course homepage with editing mode on
And I follow "Test Workshop 1"
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| grade | 80 |
| Submission grade to pass | 90 |
| gradinggrade | 20 |
| Assessment grade to pass | 30 |
And I press "Save and return to course"
Then "The grade to pass can not be greater than the maximum possible grade 80" "text" should exist in the "Submission grade to pass" "form_row"
Then "The grade to pass can not be greater than the maximum possible grade 20" "text" should exist in the "Assessment grade to pass" "form_row"
Scenario: Set a valid grade to pass for quiz activity
When I turn editing mode on
And I add a "Quiz" to section "1" and I fill the form with:
| Name | Test Quiz 1 |
Given the following "activities" exist:
| activity | name | course | section | idnumber |
| quiz | Test Quiz 1 | C1 | 1 | quiz1 |
And I am on "Course 1" course homepage with editing mode on
And I follow "Test Quiz 1"
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| Grade to pass | 9.5 |
And I press "Save and return to course"
And I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
And I click on "Edit quiz Test Quiz 1" "link"
......@@ -155,11 +180,15 @@ Feature: We can set the grade to pass value
And the field "Grade to pass" matches value "8.00"
Scenario: Set a valid grade to pass for lesson activity
When I turn editing mode on
And I add a "Lesson" to section "1" and I fill the form with:
| Name | Test Lesson 1 |
| Description | Test |
Given the following "activities" exist:
| activity | name | intro | course | section | idnumber |
| lesson | Test Lesson 1 | Test | C1 | 1 | lesson1 |
And I am on "Course 1" course homepage with editing mode on
And I follow "Test Lesson 1"
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| Grade to pass | 90 |
And I press "Save and return to course"
And I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on