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
......@@ -22,25 +22,27 @@ Feature: Assign reset
| name | course | idnumber |
| Group 1 | C1 | G1 |
| Group 2 | C1 | G2 |
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 name |
| Description | Submit your online text |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_onlinetext_wordlimit_enabled | 1 |
| assignsubmission_onlinetext_wordlimit | 10 |
| assignsubmission_file_enabled | 0 |
And the following "activity" exists:
| activity | assign |
| course | C1 |
| idnumber | 0001 |
| name | Test assignment name |
| intro | Submit your online text |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_onlinetext_wordlimit_enabled | 1 |
| assignsubmission_onlinetext_wordlimit | 10 |
| assignsubmission_file_enabled | 0 |
Scenario: Use course reset to clear all attempt data
When I log out
And I log in as "student1"
When I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
When I press "Add submission"
And I set the following fields to these values:
| Online text | I'm the student first submission |
And I press "Save changes"
And I press "Submit assignment"
And I press "Continue"
Then I should see "Submitted for grading"
And I should see "I'm the student first submission"
And I should see "Not graded"
......@@ -63,7 +65,9 @@ Feature: Assign reset
@javascript
Scenario: Use course reset to remove user overrides.
When I follow "Test assignment name"
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I navigate to "User overrides" in current page administration
And I press "Add user override"
And I set the following fields to these values:
......@@ -88,7 +92,9 @@ Feature: Assign reset
Then I should not see "Sam1 Student1"
Scenario: Use course reset to remove group overrides.
When I follow "Test assignment name"
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I navigate to "Group overrides" in current page administration
And I press "Add group override"
And I set the following fields to these values:
......@@ -113,7 +119,9 @@ Feature: Assign reset
Then I should not see "Group 1"
Scenario: Use course reset to reset blind marking assignment.
Given I follow "Test assignment name"
When I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| blindmarking | 1 |
......
......@@ -24,14 +24,18 @@ Feature: Assignment with no calendar capabilites
Scenario: Editing an assignment
Given I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
When I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment name |
| Description | Test assignment description |
And the following "activities" exist:
| activity | name | intro | course | section | idnumber |
| assign | Test assignment name | Test assignment description | C1 | 1 | assign1 |
And I am on "Course 1" course homepage
And I follow "Test assignment name"
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| Allow submissions from | ##1 January 2017## |
| Due date | ##1 February 2017## |
| Cut-off date | ##2 February 2017## |
| Remind me to grade by | ##1 March 2017## |
And I press "Save and return to course"
And I log out
When I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
......
......@@ -238,17 +238,25 @@ Feature: Group assignment submissions
| grouping | group |
| GG1 | G1 |
| GG1 | G2 |
And the following "activity" exists:
| activity | assign |
| course | C1 |
| idnumber | 0001 |
| name | Test assignment name |
| intro | Test assignment description |
| section | 1 |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
And I log in as "admin"
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 | Test assignment description |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
And I follow "Test assignment name"
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| Students submit in groups | Yes |
| Grouping for student groups | Grouping 1 |
| Group mode | Separate groups |
| Require group to make submission | No |
And I press "Save and return to course"
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
......@@ -257,6 +265,8 @@ Feature: Group assignment submissions
And I set the following fields to these values:
| Online text | I'm the student's 1 submission |
And I press "Save changes"
And I press "Submit assignment"
And I press "Continue"
And I log out
And I log in as "student3"
And I am on "Course 1" course homepage
......@@ -265,6 +275,8 @@ Feature: Group assignment submissions
And I set the following fields to these values:
| Online text | I'm the student's 3 submission |
And I press "Save changes"
And I press "Submit assignment"
And I press "Continue"
And I log out
And I log in as "student5"
And I am on "Course 1" course homepage
......@@ -273,6 +285,8 @@ Feature: Group assignment submissions
And I set the following fields to these values:
| Online text | I'm the student's 5 submission |
And I press "Save changes"
And I press "Submit assignment"
And I press "Continue"
And I log out
And I log in as "admin"
And I am on "Course 1" course homepage
......@@ -313,18 +327,26 @@ Feature: Group assignment submissions
| user | group |
| student1 | G1 |
| student2 | G1 |
And the following "activity" exists:
| activity | assign |
| course | C1 |
| idnumber | 0001 |
| name | Test assignment name |
| intro | Test assignment description |
| section | 1 |
| assignsubmission_onlinetext_enabled | 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 name |
| Description | Test assignment description |
| assignsubmission_onlinetext_enabled | 1 |
| assignsubmission_file_enabled | 0 |
And I follow "Test assignment name"
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| Require students to click the submit button | Yes |
| Students submit in groups | Yes |
| Group mode | No groups |
| Require group to make submission | No |
| Require all group members submit | No |
And I press "Save and return to course"
And I am on "Course 1" course homepage
And I add the "Activities" block
And I log out
......
......@@ -14,11 +14,11 @@ Feature: In a book, create chapters and sub chapters
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "activities" exist:
| activity | name | intro | course | idnumber | section |
| book | Test book | A book about dreams! | C1 | book1 | 1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Book" to section "1" and I fill the form with:
| Name | Test book |
| Description | A book about dreams! |
Scenario: Create chapters and sub chapters and navigate between them
Given I follow "Test book"
......
......@@ -14,11 +14,11 @@ Feature: Display the book description in the book and optionally in the course
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "activities" exist:
| activity | name | intro | course | idnumber | section |
| book | Test book | A book about dreams! | C1 | book1 | 1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Book" to section "1" and I fill the form with:
| Name | Test book |
| Description | A book about dreams! |
And I am on "Course 1" course homepage
And I follow "Test book"
And I should see "Add new chapter"
And I set the following fields to these values:
......
......@@ -15,13 +15,12 @@ Feature: In a book, change the navigation options
| 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: Change navigation options
Given I add a "Book" to section "1" and I fill the form with:
| Name | Test book |
| Description | A book about lorem ipsum |
| Style of navigation | TOC Only |
Given the following "activities" exist:
| activity | name | intro | course | idnumber | section | navstyle |
| book | Test book | A book about lorem ipsum | C1 | book1 | 1 | 0 |
And I am on "Course 1" course homepage with editing mode on
And I follow "Test book"
And I should see "Add new chapter"
And I set the following fields to these values:
......
......@@ -14,11 +14,11 @@ Feature: In a book, chapters and subchapters can be rearranged
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "activities" exist:
| activity | name | intro | course | idnumber | section |
| book | Test book | A book about rearrangements! | C1 | book1 | 1 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Book" to section "1" and I fill the form with:
| Name | Test book |
| Description | A book about rearrangements! |
And I follow "Test book"
And I should see "Add new chapter"
And I set the following fields to these values:
......
......@@ -14,25 +14,31 @@ Feature: Chat with no calendar capabilites
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "activity" exists:
| activity | chat |
| course | C1 |
| idnumber | 0001 |
| name | Test chat name |
| intro | Test chat description |
| section | 1 |
And I log in as "admin"
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 |
| moodle/calendar:manageentries | Prohibit |
And I log out
Scenario: Editing a chat
Given I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
When I add a "Chat" to section "1" and I fill the form with:
| Name of this chat room | Test chat name |
| Description | Test chat description |
And I am on "Course 1" course homepage
And I follow "Test chat name"
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| Repeat/publish session times | No repeats - publish the specified time only |
| id_chattime_day | 1 |
| id_chattime_month | 1 |
| id_chattime_year | 2017 |
And I press "Save and return to course"
And I log out
Scenario: Editing a chat
When I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I follow "Test chat name"
......
......@@ -16,14 +16,9 @@ Feature: Add choice activity
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Choice" to section "1" and I fill the form with:
| Choice name | Choice name |
| Description | Choice Description |
| option[0] | Option 1 |
| option[1] | Option 2 |
And I log out
And the following "activities" exist:
| activity | name | intro | course | idnumber | option | section |
| choice | Choice name | Choice Description | C1 | choice1 | Option 1, Option 2 | 1 |
When I log in as "student1"
And I am on "Course 1" course homepage
And I choose "Option 1" from "Choice name" choice activity
......
......@@ -16,15 +16,21 @@ Feature: Allow choice preview
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activity" exists:
| activity | choice |
| course | C1 |
| idnumber | choice1 |
| name | Choice name |
| intro | Choice Description |
| section | 1 |
| option | Option 1, Option 2 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
Scenario: Enable the choice preview option and view the activity as a student before the opening time
Given I add a "Choice" to section "1" and I fill the form with:
| Choice name | Choice name |
| Description | Choice Description |
| option[0] | Option 1 |
| option[1] | Option 2 |
And I follow "Choice name"
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| timeopen[enabled] | 1 |
| timeclose[enabled] | 1 |
| timeopen[day] | 30 |
......@@ -34,6 +40,7 @@ Feature: Allow choice preview
| timeclose[month] | December |
| timeclose[year] | 2037 |
| Show preview | 1 |
And I press "Save and return to course"
And I log out
When I log in as "student1"
And I am on "Course 1" course homepage
......
......@@ -9,13 +9,16 @@ Feature: Editing choice block
Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "activity" exists:
| activity | choice |
| course | C1 |
| idnumber | choice1 |
| name | Choice name 1 |
| intro | Choice Description 1 |
| section | 1 |
| option | Option 1, Option 2 |
And I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
And I add a "Choice" to section "1" and I fill the form with:
| Choice name | Choice name 1 |
| Description | Choice Description 1 |
| option[0] | Option 1 |
| option[1] | Option 2 |
And I follow "Choice name 1"
And I add the "Blog menu" block
And I should see "View all entries about this Choice"
......@@ -40,13 +43,16 @@ Feature: Editing choice block
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activity" exists:
| activity | choice |
| course | C1 |
| idnumber | choice1 |
| name | Choice name 1 |
| intro | Choice Description 1 |
| section | 1 |
| option | Option 1, Option 2 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Choice" to section "1" and I fill the form with:
| Choice name | Choice name 1 |
| Description | Choice Description 1 |
| option[0] | Option 1 |
| option[1] | Option 2 |
And I follow "Choice name 1"
And I add the "Blog menu" block
And I should see "View all entries about this Choice"
......@@ -70,13 +76,16 @@ Feature: Editing choice block
| user | course | role |
| teacher1 | C1 | editingteacher |
| teacher1 | C1 | student |
And the following "activity" exists:
| activity | choice |
| course | C1 |
| idnumber | choice1 |
| name | Choice name 1 |
| intro | Choice Description 1 |
| section | 1 |
| option | Option 1, Option 2 |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Choice" to section "1" and I fill the form with:
| Choice name | Choice name 1 |
| Description | Choice Description 1 |
| option[0] | Option 1 |
| option[1] | Option 2 |
And I follow "Choice name 1"
And I add the "Blog menu" block
And I should see "View all entries about this Choice"
......
......@@ -16,15 +16,15 @@ Feature: Teacher can choose whether to allow students to change their choice res
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Choice" to section "1" and I fill the form with:
| Choice name | Choice name |
| Description | Choice Description |
| Allow choice to be updated | No |
| option[0] | Option 1 |
| option[1] | Option 2 |
And I log out
And the following "activity" exists:
| activity | choice |
| course | C1 |
| idnumber | choice1 |
| name | Choice name |
| intro | Choice Description |
| section | 1 |
| option | Option 1, Option 2 |
| allowupdate | 0 |
When I log in as "student1"
And I am on "Course 1" course homepage
And I choose "Option 1" from "Choice name" choice activity
......
......@@ -20,15 +20,18 @@ Feature: Restrict availability of the choice module to a deadline
And I am on "Course 1" course homepage with editing mode on
Scenario: Enable the choice activity with a start deadline in the future
Given I add a "Choice" to section "1" and I fill the form with:
| Choice name | Choice name |
| Description | Choice Description |
| option[0] | Option 1 |
| option[1] | Option 2 |
Given the following "activities" exist:
| activity | name | intro | course | idnumber | option | section |
| choice | Choice name | Choice Description | C1 | choice1 | Option 1, Option 2 | 1 |
And I am on "Course 1" course homepage
And I follow "Choice name"
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| timeopen[enabled] | 1 |
| timeopen[day] | 30 |
| timeopen[month] | December |
| timeopen[year] | 2037 |
And I press "Save and return to course"
And I log out
When I log in as "student1"
And I am on "Course 1" course homepage
......@@ -36,15 +39,18 @@ Feature: Restrict availability of the choice module to a deadline
Then I should see "This activity is not available until"
Scenario: Enable the choice activity with a start deadline in the past
Given I add a "Choice" to section "1" and I fill the form with:
| Choice name | Choice name |
| Description | Choice Description |
| option[0] | Option 1 |
| option[1] | Option 2 |
Given the following "activities" exist:
| activity | name | intro | course | idnumber | option | section |
| choice | Choice name | Choice Description | C1 | choice1 | Option 1, Option 2 | 1 |
And I am on "Course 1" course homepage
And I follow "Choice name"
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| timeopen[enabled] | 1 |
| timeopen[day] | 30 |
| timeopen[month] | December |
| timeopen[year] | 2007 |
And I press "Save and return to course"
And I log out
When I log in as "student1"
And I am on "Course 1" course homepage
......@@ -54,15 +60,18 @@ Feature: Restrict availability of the choice module to a deadline
And "Save my choice" "button" should exist
Scenario: Enable the choice activity with a end deadline in the future
Given I add a "Choice" to section "1" and I fill the form with:
| Choice name | Choice name |
| Description | Choice Description |
| option[0] | Option 1 |
| option[1] | Option 2 |
Given the following "activities" exist:
| activity | name | intro | course | idnumber | option | section |
| choice | Choice name | Choice Description | C1 | choice1 | Option 1, Option 2 | 1 |
And I am on "Course 1" course homepage
And I follow "Choice name"
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| timeclose[enabled] | 1 |
| timeclose[day] | 30 |
| timeclose[month] | December |
| timeclose[year] | 2037 |
And I press "Save and return to course"
And I log out
When I log in as "student1"
And I am on "Course 1" course homepage
......@@ -72,15 +81,18 @@ Feature: Restrict availability of the choice module to a deadline
And "Save my choice" "button" should exist
Scenario: Enable the choice activity with a end deadline in the past
Given I add a "Choice" to section "1" and I fill the form with:
| Choice name | Choice name |
| Description | Choice Description |
| option[0] | Option 1 |
| option[1] | Option 2 |
Given the following "activities" exist:
| activity | name | intro | course | idnumber | option | section |
| choice | Choice name | Choice Description | C1 | choice1 | Option 1, Option 2 | 1 |
And I am on "Course 1" course homepage
And I follow "Choice name"
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| timeclose[enabled] | 1 |
| timeclose[day] | 30 |
| timeclose[month] | December |
| timeclose[year] | 2007 |
And I press "Save and return to course"
And I log out
When I log in as "student1"
And I am on "Course 1" course homepage
......
......@@ -23,13 +23,14 @@ Feature: Choice with no calendar capabilites
And I log out
Scenario: Editing a choice
And the following "activities" exist:
| activity | name | intro | course | idnumber | option | section |
| choice | Test choice name | Test choice description | C1 | choice1 | Option 1, Option 2 | 1 |
Given I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
When I add a "Choice" to section "1" and I fill the form with:
| Choice name | Test choice name |
| Description | Test choice description |
| option[0] | Option 1 |
| option[1] | Option 2 |
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 following fields to these values:
| id_timeopen_enabled | 1 |
| id_timeopen_day | 1 |
| id_timeopen_month | 1 |
......@@ -38,6 +39,7 @@ Feature: Choice with no calendar capabilites
| id_timeclose_day | 1 |
| id_timeclose_month | 2 |
| id_timeclose_year | 2017 |
And I press "Save and return to course"
And I log out
When I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
......
......@@ -20,18 +20,17 @@ Feature: Include responses from inactive users
| student1 | C1 | student |
| student2 | C1 | student |
| student3 | C1 | student |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
Scenario: Enable the choice include inactive option and check that responses from inactive students are visible
Given I add a "Choice" to section "1" and I fill the form with:
| Choice name | Choice name |
| Description | Choice Description |
| option[0] | Option 1 |
| option[1] | Option 2 |
| option[2] | Option 3 |
| Include responses from inactive/suspended users | Yes |
And I log out
Given the following "activity" exists:
| activity | choice |
| course | C1 |
| idnumber | choice1 |
| name | Choice name |
| intro | Choice Description |
| section | 1 |
| option | Option 1, Option 2, Option 3 |
| includeinactive | 1 |
And I log in as "student1"
And I am on "Course 1" course homepage
And I choose "Option 1" from "Choice name" choice activity
......@@ -82,14 +81,15 @@ Feature: Include responses from inactive users
And I log out