mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
MDL-66378 behat: Fix use of before/after selectors
This commit is contained in:
parent
989f380089
commit
221bfed37b
3 changed files with 20 additions and 12 deletions
|
@ -80,8 +80,8 @@ Feature: Glossary entries can be organised in categories
|
|||
And I follow "Browse by category"
|
||||
And "//h3[contains(.,'CATEGORYAUTOLINKS')]" "xpath_element" should appear before "//h3[contains(.,'CATEGORYNOLINKS')]" "xpath_element"
|
||||
And "//h4[contains(.,'EntryCategoryAL')]" "xpath_element" should appear before "//h3[contains(.,'CATEGORYNOLINKS')]" "xpath_element"
|
||||
And "//h4[contains(.,'EntryCategoryBoth')]" "xpath_element" should appear before "//h3[contains(.,'CATEGORYNOLINKS')]" "xpath_element"
|
||||
And "//h3[contains(.,'CATEGORYNOLINKS')]" "xpath_element" should appear before "//h4[contains(.,'EntryCategoryBoth')]" "xpath_element"
|
||||
And "(//h4[contains(.,'EntryCategoryBoth')])[1]" "xpath_element" should appear before "//h3[contains(.,'CATEGORYNOLINKS')]" "xpath_element"
|
||||
And "//h3[contains(.,'CATEGORYNOLINKS')]" "xpath_element" should appear before "(//h4[contains(.,'EntryCategoryBoth')])[2]" "xpath_element"
|
||||
And "//h4[contains(.,'EntryCategoryNL')]" "xpath_element" should appear after "//h3[contains(.,'CATEGORYNOLINKS')]" "xpath_element"
|
||||
And I should not see "EntryNoCategory"
|
||||
And I set the field "hook" to "Not categorised"
|
||||
|
@ -116,4 +116,3 @@ Feature: Glossary entries can be organised in categories
|
|||
And I should see "EntryNoCategory"
|
||||
And I should see "EntryCategoryAL"
|
||||
And I should not see "EntryCategoryBoth"
|
||||
And I log out
|
||||
|
|
|
@ -102,7 +102,7 @@ class core_question_generator extends component_generator_base {
|
|||
* @param array|stdClass $overrides any fields that should be different from the base example.
|
||||
*/
|
||||
public function update_question($question, $which = null, $overrides = null) {
|
||||
global $CFG;
|
||||
global $CFG, $DB;
|
||||
require_once($CFG->dirroot . '/question/engine/tests/helpers.php');
|
||||
|
||||
$qtype = $question->qtype;
|
||||
|
@ -113,7 +113,16 @@ class core_question_generator extends component_generator_base {
|
|||
$fromform = (object) $this->datagenerator->combine_defaults_and_record(
|
||||
(array) $fromform, $overrides);
|
||||
|
||||
return question_bank::get_qtype($qtype)->save_question($question, $fromform);
|
||||
$question = question_bank::get_qtype($qtype)->save_question($question, $fromform);
|
||||
|
||||
if ($overrides && array_key_exists('createdby', $overrides)) {
|
||||
// Manually update the createdby because questiontypebase forces current user and some tests require a
|
||||
// specific user.
|
||||
$question->createdby = $overrides['createdby'];
|
||||
$DB->update_record('question', $question);
|
||||
}
|
||||
|
||||
return $question;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -34,10 +34,10 @@ Feature: Select users when searching for user-created content
|
|||
| activity | PAGE1 |
|
||||
And I search for "frogs" using the header global search box
|
||||
And I expand all fieldsets
|
||||
And I set the field with xpath "//select[@id='id_userids']/..//input[@type='text']" to "Anne"
|
||||
When I expand the "Users" autocomplete
|
||||
# Alphabetical surname order.
|
||||
Then "Anne Additional" "text" should appear before "Anne Ditin" "text"
|
||||
And "Anne Ditin" "text" should appear before "Anne Other" "text"
|
||||
Then "Anne Additional" "text" should appear before "Anne Ditin" "text" in the "Users" "autocomplete"
|
||||
And "Anne Ditin" "text" should appear before "Anne Other" "text" in the "Users" "autocomplete"
|
||||
|
||||
@javascript
|
||||
Scenario: As administrator, search for users within course
|
||||
|
@ -49,9 +49,9 @@ Feature: Select users when searching for user-created content
|
|||
And I search for "frogs" using the header global search box
|
||||
And I expand all fieldsets
|
||||
And I select "Course: Frogs" from the "Search within" singleselect
|
||||
And I set the field with xpath "//select[@id='id_userids']/..//input[@type='text']" to "Anne"
|
||||
When I expand the "Users" autocomplete
|
||||
# Users in selected course appear first.
|
||||
And "Anne Additional" "text" should appear after "Anne Other" "text"
|
||||
Then "Anne Additional" "text" should appear after "Anne Other" "text" in the "Users" "autocomplete"
|
||||
|
||||
@javascript
|
||||
Scenario: As student, cannot see users on other courses
|
||||
|
@ -62,6 +62,6 @@ Feature: Select users when searching for user-created content
|
|||
| activity | PAGE1 |
|
||||
And I search for "frogs" using the header global search box
|
||||
And I expand all fieldsets
|
||||
And I set the field with xpath "//select[@id='id_userids']/..//input[@type='text']" to "A"
|
||||
Then "Anne Ditin" "text" should appear before "Anne Other" "text"
|
||||
When I expand the "Users" autocomplete
|
||||
Then "Anne Ditin" "text" should appear before "Anne Other" "text" in the "Users" "autocomplete"
|
||||
And "Anne Additional" "text" should not exist
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue