MDL-79863 qtype_ordering: Update Behat tests to use the MDL-66821 changes (#49)

Thanks very much, Tim Hunt. (1) Update Behat tests to use the MDL-66821 changes (2) Fix Behat test that was failing
This commit is contained in:
Tim Hunt
2024-04-04 10:59:30 +08:00
committed by Mathew May
parent 6c6942faca
commit 211edfdaeb
4 changed files with 7 additions and 7 deletions
@@ -29,7 +29,7 @@ Feature: Test duplicating a quiz containing a Ordering question
And I restore "test_backup.mbz" backup into a new course using this options:
| Schema | Course name | Course 2 |
And I navigate to "Question bank" in current page administration
And I click on "Edit" "link" in the "Moodle" "table_row"
And I choose "Edit question" action for "Moodle" in the question bank
Then the following fields match these values:
| Question name | Moodle |
| Question text | Put these words in order. |
@@ -41,7 +41,7 @@ class behat_qtype_ordering extends behat_base {
* @return string the xpath expression.
*/
protected function item_xpath_by_lable($label) {
return '//li[contains(@class, "sortableitem ") and contains(normalize-space(.), "' . $this->escape($label) . '")]';
return '//li[@class = "sortableitem" and contains(normalize-space(.), "' . $this->escape($label) . '")]';
}
/**
@@ -50,7 +50,7 @@ class behat_qtype_ordering extends behat_base {
* @return string the xpath expression.
*/
protected function item_xpath_by_position($position) {
return '//li[contains(@class, "sortableitem ")][' . $position . ']';
return '//li[@class = "sortableitem"][' . $position . ']';
}
/**
@@ -26,7 +26,7 @@ Feature: Test editing an Ordering question
@javascript @_switch_window
Scenario: Edit an Ordering question
When I click on "Edit" "link" in the "Ordering for editing" "table_row"
When I choose "Edit question" action for "Ordering for editing" in the question bank
And I set the following fields to these values:
| Question name ||
And I press "id_submitbutton"
@@ -38,7 +38,7 @@ Feature: Test editing an Ordering question
@javascript @_switch_window
Scenario: Editing an ordering question and making sure the form does not allow duplication of draggables
When I click on "Edit" "link" in the "Ordering for editing" "table_row"
When I choose "Edit question" action for "Ordering for editing" in the question bank
And I set the following fields to these values:
| Draggable item 4 | Object |
And I press "id_submitbutton"
@@ -26,11 +26,11 @@ Feature: Preview an Ordering question
@javascript @_switch_window
Scenario: Preview an Ordering question and submit a correct response.
When I click on "Preview" "link" in the "ordering-001" "table_row"
When I choose "Preview" action for "ordering-001" in the question bank
And I switch to "questionpreview" window
And I set the field "How questions behave" to "Immediate feedback"
And I press "Start again with these options"
# The test was unreliable unless if an item rendomly stared in the right place.
# The test was unreliable unless if an item randomly started in the right place.
# So we first moved each item to the last place, before putting it into the right place.
And I drag "Modular" to space "6" in the ordering question
And I drag "Modular" to space "1" in the ordering question