Merge branch 'MDL-76399-401' of https://github.com/paulholden/moodle into MOODLE_401_STABLE

This commit is contained in:
Ilya Tregubov 2022-12-29 09:43:28 +07:00
commit f84d8e3c37
4 changed files with 14 additions and 22 deletions

View File

@ -440,13 +440,12 @@ trait behat_session_trait {
if ($containerselectortype === 'NodeElement' && is_a($containerelement, NodeElement::class)) {
// Support a NodeElement being passed in for use in step chaining.
$containernode = $containerelement;
$locatorexceptionmsg = $element;
} else {
// Gets the container, it will always be text based.
$containernode = $this->get_text_selector_node($containerselectortype, $containerelement);
$locatorexceptionmsg = $element . '" in the "' . $containerelement. '" "' . $containerselectortype. '"';
}
$locatorexceptionmsg = $element . '" in the "' . $this->get_selector_description($containerselectortype, $containerelement);
$exception = new ElementNotFoundException($this->getSession(), $selectortype, null, $locatorexceptionmsg);
return $this->find($selectortype, $element, $exception, $containernode);

View File

@ -28,6 +28,7 @@
require_once(__DIR__ . '/../../behat/behat_base.php');
use Behat\Gherkin\Node\TableNode;
use Behat\Mink\Element\NodeElement;
use Behat\Mink\Exception\DriverException;
use Behat\Mink\Exception\ElementNotFoundException;
use Behat\Mink\Exception\ExpectationException;
@ -1217,20 +1218,12 @@ EOF;
* @throws ElementNotFoundException Thrown by behat_base::find
* @param string $element The locator of the specified selector
* @param string $selectortype The selector type
* @param string $containerelement The container selector type
* @param string $containerselectortype The container locator
* @param NodeElement|string $containerelement The locator of the container selector
* @param string $containerselectortype The container selector type
*/
public function should_exist_in_the($element, $selectortype, $containerelement, $containerselectortype) {
// Get the container node.
$containernode = $this->find($containerselectortype, $containerelement);
// Specific exception giving info about where can't we find the element.
$containerdescription = $this->get_selector_description($containerselectortype, $containerelement);
$locatorexceptionmsg = "{$element} not found in the {$containerdescription}}";
$exception = new ElementNotFoundException($this->getSession(), $selectortype, null, $locatorexceptionmsg);
// Looks for the requested node inside the container node.
$this->find($selectortype, $element, $exception, $containernode);
// Will throw an ElementNotFoundException if it does not exist.
$this->get_node_in_container($selectortype, $element, $containerselectortype, $containerelement);
}
/**
@ -1242,8 +1235,8 @@ EOF;
* @throws ExpectationException
* @param string $element The locator of the specified selector
* @param string $selectortype The selector type
* @param string $containerelement The container selector type
* @param string $containerselectortype The container locator
* @param NodeElement|string $containerelement The locator of the container selector
* @param string $containerselectortype The container selector type
*/
public function should_not_exist_in_the($element, $selectortype, $containerelement, $containerselectortype) {
// Get the container node.

View File

@ -34,7 +34,7 @@ Feature: Quiz question versioning
Then I should see "First question"
And I should see "Answer the first question"
And the field "version" matches value "Always latest"
And "v1 (latest)" "option" should exist in the "version" "select"
And the "version" select box should contain "v1 (latest)"
# We check that the corresponding version is the appropriate one in preview
And I click on "Preview question" "link"
And I switch to "questionpreview" window
@ -54,7 +54,7 @@ Feature: Quiz question versioning
| Correct answer | False |
And I press "id_submitbutton"
And the field "version" matches value "Always latest"
And "v1" "option" should exist in the "version" "select"
And the "version" select box should contain "v1"
And I set the field "version" to "v2 (latest)"
Then I should see "First question (v2)"
And I should see "Answer the new first question"
@ -79,9 +79,9 @@ Feature: Quiz question versioning
Then I should see "First question"
And I should see "Answer the first question"
And the field "version" matches value "Always latest"
And "v1 (latest)" "option" should exist in the "version" "select"
And "v2" "option" should not exist in the "version" "select"
And "v2 (latest)" "option" should not exist in the "version" "select"
And the "version" select box should contain "v1 (latest)"
And the "version" select box should not contain "v2"
And the "version" select box should not contain "v2 (latest)"
And I am on the "Quiz 1" "mod_quiz > View" page
And I press "Preview quiz"
And I should see "Answer the first question"

View File

@ -42,7 +42,7 @@ Feature: A teacher can put questions in categories in the question bank
And I should see "(0)"
And I should see "Created for testing category, HTML entity & its encoding" in the "'Test' & 'display'" "list_item"
And I follow "Add category"
And "'Test' & 'display' [newcatidnumber]" "option" should exist in the "Parent category" "select"
And the "Parent category" select box should contain "'Test' & 'display' [newcatidnumber]"
Scenario: A question category can be edited
When I am on the "Course 1" "core_question > course question categories" page