-
ownCloud >= 10.0. Make sure you have a running instance of ownCloud completely setup.
-
Default language set to
en(inconfig/config.phpset'default_language' ⇒ 'en',). -
An admin user called
adminwith the passwordadmin. -
No self-signed SSL certificates.
-
The testing app installed and enabled.
-
Testing utils (running
makein your terminal from thewebrootdirectory will install them). -
Docker Post-install done to put your developer account in the docker group so you can run Docker without
sudo -
Docker subnet enabled for any firewall that may be active such as, ufw. The example below shows how to update ufw’s firewall rules to allow the
172.17.0.0/16Docker subnet:sudo ufw status sudo ufw allow from 172.17.0.0/16
-
Docker containers pulled. It is recommended to use
standalone-chrome-debugwhich allows seeing the browser live. You will also need MailHog. Pull any or all of these Docker containers:
docker pull selenium/standalone-chrome
docker pull selenium/standalone-chrome-debug
docker pull selenium/standalone-firefox
docker pull selenium/standalone-firefox-debug
docker pull mailhog/mailhog-
A
vncviewer installed (in order to view the browser action as the UI tests run). For example:
sudo apt install tigervnc-viewer-
To run the Selenium server locally (not in Docker) see the notes at the end.
Tests are divided into suites, enabling each suite to test some logical portion of the functionality and for the total elapsed run-time of a single suite to be reasonable (up to about 40 minutes on Travis-CI, about 10 minutes on drone). Elapsed run-time on a local developer system is very dependent on the IO as well as CPU performance. Smaller apps may have all tests in a single suite.
Each suite consists of a number of features. Each feature is described
in a *.feature file. There are a number of scenarios in each feature
file. Each scenario has a number of scenario steps that define the steps
taken to do the test.
-
Start the Selenium Docker container in a terminal:
docker run -p 4445:4444 -p 5900:5900 -v /dev/shm:/dev/shm selenium/standalone-chrome-debugPorts on the Selenium Docker IP address are mapped to localhost so they can be accessed by the tests and the vnc viewer.
-
Start the MailHog Docker container in another terminal:
docker run -p 1025:1025 -p 8025:8025 mailhog/mailhogPorts on the MailHog docker IP address are mapped to localhost so they can be accessed by the tests.
By running these in terminal windows, it is simple to press ctrl-C to stop them when you are finished.
-
Set the following environment variables:
-
TEST_SERVER_URL(The URL of your webserver) -
TEST_SERVER_FED_URL(The alternative URL of your webserver for federation share tests.) -
BROWSER(Any one ofchrome,firefox,internet explorerorMicrosoftEdge. Defaults tochrome) -
BROWSER_VERSION(version of the browser you want to use - optional)
-
e.g., to test an instance running on the Docker subnet with Chrome do:
export TEST_SERVER_URL=http://172.17.0.1:8080/owncloud-core
export TEST_SERVER_FED_URL=http://172.17.0.1:8180/owncloud-core
export BROWSER=chrome-
If your ownCloud install is running locally on Apache, then it should already be available on the Docker subnet at
172.17.0.1 -
To run the federation Sharing tests:
-
Make sure you have configured HTTPS with valid certificates on both servers URLs
-
Import SSL certificates (or do not offer HTTPS).
-
-
Run a suite of tests:
make test-acceptance-webui BEHAT_SUITE=webUILogin
The names of suites are found in the tests/acceptance/config/behat.yml file, and start with webUI.
The tests may need to be run as the same user who is running the webserver and this user must also be the owner of the config file (config/config.php).
To run the tests as a user that is different to your current terminal user run sudo -E -u <username>. For example, to run as www-data, run sudo -E -u www-data make test-acceptance-webui BEHAT_SUITE=webUILogin.
-
The browser for the tests runs inside the Selenium docker container. View it by running the
vncviewer:vncviewer.
And connect to localhost. The VNC password of the docker container is secret.
The test system must have (at least locally) functioning IPv6:
-
working loopback address ::1
-
a
realroutable IPv6 address (not just a link-local address)
If you have a server set up that listens on both IPv4 and IPv6 (e.g. localhost on 127.0.0.1 and ::1) then the UI tests will access the server via whichever protocol your operating system prefers. If there are tests that specifically specify IPv4 or IPv6, then those will choose a suitable local address to come from so that they access the server using the required IP version.
If you are using the PHP dev server, then before starting it, in addition to the exports in the Set Up Test section, specify where the IPv6 server should listen:
export IPV6_HOST_NAME=ip6-localhostThen both IPv4 and IPv6 PHP dev servers will be started by the script:
bash tests/travis/start_php_dev_server.shIf you want the tests to drive the UI over IPv6, then export an IPv6
name or address for SRV_HOST_NAME and an IPv4 name or address for
IPV4_HOST_NAME:
export SRV_HOST_NAME=ip6-localhost
export IPV4_HOST_NAME=localhostBecause not everyone will have functional IPv6 on their test system yet, tests that specifically require IPv6 are tagged @skip @ipv6.
To run those tests, follow the section below on running skipped tests and specify --tags @ipv6.
You can run the UI tests for just a single feature by specifying the feature file:
make test-acceptance-webui BEHAT_FEATURE=tests/acceptance/features/webUITrashbin/trashbinDelete.featureTo run just a single scenario within a feature, specify the line number of the scenario:
make test-acceptance-webui BEHAT_FEATURE=tests/acceptance/features/webUITrashbin/trashbinDelete.feature<linenumber>With the app installed, run the UI tests for the app from the app root folder:
cd apps/files_texteditor
../../tests/acceptance/run.sh --suite webUITextEditorRun UI the tests for just a single feature of the app by specifying the feature file:
cd apps/files_texteditor
../../tests/acceptance/run.sh tests/acceptance/features/webUITextEditor/editTextFiles.featureIf a UI test is known to fail because of an existing bug, then it is
left in the test set but is skipped by default. Skip a test by tagging
it @skip and then put another tag with text that describes the reason
it is skipped. e.g.,:
@skip @trashbin-restore-problem-issue-1234
Scenario: restore a single file from the trashbinSkipped tests are listed at the end of a default UI test run. You can locally run the skipped test(s). Run all skipped tests for a suite with:
make test-acceptance-webui BEHAT_SUITE=webUITrashbin BEHAT_FILTER_TAGS=@skipOr run just a particular test by using its unique tag:
make test-acceptance-webui BEHAT_SUITE=webUITrashbin BEHAT_FILTER_TAGS=@trashbin-restore-problem-issue-1234When fixing the bug, remove these skip tags in the PR along with the bug fix code.
Running all test suites in a single run is not recommended. It will take more than 1 hour on a typical development system. However, you may run all UI tests with:
make test-acceptance-webuiBy default, any test scenarios that fail are automatically rerun once. This minimizes transient failures caused by browser and Selenium driver timing issues. When developing tests it can be convenient to override this behavior.
To not rerun failed test scenarios:
make test-acceptance-webui NORERUN=true BEHAT_SUITE=webUILoginYou may optionally run the Selenium server locally. Docker is now the recommended way, but local Selenium is also possible:
-
`Selenium standalone server http://docs.seleniumhq.org/download/`_ e.g. version 3.12.0 or newer.
-
Browser installed that you would like to test on (e.g. chrome)
-
`Web driver for the browser that you want to test http://www.seleniumhq.org/download/#thirdPartyDrivers`_.
-
Place the Selenium standalone server jar file and the web driver(s) somewhere in the same folder.
-
Start the Selenium server:
java -jar selenium-server-standalone-3.12.0.jar \
-port 4445 \
-enablePassThrough false-
In this configuration, the tests will continually open the browser-under-test on your local system.
-
If you run any test scenarios that need MailHog (to test password reset etc.), then you need to run the MailHog Docker container. That is much simpler than trying to configure MailHog on your local system.
-
Tests that are known not to work in specific browsers are tagged e.g.,
@skipOnFIREFOX47+or@skipOnINTERNETEXPLORERand will be skipped by the script automatically -
- The web driver for the current version of Firefox works differently to the old one. If you want to test FF < 56 you need to test on 47.0.2 and to use Selenium server 2.53.1 for it