diff --git a/blocks/tests/behat/manage_blocks.feature b/blocks/tests/behat/manage_blocks.feature index afc49fd3497..889d0f39eca 100644 --- a/blocks/tests/behat/manage_blocks.feature +++ b/blocks/tests/behat/manage_blocks.feature @@ -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: diff --git a/blocks/tests/behat/move_blocks.feature b/blocks/tests/behat/move_blocks.feature index 6a312cec5c2..21ee66f3244 100644 --- a/blocks/tests/behat/move_blocks.feature +++ b/blocks/tests/behat/move_blocks.feature @@ -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 | diff --git a/mod/survey/tests/behat/survey_completion.feature b/mod/survey/tests/behat/survey_completion.feature index 0186b1f484c..3260ea39133 100644 --- a/mod/survey/tests/behat/survey_completion.feature +++ b/mod/survey/tests/behat/survey_completion.feature @@ -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" diff --git a/mod/survey/tests/behat/survey_types.feature b/mod/survey/tests/behat/survey_types.feature index 88472193da4..acc7323d33d 100644 --- a/mod/survey/tests/behat/survey_types.feature +++ b/mod/survey/tests/behat/survey_types.feature @@ -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"