|
| 1 | +@mod @mod_questionnaire |
| 2 | +Feature: Text questions can have zero as a valid response |
| 3 | + |
| 4 | + Background: Add a text question to a questionnaire and accept zero |
| 5 | + Given the following "users" exist: |
| 6 | + | username | firstname | lastname | email | |
| 7 | + | teacher1 | Teacher | 1 | teacher1@example.com | |
| 8 | + | student1 | Student | 1 | student1@example.com | |
| 9 | + And the following "courses" exist: |
| 10 | + | fullname | shortname | category | |
| 11 | + | Course 1 | C1 | 0 | |
| 12 | + And the following "course enrolments" exist: |
| 13 | + | user | course | role | |
| 14 | + | teacher1 | C1 | editingteacher | |
| 15 | + | student1 | C1 | student | |
| 16 | + And the following "activities" exist: |
| 17 | + | activity | name | description | course | idnumber | |
| 18 | + | questionnaire | Test questionnaire | Test questionnaire description | C1 | questionnaire0 | |
| 19 | + And I log in as "teacher1" |
| 20 | + And I am on "Course 1" course homepage |
| 21 | + And I follow "Test questionnaire" |
| 22 | + And I navigate to "Questions" in current page administration |
| 23 | + And I add a "Text Box" question and I fill the form with: |
| 24 | + | Question Name | Q1 | |
| 25 | + | Yes | y | |
| 26 | + | Question Text | Enter zero | |
| 27 | + Then I log out |
| 28 | + |
| 29 | + @javascript |
| 30 | + Scenario: Student must enter no more than six digits and decimal points. |
| 31 | + And I log in as "student1" |
| 32 | + And I am on "Course 1" course homepage |
| 33 | + And I follow "Test questionnaire" |
| 34 | + And I navigate to "Answer the questions..." in current page administration |
| 35 | + Then I should see "Enter zero" |
| 36 | + And I set the field "Enter zero" to "0" |
| 37 | + And I press "Submit questionnaire" |
| 38 | + Then I should see "Thank you for completing this Questionnaire." |
| 39 | + And I press "Continue" |
| 40 | + Then I should see "Your response" |
| 41 | + And I should see "Test questionnaire" |
| 42 | + And I should see "Enter zero" |
| 43 | + And "//div[contains(@class,'questionnaire_text') and contains(@class,'questionnaire_response')]//span[@class='selected' and text()='0']" "xpath_element" should exist |
0 commit comments