diff --git a/README.md b/README.md
index 4d35ea0..99d19fe 100644
--- a/README.md
+++ b/README.md
@@ -29,12 +29,16 @@
-----
+
+
## What is it?
This project consists of a Docker image containing a Robot Framework installation.
This installation also contains Firefox, Chrome, Microsoft Edge and the Selenium library for Robot Framework. The test cases and reports should be mounted as volumes.
+
+
## Versioning
The versioning of this image follows the one of Robot Framework:
@@ -64,6 +68,8 @@ The versions used are:
As stated by [the official GitHub project](https://github.com/robotframework/Selenium2Library), starting from version 3.0, Selenium2Library is renamed to SeleniumLibrary and this project exists mainly to help with transitioning. The Selenium2Library 3.0.0 is also the last release and for new releases, please look at the [SeleniumLibrary](https://github.com/robotframework/SeleniumLibrary) project.
+
+
## Running the container
This container can be run using the following command:
@@ -73,6 +79,8 @@ This container can be run using the following command:
-v :/opt/robotframework/tests:Z \
ppodgorsek/robot-framework:
+
+
### Switching browsers
Browsers can be easily switched. It is recommended to define `${BROWSER} %{BROWSER}` in your Robot variables and to use `${BROWSER}` in your test cases. This allows to set the browser in a single place if needed.
@@ -81,6 +89,8 @@ When running your tests, simply add `-e BROWSER=chrome`, `-e BROWSER=firefox` or
Please note: `edge` will work with Selenium but not the Browser Library, as the latter currently doesn't have an easy mechanism to install additional browsers. Playwright, on which the Browser library relies, cannot install additional browsers on Linux platforms other than Ubuntu/Debian and [suggests using Chromium to test Microsoft Edge scenarios](https://playwright.dev/docs/browsers), unless you require Edge-specific capabilities.
+
+
### Changing the container's screen resolution
It is possible to define the settings of the virtual screen in which the browser is run by changing several environment variables:
@@ -89,6 +99,8 @@ It is possible to define the settings of the virtual screen in which the browser
* `SCREEN_HEIGHT` (default: 1080)
* `SCREEN_WIDTH` (default: 1920)
+
+
### Changing the container's tests and reports directories
It is possible to use different directories to read tests from and to generate reports to. This is useful when using a complex test file structure. To change the defaults, set the following environment variables:
@@ -96,6 +108,8 @@ It is possible to use different directories to read tests from and to generate r
* `ROBOT_REPORTS_DIR` (default: /opt/robotframework/reports)
* `ROBOT_TESTS_DIR` (default: /opt/robotframework/tests)
+
+
### Parallelisation
It is possible to parallelise the execution of your test suites. Simply define the `ROBOT_THREADS` environment variable, for example:
@@ -106,6 +120,8 @@ It is possible to parallelise the execution of your test suites. Simply define t
By default, there is no parallelisation.
+
+
#### Parallelisation options
When using parallelisation, it is possible to pass additional [pabot options](https://github.com/mkorpela/pabot#command-line-options), such as `--testlevelsplit`, `--argumentfile`, `--ordering`, etc. These can be passed by using the `PABOT_OPTIONS` environment variable, for example:
@@ -115,6 +131,8 @@ When using parallelisation, it is possible to pass additional [pabot options](ht
-e PABOT_OPTIONS="--testlevelsplit" \
ppodgorsek/robot-framework:latest
+
+
### Passing additional options
RobotFramework supports many options such as `--exclude`, `--variable`, `--loglevel`, etc. These can be passed by using the `ROBOT_OPTIONS` environment variable, for example:
@@ -123,12 +141,16 @@ RobotFramework supports many options such as `--exclude`, `--variable`, `--logle
-e ROBOT_OPTIONS="--loglevel DEBUG" \
ppodgorsek/robot-framework:latest
+
+
### Testing emails
This project includes the IMAP library which allows Robot Framework to connect to email servers.
A suggestion to automate email testing is to run a [Mailcatcher instance in Docker which allows IMAP connections](https://github.com/estelora/docker-mailcatcher-imap). This will ensure emails are discarded once the tests have been run.
+
+
### Dealing with Datetimes and Timezones
This project is meant to allow your tests to run anywhere. Sometimes that can be in a different timezone than your local one or of the location under test. To help solve such issues, this image includes the [DateTimeTZ Library](https://testautomation.github.io/DateTimeTZ/doc/DateTimeTZ.html).
@@ -139,6 +161,8 @@ To set the timezone used inside the Docker image, you can set the `TZ` environme
-e TZ=America/New_York \
ppodgorsek/robot-framework:latest
+
+
### Installing additional dependencies
It is possible to install additional dependencies dynamically at runtime rather than having to extend this image.
@@ -161,6 +185,8 @@ rpa==1.50.0
**For large dependencies, it is still recommended to extend the project's image and to add them there, to avoid delaying the CI/CD pipelines with repeated dependency installations.**
+
+
## Security consideration
By default, containers are implicitly run using `--user=1000:1000`, please remember to adjust that command-line setting accordingly, for example:
@@ -178,6 +204,8 @@ Additionally, it is possible to rely on user namespaces to further secure the ex
This is a good security practice to make sure containers cannot perform unwanted changes on the host. In that sense, Podman is probably well ahead of Docker by not relying on a root daemon to run its containers.
+
+
## Continuous integration
It is possible to run the project from within a Jenkins pipeline by relying on the shell command line directly:
@@ -217,6 +245,8 @@ The pipeline stage can also rely on a Docker agent, as shown in the example belo
}
}
+
+
### Defining a test run ID
When relying on Continuous Integration tools, it can be useful to define a test run ID such as the build number or branch name to avoid overwriting consecutive execution reports.
@@ -233,6 +263,8 @@ It can simply be passed during the execution, such as:
By default, the test run ID is empty.
+
+
### Upload test reports to an AWS S3 bucket
To upload the report of a test run to an S3 bucket, you need to define the following environment variables:
@@ -244,6 +276,8 @@ To upload the report of a test run to an S3 bucket, you need to define the follo
-e AWS_BUCKET_NAME= \
ppodgorsek/robot-framework:latest
+
+
## Testing this project
Not convinced yet? Simple tests have been prepared in the `test/` folder, you can run them using the following commands:
@@ -280,8 +314,12 @@ For Windows users who use **PowerShell**, the commands are slightly different:
Screenshots of the results will be available in the `reports/` folder.
+
+
## Troubleshooting
+
+
### Chromium is crashing
Chrome drivers might crash due to the small size of `/dev/shm` in the docker container:
@@ -291,6 +329,8 @@ This is [a known bug of Chromium](https://bugs.chromium.org/p/chromium/issues/de
To avoid this error, please change the shm size when starting the container by adding the following parameter: `--shm-size=1g` (or any other size more suited to your tests)
+
+
### Accessing the logs
In case further investigation is required, the logs can be accessed by mounting their folder. Simply add the following parameter to your `run` command:
@@ -303,6 +343,8 @@ Chromium allows to set additional environment properties, which can be useful wh
* `webdriver.chrome.verboseLogging=true`: enables the verbose logging mode
* `webdriver.chrome.logfile=/path/to/chromedriver.log`: sets the path to Chromium's log file
+
+
### Error: Suite contains no tests
When running tests, an unexpected error sometimes occurs:
@@ -321,6 +363,8 @@ It is also important to check if Robot Framework is allowed to access the resour
* The folder where the tests are located,
* The test files themselves.
+
+
### Database tests are failing in spite of the DatabaseLibrary being present
As per their official project page, the [Robot Framework DatabaseLibrary](https://github.com/franz-see/Robotframework-Database-Library) contains utilities meant for Robot Framework's usage. This can allow you to query your database after an action has been made to verify the results. This is compatible with any Database API Specification 2.0 module.
@@ -331,6 +375,8 @@ It is anyway mandatory to extend the container image to install the specific dat
* [Oracle](https://www.oracle.com/uk/database/technologies/appdev/python.html): `pip install py2oracle`
* [PostgreSQL](http://pybrary.net/pg8000/index.html): `pip install pg8000`
+
+
### Supported devices and architectures
As mentioned on the [Docker Hub](https://hub.docker.com/r/ppodgorsek/robot-framework), the project has been built and uploaded as a `linux/amd64` image only. This means ARM devices such as MacBook M1/M2 and Amazon EC2 Graviton won't be able to run the image with the default configuration.
@@ -347,6 +393,8 @@ Please note: builds and automated tests of this project will remain performed on
If this does not solve your platform-related issues, you will have to rebuild the image for your device/platform, specifying that `--platform` option during the build and run.
+
+
## Please contribute!
Have you found an issue? Do you have an idea for an improvement? Feel free to contribute by submitting it [on the GitHub project](https://github.com/ppodgorsek/docker-robot-framework/issues).