aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@users.noreply.github.com>2021-04-21 09:31:29 +0200
committerGitHub <noreply@github.com>2021-04-21 09:31:29 +0200
commit31d88209f77558546561886babe6b3f39cd6db5f (patch)
tree208db44648fa800f22403611d73b9300cb3d8586 /tests
parentdb2aea2f04854e06851e3a42387dad1d73488dc5 (diff)
parent4b376a107ba4f30ca5d5db559f09685378bb8730 (diff)
downloadnextcloud-server-31d88209f77558546561886babe6b3f39cd6db5f.tar.gz
nextcloud-server-31d88209f77558546561886babe6b3f39cd6db5f.zip
Merge pull request #25991 from nextcloud/update-acceptance-tests-to-selenium3
Diffstat (limited to 'tests')
-rw-r--r--tests/acceptance/config/behat.yml24
-rw-r--r--tests/acceptance/features/bootstrap/ContactsMenuContext.php2
-rw-r--r--tests/acceptance/features/bootstrap/FilesAppSharingContext.php3
-rw-r--r--tests/acceptance/features/bootstrap/SearchContext.php2
-rw-r--r--tests/acceptance/features/bootstrap/ThemingAppContext.php2
-rw-r--r--tests/acceptance/features/bootstrap/UsersSettingsContext.php3
-rw-r--r--tests/acceptance/features/core/ElementWrapper.php25
-rwxr-xr-xtests/acceptance/run.sh4
8 files changed, 57 insertions, 8 deletions
diff --git a/tests/acceptance/config/behat.yml b/tests/acceptance/config/behat.yml
index a43bcb504a6..eb5c7d61f8c 100644
--- a/tests/acceptance/config/behat.yml
+++ b/tests/acceptance/config/behat.yml
@@ -65,15 +65,39 @@ default:
default:
selenium2:
wd_host: %selenium.server%
+ browser: "chrome"
+ capabilities:
+ extra_capabilities:
+ goog:chromeOptions:
+ args: ["disable-dev-shm-usage"]
+ w3c: false
John:
selenium2:
wd_host: %selenium.server%
+ browser: "chrome"
+ capabilities:
+ extra_capabilities:
+ goog:chromeOptions:
+ args: ["disable-dev-shm-usage"]
+ w3c: false
Jane:
selenium2:
wd_host: %selenium.server%
+ browser: "chrome"
+ capabilities:
+ extra_capabilities:
+ goog:chromeOptions:
+ args: ["disable-dev-shm-usage"]
+ w3c: false
Jim:
selenium2:
wd_host: %selenium.server%
+ browser: "chrome"
+ capabilities:
+ extra_capabilities:
+ goog:chromeOptions:
+ args: ["disable-dev-shm-usage"]
+ w3c: false
Rubeus:
# Rubeus uses a browser that has CSS grid support.
selenium2:
diff --git a/tests/acceptance/features/bootstrap/ContactsMenuContext.php b/tests/acceptance/features/bootstrap/ContactsMenuContext.php
index 35786062150..ae4eab89ec7 100644
--- a/tests/acceptance/features/bootstrap/ContactsMenuContext.php
+++ b/tests/acceptance/features/bootstrap/ContactsMenuContext.php
@@ -82,7 +82,7 @@ class ContactsMenuContext implements Context, ActorAwareInterface {
* @When I search for the user :user
*/
public function iSearchForTheUser($user) {
- $this->actor->find(self::contactsMenuSearchInput(), 10)->setValue($user . "\r");
+ $this->actor->find(self::contactsMenuSearchInput(), 10)->setValue($user);
}
/**
diff --git a/tests/acceptance/features/bootstrap/FilesAppSharingContext.php b/tests/acceptance/features/bootstrap/FilesAppSharingContext.php
index e8515fa1124..e3b63476fff 100644
--- a/tests/acceptance/features/bootstrap/FilesAppSharingContext.php
+++ b/tests/acceptance/features/bootstrap/FilesAppSharingContext.php
@@ -23,6 +23,7 @@
use Behat\Behat\Context\Context;
use PHPUnit\Framework\Assert;
+use WebDriver\Key;
class FilesAppSharingContext implements Context, ActorAwareInterface {
use ActorAware;
@@ -427,7 +428,7 @@ class FilesAppSharingContext implements Context, ActorAwareInterface {
$shareLinkMenuTriggerElement = $this->actor->find(self::shareLinkMenuTrigger(), 2);
$this->actor->find(self::passwordProtectCheckbox($shareLinkMenuTriggerElement), 2)->click();
- $this->actor->find(self::passwordProtectField($shareLinkMenuTriggerElement), 2)->setValue($password . "\r");
+ $this->actor->find(self::passwordProtectField($shareLinkMenuTriggerElement), 2)->setValue($password . Key::ENTER);
}
/**
diff --git a/tests/acceptance/features/bootstrap/SearchContext.php b/tests/acceptance/features/bootstrap/SearchContext.php
index ba0d9d9933d..db7aeb90ffe 100644
--- a/tests/acceptance/features/bootstrap/SearchContext.php
+++ b/tests/acceptance/features/bootstrap/SearchContext.php
@@ -86,7 +86,7 @@ class SearchContext implements Context, ActorAwareInterface {
* @When I search for :query
*/
public function iSearchFor($query) {
- $this->actor->find(self::searchBoxInput(), 10)->setValue($query . "\r");
+ $this->actor->find(self::searchBoxInput(), 10)->setValue($query);
}
/**
diff --git a/tests/acceptance/features/bootstrap/ThemingAppContext.php b/tests/acceptance/features/bootstrap/ThemingAppContext.php
index 70fb2b01e16..d17d9c18109 100644
--- a/tests/acceptance/features/bootstrap/ThemingAppContext.php
+++ b/tests/acceptance/features/bootstrap/ThemingAppContext.php
@@ -65,7 +65,7 @@ class ThemingAppContext implements Context, ActorAwareInterface {
* @When I set the :parameterName parameter in the Theming app to :parameterValue
*/
public function iSetTheParameterInTheThemingAppTo($parameterName, $parameterValue) {
- $this->actor->find(self::inputFieldFor($parameterName), 10)->setValue($parameterValue . "\r");
+ $this->actor->find(self::inputFieldFor($parameterName), 10)->setValue($parameterValue);
}
/**
diff --git a/tests/acceptance/features/bootstrap/UsersSettingsContext.php b/tests/acceptance/features/bootstrap/UsersSettingsContext.php
index 02e1825e4c9..d60261d5d1a 100644
--- a/tests/acceptance/features/bootstrap/UsersSettingsContext.php
+++ b/tests/acceptance/features/bootstrap/UsersSettingsContext.php
@@ -25,6 +25,7 @@
use Behat\Behat\Context\Context;
use PHPUnit\Framework\Assert;
+use WebDriver\Key;
class UsersSettingsContext implements Context, ActorAwareInterface {
use ActorAware;
@@ -242,7 +243,7 @@ class UsersSettingsContext implements Context, ActorAwareInterface {
* @When I set the :field for :user to :value
*/
public function iSetTheFieldForUserTo($field, $user, $value) {
- $this->actor->find(self::inputForUserInCell($field, $user), 2)->setValue($value . "\r");
+ $this->actor->find(self::inputForUserInCell($field, $user), 2)->setValue($value . Key::ENTER);
}
/**
diff --git a/tests/acceptance/features/core/ElementWrapper.php b/tests/acceptance/features/core/ElementWrapper.php
index d5f7ef495c1..89a73d5aa79 100644
--- a/tests/acceptance/features/core/ElementWrapper.php
+++ b/tests/acceptance/features/core/ElementWrapper.php
@@ -66,6 +66,11 @@
* exception instead of an ElementNotVisible exception, so those cases are
* handled like ElementNotVisible exceptions.
*
+ * ElementNotInteractable exceptions are thrown in Selenium 3 when the command
+ * needs to interact with an element but that is not possible. This could be a
+ * transitive situation (for example, due to an animation), so the command is
+ * executed again after a small timeout.
+ *
* Despite the automatic handling it is possible for the commands to throw those
* exceptions when they are executed again; this class does not handle cases
* like an element becoming stale several times in a row (uncommon) or an
@@ -73,7 +78,10 @@
* that the timeout is too short or that the test has to, indeed, fail). In a
* similar way, MoveTargetOutOfBounds exceptions would be thrown again if
* originally they were thrown because the element was visible but "out of
- * reach".
+ * reach". ElementNotInteractable exceptions would be thrown again if it is not
+ * possible to interact yet with the element after the wait (which could mean
+ * that the test has to, indeed, fail, although it could mean too that the
+ * automatic handling needs to be improved).
*
* If needed, automatically handling failed commands can be disabled calling
* "doNotHandleFailedCommands()"; as it returns the ElementWrapper it can be
@@ -279,6 +287,13 @@ class ElementWrapper {
* If an ElementNotVisible or a MoveTargetOutOfBounds exception is thrown it
* is waited for the wrapped element to be visible and, then, the command is
* executed again.
+ * If an ElementNotInteractable exception is thrown it is also waited for
+ * the wrapped element to be visible. It is very likely that the element was
+ * visible already, but it is not possible to easily check if the element
+ * can be interacted with, retrying will be only useful if it was a
+ * transitive situation that resolves itself with a wait (for example, due
+ * to an animation) and waiting for the element to be visible will always
+ * start with a wait.
*
* @param \Closure $commandCallback the command to execute.
* @param string $errorMessage an error message that describes the failed
@@ -295,6 +310,14 @@ class ElementWrapper {
$this->printFailedCommandMessage($exception, $errorMessage);
} catch (\WebDriver\Exception\MoveTargetOutOfBounds $exception) {
$this->printFailedCommandMessage($exception, $errorMessage);
+ } catch (\Exception $exception) {
+ // The "ElementNotInteractable" exception is not available yet in
+ // the current "instaclick/php-webdriver" version, so it is thrown
+ // as a generic exception with a specific message.
+ if (stripos($exception->getMessage(), "element not interactable") === false) {
+ throw $exception;
+ }
+ $this->printFailedCommandMessage($exception, $errorMessage);
}
$this->waitForElementToBeVisible();
diff --git a/tests/acceptance/run.sh b/tests/acceptance/run.sh
index 48e39bcd119..9a77d717a0c 100755
--- a/tests/acceptance/run.sh
+++ b/tests/acceptance/run.sh
@@ -108,12 +108,12 @@ function prepareSelenium() {
SELENIUM_CONTAINER=selenium-nextcloud-local-test-acceptance
echo "Starting Selenium server"
- docker run --detach --name=$SELENIUM_CONTAINER --publish 4444:4444 --publish 5900:5900 $DOCKER_OPTIONS selenium/standalone-firefox-debug:2.53.1-beryllium
+ docker run --detach --name=$SELENIUM_CONTAINER --publish 4444:4444 --publish 5900:5900 $DOCKER_OPTIONS selenium/standalone-chrome-debug:3.141.59
echo "Waiting for Selenium server to be ready"
if ! $TIMEOUT 10s bash -c "while ! curl 127.0.0.1:4444 >/dev/null 2>&1; do sleep 1; done"; then
echo "Could not start Selenium server; running" \
- "\"docker run --rm --publish 4444:4444 --publish 5900:5900 $DOCKER_OPTIONS selenium/standalone-firefox-debug:2.53.1-beryllium\"" \
+ "\"docker run --rm --publish 4444:4444 --publish 5900:5900 $DOCKER_OPTIONS selenium/standalone-chrome-debug:3.141.59\"" \
"could give you a hint of the problem"
exit 1