Merge pull request #25991 from nextcloud/update-acceptance-tests-to-selenium3
This commit is contained in:
commit
31d88209f7
22
.drone.yml
22
.drone.yml
|
@ -1709,7 +1709,7 @@ steps:
|
|||
|
||||
services:
|
||||
- name: selenium
|
||||
image: selenium/standalone-firefox:2.53.1-beryllium
|
||||
image: selenium/standalone-chrome:3.141.59
|
||||
environment:
|
||||
# Reduce default log level for Selenium server (INFO) as it is too
|
||||
# verbose.
|
||||
|
@ -1739,7 +1739,7 @@ trigger:
|
|||
#
|
||||
#services:
|
||||
#- name: selenium
|
||||
# image: selenium/standalone-firefox:2.53.1-beryllium
|
||||
# image: selenium/standalone-chrome:3.141.59
|
||||
# environment:
|
||||
# # Reduce default log level for Selenium server (INFO) as it is too
|
||||
# # verbose.
|
||||
|
@ -1769,7 +1769,7 @@ steps:
|
|||
|
||||
services:
|
||||
- name: selenium
|
||||
image: selenium/standalone-firefox:2.53.1-beryllium
|
||||
image: selenium/standalone-chrome:3.141.59
|
||||
environment:
|
||||
# Reduce default log level for Selenium server (INFO) as it is too
|
||||
# verbose.
|
||||
|
@ -1799,7 +1799,7 @@ steps:
|
|||
|
||||
services:
|
||||
- name: selenium
|
||||
image: selenium/standalone-firefox:2.53.1-beryllium
|
||||
image: selenium/standalone-chrome:3.141.59
|
||||
environment:
|
||||
# Reduce default log level for Selenium server (INFO) as it is too
|
||||
# verbose.
|
||||
|
@ -1829,7 +1829,7 @@ steps:
|
|||
|
||||
services:
|
||||
- name: selenium
|
||||
image: selenium/standalone-firefox:2.53.1-beryllium
|
||||
image: selenium/standalone-chrome:3.141.59
|
||||
environment:
|
||||
# Reduce default log level for Selenium server (INFO) as it is too
|
||||
# verbose.
|
||||
|
@ -1859,7 +1859,7 @@ steps:
|
|||
|
||||
services:
|
||||
- name: selenium
|
||||
image: selenium/standalone-firefox:2.53.1-beryllium
|
||||
image: selenium/standalone-chrome:3.141.59
|
||||
environment:
|
||||
# Reduce default log level for Selenium server (INFO) as it is too
|
||||
# verbose.
|
||||
|
@ -1889,7 +1889,7 @@ steps:
|
|||
|
||||
services:
|
||||
- name: selenium
|
||||
image: selenium/standalone-firefox:2.53.1-beryllium
|
||||
image: selenium/standalone-chrome:3.141.59
|
||||
environment:
|
||||
# Reduce default log level for Selenium server (INFO) as it is too
|
||||
# verbose.
|
||||
|
@ -1919,7 +1919,7 @@ steps:
|
|||
|
||||
services:
|
||||
- name: selenium
|
||||
image: selenium/standalone-firefox:2.53.1-beryllium
|
||||
image: selenium/standalone-chrome:3.141.59
|
||||
environment:
|
||||
# Reduce default log level for Selenium server (INFO) as it is too
|
||||
# verbose.
|
||||
|
@ -1949,7 +1949,7 @@ steps:
|
|||
|
||||
services:
|
||||
- name: selenium
|
||||
image: selenium/standalone-firefox:2.53.1-beryllium
|
||||
image: selenium/standalone-chrome:3.141.59
|
||||
environment:
|
||||
# Reduce default log level for Selenium server (INFO) as it is too
|
||||
# verbose.
|
||||
|
@ -1979,7 +1979,7 @@ steps:
|
|||
|
||||
services:
|
||||
- name: selenium
|
||||
image: selenium/standalone-firefox:2.53.1-beryllium
|
||||
image: selenium/standalone-chrome:3.141.59
|
||||
environment:
|
||||
# Reduce default log level for Selenium server (INFO) as it is too
|
||||
# verbose.
|
||||
|
@ -2009,7 +2009,7 @@ steps:
|
|||
|
||||
services:
|
||||
- name: selenium
|
||||
image: selenium/standalone-firefox:2.53.1-beryllium
|
||||
image: selenium/standalone-chrome:3.141.59
|
||||
environment:
|
||||
# Reduce default log level for Selenium server (INFO) as it is too
|
||||
# verbose.
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue