Skip to content

Commit

Permalink
Merge branch 'master' into feature/support-webgl
Browse files Browse the repository at this point in the history
  • Loading branch information
ppodgorsek authored Sep 7, 2023
2 parents 3c540b4 + 55367fa commit f5846cb
Show file tree
Hide file tree
Showing 6 changed files with 221 additions and 234 deletions.
177 changes: 162 additions & 15 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ env:
IMAGE_NAME: docker-robot-framework:ci

jobs:
# Run tests.
# Build and run tests.
# See also https://docs.docker.com/docker-hub/builds/automated-testing/
build:
runs-on: ubuntu-latest
Expand All @@ -35,43 +35,190 @@ jobs:
uses: actions/checkout@v2
- name: Build image
run:
docker build . --tag $IMAGE_NAME --file Dockerfile
podman build . --tag $IMAGE_NAME --file Dockerfile
- name: Basic Test
run:
docker run --shm-size=1g -v `pwd`/test:/opt/robotframework/tests:Z -e BROWSER=$BROWSER $IMAGE_NAME
podman run --shm-size=1g -v `pwd`/test:/opt/robotframework/tests:Z -e BROWSER=$BROWSER $IMAGE_NAME
- name: Colour Depth 16 Test
run:
docker run --shm-size=1g -v `pwd`/test:/opt/robotframework/tests:Z -e BROWSER=$BROWSER -e SCREEN_COLOUR_DEPTH=16 $IMAGE_NAME
podman run --shm-size=1g -v `pwd`/test:/opt/robotframework/tests:Z -e BROWSER=$BROWSER -e SCREEN_COLOUR_DEPTH=16 $IMAGE_NAME
- name: Screen Width 800x600 Test
run:
docker run --shm-size=1g -v `pwd`/test:/opt/robotframework/tests:Z -e BROWSER=$BROWSER -e SCREEN_WIDTH=800 -e SCREEN_HEIGHT=600 $IMAGE_NAME
podman run --shm-size=1g -v `pwd`/test:/opt/robotframework/tests:Z -e BROWSER=$BROWSER -e SCREEN_WIDTH=800 -e SCREEN_HEIGHT=600 $IMAGE_NAME
- name: Screen Width 1024x768 Test
run:
docker run --shm-size=1g -v `pwd`/test:/opt/robotframework/tests:Z -e BROWSER=$BROWSER -e SCREEN_WIDTH=1024 -e SCREEN_HEIGHT=768 $IMAGE_NAME
podman run --shm-size=1g -v `pwd`/test:/opt/robotframework/tests:Z -e BROWSER=$BROWSER -e SCREEN_WIDTH=1024 -e SCREEN_HEIGHT=768 $IMAGE_NAME
- name: Screen Width 1280x1024 Test
run:
docker run --shm-size=1g -v `pwd`/test:/opt/robotframework/tests:Z -e BROWSER=$BROWSER -e SCREEN_WIDTH=1280 -e SCREEN_HEIGHT=1024 $IMAGE_NAME
podman run --shm-size=1g -v `pwd`/test:/opt/robotframework/tests:Z -e BROWSER=$BROWSER -e SCREEN_WIDTH=1280 -e SCREEN_HEIGHT=1024 $IMAGE_NAME
- name: Screen Width 2560x1440 Test
run:
docker run --shm-size=1g -v `pwd`/test:/opt/robotframework/tests:Z -e BROWSER=$BROWSER -e SCREEN_WIDTH=2560 -e SCREEN_HEIGHT=1440 $IMAGE_NAME
podman run --shm-size=1g -v `pwd`/test:/opt/robotframework/tests:Z -e BROWSER=$BROWSER -e SCREEN_WIDTH=2560 -e SCREEN_HEIGHT=1440 $IMAGE_NAME
- name: Screen Width 3840x2160 Test
run:
docker run --shm-size=1g -v `pwd`/test:/opt/robotframework/tests:Z -e BROWSER=$BROWSER -e SCREEN_WIDTH=3840 -e SCREEN_HEIGHT=2160 $IMAGE_NAME
podman run --shm-size=1g -v `pwd`/test:/opt/robotframework/tests:Z -e BROWSER=$BROWSER -e SCREEN_WIDTH=3840 -e SCREEN_HEIGHT=2160 $IMAGE_NAME
- name: Debug Log Level Test
run:
docker run --shm-size=1g -v `pwd`/test:/opt/robotframework/tests:Z -e BROWSER=$BROWSER -e ROBOT_OPTIONS="--loglevel DEBUG" $IMAGE_NAME
podman run --shm-size=1g -v `pwd`/test:/opt/robotframework/tests:Z -e BROWSER=$BROWSER -e ROBOT_OPTIONS="--loglevel DEBUG" $IMAGE_NAME
- name: Basic Multithreaded Test
run:
docker run --shm-size=1g -v `pwd`/test:/opt/robotframework/tests:Z -e BROWSER=$BROWSER -e ROBOT_THREADS=4 $IMAGE_NAME
podman run --shm-size=1g -v `pwd`/test:/opt/robotframework/tests:Z -e BROWSER=$BROWSER -e ROBOT_THREADS=4 $IMAGE_NAME
- name: Test Level Multithreaded Test
run:
docker run --shm-size=1g -v `pwd`/test:/opt/robotframework/tests:Z -e BROWSER=$BROWSER -e ROBOT_THREADS=4 -e PABOT_OPTIONS="--testlevelsplit" $IMAGE_NAME
podman run --shm-size=1g -v `pwd`/test:/opt/robotframework/tests:Z -e BROWSER=$BROWSER -e ROBOT_THREADS=4 -e PABOT_OPTIONS="--testlevelsplit" $IMAGE_NAME
- name: Custom User Test
run:
docker run --user=2000 --shm-size=1g -v `pwd`/test:/opt/robotframework/tests:Z -e BROWSER=$BROWSER $IMAGE_NAME
podman run --user=2000 --shm-size=1g -v `pwd`/test:/opt/robotframework/tests:Z -e BROWSER=$BROWSER $IMAGE_NAME
- name: Custom User and Group Test
run:
docker run --user=2000:2000 --shm-size=1g -v `pwd`/test:/opt/robotframework/tests:Z -e BROWSER=$BROWSER $IMAGE_NAME
podman run --user=2000:2000 --shm-size=1g -v `pwd`/test:/opt/robotframework/tests:Z -e BROWSER=$BROWSER $IMAGE_NAME
- name: Datetime
run:
docker run --user=2000:2000 --shm-size=1g -v `pwd`/test:/opt/robotframework/tests:Z -e BROWSER=$BROWSER -e TZ="America/New_York" $IMAGE_NAME
podman run --user=2000:2000 --shm-size=1g -v `pwd`/test:/opt/robotframework/tests:Z -e BROWSER=$BROWSER -e TZ="America/New_York" $IMAGE_NAME

# Build and run tests for Microsoft Edge.
# This must be processed separately from Firefox and Chrome, due to the Browser library not handling Microsoft Edge by default
# and having no easy way to install new browsers unfortunately.
build-microsoft-edge:
runs-on: ubuntu-latest
env:
BROWSER: "edge"
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build image
run:
podman build . --tag $IMAGE_NAME --file Dockerfile
- name: Basic Test
run: |
podman run --shm-size=1g \
-v `pwd`/test/faker.robot:/opt/robotframework/tests/faker.robot:Z \
-v `pwd`/test/requests.robot:/opt/robotframework/tests/requests.robot:Z \
-v `pwd`/test/selenium.robot:/opt/robotframework/tests/selenium.robot:Z \
-v `pwd`/test/timezones.robot:/opt/robotframework/tests/timezones.robot:Z \
-e BROWSER=$BROWSER \
$IMAGE_NAME
- name: Colour Depth 16 Test
run: |
podman run --shm-size=1g \
-v `pwd`/test/faker.robot:/opt/robotframework/tests/faker.robot:Z \
-v `pwd`/test/requests.robot:/opt/robotframework/tests/requests.robot:Z \
-v `pwd`/test/selenium.robot:/opt/robotframework/tests/selenium.robot:Z \
-v `pwd`/test/timezones.robot:/opt/robotframework/tests/timezones.robot:Z \
-e BROWSER=$BROWSER \
-e SCREEN_COLOUR_DEPTH=16 \
$IMAGE_NAME
- name: Screen Width 800x600 Test
run: |
podman run --shm-size=1g \
-v `pwd`/test/faker.robot:/opt/robotframework/tests/faker.robot:Z \
-v `pwd`/test/requests.robot:/opt/robotframework/tests/requests.robot:Z \
-v `pwd`/test/selenium.robot:/opt/robotframework/tests/selenium.robot:Z \
-v `pwd`/test/timezones.robot:/opt/robotframework/tests/timezones.robot:Z \
-e BROWSER=$BROWSER \
-e SCREEN_WIDTH=800 \
-e SCREEN_HEIGHT=600 \
$IMAGE_NAME
- name: Screen Width 1024x768 Test
run: |
podman run --shm-size=1g \
-v `pwd`/test/faker.robot:/opt/robotframework/tests/faker.robot:Z \
-v `pwd`/test/requests.robot:/opt/robotframework/tests/requests.robot:Z \
-v `pwd`/test/selenium.robot:/opt/robotframework/tests/selenium.robot:Z \
-v `pwd`/test/timezones.robot:/opt/robotframework/tests/timezones.robot:Z \
-e BROWSER=$BROWSER \
-e SCREEN_WIDTH=1024 \
-e SCREEN_HEIGHT=768 \
$IMAGE_NAME
- name: Screen Width 1280x1024 Test
run: |
podman run --shm-size=1g \
-v `pwd`/test/faker.robot:/opt/robotframework/tests/faker.robot:Z \
-v `pwd`/test/requests.robot:/opt/robotframework/tests/requests.robot:Z \
-v `pwd`/test/selenium.robot:/opt/robotframework/tests/selenium.robot:Z \
-v `pwd`/test/timezones.robot:/opt/robotframework/tests/timezones.robot:Z \
-e BROWSER=$BROWSER \
-e SCREEN_WIDTH=1280 \
-e SCREEN_HEIGHT=1024 \
$IMAGE_NAME
- name: Screen Width 2560x1440 Test
run: |
podman run --shm-size=1g \
-v `pwd`/test/faker.robot:/opt/robotframework/tests/faker.robot:Z \
-v `pwd`/test/requests.robot:/opt/robotframework/tests/requests.robot:Z \
-v `pwd`/test/selenium.robot:/opt/robotframework/tests/selenium.robot:Z \
-v `pwd`/test/timezones.robot:/opt/robotframework/tests/timezones.robot:Z \
-e BROWSER=$BROWSER \
-e SCREEN_WIDTH=2560 \
-e SCREEN_HEIGHT=1440 \
$IMAGE_NAME
- name: Screen Width 3840x2160 Test
run: |
podman run --shm-size=1g \
-v `pwd`/test/faker.robot:/opt/robotframework/tests/faker.robot:Z \
-v `pwd`/test/requests.robot:/opt/robotframework/tests/requests.robot:Z \
-v `pwd`/test/selenium.robot:/opt/robotframework/tests/selenium.robot:Z \
-v `pwd`/test/timezones.robot:/opt/robotframework/tests/timezones.robot:Z \
-e BROWSER=$BROWSER \
-e SCREEN_WIDTH=3840 \
-e SCREEN_HEIGHT=2160 \
$IMAGE_NAME
- name: Debug Log Level Test
run: |
podman run --shm-size=1g \
-v `pwd`/test/faker.robot:/opt/robotframework/tests/faker.robot:Z \
-v `pwd`/test/requests.robot:/opt/robotframework/tests/requests.robot:Z \
-v `pwd`/test/selenium.robot:/opt/robotframework/tests/selenium.robot:Z \
-v `pwd`/test/timezones.robot:/opt/robotframework/tests/timezones.robot:Z \
-e BROWSER=$BROWSER \
-e ROBOT_OPTIONS="--loglevel DEBUG" \
$IMAGE_NAME
- name: Basic Multithreaded Test
run: |
podman run --shm-size=1g \
-v `pwd`/test/faker.robot:/opt/robotframework/tests/faker.robot:Z \
-v `pwd`/test/requests.robot:/opt/robotframework/tests/requests.robot:Z \
-v `pwd`/test/selenium.robot:/opt/robotframework/tests/selenium.robot:Z \
-v `pwd`/test/timezones.robot:/opt/robotframework/tests/timezones.robot:Z \
-e BROWSER=$BROWSER \
-e ROBOT_THREADS=4 \
$IMAGE_NAME
- name: Test Level Multithreaded Test
run: |
podman run --shm-size=1g \
-v `pwd`/test/faker.robot:/opt/robotframework/tests/faker.robot:Z \
-v `pwd`/test/requests.robot:/opt/robotframework/tests/requests.robot:Z \
-v `pwd`/test/selenium.robot:/opt/robotframework/tests/selenium.robot:Z \
-v `pwd`/test/timezones.robot:/opt/robotframework/tests/timezones.robot:Z \
-e BROWSER=$BROWSER \
-e ROBOT_THREADS=4 \
-e PABOT_OPTIONS="--testlevelsplit" \
$IMAGE_NAME
- name: Custom User Test
run: |
podman run --user=2000 --shm-size=1g \
-v `pwd`/test/faker.robot:/opt/robotframework/tests/faker.robot:Z \
-v `pwd`/test/requests.robot:/opt/robotframework/tests/requests.robot:Z \
-v `pwd`/test/selenium.robot:/opt/robotframework/tests/selenium.robot:Z \
-v `pwd`/test/timezones.robot:/opt/robotframework/tests/timezones.robot:Z \
-e BROWSER=$BROWSER \
$IMAGE_NAME
- name: Custom User and Group Test
run: |
podman run --user=2000:2000 --shm-size=1g \
-v `pwd`/test/faker.robot:/opt/robotframework/tests/faker.robot:Z \
-v `pwd`/test/requests.robot:/opt/robotframework/tests/requests.robot:Z \
-v `pwd`/test/selenium.robot:/opt/robotframework/tests/selenium.robot:Z \
-v `pwd`/test/timezones.robot:/opt/robotframework/tests/timezones.robot:Z \
-e BROWSER=$BROWSER \
$IMAGE_NAME
- name: Datetime
run: |
podman run --user=2000:2000 --shm-size=1g \
-v `pwd`/test/faker.robot:/opt/robotframework/tests/faker.robot:Z \
-v `pwd`/test/requests.robot:/opt/robotframework/tests/requests.robot:Z \
-v `pwd`/test/selenium.robot:/opt/robotframework/tests/selenium.robot:Z \
-v `pwd`/test/timezones.robot:/opt/robotframework/tests/timezones.robot:Z \
-e BROWSER=$BROWSER \
-e TZ="America/New_York" \
$IMAGE_NAME
60 changes: 42 additions & 18 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM fedora:36
FROM fedora:38

MAINTAINER Paul Podgorsek <[email protected]>
LABEL description Robot Framework in Docker.
Expand Down Expand Up @@ -29,23 +29,23 @@ ENV ROBOT_UID 1000
ENV ROBOT_GID 1000

# Dependency versions
ENV ALPINE_GLIBC 2.35-r0
ENV AWS_CLI_VERSION 1.22.87
ENV AWS_CLI_VERSION 1.29.40
ENV AXE_SELENIUM_LIBRARY_VERSION 2.1.6
ENV BROWSER_LIBRARY_VERSION 12.2.0
ENV CHROMIUM_VERSION 99.0
ENV BROWSER_LIBRARY_VERSION 16.2.0
ENV CHROMIUM_VERSION 116.0
ENV DATABASE_LIBRARY_VERSION 1.2.4
ENV DATADRIVER_VERSION 1.6.0
ENV DATADRIVER_VERSION 1.8.1
ENV DATETIMETZ_VERSION 1.0.6
ENV MICROSOFT_EDGE_VERSION 116.0.1938.69
ENV FAKER_VERSION 5.0.0
ENV FIREFOX_VERSION 98.0
ENV FIREFOX_VERSION 117.0
ENV FTP_LIBRARY_VERSION 1.9
ENV GECKO_DRIVER_VERSION v0.30.0
ENV IMAP_LIBRARY_VERSION 0.4.2
ENV PABOT_VERSION 2.5.2
ENV REQUESTS_VERSION 0.9.2
ENV ROBOT_FRAMEWORK_VERSION 5.0
ENV SELENIUM_LIBRARY_VERSION 6.0.0
ENV GECKO_DRIVER_VERSION v0.33.0
ENV IMAP_LIBRARY_VERSION 0.4.6
ENV PABOT_VERSION 2.16.0
ENV REQUESTS_VERSION 0.9.5
ENV ROBOT_FRAMEWORK_VERSION 6.1
ENV SELENIUM_LIBRARY_VERSION 6.1.0
ENV SSH_LIBRARY_VERSION 3.8.0
ENV XVFB_VERSION 1.20

Expand All @@ -63,11 +63,15 @@ RUN dnf upgrade -y --refresh \
chromedriver-${CHROMIUM_VERSION}* \
chromium-${CHROMIUM_VERSION}* \
firefox-${FIREFOX_VERSION}* \
gcc \
gcc-c++ \
npm \
nodejs \
python3-pip \
python3-pyyaml \
tzdata \
xorg-x11-server-Xvfb-${XVFB_VERSION}* \
dnf-plugins-core \
&& dnf clean all

# FIXME: below is a workaround, as the path is ignored
Expand All @@ -91,9 +95,11 @@ RUN pip3 install \
robotframework-seleniumlibrary==$SELENIUM_LIBRARY_VERSION \
robotframework-sshlibrary==$SSH_LIBRARY_VERSION \
axe-selenium-python==$AXE_SELENIUM_LIBRARY_VERSION \
PyYAML \
# Install awscli to be able to upload test reports to AWS S3
awscli==$AWS_CLI_VERSION
awscli==$AWS_CLI_VERSION \
# Install an older Selenium version to avoid issues when running tests
# https://github.com/robotframework/SeleniumLibrary/issues/1835
selenium==4.9.0

# Gecko drivers
RUN dnf install -y \
Expand All @@ -110,10 +116,28 @@ RUN dnf install -y \
wget \
&& dnf clean all

# Install the Node dependencies for the Browser library
# Install Microsoft Edge & webdriver
RUN rpm --import https://packages.microsoft.com/keys/microsoft.asc \
&& dnf config-manager --add-repo https://packages.microsoft.com/yumrepos/edge \
&& dnf install -y \
microsoft-edge-stable-${MICROSOFT_EDGE_VERSION} \
wget \
zip \

&& wget -q "https://msedgedriver.azureedge.net/${MICROSOFT_EDGE_VERSION}/edgedriver_linux64.zip" \
&& unzip edgedriver_linux64.zip -d edge \
&& mv edge/msedgedriver /opt/robotframework/drivers/msedgedriver \
&& rm -Rf edgedriver_linux64.zip edge/ \

# IMPORTANT: don't remove the wget package because it's a dependency of Microsoft Edge
&& dnf remove -y \
zip \
&& dnf clean all

ENV PATH=/opt/microsoft/msedge:$PATH

# FIXME: Playright currently doesn't support relying on system browsers, which is why the `--skip-browsers` parameter cannot be used here.
RUN rfbrowser init \
&& ln -sf /usr/lib64/libstdc++.so.6 /usr/local/lib/python3.10/site-packages/Browser/wrapper/node_modules/playwright-core/.local-browsers/firefox-1316/firefox/libstdc++.so.6
RUN rfbrowser init

# Create the default report and work folders with the default user to avoid runtime issues
# These folders are writeable by anyone, to ensure the user can be changed on the command line.
Expand Down
29 changes: 16 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Robot Framework in Docker, with Firefox and Chrome
# Robot Framework in Docker, with Firefox, Chrome and Microsoft Edge

## What is it?

This project consists of a Docker image containing a Robot Framework installation.

This installation also contains Firefox, Chrome and the Selenium library for Robot Framework. The test cases and reports should be mounted as volumes.
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

Expand All @@ -15,22 +15,23 @@ The versioning of this image follows the one of Robot Framework:

The versions used are:

* [Robot Framework](https://github.com/robotframework/robotframework) 5.0
* [Robot Framework Browser Library](https://github.com/MarketSquare/robotframework-browser) 12.2.0
* [Robot Framework](https://github.com/robotframework/robotframework) 6.1
* [Robot Framework Browser Library](https://github.com/MarketSquare/robotframework-browser) 16.2.0
* [Robot Framework DatabaseLibrary](https://github.com/franz-see/Robotframework-Database-Library) 1.2.4
* [Robot Framework Datadriver](https://github.com/Snooz82/robotframework-datadriver) 1.6.0
* [Robot Framework Datadriver](https://github.com/Snooz82/robotframework-datadriver) 1.8.1
* [Robot Framework DateTimeTZ](https://github.com/testautomation/DateTimeTZ) 1.0.6
* [Robot Framework Faker](https://github.com/guykisel/robotframework-faker) 5.0.0
* [Robot Framework FTPLibrary](https://github.com/kowalpy/Robot-Framework-FTP-Library) 1.9
* [Robot Framework IMAPLibrary 2](https://pypi.org/project/robotframework-imaplibrary2/) 0.4.2
* [Robot Framework Pabot](https://github.com/mkorpela/pabot) 2.5.2
* [Robot Framework Requests](https://github.com/bulkan/robotframework-requests) 0.9.2
* [Robot Framework SeleniumLibrary](https://github.com/robotframework/SeleniumLibrary) 6.0.0
* [Robot Framework IMAPLibrary 2](https://pypi.org/project/robotframework-imaplibrary2/) 0.4.6
* [Robot Framework Pabot](https://github.com/mkorpela/pabot) 2.16.0
* [Robot Framework Requests](https://github.com/bulkan/robotframework-requests) 0.9.5
* [Robot Framework SeleniumLibrary](https://github.com/robotframework/SeleniumLibrary) 6.1.0
* [Robot Framework SSHLibrary](https://github.com/robotframework/SSHLibrary) 3.8.0
* [Axe Selenium Library](https://github.com/mozilla-services/axe-selenium-python) 2.1.6
* Firefox 91.7
* Chromium 99.0
* [Amazon AWS CLI](https://pypi.org/project/awscli/) 1.22.87
* Firefox 117.0
* Chromium 116.0
* Microsoft Edge 116.0.1938.69
* [Amazon AWS CLI](https://pypi.org/project/awscli/) 1.29.40

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.

Expand All @@ -47,7 +48,9 @@ This container can be run using the following command:

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.

When running your tests, simply add `-e BROWSER=chrome` or `-e BROWSER=firefox` to the run command.
When running your tests, simply add `-e BROWSER=chrome`, `-e BROWSER=firefox` or `-e BROWSER=edge`to the run command.

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

Expand Down
Loading

0 comments on commit f5846cb

Please sign in to comment.