Skip to content

Commit 7625a87

Browse files
danxuliuskjnldsv
authored andcommitted
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. Besides that, the Selenium driver for Mink uses a library to simulate certain events, bitovi/syn. In version 1.4.0 that library was updated to version 0.0.3, which seems to somehow break pressing the "escape" key. Due to this now the sharing menu has to be closed by pressing "enter" on the share menu button instead. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
1 parent 223b36e commit 7625a87

4 files changed

Lines changed: 30 additions & 20 deletions

File tree

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
/**

tests/acceptance/features/bootstrap/FilesAppSharingContext.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,8 @@ public function iWriteDownTheSharedLink() {
372372
self::shareLinkMenu($shareLinkMenuTriggerElement),
373373
$timeout = 2 * $this->actor->getFindTimeoutMultiplier())) {
374374
// It may not be possible to click on the menu button (due to the
375-
// menu itself covering it), so "Esc" key is pressed instead.
376-
$this->actor->find(self::shareLinkMenu($shareLinkMenuTriggerElement), 2)->getWrappedElement()->keyPress(27);
375+
// menu itself covering it), so "Enter" key is pressed instead.
376+
$this->actor->find(self::shareLinkMenuButton(), 2)->getWrappedElement()->keyPress(13);
377377
}
378378

379379
$this->actor->find(self::copyLinkButton(), 10)->click();

0 commit comments

Comments
 (0)