MDL-48750 Lesson: Behat test for lesson attempt info

behat test provided by Jean-Michel Vedrine
This commit is contained in:
Stephen Bourget
2015-01-13 10:59:53 +00:00
committed by Dan Poltawski
parent 6c5b72e889
commit 871a756d06
@@ -0,0 +1,147 @@
@mod @mod_lesson
Feature: In My home, teacher can see the number of student attempts to lessons
In order to know the number of student attempts to a lesson
As a teacher
I need to see it in My home
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@asd.com |
| student1 | Student | 1 | student1@asd.com |
| student2 | Student | 2 | student2@asd.com |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
And I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
@javascript
Scenario: number of student attempts
Given I add a "Lesson" to section "1"
And I expand all fieldsets
And I click on "id_deadline_enabled" "checkbox"
And I set the following fields to these values:
| Name | Test lesson name |
| Description | Test lesson description |
| deadline[day] | 1 |
| deadline[month] | January |
| deadline[year] | 2030 |
| deadline[hour] | 08 |
| deadline[minute] | 00 |
| Re-takes allowed | Yes |
And I press "Save and return to course"
And I follow "Test lesson name"
And I follow "Add a question page"
And I set the field "Select a question type" to "True/false"
And I press "Add a question page"
And I set the following fields to these values:
| Page title | True/false question 1 |
| Page contents | Cat is an amphibian |
| id_answer_editor_0 | False |
| id_response_editor_0 | Correct |
| id_jumpto_0 | Next page |
| id_answer_editor_1 | True |
| id_response_editor_1 | Wrong |
| id_jumpto_1 | This page |
And I press "Save page"
And I set the field "qtype" to "Question"
And I set the field "Select a question type" to "True/false"
And I press "Add a question page"
And I set the following fields to these values:
| Page title | True/false question 2 |
| Page contents | Paper is made from trees. |
| id_answer_editor_0 | True |
| id_response_editor_0 | Correct |
| id_jumpto_0 | Next page |
| id_answer_editor_1 | False |
| id_response_editor_1 | Wrong |
| id_jumpto_1 | This page |
And I press "Save page"
And I follow "Expanded"
And I click on "Add a question page here" "link" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' addlinks ')][3]" "xpath_element"
And I set the field "Select a question type" to "True/false"
And I press "Add a question page"
And I set the following fields to these values:
| Page title | True/false question 3 |
| Page contents | 1+1=2 |
| id_answer_editor_0 | True |
| id_response_editor_0 | Correct |
| id_jumpto_0 | Next page |
| id_answer_editor_1 | False |
| id_response_editor_1 | Wrong |
| id_jumpto_1 | This page |
And I press "Save page"
And I log out
And I log in as "student1"
And I follow "Course 1"
And I follow "Test lesson name"
And I should see "Cat is an amphibian"
And I set the following fields to these values:
| False | 1 |
And I press "Submit"
And I press "Continue"
And I should see "Paper is made from trees."
And I set the following fields to these values:
| False | 1 |
And I press "Submit"
And I press "Continue"
And I should see "1+1=2"
And I set the following fields to these values:
| False | 1 |
And I press "Submit"
And I press "Continue"
And I should see "Congratulations - end of lesson reached"
And I should see "Your score is 1 (out of 3)."
And I follow "Return to Course 1"
And I follow "Test lesson name"
And I should see "Cat is an amphibian"
And I set the following fields to these values:
| False | 1 |
And I press "Submit"
And I press "Continue"
And I should see "Paper is made from trees."
And I set the following fields to these values:
| True | 1 |
And I press "Submit"
And I press "Continue"
And I should see "1+1=2"
And I set the following fields to these values:
| True | 1 |
And I press "Submit"
And I press "Continue"
And I should see "Congratulations - end of lesson reached"
And I should see "Your score is 3 (out of 3)."
And I log out
And I log in as "student2"
And I follow "Course 1"
And I follow "Test lesson name"
And I should see "Cat is an amphibian"
And I set the following fields to these values:
| True | 1 |
And I press "Submit"
And I press "Continue"
And I should see "Paper is made from trees."
And I set the following fields to these values:
| True | 1 |
And I press "Submit"
And I press "Continue"
And I should see "1+1=2"
And I set the following fields to these values:
| True | 1 |
And I press "Submit"
And I press "Continue"
And I should see "Congratulations - end of lesson reached"
And I should see "Your score is 2 (out of 3)."
And I log out
And I log in as "teacher1"
When I click on "My home" "link" in the "Navigation" "block"
Then I should see "You have lessons that are due"
And I click on ".collapsibleregioncaption" "css_element"
And I should see "3 attempts"