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
......@@ -19,16 +19,18 @@ Feature: A teacher can choose whether to publish choice activity results anonymo
| student1 | C1 | student |
| student2 | C1 | student |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
Scenario: Publish anonymous results
Given I add a "Choice" to section "1" and I fill the form with:
| Choice name | Choice 1 |
| 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 1 | Choice Description | C1 | choice1 | Option 1, Option 2 | 1 |
And I am on "Course 1" course homepage
And I follow "Choice 1"
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| Publish results | Always show results to students |
| Privacy of results | Publish anonymous results, do not show student names |
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
......@@ -41,13 +43,16 @@ Feature: A teacher can choose whether to publish choice activity results anonymo
And I should not see "Users who chose this option"
Scenario: Publish full results
Given I add a "Choice" to section "1" and I fill the form with:
| Choice name | Choice 1 |
| 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 1 | Choice Description | C1 | choice1 | Option 1, Option 2 | 1 |
And I am on "Course 1" course homepage
And I follow "Choice 1"
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| Publish results | Always show results to students |
| Privacy of results | Publish full results, showing names and their choices |
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
......
......@@ -18,15 +18,9 @@ Feature: Update a choice activity removing options
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | 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 |
| option[2] | Option 3 |
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, Option 3 | 1 |
And I log in as "student1"
And I am on "Course 1" course homepage
And I choose "Option 3" from "Choice name" choice activity
......
......@@ -24,10 +24,13 @@ Feature: Database with no calendar capabilites
Scenario: Editing a database
Given I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
When I add a "Database" to section "1" and I fill the form with:
| Name | Test database name |
| Description | Test database description |
And the following "activities" exist:
| activity | name | intro | course | section | idnumber |
| data | Test database name | Test database description | C1 | 1 | data1 |
And I am on "Course 1" course homepage
And I follow "Test database name"
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| id_timeavailablefrom_enabled | 1 |
| id_timeavailablefrom_day | 1 |
| id_timeavailablefrom_month | 1 |
......@@ -44,6 +47,7 @@ Feature: Database with no calendar capabilites
| id_timeviewto_day | 1 |
| id_timeviewto_month | 4 |
| id_timeviewto_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
......
......@@ -23,11 +23,14 @@ Feature: Feedback with no calendar capabilites
And I log out
Scenario: Editing a feedback
Given I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
When I add a "Feedback" to section "1" and I fill the form with:
| Name | Test feedback name |
| Description | Test feedback description |
Given the following "activities" exist:
| activity | name | intro | course | idnumber |
| feedback | Test feedback name | Test feedback description | C1 | feedback1 |
And I log in as "admin"
And I am on "Course 1" course homepage
And I follow "Test feedback 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 |
......@@ -36,6 +39,7 @@ Feature: Feedback 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
......
......@@ -289,12 +289,11 @@ Feature: A user can control their own subscription preferences for a discussion
And the field "Discussion subscription" matches value "I don't want to be notified of new posts in this discussion"
Scenario: A guest should not be able to subscribe to a discussion
Given I am on site homepage
Given the following "activities" exist:
| activity | name | intro | course | section | idnumber | type |
| forum | Test forum name | Test forum description | Acceptance test site | 1 | forum1 | general |
And I am on site homepage
And I turn editing mode on
And I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test forum name |
| Forum type | Standard forum for general use |
| Description | Test forum description |
And I add a new discussion to "Test forum name" forum with:
| Subject | Test post subject one |
| Message | Test post message one |
......@@ -308,12 +307,11 @@ Feature: A user can control their own subscription preferences for a discussion
And "Unsubscribe from this discussion" "checkbox" should not exist
Scenario: A user who is not logged in should not be able to subscribe to a discussion
Given I am on site homepage
Given the following "activities" exist:
| activity | name | intro | course | section | idnumber | type |
| forum | Test forum name | Test forum description | Acceptance test site | 1 | forum1 | general |
And I am on site homepage
And I turn editing mode on
And I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test forum name |
| Forum type | Standard forum for general use |
| Description | Test forum description |
And I add a new discussion to "Test forum name" forum with:
| Subject | Test post subject one |
| Message | Test post message one |
......
......@@ -16,11 +16,11 @@ Feature: Teachers can edit or delete any forum post
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activities" exist:
| activity | name | intro | course | section | idnumber |
| forum | Test forum name | Test forum description | C1 | 1 | forum1 |
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 |
And I am on "Course 1" course homepage
And I add a new discussion to "Test forum name" forum with:
| Subject | Teacher post subject |
| Message | Teacher post message |
......
......@@ -15,14 +15,22 @@ Feature: A user can control their own subscription preferences for a forum
| user | course | role |
| student1 | C1 | student |
And I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
Scenario: A disallowed subscription forum cannot be subscribed to
Given I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test forum name |
| Forum type | Standard forum for general use |
| Description | Test forum description |
Given the following "activity" exists:
| activity | forum |
| course | C1 |
| idnumber | forum1 |
| name | Test forum name |
| intro | Test forum description |
| type | general |
| section | 1 |
And I am on "Course 1" course homepage
Given I follow "Test forum name"
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| Subscription mode | Subscription disabled |
And I press "Save and return to course"
And I add a new discussion to "Test forum name" forum with:
| Subject | Test post subject |
| Message | Test post message |
......@@ -36,11 +44,20 @@ Feature: A user can control their own subscription preferences for a forum
And "You are not subscribed to this discussion. Click to subscribe." "link" should not exist in the "Test post subject" "table_row"
Scenario: A forced subscription forum cannot be subscribed to
Given I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test forum name |
| Forum type | Standard forum for general use |
| Description | Test forum description |
Given the following "activity" exists:
| activity | forum |
| course | C1 |
| idnumber | forum1 |
| name | Test forum name |
| intro | Test forum description |
| type | general |
| section | 1 |
And I am on "Course 1" course homepage
Given I follow "Test forum name"
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| Subscription mode | Forced subscription |
And I press "Save and return to course"
And I add a new discussion to "Test forum name" forum with:
| Subject | Test post subject |
| Message | Test post message |
......@@ -54,11 +71,20 @@ Feature: A user can control their own subscription preferences for a forum
And "You are not subscribed to this discussion. Click to subscribe." "link" should not exist in the "Test post subject" "table_row"
Scenario: An optional forum can be subscribed to
Given I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test forum name |
| Forum type | Standard forum for general use |
| Description | Test forum description |
Given the following "activity" exists:
| activity | forum |
| course | C1 |
| idnumber | forum1 |
| name | Test forum name |
| intro | Test forum description |
| type | general |
| section | 1 |
And I am on "Course 1" course homepage
Given I follow "Test forum name"
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| Subscription mode | Optional subscription |
And I press "Save and return to course"
And I add a new discussion to "Test forum name" forum with:
| Subject | Test post subject |
| Message | Test post message |
......@@ -74,11 +100,20 @@ Feature: A user can control their own subscription preferences for a forum
And I should not see "Subscribe to this forum"
Scenario: An Automatic forum can be unsubscribed from
Given I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test forum name |
| Forum type | Standard forum for general use |
| Description | Test forum description |
Given the following "activity" exists:
| activity | forum |
| course | C1 |
| idnumber | forum1 |
| name | Test forum name |
| intro | Test forum description |
| type | general |
| section | 1 |
And I am on "Course 1" course homepage
Given I follow "Test forum name"
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| Subscription mode | Auto subscription |
And I press "Save and return to course"
And I add a new discussion to "Test forum name" forum with:
| Subject | Test post subject |
| Message | Test post message |
......
......@@ -64,12 +64,21 @@ Feature: As a teacher I need to see an accurate list of subscribed users
And I should not see "Student 3"
Scenario: A forced forum does not allow to edit the subscribers
When I add a "Forum" to section "1" and I fill the form with:
| Forum name | Forced Forum 2 |
| Forum type | Standard forum for general use |
| Description | Test forum description |
Given the following "activity" exists:
| activity | forum |
| name | Forced Forum 2 |
| intro | Test forum description |
| type | general |
| course | C1 |
| idnumber | 0001 |
| section | 1 |
And I am on "Course 1" course homepage
And I follow "Forced Forum 2"
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| Subscription mode | Forced subscription |
| Availability | Show on course page |
And I press "Save and return to course"
And I follow "Forced Forum 2"
And I navigate to "Show/edit current subscribers" in current page administration
Then I should see "Teacher Teacher"
......@@ -79,12 +88,21 @@ Feature: As a teacher I need to see an accurate list of subscribed users
And I should not see "Manage subscribers"
Scenario: A forced and hidden forum lists only teachers
When I add a "Forum" to section "1" and I fill the form with:
| Forum name | Forced Forum 2 |
| Forum type | Standard forum for general use |
| Description | Test forum description |
Given the following "activity" exists:
| activity | forum |
| name | Forced Forum 2 |
| intro | Test forum description |
| type | general |
| course | C1 |
| idnumber | 0001 |
| section | 1 |
And I am on "Course 1" course homepage
And I follow "Forced Forum 2"
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| Subscription mode | Forced subscription |
| Availability | Hide from students |
And I press "Save and return to course"
And I follow "Forced Forum 2"
And I navigate to "Show/edit current subscribers" in current page administration
Then I should see "Teacher Teacher"
......
......@@ -16,16 +16,20 @@ Feature: A user can control their default discussion subscription settings
| user | course | role |
| student1 | C1 | student |
| student2 | C1 | student |
And the following "activities" exist:
| activity | name | intro | course | idnumber | type | section |
| forum | Test forum name | Test forum description | C1 | forump1 | general | 1 |
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:
| Subscription mode | Optional subscription |
And I press "Save and return to course"
And I am on "Course 1" course homepage with editing mode on
Scenario: Creating a new discussion in an optional forum follows user preferences
Given I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test forum name |
| Forum type | Standard forum for general use |
| Description | Test forum description |
| Subscription mode | Optional subscription |
And I log out
Given I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test forum name"
......@@ -41,12 +45,7 @@ Feature: A user can control their default discussion subscription settings
And "input[name=discussionsubscribe]:not([checked=checked])" "css_element" should exist
Scenario: Replying to an existing discussion in an optional forum follows user preferences
Given I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test forum name |
| Forum type | Standard forum for general use |
| Description | Test forum description |
| Subscription mode | Optional subscription |
And I add a new discussion to "Test forum name" forum with:
Given I add a new discussion to "Test forum name" forum with:
| Subject | Test post subject |
| Message | Test post message |
And I log out
......@@ -65,11 +64,11 @@ Feature: A user can control their default discussion subscription settings
And "input[name=discussionsubscribe]:not([checked=checked])" "css_element" should exist
Scenario: Creating a new discussion in an automatic forum follows forum subscription
Given I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test forum name |
| Forum type | Standard forum for general use |
| Description | Test forum description |
Given I follow "Test forum name"
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| Subscription mode | Auto subscription |
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
......@@ -86,11 +85,12 @@ Feature: A user can control their default discussion subscription settings
And "input[name=discussionsubscribe][checked=checked]" "css_element" should exist
Scenario: Replying to an existing discussion in an automatic forum follows forum subscription
Given I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test forum name |
| Forum type | Standard forum for general use |
| Description | Test forum description |
Given 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:
| Subscription mode | Optional subscription |
And I press "Save and return to course"
And I add a new discussion to "Test forum name" forum with:
| Subject | Test post subject |
| Message | Test post message |
......@@ -111,11 +111,11 @@ Feature: A user can control their default discussion subscription settings
@javascript
Scenario: Replying to an existing discussion in an automatic forum which has been unsubscribed from follows user preferences
Given I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test forum name |
| Forum type | Standard forum for general use |
| Description | Test forum description |
Given I follow "Test forum name"
And I navigate to "Edit settings" in current page administration
And I set the following fields to these values:
| Subscription mode | Auto subscription |
And I press "Save and return to course"
And I add a new discussion to "Test forum name" forum with:
| Subject | Test post subject |
| Message | Test post message |
......
......@@ -18,13 +18,19 @@ Feature: A teacher can control the subscription to a forum
| teacher | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
And the following "activity" exists:
| activity | forum |
| course | C1 |
| idnumber | f01 |
| intro | Test forum description |
| name | Test forum name |
And I log in as "teacher"
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 |
| Forum type | Standard forum for general use |
| Description | Test forum description |
| Subscription mode | Auto subscription |
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:
| Subscription mode | Auto subscription |
And I press "Save and return to course"
Scenario: A teacher can change toggle subscription editing on and off
Given I follow "Test forum name"
......
......@@ -131,13 +131,17 @@ Feature: I can grade a students interaction across a forum
And I should see "Tutor" in the "Parent category" "fieldset"
Scenario: Setting both a rating and a whole forum grade does not bleed
Given I add a "Forum" to section "1"
And I expand all fieldsets
And I set the following fields to these values:
| Forum name | Test Forum 1 |
| Description | Test |
When I set the field "Ratings > Aggregate type" to "Count of ratings"
Given the following "activity" exists:
| activity | forum |
| course | C1 |
| idnumber | 0001 |
| name | Test Forum 1 |
| intro | Test |
| section | 1 |
And I am on "Course 1" course homepage
And I follow "Test Forum 1"
And I navigate to "Edit settings" in current page administration
And I set the field "Ratings > Aggregate type" to "Count of ratings"
And I set the field "Ratings > Type" to "Point"
And I set the field "Ratings > Maximum grade" to "100"
And I set the field "Ratings > Grade category" to "Peers"
......
......@@ -38,21 +38,10 @@ Feature: Posting to groups in a separate group discussion when restricted to gro
| G1 | G1G1 |
| G1 | G1G2 |
| G2 | G2G1 |
And I log in as "admin"
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 | Multiple groups forum |
| Forum type | Standard forum for general use |
| Description | Standard forum description |
| Group mode | Separate groups |
| Grouping | G1 |
And I add a "Forum" to section "1" and I fill the form with:
| Forum name | Single groups forum |
| Forum type | Standard forum for general use |
| Description | Standard forum description |
| Group mode | Separate groups |
| Grouping | G2 |
And I log out
And the following "activities" exist:
| activity | course | idnumber | name | intro | type | section | groupmode | grouping |
| forum | C1 | 00001 | Multiple groups forum | Standard forum description | general | 1 | 1 | G1 |
| forum | C1 | 00001 | Single groups forum | Standard forum description | general | 1 | 1 | G2 |
Scenario: Teacher with accessallgroups can post in all groups
Given I log in as "teacher1"
......
......@@ -18,12 +18,11 @@ Feature: Forum discussions can be split
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
And the following "activities" exist:
| activity | name | intro | course | idnumber | type |
| forum | Study discussions | Forum to discuss your coursework. | C1 | forump1 | general |
And I log in as "teacher1"
And I am on "Science 101" course homepage with editing mode on
And I add a "Forum" to section "1" and I fill the form with:
| Forum name | Study discussions |
| Forum type | Standard forum for general use |
| Description | Forum to discuss your coursework. |
And I am on "Science 101" course homepage
And I add a new discussion to "Study discussions" forum with:
| Subject | Photosynthesis discussion |
| Message | Lets discuss our learning about Photosynthesis this week in this thread. |
......
......@@ -14,13 +14,13 @@ Feature: Users can choose to set start and end time for display of their discuss
And the following "course enrolments" exist:
| user | course | role |
| student1 | C1 | student |
And the following "activities" exist:
| activity | name | intro | course | idnumber | type |
| forum | Test forum name | Test forum description | C1 | forump1 | general |
And I log in as "admin"
And the following config values are set as admin:
| forum_enabletimedposts | 1 |
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 |
And I am on "Course 1" course homepage
And I add a new discussion to "Test forum name" forum with:
| Subject | Discussion 1 |
| Message | Discussion contents 1, first message |
......
......@@ -17,14 +17,17 @@ Feature: A teacher can set one of 3 possible options for tracking read forum pos
| student1 | C1 | student |
| student2 | C1 | student |
And I log in as "admin"
And I am on "Course 1" course homepage with editing mode on
Scenario: Tracking forum posts off
Given I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test forum name |
| Forum type | Standard forum for general use |
| Description | Test forum description |
| Read tracking | Off |
Given the following "activity" exists:
| activity | forum |
| course | C1 |
| idnumber | 00001 |
| name | Test forum name |
| intro | Test forum description |
| section | 1 |
| trackingtype | 0 |
And I am on "Course 1" course homepage
And I add a new discussion to "Test forum name" forum with:
| Subject | Test post subject |
| Message | Test post message |
......@@ -36,11 +39,16 @@ Feature: A teacher can set one of 3 possible options for tracking read forum pos
And I should not see "Track unread posts"
Scenario: Tracking forum posts optional with user tracking on
Given I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test forum name |
| Forum type | Standard forum for general use |
| Description | Test forum description |
| Read tracking | Optional |
Given the following "activity" exists:
| activity | forum |
| course | C1 |
| idnumber | 00001 |
| name | Test forum name |
| intro | Test forum description |
| section | 1 |
| type | generalforum |
| trackingtype | 1 |
And I am on "Course 1" course homepage
And I add a new discussion to "Test forum name" forum with:
| Subject | Test post subject |
| Message | Test post message |
......@@ -61,11 +69,16 @@ Feature: A teacher can set one of 3 possible options for tracking read forum pos
And I should not see "1 unread post"
Scenario: Tracking forum posts optional with user tracking off
Given I add a "Forum" to section "1" and I fill the form with: