MDL-65831 behat: New steps to switch offline mode for moodle app behats
parent
079697de89
commit
21803fc7f2
|
@ -240,9 +240,12 @@
|
|||
var exactLabelMatches = [];
|
||||
var anyLabelMatches = [];
|
||||
findPossibleMatches('//*[@aria-label and contains(@aria-label, "' + escapedText + '")]' +
|
||||
'| //a[@title and contains(@title, "' + escapedText + '")]' +
|
||||
'| //img[@alt and contains(@alt, "' + escapedText + '")]', function(match) {
|
||||
// Add to array depending on if it's an exact or partial match.
|
||||
var attributeData = match.getAttribute('aria-label') || match.getAttribute('alt');
|
||||
var attributeData = match.getAttribute('aria-label') ||
|
||||
match.getAttribute('title') ||
|
||||
match.getAttribute('alt');
|
||||
if (attributeData.trim() === text) {
|
||||
exactLabelMatches.push(match);
|
||||
} else {
|
||||
|
|
|
@ -524,4 +524,15 @@ class behat_app extends behat_base {
|
|||
$this->getSession()->getDriver()->executeScript('window.close()');
|
||||
$this->getSession()->switchToWindow($names[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Switch navigator online mode.
|
||||
*
|
||||
* @Given /^I switch offline mode to "(?P<offline_string>(?:[^"]|\\")*)"$/
|
||||
* @param string $offline New value for navigator online mode
|
||||
* @throws DriverException If the navigator.online mode is not available
|
||||
*/
|
||||
public function i_switch_offline_mode(string $offline) {
|
||||
$this->getSession()->evaluateScript('appProvider.setForceOffline(' . $offline . ');');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue