MDL-41155 Lesson: Added behat tests for multiple question attempts

This commit is contained in:
Dave Cooper 2014-11-20 11:50:32 +08:00
parent c106341098
commit 22cd6b3c8b

View File

@ -4,8 +4,7 @@ Feature: In a lesson activity, students can navigate through a series of pages i
As a teacher
I need to add pages and questions with links between them
@javascript
Scenario: Student navigation with pages and questions
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@asd.com |
@ -20,7 +19,10 @@ Feature: In a lesson activity, students can navigate through a series of pages i
And I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
And I add a "Lesson" to section "1" and I fill the form with:
@javascript
Scenario: Student navigation with pages and questions
Given I add a "Lesson" to section "1" and I fill the form with:
| Name | Test lesson name |
| Description | Test lesson description |
And I follow "Test lesson name"
@ -87,3 +89,45 @@ Feature: In a lesson activity, students can navigate through a series of pages i
And I press "Continue"
And I should see "Congratulations - end of lesson reached"
And I should see "Your score is 0 (out of 1)."
@javascript
Scenario: Student reattempts a question until out of attempts
Given I add a "Lesson" to section "1" and I fill the form with:
| Name | Test lesson name |
| Description | Test lesson description |
| id_review | Yes |
| id_maxattempts | 3 |
And I follow "Test lesson name"
And I follow "Add a question page"
And I set the following fields to these values:
| id_qtype | True/false |
And I press "Add a question page"
And I set the following fields to these values:
| Page title | Test question |
| Page contents | Test content |
| id_answer_editor_0 | right |
| id_answer_editor_1 | wrong |
And I press "Save page"
And I log out
And I log in as "student1"
And I follow "Course 1"
When I follow "Test lesson name"
Then I should see "Test content"
And I set the following fields to these values:
| wrong | 1 |
And I press "Submit"
And I should see "You have 2 attempt(s) remaining"
And I press "Yes, I'd like to try again"
And I should see "Test content"
And I set the following fields to these values:
| wrong | 1 |
And I press "Submit"
And I should see "You have 1 attempt(s) remaining"
And I press "Yes, I'd like to try again"
And I should see "Test content"
And I set the following fields to these values:
| wrong | 1 |
And I press "Submit"
And I should see "(Maximum number of attempts reached - Moving to next page)"
And I press "Continue"
And I should see "Congratulations - end of lesson reached"