Skip to content

Commit

Permalink
MDL-50145 mod_lesson: added behat test for multiple dashboard lessons
Browse files Browse the repository at this point in the history
  • Loading branch information
mdjnelson committed Jun 9, 2015
1 parent bc10960 commit ca0042c
Showing 1 changed file with 76 additions and 0 deletions.
76 changes: 76 additions & 0 deletions mod/lesson/tests/behat/lesson_student_dashboard.feature
Original file line number Diff line number Diff line change
Expand Up @@ -324,3 +324,79 @@ Feature: In Dashboard, a student can see their current status on all lessons wit
Then I should see "You have lessons that are due"
And I click on ".collapsibleregioncaption" "css_element"
And I should see "No attempts have been made on this lesson"

Scenario: Viewing the status for multiple lessons in multiple courses
Given the following "courses" exist:
| fullname | shortname | category |
| Course 2 | C2 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C2 | editingteacher |
| student1 | C2 | student |
And the following "activities" exist:
| activity | name | intro | deadline | retake | course | idnumber |
| lesson | Test lesson name 2 | Test lesson description | 1893481200 | 1 | C1 | lesson1 |
| lesson | Test lesson name 3 | Test lesson description | 1893481200 | 1 | C2 | lesson1 |
And I turn editing mode off
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 |
| Page contents | D035 M00d13 r0x0rz j00 b0x0rs? |
| id_answer_editor_0 | True |
| id_answer_editor_1 | False |
And I press "Save page"
And I follow "Test lesson name 2"
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 |
| Page contents | D035 M00d13 r0x0rz j00 b0x0rs? |
| id_answer_editor_0 | True |
| id_answer_editor_1 | False |
And I press "Save page"
And I click on "Dashboard" "link" in the "Navigation" "block"
And I follow "Course 2"
And I follow "Test lesson name 3"
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 | D035 M00d13 r0x0rz j00 b0x0rs? |
| id_answer_editor_0 | True |
| id_answer_editor_1 | False |
And I press "Save page"
And I select "Question" from the "qtype" singleselect
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 | D035 M00d13 r0x0rz j00 b0x0rs? |
| id_answer_editor_0 | True |
| id_answer_editor_1 | False |
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 "D035 M00d13 r0x0rz j00 b0x0rs?"
And I set the following fields to these values:
| True | 1 |
And I press "Submit"
And I click on "Dashboard" "link" in the "Navigation" "block"
And I follow "Course 2"
And I follow "Test lesson name 3"
And I should see "D035 M00d13 r0x0rz j00 b0x0rs?"
And I set the following fields to these values:
| True | 1 |
And I press "Submit"
When I click on "Dashboard" "link" in the "Navigation" "block"
Then I should see "You have lessons that are due" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' coursebox ' ) and contains(normalize-space(.), 'Course 1')]/div[contains( normalize-space(.), 'You have lessons that are due ' )]" "xpath_element"
And I should see "You have lessons that are due" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' coursebox ' ) and contains(normalize-space(.), 'Course 2')]/div[contains( normalize-space(.), 'You have lessons that are due ' )]" "xpath_element"
And I should see "Lesson has been started, but not yet completed" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' overview ' ) and descendant-or-self::a[.='Test lesson name 3']]" "xpath_element"
And I should see "Completed, You can re-attempt this lesson" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' overview ' ) and descendant-or-self::a[.='Test lesson name']]" "xpath_element"
And I should see "No attempts have been made on this lesson" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' overview ' ) and descendant-or-self::a[.='Test lesson name 2']]" "xpath_element"

0 comments on commit ca0042c

Please sign in to comment.