diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2021-01-17 23:30:01 +0100 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2021-03-30 08:35:16 +0200 |
commit | 7625a8741202aa14bc3e98ad02a1adab0d1dd475 (patch) | |
tree | 63a491641ad15c8c733312096de29023315a7640 /tests | |
parent | 223b36e851f964b536aaddcd20c34532562a7c01 (diff) | |
download | nextcloud-server-7625a8741202aa14bc3e98ad02a1adab0d1dd475.tar.gz nextcloud-server-7625a8741202aa14bc3e98ad02a1adab0d1dd475.zip |
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>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/acceptance/composer.json | 2 | ||||
-rw-r--r-- | tests/acceptance/composer.lock | 28 | ||||
-rw-r--r-- | tests/acceptance/features/bootstrap/FileListContext.php | 16 | ||||
-rw-r--r-- | tests/acceptance/features/bootstrap/FilesAppSharingContext.php | 4 |
4 files changed, 30 insertions, 20 deletions
diff --git a/tests/acceptance/composer.json b/tests/acceptance/composer.json index 27a30f8fb8a..64808d9e28d 100644 --- a/tests/acceptance/composer.json +++ b/tests/acceptance/composer.json @@ -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": { diff --git a/tests/acceptance/composer.lock b/tests/acceptance/composer.lock index 94f599c3996..4f18fb9c409 100644 --- a/tests/acceptance/composer.lock +++ b/tests/acceptance/composer.lock @@ -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": { @@ -302,14 +302,14 @@ ], "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", diff --git a/tests/acceptance/features/bootstrap/FileListContext.php b/tests/acceptance/features/bootstrap/FileListContext.php index 5f66c0fbbb0..ce2bd9971e0 100644 --- a/tests/acceptance/features/bootstrap/FileListContext.php +++ b/tests/acceptance/features/bootstrap/FileListContext.php @@ -126,7 +126,7 @@ 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"); } @@ -134,6 +134,15 @@ class FileListContext implements Context, ActorAwareInterface { /** * @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 + */ public static function fileListHeader($fileListAncestor) { return Locator::forThe()->css("thead")-> descendantOf($fileListAncestor)-> @@ -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); } /** diff --git a/tests/acceptance/features/bootstrap/FilesAppSharingContext.php b/tests/acceptance/features/bootstrap/FilesAppSharingContext.php index 4540d7ae48d..e8515fa1124 100644 --- a/tests/acceptance/features/bootstrap/FilesAppSharingContext.php +++ b/tests/acceptance/features/bootstrap/FilesAppSharingContext.php @@ -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(); |