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
...@@ -49,10 +49,14 @@ Feature: Edit capabilities ...@@ -49,10 +49,14 @@ Feature: Edit capabilities
Scenario: Module capabilities overrides Scenario: Module capabilities overrides
Given I log in as "teacher1" Given I log in as "teacher1"
And the following "activity" exists:
| activity | forum |
| course | C1 |
| idnumber | 00001 |
| name | I'm the name |
| intro | I'm the introduction |
| section | 1 |
And I am on "Course 1" course homepage with editing mode on 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 | I'm the name |
| Description | I'm the introduction |
And I follow "I'm the name" And I follow "I'm the name"
And I navigate to "Permissions" in current page administration And I navigate to "Permissions" in current page administration
And I override the system permissions of "Student" role with: And I override the system permissions of "Student" role with:
......
...@@ -115,15 +115,24 @@ Feature: Verify that all form fields values can be get and set ...@@ -115,15 +115,24 @@ Feature: Verify that all form fields values can be get and set
| Wiki name | Test this one baby | | Wiki name | Test this one baby |
| Default format | HTML | | Default format | HTML |
And I press "Cancel" And I press "Cancel"
And I am on "Course 1" course homepage
# Radio - Checking "I set the field" and "the field matches value". # Radio - Checking "I set the field" and "the field matches value".
And I add a "Choice" to section "1" and I fill the form with: And the following "activity" exists:
| Choice name | Test choice name | | activity | choice |
| Description | Test choice description | | course | C1 |
| Allow choice to be updated | Yes | | idnumber | choice1 |
| Option 1 | one | | intro | Test choice description |
| Option 2 | two | | name | Test choice name |
| Option 3 | three | | choice1 | Option 1, Option 2, Option 3 |
| section | 1 |
| allowupdate | 1 |
And I am on "Course 1" course homepage
And I follow "Test choice name"
And I navigate to "Edit settings" in current page administration
And I set the field "Option 1" to "one"
And I set the field "Option 2" to "two"
And I set the field "Option 3" to "three"
And I press "Save and return to course"
And I am on "Course 1" course homepage
And I follow "Test choice name" And I follow "Test choice name"
And I set the field "one" to "1" And I set the field "one" to "1"
And I press "Save my choice" And I press "Save my choice"
......
...@@ -43,10 +43,14 @@ Feature: Basic recycle bin functionality ...@@ -43,10 +43,14 @@ Feature: Basic recycle bin functionality
Scenario: Restore a deleted assignment Scenario: Restore a deleted assignment
Given I log in as "teacher1" Given I log in as "teacher1"
And the following "activity" exists:
| activity | assign |
| name | Test assign |
| intro | Test |
| course | C1 |
| idnumber | 0001 |
| section | 1 |
And I am on "Course 1" course homepage with editing mode on 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 assign |
| Description | Test |
And I delete "Test assign" activity And I delete "Test assign" activity
When I navigate to "Recycle bin" in current page administration When I navigate to "Recycle bin" in current page administration
Then I should see "Test assign" Then I should see "Test assign"
......
...@@ -32,8 +32,16 @@ Feature: edit_availability ...@@ -32,8 +32,16 @@ Feature: edit_availability
Given the following config values are set as admin: Given the following config values are set as admin:
| enableavailability | 0 | | enableavailability | 0 |
When I log in as "teacher1" When I log in as "teacher1"
And the following "activity" exists:
| activity | page |
| course | C1 |
| idnumber | 0001 |
| section | 1 |
| name | Page1 |
| intro | pageintro |
And I am on "Course 1" course homepage with editing mode on And I am on "Course 1" course homepage with editing mode on
And I add a "Page" to section "1" And I follow "Page1"
And I navigate to "Edit settings" in current page administration
Then "Restrict access" "fieldset" should not exist Then "Restrict access" "fieldset" should not exist
Given I am on "Course 1" course homepage Given I am on "Course 1" course homepage
...@@ -43,8 +51,16 @@ Feature: edit_availability ...@@ -43,8 +51,16 @@ Feature: edit_availability
And the following config values are set as admin: And the following config values are set as admin:
| enableavailability | 1 | | enableavailability | 1 |
And the following "activity" exists:
| activity | page |
| course | C1 |
| idnumber | 0002 |
| section | 1 |
| name | Page2 |
| intro | pageintro |
And I am on "Course 1" course homepage And I am on "Course 1" course homepage
And I add a "Page" to section "1" And I follow "Page2"
And I navigate to "Edit settings" in current page administration
Then "Restrict access" "fieldset" should exist Then "Restrict access" "fieldset" should exist
Given I am on "Course 1" course homepage Given I am on "Course 1" course homepage
......
...@@ -14,15 +14,15 @@ Feature: Duplicate activities ...@@ -14,15 +14,15 @@ Feature: Duplicate activities
And the following "course enrolments" exist: And the following "course enrolments" exist:
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher1 | C1 | editingteacher |
And the following "activities" exist:
| activity | name | intro | course | idnumber | section |
| data | Test database name | Test database description | C1 | database1 | 1 |
And I log in as "admin" And I log in as "admin"
And I set the following administration settings values: And I set the following administration settings values:
| backup_import_activities | 0 | | backup_import_activities | 0 |
And I log out And I log out
And I log in as "teacher1" And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on And I am on "Course 1" course homepage with editing mode on
And I add a "Database" to section "1" and I fill the form with:
| Name | Test database name |
| Description | Test database description |
And I duplicate "Test database name" activity And I duplicate "Test database name" activity
And I should see "Test database name (copy)" And I should see "Test database name (copy)"
And I wait until section "1" is available And I wait until section "1" is available
......
...@@ -19,13 +19,11 @@ Feature: Import course's contents into another course ...@@ -19,13 +19,11 @@ Feature: Import course's contents into another course
Scenario: Import course's contents to another course Scenario: Import course's contents to another course
Given I log in as "teacher1" Given I log in as "teacher1"
And the following "activities" exist:
| activity | name | intro | course | idnumber | section |
| data | Test database name | Test database description | C1 | database1 | 2 |
| 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 am on "Course 1" course homepage with editing mode on
And I add a "Database" to section "1" and I fill the form with:
| Name | Test database name |
| Description | Test database description |
And I add a "Forum" to section "2" and I fill the form with:
| Forum name | Test forum name |
| Description | Test forum description |
And I add the "Comments" block And I add the "Comments" block
And I add the "Recent blog entries" block And I add the "Recent blog entries" block
And I turn editing mode off And I turn editing mode off
......
...@@ -24,30 +24,16 @@ Feature: The activity results block displays student scores ...@@ -24,30 +24,16 @@ Feature: The activity results block displays student scores
| student3 | C1 | student | | student3 | C1 | student |
| student4 | C1 | student | | student4 | C1 | student |
| student5 | C1 | student | | student5 | C1 | student |
And the following "activities" exist:
| activity | name | intro | course | section | idnumber | assignsubmission_file_enabled |
| assign | Test assignment 1 | Offline text | C1 | 1 | assign1 | 0 |
| assign | Test assignment 2 | Offline text | C1 | 1 | assign2 | 0 |
| assign | Test assignment 3 | Offline text | C1 | 1 | assign3 | 0 |
And the following "activities" exist:
| activity | name | content | course | section | idnumber |
| page | Test page name | This is a page | C1 | 1 | page1 |
And I log in as "teacher1" And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on 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 am on "Course 1" course homepage
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment 2 |
| Description | Offline text |
| assignsubmission_file_enabled | 0 |
And I am on "Course 1" course homepage
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment 3 |
| Description | Offline text |
| assignsubmission_file_enabled | 0 |
And I am on "Course 1" course homepage
And I add a "Page" to section "1"
And I set the following fields to these values:
| Name | Test page name |
| Description | Test page description |
| Page content | This is a page |
And I press "Save and return to course"
And I am on "Course 1" course homepage
And I should see "Test page name" And I should see "Test page name"
And I navigate to "View > Grader report" in the course gradebook And I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on And I turn editing mode on
......
...@@ -29,12 +29,15 @@ Feature: The activity results block doesn't displays student scores for unconfig ...@@ -29,12 +29,15 @@ Feature: The activity results block doesn't displays student scores for unconfig
Then I should see "Please configure this block and select which activity it should display results from." in the "Activity results" "block" Then I should see "Please configure this block and select which activity it should display results from." in the "Activity results" "block"
Scenario: Try to configure the block on a resource page in a course without activities Scenario: Try to configure the block on a resource page in a course without activities
Given I add a "Page" to section "1" Given the following "activity" exists:
And I set the following fields to these values: | activity | page |
| Name | Test page name | | course | C1 |
| Description | Test page description | | idnumber | 0001 |
| page | This is a page | | name | Test page name |
And I press "Save and display" | intro | Test page description |
| section | 1 |
| content | This is a page |
And I am on "Course 1" course homepage
When I add the "Activity results" block When I add the "Activity results" block
And I configure the "Activity results" block And I configure the "Activity results" block
And I should see "There are not yet any activities in this course." And I should see "There are not yet any activities in this course."
......
...@@ -18,10 +18,9 @@ Feature: The activity results block doesn't display student scores for unsupport ...@@ -18,10 +18,9 @@ Feature: The activity results block doesn't display student scores for unsupport
And I am on "Course 1" course homepage with editing mode on And I am on "Course 1" course homepage with editing mode on
Scenario: Try to configure the block to use an activity without grades Scenario: Try to configure the block to use an activity without grades
Given I add a "Assignment" to section "1" and I fill the form with: Given the following "activities" exist:
| Assignment name | Test assignment | | activity | name | intro | course | section | idnumber | assignsubmission_file_enabled |
| Description | Offline text | | assign | Test assignment | Offline text | C1 | 1 | assign1 | 0 |
| assignsubmission_file_enabled | 0 |
And I am on "Course 1" course homepage And I am on "Course 1" course homepage
And I add the "Activity results" block And I add the "Activity results" block
And I configure the "Activity results" block And I configure the "Activity results" block
......
...@@ -16,6 +16,16 @@ Feature: The activity results block can have administrator set defaults ...@@ -16,6 +16,16 @@ Feature: The activity results block can have administrator set defaults
| user | course | role | | user | course | role |
| teacher1 | C1 | editingteacher | | teacher1 | C1 | editingteacher |
| student1 | C1 | student | | student1 | C1 | student |
And the following "activity" exists:
| activity | assign |
| course | C1 |
| idnumber | 0001 |
| name | Test assignment |
| 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
Scenario: Assign some site-wide defaults to the block. Scenario: Assign some site-wide defaults to the block.
Given the following config values are set as admin: Given the following config values are set as admin:
...@@ -23,12 +33,6 @@ Feature: The activity results block can have administrator set defaults ...@@ -23,12 +33,6 @@ Feature: The activity results block can have administrator set defaults
| config_showworst | 0 | block_activity_results | | config_showworst | 0 | block_activity_results |
| config_gradeformat | 2 | block_activity_results | | config_gradeformat | 2 | block_activity_results |
| config_nameformat | 2 | block_activity_results | | config_nameformat | 2 | block_activity_results |
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 |
| Description | Offline text |
| assignsubmission_file_enabled | 0 |
And I am on "Course 1" course homepage And I am on "Course 1" course homepage
And I add the "Activity results" block And I add the "Activity results" block
When I configure the "Activity results" block When I configure the "Activity results" block
...@@ -46,12 +50,6 @@ Feature: The activity results block can have administrator set defaults ...@@ -46,12 +50,6 @@ Feature: The activity results block can have administrator set defaults
| config_showbest_locked | 1 | block_activity_results | | config_showbest_locked | 1 | block_activity_results |
| config_showworst | 0 | block_activity_results | | config_showworst | 0 | block_activity_results |
| config_showworst_locked | 1 | block_activity_results | | config_showworst_locked | 1 | block_activity_results |
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 |
| Description | Offline text |
| assignsubmission_file_enabled | 0 |
And I am on "Course 1" course homepage And I am on "Course 1" course homepage
And I add the "Activity results" block And I add the "Activity results" block
When I configure the "Activity results" block When I configure the "Activity results" block
......
...@@ -24,13 +24,11 @@ Feature: The activity results block displays student high scores ...@@ -24,13 +24,11 @@ Feature: The activity results block displays student high scores
| student3 | C1 | student | | student3 | C1 | student |
| student4 | C1 | student | | student4 | C1 | student |
| student5 | C1 | student | | student5 | C1 | student |
And the following "activities" exist:
| activity | name | intro | course | section | idnumber | assignsubmission_file_enabled |
| assign | Test assignment | Offline text | C1 | 1 | assign1 | 0 |
And I log in as "teacher1" And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on 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 |
| Description | Offline text |
| assignsubmission_file_enabled | 0 |
And I am on "Course 1" course homepage
And I navigate to "View > Grader report" in the course gradebook And I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on And I turn editing mode on
And I give the grade "90.00" to the user "Student 1" for the grade item "Test assignment" And I give the grade "90.00" to the user "Student 1" for the grade item "Test assignment"
......
...@@ -24,6 +24,13 @@ Feature: The activity results block displays students high scores in group as sc ...@@ -24,6 +24,13 @@ Feature: The activity results block displays students high scores in group as sc
| student3 | C1 | student | | student3 | C1 | student |
| student4 | C1 | student | | student4 | C1 | student |
| student5 | C1 | student | | student5 | C1 | student |
And the following "activity" exists:
| activity | assign |
| course | C1 |
| idnumber | 0001 |
| name | Test assignment |
| intro | Offline text |
| assignsubmission_file_enabled | 0 |
And I log in as "teacher1" And I log in as "teacher1"
And I am on "Course 1" course homepage And I am on "Course 1" course homepage
And I navigate to "Scales" in the course gradebook And I navigate to "Scales" in the course gradebook
...@@ -32,13 +39,13 @@ Feature: The activity results block displays students high scores in group as sc ...@@ -32,13 +39,13 @@ Feature: The activity results block displays students high scores in group as sc
| Name | My Scale | | Name | My Scale |
| Scale | Disappointing, Not good enough, Average, Good, Very good, Excellent! | | Scale | Disappointing, Not good enough, Average, Good, Very good, Excellent! |
And I press "Save changes" And I press "Save changes"
And I am on "Course 1" course homepage with editing mode on And I am on "Course 1" course homepage
And I add a "Assignment" to section "1" and I fill the form with: And I follow "Test assignment"
| Assignment name | Test assignment | And I navigate to "Edit settings" in current page administration
| Description | Offline text | And I set the following fields to these values:
| assignsubmission_file_enabled | 0 |
| id_grade_modgrade_type | Scale | | id_grade_modgrade_type | Scale |
| id_grade_modgrade_scale | My Scale | | id_grade_modgrade_scale | My Scale |
And I press "Save and return to course"
And I am on "Course 1" course homepage And I am on "Course 1" course homepage
And I navigate to "View > Grader report" in the course gradebook And I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on And I turn editing mode on
...@@ -48,7 +55,7 @@ Feature: The activity results block displays students high scores in group as sc ...@@ -48,7 +55,7 @@ Feature: The activity results block displays students high scores in group as sc
And I give the grade "Average" to the user "Student 4" for the grade item "Test assignment" And I give the grade "Average" to the user "Student 4" for the grade item "Test assignment"
And I give the grade "Not good enough" to the user "Student 5" for the grade item "Test assignment" And I give the grade "Not good enough" to the user "Student 5" for the grade item "Test assignment"
And I press "Save changes" And I press "Save changes"
And I am on "Course 1" course homepage And I am on "Course 1" course homepage with editing mode on
Scenario: Configure the block on the course page to show 1 high score Scenario: Configure the block on the course page to show 1 high score
Given I add the "Activity results" block Given I add the "Activity results" block
......
...@@ -41,22 +41,26 @@ Feature: The activity results block displays student in group high scores as sca ...@@ -41,22 +41,26 @@ Feature: The activity results block displays student in group high scores as sca
| student4 | G2 | | student4 | G2 |
| student5 | G3 | | student5 | G3 |
| student6 | G3 | | student6 | G3 |
And the following "activities" exist:
| activity | name | intro | course | section | idnumber |
| assign | Test assignment | Offline text | C1 | 1 | assign1 |
And I log in as "teacher1" And I log in as "teacher1"
And I am on "Course 1" course homepage And I am on "Course 1" course homepage with editing mode on
And I navigate to "Scales" in the course gradebook And I navigate to "Scales" in the course gradebook
And I press "Add a new scale" And I press "Add a new scale"
And I set the following fields to these values: And I set the following fields to these values:
| Name | My Scale | | Name | My Scale |
| Scale | Disappointing, Not good enough, Average, Good, Very good, Excellent! | | Scale | Disappointing, Not good enough, Average, Good, Very good, Excellent! |
And I press "Save changes" And I press "Save changes"
And I am on "Course 1" course homepage with editing mode on And I am on "Course 1" course homepage
And I add a "Assignment" to section "1" and I fill the form with: And I follow "Test assignment"
| Assignment name | Test assignment | And I navigate to "Edit settings" in current page administration
| Description | Offline text | And I set the following fields to these values:
| assignsubmission_file_enabled | 0 | | assignsubmission_file_enabled | 0 |
| id_grade_modgrade_type | Scale | | id_grade_modgrade_type | Scale |
| id_grade_modgrade_scale | My Scale | | id_grade_modgrade_scale | My Scale |
| Group mode | Separate groups | | Group mode | Separate groups |
And I press "Save and return to course"
And I am on "Course 1" course homepage And I am on "Course 1" course homepage
And I navigate to "View > Grader report" in the course gradebook And I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on And I turn editing mode on
......
...@@ -41,14 +41,17 @@ Feature: The activity results block displays student in separate groups scores ...@@ -41,14 +41,17 @@ Feature: The activity results block displays student in separate groups scores
| student4 | G2 | | student4 | G2 |
| student5 | G3 | | student5 | G3 |
| student6 | G3 | | student6 | G3 |
And the following "activity" exists:
| activity | assign |
| course | C1 |
| idnumber | 0001 |
| name | Test assignment |
| intro | Offline text |
| section | 1 |
| assignsubmission_file_enabled | 0 |
| groupmode | 1 |
And I log in as "teacher1" And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on 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 |
| Description | Offline text |
| assignsubmission_file_enabled | 0 |
| Group mode | Separate groups |
And I am on "Course 1" course homepage
And I navigate to "View > Grader report" in the course gradebook And I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on And I turn editing mode on
And I give the grade "100.00" to the user "Student 1" for the grade item "Test assignment" And I give the grade "100.00" to the user "Student 1" for the grade item "Test assignment"
......
...@@ -41,13 +41,16 @@ Feature: The activity results block displays student in visible groups scores ...@@ -41,13 +41,16 @@ Feature: The activity results block displays student in visible groups scores
| student4 | G2 | | student4 | G2 |
| student5 | G3 | | student5 | G3 |
| student6 | G3 | | student6 | G3 |
And the following "activities" exist:
| activity | name | intro | course | idnumber | section | assignsubmission_file_enabled |
| assign | Test assignment | Test assignment | C1 | assign1 | 1 | 0 |
And I log in as "teacher1" And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on 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: And I follow "Test assignment"
| Assignment name | Test assignment | And I navigate to "Edit settings" in current page administration
| Description | Offline text | And I set the following fields to these values:
| assignsubmission_file_enabled | 0 |
| Group mode | Visible groups | | Group mode | Visible groups |
And I press "Save and return to course"
And I am on "Course 1" course homepage And I am on "Course 1" course homepage
And I navigate to "View > Grader report" in the course gradebook And I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on And I turn editing mode on
......
...@@ -24,13 +24,16 @@ Feature: The activity results block displays student low scores ...@@ -24,13 +24,16 @@ Feature: The activity results block displays student low scores
| student3 | C1 | student | | student3 | C1 | student |
| student4 | C1 | student | | student4 | C1 | student |
| student5 | C1 | student | | student5 | C1 | student |
And the following "activity" exists:
| activity | assign |
| course | C1 |
| idnumber | 0001 |
| name | Test assignment |
| intro | Offline text |
| section | 1 |
| assignsubmission_file_enabled | 0 |
And I log in as "teacher1" And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on 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 |
| Description | Offline text |
| assignsubmission_file_enabled | 0 |
And I am on "Course 1" course homepage
And I navigate to "View > Grader report" in the course gradebook And I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on And I turn editing mode on
And I give the grade "90.00" to the user "Student 1" for the grade item "Test assignment" And I give the grade "90.00" to the user "Student 1" for the grade item "Test assignment"
......
...@@ -24,6 +24,14 @@ Feature: The activity results block displays student low scores as scales ...@@ -24,6 +24,14 @@ Feature: The activity results block displays student low scores as scales
| student3 | C1 | student | | student3 | C1 | student |
| student4 | C1 | student | | student4 | C1 | student |
| student5 | C1 | student | | student5 | C1 | student |
Given the following "activity" exists:
| activity | assign |
| name | Test assignment |
| intro | Offline text |
| course | C1 |
| idnumber | 0001 |
| section | 1 |
| assignsubmission_file_enabled | 0 |
And I log in as "teacher1" And I log in as "teacher1"
And I am on "Course 1" course homepage And I am on "Course 1" course homepage
And I navigate to "Scales" in the course gradebook And I navigate to "Scales" in the course gradebook
...@@ -33,12 +41,12 @@ Feature: The activity results block displays student low scores as scales ...@@ -33,12 +41,12 @@ Feature: The activity results block displays student low scores as scales
| Scale | Disappointing, Not good enough, Average, Good, Very good, Excellent! | | Scale | Disappointing, Not good enough, Average, Good, Very good, Excellent! |
And I press "Save changes"