mirror of
https://github.com/moodle/moodle.git
synced 2025-03-05 00:22:43 +01:00
Merge branch 'MDL-42013_master' of git://github.com/dmonllao/moodle
This commit is contained in:
commit
d1050e406f
@ -36,7 +36,7 @@ Feature: Page contents assertions
|
|||||||
And I log in as "admin"
|
And I log in as "admin"
|
||||||
And I follow "Course 1"
|
And I follow "Course 1"
|
||||||
When I click on "Move this to the dock" "button" in the "Administration" "block"
|
When I click on "Move this to the dock" "button" in the "Administration" "block"
|
||||||
Then I should not see "Question bank"
|
Then I should not see "Question bank" in the "region-pre" "region"
|
||||||
And I click on "//div[@id='dock']/descendant::h2[normalize-space(.)='Administration']" "xpath_element"
|
And I click on "//div[@id='dock']/descendant::h2[normalize-space(.)='Administration']" "xpath_element"
|
||||||
|
|
||||||
@javascript
|
@javascript
|
||||||
@ -46,4 +46,4 @@ Feature: Page contents assertions
|
|||||||
| Course 1 | C1 | 0 |
|
| Course 1 | C1 | 0 |
|
||||||
And I log in as "admin"
|
And I log in as "admin"
|
||||||
When I click on "Move this to the dock" "button" in the "Administration" "block"
|
When I click on "Move this to the dock" "button" in the "Administration" "block"
|
||||||
Then I should not see "Turn editing on"
|
Then I should not see "Turn editing on" in the "region-pre" "region"
|
||||||
|
@ -32,5 +32,5 @@ Feature: Forms manipulation
|
|||||||
Then I should see "Close the quiz"
|
Then I should see "Close the quiz"
|
||||||
And I should see "Group mode"
|
And I should see "Group mode"
|
||||||
And I should see "Grouping"
|
And I should see "Grouping"
|
||||||
And I should not see "Show more..."
|
And I should not see "Show more..." in the "region-main-box" "region"
|
||||||
And I should see "Show less..."
|
And I should see "Show less..."
|
||||||
|
@ -285,7 +285,7 @@ class behat_general extends behat_base {
|
|||||||
public function assert_page_contains_text($text) {
|
public function assert_page_contains_text($text) {
|
||||||
|
|
||||||
$xpathliteral = $this->getSession()->getSelectorsHandler()->xpathLiteral($text);
|
$xpathliteral = $this->getSession()->getSelectorsHandler()->xpathLiteral($text);
|
||||||
$xpath = "/descendant::*[contains(., $xpathliteral)]";
|
$xpath = "/descendant-or-self::*[contains(., $xpathliteral)]";
|
||||||
|
|
||||||
// Wait until it finds the text, otherwise custom exception.
|
// Wait until it finds the text, otherwise custom exception.
|
||||||
try {
|
try {
|
||||||
@ -304,45 +304,69 @@ class behat_general extends behat_base {
|
|||||||
*/
|
*/
|
||||||
public function assert_page_not_contains_text($text) {
|
public function assert_page_not_contains_text($text) {
|
||||||
|
|
||||||
$xpathliteral = $this->getSession()->getSelectorsHandler()->xpathLiteral($text);
|
// Delegating the process to assert_page_contains_text.
|
||||||
$xpath = "/descendant::*[not(contains(., $xpathliteral))]";
|
|
||||||
|
|
||||||
// Wait until it finds the text, otherwise custom exception.
|
|
||||||
try {
|
try {
|
||||||
$this->find('xpath', $xpath);
|
$this->assert_page_contains_text($text);
|
||||||
} catch (ElementNotFoundException $e) {
|
} catch (ExpectationException $e) {
|
||||||
throw new ExpectationException('"' . $text . '" text was found in the page', $this->getSession());
|
// It should not appear, so this is good.
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the page contains the text this is failing.
|
||||||
|
throw new ExpectationException('"' . $text . '" text was found in the page', $this->getSession());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks, that element with specified CSS selector or XPath contains specified text.
|
* Checks, that element with specified CSS selector or XPath contains specified text.
|
||||||
*
|
*
|
||||||
* @Then /^I should see "(?P<text_string>(?:[^"]|\\")*)" in the "(?P<element_string>(?:[^"]|\\")*)" "(?P<text_selector_string>[^"]*)"$/
|
* @Then /^I should see "(?P<text_string>(?:[^"]|\\")*)" in the "(?P<element_string>(?:[^"]|\\")*)" "(?P<text_selector_string>[^"]*)"$/
|
||||||
|
* @throws ElementNotFoundException
|
||||||
|
* @throws ExpectationException
|
||||||
* @param string $text
|
* @param string $text
|
||||||
* @param string $element Element we look in.
|
* @param string $element Element we look in.
|
||||||
* @param string $selectortype The type of element where we are looking in.
|
* @param string $selectortype The type of element where we are looking in.
|
||||||
*/
|
*/
|
||||||
public function assert_element_contains_text($text, $element, $selectortype) {
|
public function assert_element_contains_text($text, $element, $selectortype) {
|
||||||
|
|
||||||
// Transforming from steps definitions selector/locator format to Mink format.
|
// Getting the container where the text should be found.
|
||||||
list($selector, $locator) = $this->transform_text_selector($selectortype, $element);
|
$container = $this->get_selected_node($selectortype, $element);
|
||||||
$this->assertSession()->elementTextContains($selector, $locator, $text);
|
|
||||||
|
$xpathliteral = $this->getSession()->getSelectorsHandler()->xpathLiteral($text);
|
||||||
|
$xpath = "/descendant-or-self::*[contains(., $xpathliteral)]";
|
||||||
|
|
||||||
|
// Wait until it finds the text inside the container, otherwise custom exception.
|
||||||
|
try {
|
||||||
|
$this->find('xpath', $xpath, false, $container);
|
||||||
|
} catch (ElementNotFoundException $e) {
|
||||||
|
throw new ExpectationException('"' . $text . '" text was not found in the ' . $element . ' element', $this->getSession());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks, that element with specified CSS selector or XPath doesn't contain specified text.
|
* Checks, that element with specified CSS selector or XPath doesn't contain specified text.
|
||||||
*
|
*
|
||||||
* @Then /^I should not see "(?P<text_string>(?:[^"]|\\")*)" in the "(?P<element_string>(?:[^"]|\\")*)" "(?P<text_selector_string>[^"]*)"$/
|
* @Then /^I should not see "(?P<text_string>(?:[^"]|\\")*)" in the "(?P<element_string>(?:[^"]|\\")*)" "(?P<text_selector_string>[^"]*)"$/
|
||||||
|
* @throws ElementNotFoundException
|
||||||
|
* @throws ExpectationException
|
||||||
* @param string $text
|
* @param string $text
|
||||||
* @param string $element Element we look in.
|
* @param string $element Element we look in.
|
||||||
* @param string $selectortype The type of element where we are looking in.
|
* @param string $selectortype The type of element where we are looking in.
|
||||||
*/
|
*/
|
||||||
public function assert_element_not_contains_text($text, $element, $selectortype) {
|
public function assert_element_not_contains_text($text, $element, $selectortype) {
|
||||||
|
|
||||||
// Transforming from steps definitions selector/locator format to mink format.
|
// Delegating the process to assert_element_contains_text.
|
||||||
list($selector, $locator) = $this->transform_text_selector($selectortype, $element);
|
try {
|
||||||
$this->assertSession()->elementTextNotContains($selector, $locator, $text);
|
$this->assert_element_contains_text($text, $element, $selectortype);
|
||||||
|
} catch (ExpectationException $e) {
|
||||||
|
// It should not appear, so this is good.
|
||||||
|
// We only catch ExpectationException as ElementNotFoundException
|
||||||
|
// will be thrown if the container does not exist.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the element contains the text this is failing.
|
||||||
|
throw new ExpectationException('"' . $text . '" text was found in the ' . $element . ' element', $this->getSession());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -56,5 +56,5 @@ Feature: Students can edit or delete their forum posts within a set time limit
|
|||||||
Scenario: Time limit expires
|
Scenario: Time limit expires
|
||||||
When I wait "70" seconds
|
When I wait "70" seconds
|
||||||
And I follow "Forum post subject"
|
And I follow "Forum post subject"
|
||||||
Then I should not see "Edit"
|
Then I should not see "Edit" in the "region-main" "region"
|
||||||
And I should not see "Delete"
|
And I should not see "Delete" in the "region-main" "region"
|
||||||
|
@ -13,7 +13,9 @@ Feature: Delete files and folders from the file manager
|
|||||||
And I create "Delete me" folder in "Files" filepicker
|
And I create "Delete me" folder in "Files" filepicker
|
||||||
And I press "Save changes"
|
And I press "Save changes"
|
||||||
When I delete "empty.txt" from "Files" filepicker
|
When I delete "empty.txt" from "Files" filepicker
|
||||||
|
And I press "Save changes"
|
||||||
Then I should not see "empty.txt"
|
Then I should not see "empty.txt"
|
||||||
And I delete "Delete me" from "Files" filepicker
|
And I delete "Delete me" from "Files" filepicker
|
||||||
|
And I press "Save changes"
|
||||||
And I should not see "Delete me"
|
And I should not see "Delete me"
|
||||||
And I press "Cancel"
|
And I press "Cancel"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user