Skip to content

Commit ea6e7e6

Browse files
committed
Update Selenium driver for Mink from 1.3.1 to 1.4.0 in acceptance tests
Since version 1.4.0 the Selenium driver for Mink uses again the element on which the value was set (see minkphp/MinkSelenium2Driver#286). When creating a new folder or renaming one sending a new line ("\r") caused the element on which the value was set to be removed, so the element was no longer attached to the DOM when the driver tried to use it again, and thus a "StaleElementReference" exception was thrown. Due to this now it is needed to explicitly click the confirm button when creating a new folder. In the case of the renaming, on the other hand, nothing else besides not sending the new line is needed, as the Selenium driver now unfocuses the element (that is why it uses again the element after setting the value) which triggers the renaming. Signed-off-by: Daniel Calviño Sánchez <[email protected]>
1 parent 0bad065 commit ea6e7e6

File tree

3 files changed

+28
-18
lines changed

3 files changed

+28
-18
lines changed

tests/acceptance/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"behat/behat": "3.8.1",
44
"behat/mink": "1.7.1",
55
"behat/mink-extension": "2.3.1",
6-
"behat/mink-selenium2-driver": "1.3.1",
6+
"behat/mink-selenium2-driver": "1.4.0",
77
"phpunit/phpunit": "6.5.14"
88
},
99
"autoload": {

tests/acceptance/composer.lock

Lines changed: 14 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/acceptance/features/bootstrap/FileListContext.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,20 @@ public static function createNewFolderMenuItem($fileListAncestor) {
126126
* @return Locator
127127
*/
128128
public static function createNewFolderMenuItemNameInput($fileListAncestor) {
129-
return Locator::forThe()->css(".filenameform input")->
129+
return Locator::forThe()->css(".filenameform input[type=text]")->
130130
descendantOf(self::createNewFolderMenuItem($fileListAncestor))->
131131
describedAs("Name input in create new folder menu item in file list");
132132
}
133133

134+
/**
135+
* @return Locator
136+
*/
137+
public static function createNewFolderMenuItemConfirmButton($fileListAncestor) {
138+
return Locator::forThe()->css(".filenameform input[type=submit]")->
139+
descendantOf(self::createNewFolderMenuItem($fileListAncestor))->
140+
describedAs("Confirm button in create new folder menu item in file list");
141+
}
142+
134143
/**
135144
* @return Locator
136145
*/
@@ -356,7 +365,8 @@ public function iCreateANewFolderNamed($folderName) {
356365
$this->actor->find(self::createMenuButton($this->fileListAncestor), 10)->click();
357366

358367
$this->actor->find(self::createNewFolderMenuItem($this->fileListAncestor), 2)->click();
359-
$this->actor->find(self::createNewFolderMenuItemNameInput($this->fileListAncestor), 2)->setValue($folderName . "\r");
368+
$this->actor->find(self::createNewFolderMenuItemNameInput($this->fileListAncestor), 2)->setValue($folderName);
369+
$this->actor->find(self::createNewFolderMenuItemConfirmButton($this->fileListAncestor), 2)->click();
360370
}
361371

362372
/**
@@ -410,7 +420,7 @@ public function iRenameTo($fileName1, $fileName2) {
410420
// This should not be a problem, though, as the default behaviour is to
411421
// bring the browser window to the foreground when switching to a
412422
// different actor.
413-
$this->actor->find(self::renameInputForFile($this->fileListAncestor, $fileName1), 10)->setValue($fileName2 . "\r");
423+
$this->actor->find(self::renameInputForFile($this->fileListAncestor, $fileName1), 10)->setValue($fileName2);
414424
}
415425

416426
/**

0 commit comments

Comments
 (0)