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
https://github.com/minkphp/MinkSelenium2Driver/pull/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>
This commit is contained in:
Daniel Calviño Sánchez 2021-01-17 23:30:01 +01:00 committed by John Molakvoæ (skjnldsv)
parent 223b36e851
commit 7625a87412
No known key found for this signature in database
GPG Key ID: 60C25B8C072916CF
4 changed files with 30 additions and 20 deletions

View File

@ -3,7 +3,7 @@
"behat/behat": "3.8.1",
"behat/mink": "1.7.1",
"behat/mink-extension": "2.3.1",
"behat/mink-selenium2-driver": "1.3.1",
"behat/mink-selenium2-driver": "1.4.0",
"phpunit/phpunit": "6.5.14"
},
"autoload": {

View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "f75fc126df5999c922c96e1593eabf31",
"content-hash": "23dccfe6d77917642d1be256dc842b55",
"packages": [],
"packages-dev": [
{
@ -265,30 +265,30 @@
},
{
"name": "behat/mink-selenium2-driver",
"version": "v1.3.1",
"version": "v1.4.0",
"source": {
"type": "git",
"url": "https://github.com/minkphp/MinkSelenium2Driver.git",
"reference": "473a9f3ebe0c134ee1e623ce8a9c852832020288"
"reference": "312a967dd527f28980cce40850339cd5316da092"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/minkphp/MinkSelenium2Driver/zipball/473a9f3ebe0c134ee1e623ce8a9c852832020288",
"reference": "473a9f3ebe0c134ee1e623ce8a9c852832020288",
"url": "https://api.github.com/repos/minkphp/MinkSelenium2Driver/zipball/312a967dd527f28980cce40850339cd5316da092",
"reference": "312a967dd527f28980cce40850339cd5316da092",
"shasum": ""
},
"require": {
"behat/mink": "~1.7@dev",
"instaclick/php-webdriver": "~1.1",
"php": ">=5.3.1"
"php": ">=5.4"
},
"require-dev": {
"symfony/phpunit-bridge": "~2.7"
"mink/driver-testsuite": "dev-master"
},
"type": "mink-driver",
"extra": {
"branch-alias": {
"dev-master": "1.3.x-dev"
"dev-master": "1.4.x-dev"
}
},
"autoload": {
@ -301,15 +301,15 @@
"MIT"
],
"authors": [
{
"name": "Konstantin Kudryashov",
"email": "ever.zet@gmail.com",
"homepage": "http://everzet.com"
},
{
"name": "Pete Otaqui",
"email": "pete@otaqui.com",
"homepage": "https://github.com/pete-otaqui"
},
{
"name": "Konstantin Kudryashov",
"email": "ever.zet@gmail.com",
"homepage": "http://everzet.com"
}
],
"description": "Selenium2 (WebDriver) driver for Mink framework",
@ -322,7 +322,7 @@
"testing",
"webdriver"
],
"time": "2016-03-05T09:10:18+00:00"
"time": "2020-03-11T14:43:21+00:00"
},
{
"name": "behat/transliterator",

View File

@ -126,11 +126,20 @@ class FileListContext implements Context, ActorAwareInterface {
* @return Locator
*/
public static function createNewFolderMenuItemNameInput($fileListAncestor) {
return Locator::forThe()->css(".filenameform input")->
return Locator::forThe()->css(".filenameform input[type=text]")->
descendantOf(self::createNewFolderMenuItem($fileListAncestor))->
describedAs("Name input in create new folder menu item in file list");
}
/**
* @return Locator
*/
public static function createNewFolderMenuItemConfirmButton($fileListAncestor) {
return Locator::forThe()->css(".filenameform input[type=submit]")->
descendantOf(self::createNewFolderMenuItem($fileListAncestor))->
describedAs("Confirm button in create new folder menu item in file list");
}
/**
* @return Locator
*/
@ -356,7 +365,8 @@ class FileListContext implements Context, ActorAwareInterface {
$this->actor->find(self::createMenuButton($this->fileListAncestor), 10)->click();
$this->actor->find(self::createNewFolderMenuItem($this->fileListAncestor), 2)->click();
$this->actor->find(self::createNewFolderMenuItemNameInput($this->fileListAncestor), 2)->setValue($folderName . "\r");
$this->actor->find(self::createNewFolderMenuItemNameInput($this->fileListAncestor), 2)->setValue($folderName);
$this->actor->find(self::createNewFolderMenuItemConfirmButton($this->fileListAncestor), 2)->click();
}
/**
@ -410,7 +420,7 @@ class FileListContext implements Context, ActorAwareInterface {
// This should not be a problem, though, as the default behaviour is to
// bring the browser window to the foreground when switching to a
// different actor.
$this->actor->find(self::renameInputForFile($this->fileListAncestor, $fileName1), 10)->setValue($fileName2 . "\r");
$this->actor->find(self::renameInputForFile($this->fileListAncestor, $fileName1), 10)->setValue($fileName2);
}
/**

View File

@ -372,8 +372,8 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
self::shareLinkMenu($shareLinkMenuTriggerElement),
$timeout = 2 * $this->actor->getFindTimeoutMultiplier())) {
// It may not be possible to click on the menu button (due to the
// menu itself covering it), so "Esc" key is pressed instead.
$this->actor->find(self::shareLinkMenu($shareLinkMenuTriggerElement), 2)->getWrappedElement()->keyPress(27);
// menu itself covering it), so "Enter" key is pressed instead.
$this->actor->find(self::shareLinkMenuButton(), 2)->getWrappedElement()->keyPress(13);
}
$this->actor->find(self::copyLinkButton(), 10)->click();