Update acceptance tests to Selenium 3

The acceptance tests used the last Selenium 2 Docker container
available, which provides a rather old Firefox version (Firefox 47).
Nevertheless, despite some rendering issues, most things still worked as
expected due to the JavaScript files being built with support for older
browsers. However, now that support for Internet Explorer 11 and older
browsers will be dropped things could start to fail, so a newer browser
(and thus a newer Selenium version) should be used in the acceptance
tests.

Selenium has been standardized by the W3C, and the protocol to
communicate between the Selenium server and the browser has changed due
to that. Firefox >= 48 only supports the new W3C protocol, but the
Selenium driver for Mink does not support it yet.

The old protocol can still be used in recent Chromium/Chrome versions by
explicitly forcing it, so for the time being the acceptance tests will
need to be run on Chrome instead (although Firefox provides some
interesting features like the fake streams that would be needed to test
calls in Talk, so they should be moved again to Firefox once possible).

Finally, the default shm size of Docker is 64 MiB. This does not seem
enough to run newer Chrome releases and causes the browser to randomly
crash during the tests ("unknown error: session deleted because of page
crash" is shown in the logs). Due to this "disable-dev-shm-usage" needs
to be used so Chrome writes shared memory files into "/tmp" instead of
"/dev/shm" (the default shm size of Docker could have been increased
instead using "docker run --shm-size...", but that seems to be
problematic when the container is run in current Drone releases).

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
Daniel Calviño Sánchez 2021-03-06 15:05:54 +01:00
parent 14b85f4eec
commit 9e1246eba5
3 changed files with 37 additions and 13 deletions

View File

@ -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.

View File

@ -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:

View File

@ -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