Skip to content

Commit

Permalink
Add behat test for the latex annotation feature.
Browse files Browse the repository at this point in the history
  • Loading branch information
srobotta committed Sep 14, 2024
1 parent fa3f7fd commit 26881e5
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/behat/load_question.feature
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,24 @@ Feature: Test the cloze question editor string parser that a selected question s
And the field with xpath "//form[@name='tiny_cloze_form']//li[2]//input[contains(@class, 'tiny_cloze_answer')]" matches value "Bill"
And the field with xpath "//form[@name='tiny_cloze_form']//li[2]//select[contains(@class, 'tiny_cloze_frac')]" matches value "Correct"
And the field with xpath "//form[@name='tiny_cloze_form']//li[2]//input[contains(@class, 'tiny_cloze_feedback')]" matches value "This is the short form but correct"

Scenario: Load MULTICHOICE_V question with latex notation
When I am on the "Course 1" "core_question > course question bank" page logged in as teacher
And I press "Create a new question ..."
And I set the field "Embedded answers (Cloze)" to "1"
And I click on "Add" "button" in the "Choose a question type to add" "dialogue"
And I set the field "Question name" to "multianswer-001"
And I set the field "Question text" to multiline:
"""
<p><span class="cloze-question-marker" contenteditable="false">{1:MULTICHOICE_V:=\(\frac{1\}{2\}\)~\(\frac{2\}{3\}\)~\(\frac{3\}{4\}\)}</span></p>
"""
And I select the "span" element in position "0" of the "Question text" TinyMCE editor
When I click on "Cloze question editor" "button"
Then I should see "Multiple choice - single response (MULTICHOICE_V)"
And the field "Default mark" matches value "1"
And the field with xpath "//form[@name='tiny_cloze_form']//li[1]//input[contains(@class, 'tiny_cloze_answer')]" matches value "\(\frac{1}{2}\)"
And the field with xpath "//form[@name='tiny_cloze_form']//li[1]//select[contains(@class, 'tiny_cloze_frac')]" matches value "Correct"
And the field with xpath "//form[@name='tiny_cloze_form']//li[2]//input[contains(@class, 'tiny_cloze_answer')]" matches value "\(\frac{2}{3}\)"
And the field with xpath "//form[@name='tiny_cloze_form']//li[2]//select[contains(@class, 'tiny_cloze_frac')]" matches value "Incorrect"
And the field with xpath "//form[@name='tiny_cloze_form']//li[3]//input[contains(@class, 'tiny_cloze_answer')]" matches value "\(\frac{3}{4}\)"
And the field with xpath "//form[@name='tiny_cloze_form']//li[3]//select[contains(@class, 'tiny_cloze_frac')]" matches value "Incorrect"

0 comments on commit 26881e5

Please sign in to comment.