@mod @mod_lesson Feature: In Dashboard, 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 Dashboard Background: Given the following "users" exist: | username | firstname | lastname | email | | teacher1 | Teacher | 1 | teacher1@example.com | | student1 | Student | 1 | student1@example.com | | student2 | Student | 2 | student2@example.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 "Dashboard" "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"