This page probably is 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.
UI tests typically require browser/machine focus (especially when entering text in input fields). To avoid being stuck while UI tests proceed, it's handy to run them — the Selenium part — inside a VM.
mvn clean verify -P jetty9-standalone,manual-tests
mvn -o ...) if you just installed one of the modules you want to put under test
java -jar selenium-server-standalone-2.42.2.jar
java -jar -Dwebdriver.gecko.driver=/path/to/geckodriver selenium-server-standalone-3.3.1.jar
/etc/environment, e.g. through
echo "_JAVA_OPTIONS='-Dwebdriver.gecko.driver=/path/to/geckodriver" | sudo tee -a /etc/environment, then log out and back in for the changes to take effect
On your host run the UI Tests with the variables
seleniumServerHostName which is the address of your newly created VM and
containerHostName which is the address used of your VM to access your host system (this is probably not equal to your machines address in the magnolia network)
$ mvn -U clean install -Pjetty9-standalone,ui-tests -DseleniumServerHostName=192.168.56.101 -DcontainerHostName=192.168.56.1
If necessary replace the IP addresses.
In your run configuration in IntelliJ you have to add these two variables
containerHostName as well.
selenium-serveron the desktop as follows
#!/bin/bash gnome-terminal -e "java -jar selenium-server-standalone-2.42.2.jar"
chmod +x your-script
Double-click your script and you're good to go!
When tests seem to fail randomly in a non-reproducible manner on from Jenkins, it's sometimes related to slower hardware compared to local execution. To be more consistent and robust, it can be helpful to mimic such a low-end environment.
Some failures (like hidden dialog commit buttons) only occur on screens with low resolution. With VirtualBox guest extensions properly installed, you should be able to simply resize the VM window and the guest's virtual screen should automatically adjust. As a reference for size, screenshots from failed Jenkins build may be used; or just roughly 1000 x 700 px.
Other test failures are caused by racing conditions only surfacing on slow systems, where certain elements take longer to load than usual. For Linux (now OS X too), there's a command line tool called cpulimit to set an upper CPU time percentage limit for certain processes.
sudo apt-get install cpulimitor simply click here (apt-url)
Setting the limit to 5% for the process with id 1234 is done by
cpulimit -l 5 -i 1234