Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Magnolia 5.5 and above

Note

This page and its subpages are outdated partially.

For a more up-to-date documentation regarding UI tests for Magnolia 6.1 and higher, please also check the documentation on bitbucket.

Info
titleCaution


You need the docker-engine installed on your local machine. (For macOS have a look here)

...

To observe the browser with the test execution launch a VNC client and connect to localhost:5901 with password "secret". (Under macOS that easily done with the app Screen Sharing)


Tip
titleTip
Giving Docker more resources than the default seems to help making the local testing environment more stable and faster. E.g.
Image Added


No Docker Setup (Manual run)

...

Test will be executed in a new Chrome browser window.

Alternative No Docker Setup (Manual run)

Another alternative method to run UI Tests without relying too much on Docker. This method has some advantages compared to the previous No docker setup:

 + Don't have to manually setup selenium every times

 + UI clients moved to docker so we can avoid test browser to be opened randomly on active monitors.

Step 1: Prepare Docker containers

Code Block
titledocker commands
docker network create uitest
docker run -d --network uitest -p 4444:4444 --name hub selenium/hub
docker run -d --network uitest -e HUB_PORT_4444_TCP_ADDR=hub -e HUB_PORT_4444_TCP_PORT=4444 -p 5901:5900 --name client1 selenium/node-chrome-debug
docker run -d --network uitest -e HUB_PORT_4444_TCP_ADDR=hub -e HUB_PORT_4444_TCP_PORT=4444 -p 5902:5900 --name client2 selenium/node-chrome-debug

 + Create two docker virtual UI clients (client1, client2) which connect to one docker selenium hub (in the same shared network called "uitest". The reason for two virtual clients is that with only one client, there would be higher chances of unclear slow down and un-responsive. With two clients, selenium hub will automatically switch back/forth and tests run smoother.

Step 2: Apply patch to by-pass docker environment setup in ce

View file
namepatch.diff
height250

Step 3: Manually start Magnolia webapps as described in above No Docker Setup

Step 4: Run ui-tests with additional VM options

Code Block
titleAdditional VM options
-ea -Dsetup.test.env=false -Dselenium.hub.name=localhost -Dselenium.hub.host=localhost -DcontainerHttpPort=8080 -DprivateContainerHttpPort=8080 -DprivateHostName=<one-of-host-real-ip>

 *** <one-of-host-real-ip>: can be either IP of wireless or wired adapter, so if the host is configured with DHCP, that address must be updated every run. We can create a virtual network adapter and assign that adapter with some fixed IP to avoid edit that param many times.

Magnolia 5.4

Location

Our ui tests are placed in the ce-bundle/magnolia-integration-tests/tests because all the required setup (install and start an author and public instance) is already there.

...