Skip to content

Instantly share code, notes, and snippets.

@rajeshtaneja
Created November 12, 2014 09:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rajeshtaneja/78c2588ec5c4984d005f to your computer and use it in GitHub Desktop.
Save rajeshtaneja/78c2588ec5c4984d005f to your computer and use it in GitHub Desktop.
Check preview_question page with specific scenarios
@core @core_question @_switch_window
Feature: A teacher can preview questions in the question bank
In order to ensure the questions are properly created
As a teacher
I need to preview the questions
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@asd.com |
And the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | weeks |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And I log in as "teacher1"
And I follow "Course 1"
And I add a "Numerical" question filling the form with:
| Question name | Test question to be previewed |
| Question text | How much is 1 + 1 |
| answer[0] | 2 |
| fraction[0] | 100% |
| answer[1] | * |
| fraction[1] | None |
And I click on "Preview" "link" in the "Test question to be previewed" "table_row"
And I switch to "questionpreview" window
And I set the following fields to these values:
| Whether correct | Shown |
| How questions behave | Deferred feedback |
And I press "Start again with these options"
And I should see "How much is 1 + 1"
And I should see "Technical information"
And I should see "Attempt options"
And I should see "Display options"
@javascript
Scenario: Preview a question should set state properly
Given I set the field "Answer:" to "1"
And I press "Save"
Then the state of "How much is 1 + 1" question is shown as "Answer saved"
@javascript
Scenario: Preview a question should report correct answer
Given I set the field "Answer:" to "2"
And I press "Save"
And the state of "How much is 1 + 1" question is shown as "Answer saved"
When I press "Submit and finish"
Then the state of "How much is 1 + 1" question is shown as "Complete"
@javascript
Scenario: Preview a question should report incorrect answer
Given I set the field "Answer:" to "1"
And I press "Save"
And the state of "How much is 1 + 1" question is shown as "Answer saved"
When I press "Submit and finish"
Then the state of "How much is 1 + 1" question is shown as "Incorrect"
@javascript
Scenario: Preview a question state of question should reset when "Start again" is pressed
Given I set the field "Answer:" to "1"
And I press "Save"
And the state of "How much is 1 + 1" question is shown as "Answer saved"
And I press "Submit and finish"
And the state of "How much is 1 + 1" question is shown as "Incorrect"
When I press "Start again"
Then the state of "How much is 1 + 1" question is shown as "Not yet answered"
@javascript
Scenario: Preview a question "Fill in correct response" should fill correct answer
When I press "Fill in correct responses"
Then the field "Answer:" matches value "2"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment