mirror of
https://github.com/moodle/moodle.git
synced 2025-08-09 02:46:40 +02:00
MDL-43236 behat: Backporting new method to ease backporting future scenarios
This commit is contained in:
parent
7330bdebff
commit
4e8c18cc86
3 changed files with 58 additions and 4 deletions
|
@ -136,6 +136,23 @@ class behat_data_generators extends behat_base {
|
||||||
/**
|
/**
|
||||||
* Creates the specified element. More info about available elements in http://docs.moodle.org/dev/Acceptance_testing#Fixtures.
|
* Creates the specified element. More info about available elements in http://docs.moodle.org/dev/Acceptance_testing#Fixtures.
|
||||||
*
|
*
|
||||||
|
* This method has been introduced in 2.7 and replaces self::the_following_exists(),
|
||||||
|
* it has been added here to make backports easier and to help 3rd parties working on new
|
||||||
|
* scenarios so they don't need to update their scenarios when they upgrade to 2.7.
|
||||||
|
*
|
||||||
|
* @Given /^the following "(?P<element_string>(?:[^"]|\\")*)" exist:$/
|
||||||
|
*
|
||||||
|
* @param string $elementname The name of the entity to add
|
||||||
|
* @param TableNode $data
|
||||||
|
*/
|
||||||
|
public function the_following_exist($elementname, TableNode $data) {
|
||||||
|
// Forwarding it.
|
||||||
|
$this->the_following_exists($elementname, $data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates the specified element. More info about available elements in http://docs.moodle.org/dev/Acceptance_testing#Fixtures. This step will be deprecated in Moodle 2.7 in favour of 'the following "ELEMENT_STRING" exist:'.
|
||||||
|
*
|
||||||
* @Given /^the following "(?P<element_string>(?:[^"]|\\")*)" exists:$/
|
* @Given /^the following "(?P<element_string>(?:[^"]|\\")*)" exists:$/
|
||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
|
|
|
@ -84,7 +84,7 @@ class behat_forms extends behat_base {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fills a moodle form with field/value data.
|
* Fills a moodle form with field/value data. This step will be deprecated in Moodle 2.7 in favour of 'I set the following fields to these values:'.
|
||||||
*
|
*
|
||||||
* @Given /^I fill the moodle form with:$/
|
* @Given /^I fill the moodle form with:$/
|
||||||
* @throws ElementNotFoundException Thrown by behat_base::find
|
* @throws ElementNotFoundException Thrown by behat_base::find
|
||||||
|
@ -193,7 +193,7 @@ class behat_forms extends behat_base {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fills in form text field with specified id|name|label|value. It works with text-based fields.
|
* Fills in form text field with specified id|name|label|value. It works with text-based fields. This step will be deprecated in Moodle 2.7 in favour of 'I set the field "FIELD_STRING" to "VALUE_STRING"'.
|
||||||
*
|
*
|
||||||
* @When /^I fill in "(?P<field_string>(?:[^"]|\\")*)" with "(?P<value_string>(?:[^"]|\\")*)"$/
|
* @When /^I fill in "(?P<field_string>(?:[^"]|\\")*)" with "(?P<value_string>(?:[^"]|\\")*)"$/
|
||||||
* @throws ElementNotFoundException Thrown by behat_base::find
|
* @throws ElementNotFoundException Thrown by behat_base::find
|
||||||
|
@ -250,7 +250,7 @@ class behat_forms extends behat_base {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks that the field matches the specified value. When using multi-select fields use commas to separate selected options.
|
* Checks that the field matches the specified value. When using multi-select fields use commas to separate selected options. This step will be deprecated in Moodle 2.7 in favour of 'the field "FIELD_STRING" matches value "VALUE_STRING"'.
|
||||||
*
|
*
|
||||||
* @Then /^the "(?P<field_string>(?:[^"]|\\")*)" field should match "(?P<value_string>(?:[^"]|\\")*)" value$/
|
* @Then /^the "(?P<field_string>(?:[^"]|\\")*)" field should match "(?P<value_string>(?:[^"]|\\")*)" value$/
|
||||||
* @throws ExpectationException
|
* @throws ExpectationException
|
||||||
|
|
|
@ -788,7 +788,25 @@ class behat_general extends behat_base {
|
||||||
/**
|
/**
|
||||||
* Checks the provided element and selector type exists in the current page.
|
* Checks the provided element and selector type exists in the current page.
|
||||||
*
|
*
|
||||||
* This step is for advanced users, use it if you don't find anything else suitable for what you need.
|
* This method has been introduced in 2.7 and replaces self::should_exists(),
|
||||||
|
* it has been added here to make backports easier and to help 3rd parties working on new
|
||||||
|
* scenarios so they don't need to update their scenarios when they upgrade to 2.7.
|
||||||
|
*
|
||||||
|
* @Then /^"(?P<element_string>(?:[^"]|\\")*)" "(?P<selector_string>[^"]*)" should exist$/
|
||||||
|
*
|
||||||
|
* @param string $element The locator of the specified selector
|
||||||
|
* @param string $selectortype The selector type
|
||||||
|
*/
|
||||||
|
public function should_exist($element, $selectortype) {
|
||||||
|
// Forwarding it.
|
||||||
|
$this->should_exists($element, $selectortype);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks the provided element and selector type exists in the current page. This step will be deprecated in Moodle 2.7 in favour of '"ELEMENT_STRING" "SELECTOR_STRING" should exist'.
|
||||||
|
*
|
||||||
|
* This step is for advanced users, use it if you don't find
|
||||||
|
* anything else suitable for what you need.
|
||||||
*
|
*
|
||||||
* @Then /^"(?P<element_string>(?:[^"]|\\")*)" "(?P<selector_string>[^"]*)" should exists$/
|
* @Then /^"(?P<element_string>(?:[^"]|\\")*)" "(?P<selector_string>[^"]*)" should exists$/
|
||||||
* @throws ElementNotFoundException Thrown by behat_base::find
|
* @throws ElementNotFoundException Thrown by behat_base::find
|
||||||
|
@ -807,6 +825,25 @@ class behat_general extends behat_base {
|
||||||
/**
|
/**
|
||||||
* Checks that the provided element and selector type not exists in the current page.
|
* Checks that the provided element and selector type not exists in the current page.
|
||||||
*
|
*
|
||||||
|
* This step is for advanced users, use it if you don't find
|
||||||
|
* anything else suitable for what you need.
|
||||||
|
*
|
||||||
|
* This method has been introduced in 2.7 and replaces self::should_not_exists(),
|
||||||
|
* it has been added here to make backports easier and to help 3rd parties working on new
|
||||||
|
* scenarios so they don't need to update their scenarios when they upgrade to 2.7.
|
||||||
|
*
|
||||||
|
* @Then /^"(?P<element_string>(?:[^"]|\\")*)" "(?P<selector_string>[^"]*)" should not exist$/
|
||||||
|
* @param string $element The locator of the specified selector
|
||||||
|
* @param string $selectortype The selector type
|
||||||
|
*/
|
||||||
|
public function should_not_exist($element, $selectortype) {
|
||||||
|
// Forwarding it.
|
||||||
|
$this->should_not_exists($element, $selectortype);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks that the provided element and selector type not exists in the current page. This step will be deprecated in Moodle 2.7 in favour of '"ELEMENT_STRING" "SELECTOR_STRING" should not exist'.
|
||||||
|
*
|
||||||
* This step is for advanced users, use it if you don't find anything else suitable for what you need.
|
* This step is for advanced users, use it if you don't find anything else suitable for what you need.
|
||||||
*
|
*
|
||||||
* @Then /^"(?P<element_string>(?:[^"]|\\")*)" "(?P<selector_string>[^"]*)" should not exists$/
|
* @Then /^"(?P<element_string>(?:[^"]|\\")*)" "(?P<selector_string>[^"]*)" should not exists$/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue