forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'MDL-42627_master' of git://github.com/dmonllao/moodle
- Loading branch information
Showing
14 changed files
with
127 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,11 +32,11 @@ Feature: Upload users to a cohort | |
And I press "Upload users" | ||
And I press "Continue" | ||
And I follow "Cohorts" | ||
And I click on "Assign" "link" in the "Cohort 1" table row | ||
And I click on "Assign" "link" in the "Cohort 1" "table_row" | ||
Then the "Current users" select box should contain "Tom Jones ([email protected])" | ||
And the "Current users" select box should contain "Bob Jones ([email protected])" | ||
And I press "Back to cohorts" | ||
And I click on "Assign" "link" in the "Cohort 2" table row | ||
And I click on "Assign" "link" in the "Cohort 2" "table_row" | ||
And the "Current users" select box should contain "Mary Smith ([email protected])" | ||
And the "Current users" select box should contain "Alice Smith ([email protected])" | ||
And I am on homepage | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
<?php | ||
// This file is part of Moodle - http://moodle.org/ | ||
// | ||
// Moodle is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// Moodle is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
/** | ||
* Steps definitions that will be deprecated in the next releases. | ||
* | ||
* @package core | ||
* @category test | ||
* @copyright 2013 David Monllaó | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
|
||
// NOTE: no MOODLE_INTERNAL test here, this file may be required by behat before including /config.php. | ||
|
||
require_once(__DIR__ . '/../../../lib/behat/behat_base.php'); | ||
|
||
use Behat\Mink\Exception\ElementNotFoundException as ElementNotFoundException; | ||
|
||
/** | ||
* Deprecated behat step definitions. | ||
* | ||
* @package core | ||
* @category test | ||
* @copyright 2013 David Monllaó | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | ||
*/ | ||
class behat_deprecated extends behat_base { | ||
|
||
/** | ||
* Click on the specified element inside a table row containing the specified text. | ||
* | ||
* @deprecated since Moodle 2.7 MDL-42627 | ||
* @todo MDL-42862 This will be deleted in Moodle 2.9 | ||
* @see behat_general::i_click_on_in_the() | ||
* | ||
* @Given /^I click on "(?P<element_string>(?:[^"]|\\")*)" "(?P<selector_string>(?:[^"]|\\")*)" in the "(?P<row_text_string>(?:[^"]|\\")*)" table row$/ | ||
* @throws ElementNotFoundException | ||
* @param string $element Element we look for | ||
* @param string $selectortype The type of what we look for | ||
* @param string $tablerowtext The table row text | ||
*/ | ||
public function i_click_on_in_the_table_row($element, $selectortype, $tablerowtext) { | ||
|
||
// Throw an exception if deprecated methods are not allowed otherwise allow it's execution. | ||
$alternative = 'I click on "' . $this->escape($element) . '" "' . $this->escape($selectortype) . | ||
'" in the "' . $this->escape($tablerowtext) . '" "table_row"'; | ||
$this->deprecated_message($alternative); | ||
|
||
// The table row container. | ||
$nocontainerexception = new ElementNotFoundException($this->getSession(), '"' . $tablerowtext . '" row text '); | ||
$tablerowtext = $this->getSession()->getSelectorsHandler()->xpathLiteral($tablerowtext); | ||
$rownode = $this->find('xpath', "//tr[contains(., $tablerowtext)]", $nocontainerexception); | ||
|
||
// Looking for the element DOM node inside the specified row. | ||
list($selector, $locator) = $this->transform_selector($selectortype, $element); | ||
$elementnode = $this->find($selector, $locator, false, $rownode); | ||
$elementnode->click(); | ||
} | ||
|
||
/** | ||
* Throws an exception if $CFG->behat_usedeprecated is not allowed. | ||
* | ||
* @throws Exception | ||
* @param string|array $alternatives Alternative/s to the requested step | ||
* @return void | ||
*/ | ||
protected function deprecated_message($alternatives) { | ||
global $CFG; | ||
|
||
// We do nothing if it is enabled. | ||
if (!empty($CFG->behat_usedeprecated)) { | ||
return; | ||
} | ||
|
||
if (is_scalar($alternatives)) { | ||
$alternatives = array($alternatives); | ||
} | ||
|
||
$message = 'Deprecated step, rather than using this step you can:'; | ||
foreach ($alternatives as $alternative) { | ||
$message .= PHP_EOL . '- ' . $alternative; | ||
} | ||
$message .= PHP_EOL . '- Set $CFG->behat_usedeprecated in config.php to allow the use of deprecated steps if you don\'t have any other option'; | ||
throw new Exception($message); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters