MDL-66378 behat: JS does not work with newlines in an xpath

This commit is contained in:
Andrew Nicols 2019-08-16 11:32:12 +08:00
parent 221bfed37b
commit 460a0a74c4

View file

@ -856,8 +856,13 @@ class behat_general extends behat_base {
list($preselector, $prelocator) = $this->transform_selector($preselectortype, $preelement); list($preselector, $prelocator) = $this->transform_selector($preselectortype, $preelement);
list($postselector, $postlocator) = $this->transform_selector($postselectortype, $postelement); list($postselector, $postlocator) = $this->transform_selector($postselectortype, $postelement);
$prexpath = $this->find($preselector, $prelocator, false, $containernode)->getXpath(); $newlines = [
$postxpath = $this->find($postselector, $postlocator, false, $containernode)->getXpath(); "\r\n",
"\r",
"\n",
];
$prexpath = str_replace($newlines, ' ', $this->find($preselector, $prelocator, false, $containernode)->getXpath());
$postxpath = str_replace($newlines, ' ', $this->find($postselector, $postlocator, false, $containernode)->getXpath());
if ($this->running_javascript()) { if ($this->running_javascript()) {
// The xpath to do this was running really slowly on certain Chrome versions so we are using // The xpath to do this was running really slowly on certain Chrome versions so we are using