MDL-75960 behat: Survey behat generators use UI

Replace steps that manually add Survey instances via the UI and use
Behat generators. This improves the speed of the Behat test runs.
This commit is contained in:
Angelia Dela Cruz
2022-11-28 10:22:29 +08:00
parent 959721b58a
commit bf8f9164c0
4 changed files with 36 additions and 37 deletions
+6 -7
View File
@@ -14,12 +14,12 @@ Feature: Block appearances
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "activities" exist:
| activity | course | name | element |
| survey | C1 | Test survey name | 4 |
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 |
| 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 |
@@ -28,9 +28,8 @@ Feature: Block appearances
| Chapter title | Book title |
| Content | Book content test test |
And I press "Save changes"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I am on the "Course 1" course page logged in as teacher1
And I turn editing mode on
And I add the "Comments" block
And I configure the "Comments" block
And I set the following fields to these values:
+3 -4
View File
@@ -14,12 +14,11 @@ Feature: Block region moving
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "activities" exist:
| activity | name | course | template |
| survey | Test survey name | C1 | 4 |
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 |
| 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 |
@@ -20,31 +20,20 @@ Feature: A teacher can use activity completion to track a student progress
And I am on "Course 1" course homepage with editing mode on
Scenario: Require survey view
Given I add a "Survey" to section "1" and I fill the form with:
| Name | Test survey name |
| Survey type | Critical incidents |
| Description | Test survey description |
| Completion tracking | Show activity as complete when conditions are met |
| id_completionview | 1 |
| id_completionsubmit | 0 |
And I log out
When I log in as "student1"
And I am on "Course 1" course homepage
Given the following "activities" exist:
| activity | course | name | template | completion | completionview | completionsubmit |
| survey | C1 | Test survey name | 5 | 2 | 1 | 0 |
When I am on the "Course 1" course page logged in as student1
And the "Test survey name" "survey" activity with "auto" completion should be marked as not complete
And I follow "Test survey name"
And I am on "Course 1" course homepage
Then the "Test survey name" "survey" activity with "auto" completion should be marked as complete
Scenario: Require survey submission
Given I add a "Survey" to section "1" and I fill the form with:
| Name | Test survey name |
| Survey type | Critical incidents |
| Description | Test survey description |
| Completion tracking | Show activity as complete when conditions are met |
| id_completionsubmit | 1 |
And I log out
When I log in as "student1"
And I am on "Course 1" course homepage
Given the following "activities" exist:
| activity | course | name | template | completion | completionsubmit |
| survey | C1 | Test survey name | 5 | 2 | 1 |
When I am on the "Course 1" course page logged in as student1
And the "Test survey name" "survey" activity with "auto" completion should be marked as not complete
And I follow "Test survey name"
And I press "Click here to continue"
+19 -7
View File
@@ -4,7 +4,7 @@ Feature: A teacher can set three types of survey activity
As a teacher
I need to set survey activities and select which survey type suits my needs
Scenario: Switching between the three survey types
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
@@ -15,12 +15,12 @@ Feature: A teacher can set three types of survey activity
| user | course | role |
| teacher1 | C1 | editingteacher |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
When I add a "Survey" to section "1" and I fill the form with:
| Name | Test survey name |
| Survey type | ATTLS (20 item version) |
| Description | Test survey description |
And I follow "Test survey name"
Scenario: Switching between the three survey types
Given the following "activities" exist:
| activity | course | name |
| survey | C1 | Test survey name |
When I am on the "Test survey name" "survey activity" page
Then I should see "Attitudes Towards Thinking and Learning"
And I follow "Edit settings"
And I set the following fields to these values:
@@ -33,3 +33,15 @@ Feature: A teacher can set three types of survey activity
And I press "Save and display"
And I should see "In this online unit..."
And I should see "my learning focuses on issues that interest me."
@javascript
Scenario: Survey activity is created via UI
Given I am on the "Course 1" course page
And I turn editing mode on
And I add a "Survey" to section "1"
And I set the following fields to these values:
| Name | Test survey name |
| Description | Test survey description |
| Survey type | Critical incidents |
When I press "Save and return to course"
Then I should see "Test survey name"