In my regexp Behat tests I would like to check that the validation error messages work. I have this scenario:
Scenario: Create a Regexp question
When I am on the "Course 1" "core_question > course question bank" page logged in as teacher
And I add a "Regular expression short answer" question filling the form with:
| Question name | regularshortanswer-001 |
| Question text | How much does this computer cost? |
| Default mark | 1 |
| Case sensitivity | Yes, case must match |
| id_answer_0 | 799.99$ |
| id_fraction_0 | 100% |
| id_feedback_0 | OK. |
| id_answer_1 | approximately 800$ |
| id_fraction_1 | 90% |
| id_feedback_1 | Almost. |
Then I should see "In Answers with a grade > 0 these unescaped metacharacters are not allowed: . ^ $ * + { } \"
And I set the field with xpath "//input[contains(@id, 'id_answer_1')]" to "approximately 800\$"
And I click on "Save changes" "button"
Then I should see "regularshortanswer-001"
Error message: "regularshortanswer-001" text was not found in the page (Behat\Mink\Exception\ExpectationException)
The reason for this error is that the scenario never presses the Save changes button on the question edit form. Do I have to issue a special command after setting a field with xpath? Be more specific in the location of the Save changes button? Or should I simply give up on this validation test?