Skip to content

Commit

Permalink
Merge pull request ppodgorsek#400 from ppodgorsek/issue-386
Browse files Browse the repository at this point in the history
Issue ppodgorsek#386 - Upgrade the Robot Framework Browser library to version 12.2.0
  • Loading branch information
ppodgorsek authored Apr 3, 2022
2 parents df8224a + 20ddac9 commit 81ab9a1
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 78 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
*~

.git/
.github/
test/

.gitignore
Expand Down
125 changes: 53 additions & 72 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.9.12-alpine3.15
FROM fedora:36

MAINTAINER Paul Podgorsek <[email protected]>
LABEL description Robot Framework in Docker.
Expand Down Expand Up @@ -38,7 +38,7 @@ ENV DATABASE_LIBRARY_VERSION 1.2.4
ENV DATADRIVER_VERSION 1.6.0
ENV DATETIMETZ_VERSION 1.0.6
ENV FAKER_VERSION 5.0.0
ENV FIREFOX_VERSION 91.7
ENV FIREFOX_VERSION 98.0
ENV FTP_LIBRARY_VERSION 1.9
ENV GECKO_DRIVER_VERSION v0.30.0
ENV IMAP_LIBRARY_VERSION 0.4.2
Expand All @@ -58,81 +58,62 @@ COPY bin/chromium-browser.sh /opt/robotframework/bin/chromium-browser
COPY bin/run-tests-in-virtual-screen.sh /opt/robotframework/bin/

# Install system dependencies
RUN apk update \
&& apk --no-cache upgrade \
&& apk --no-cache --virtual .build-deps add \

# Install dependencies for cryptography due to https://github.com/pyca/cryptography/issues/5771
cargo \
rust \

# Continue with system dependencies
gcc \
g++ \
libffi-dev \
linux-headers \
make \
musl-dev \
openssl-dev \
which \
wget \
&& apk --no-cache add \
"chromium~$CHROMIUM_VERSION" \
"chromium-chromedriver~$CHROMIUM_VERSION" \
"firefox-esr~$FIREFOX_VERSION" \
RUN dnf upgrade -y --refresh \
&& dnf install -y \
chromedriver-${CHROMIUM_VERSION}* \
chromium-${CHROMIUM_VERSION}* \
firefox-${FIREFOX_VERSION}* \
npm \
nodejs \
xauth \
python3-pip \
tzdata \
"xvfb-run~$XVFB_VERSION" \
&& mv /usr/lib/chromium/chrome /usr/lib/chromium/chrome-original \
&& ln -sfv /opt/robotframework/bin/chromium-browser /usr/lib/chromium/chrome \
# FIXME: above is a workaround, as the path is ignored

# Install Robot Framework and Selenium Library
&& pip3 install \
--no-cache-dir \
robotframework==$ROBOT_FRAMEWORK_VERSION \
robotframework-browser==$BROWSER_LIBRARY_VERSION \
robotframework-databaselibrary==$DATABASE_LIBRARY_VERSION \
robotframework-datadriver==$DATADRIVER_VERSION \
robotframework-datadriver[XLS] \
robotframework-datetime-tz==$DATETIMETZ_VERSION \
robotframework-faker==$FAKER_VERSION \
robotframework-ftplibrary==$FTP_LIBRARY_VERSION \
robotframework-imaplibrary2==$IMAP_LIBRARY_VERSION \
robotframework-pabot==$PABOT_VERSION \
robotframework-requests==$REQUESTS_VERSION \
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 \

# Install the node dependencies for the Browser library
&& rfbrowser init \

# Download the glibc package for Alpine Linux from its GitHub repository
&& wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub \
&& wget -q "https://github.com/sgerrand/alpine-pkg-glibc/releases/download/$ALPINE_GLIBC/glibc-$ALPINE_GLIBC.apk" \
&& wget -q "https://github.com/sgerrand/alpine-pkg-glibc/releases/download/$ALPINE_GLIBC/glibc-bin-$ALPINE_GLIBC.apk" \
&& apk add glibc-$ALPINE_GLIBC.apk \
&& apk add glibc-bin-$ALPINE_GLIBC.apk \
&& rm glibc-$ALPINE_GLIBC.apk \
&& rm glibc-bin-$ALPINE_GLIBC.apk \
&& rm /etc/apk/keys/sgerrand.rsa.pub \

# Download Gecko drivers directly from the GitHub repository
xorg-x11-server-Xvfb-${XVFB_VERSION}* \
&& dnf clean all

# FIXME: below is a workaround, as the path is ignored
RUN mv /usr/lib64/chromium-browser/chromium-browser /usr/lib64/chromium-browser/chromium-browser-original \
&& ln -sfv /opt/robotframework/bin/chromium-browser /usr/lib64/chromium-browser/chromium-browser

# Install Robot Framework and associated libraries
RUN pip3 install \
--no-cache-dir \
robotframework==$ROBOT_FRAMEWORK_VERSION \
robotframework-browser==$BROWSER_LIBRARY_VERSION \
robotframework-databaselibrary==$DATABASE_LIBRARY_VERSION \
robotframework-datadriver==$DATADRIVER_VERSION \
robotframework-datadriver[XLS] \
robotframework-datetime-tz==$DATETIMETZ_VERSION \
robotframework-faker==$FAKER_VERSION \
robotframework-ftplibrary==$FTP_LIBRARY_VERSION \
robotframework-imaplibrary2==$IMAP_LIBRARY_VERSION \
robotframework-pabot==$PABOT_VERSION \
robotframework-requests==$REQUESTS_VERSION \
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

# Gecko drivers
RUN dnf install -y \
wget \

# Download Gecko drivers directly from the GitHub repository
&& wget -q "https://github.com/mozilla/geckodriver/releases/download/$GECKO_DRIVER_VERSION/geckodriver-$GECKO_DRIVER_VERSION-linux64.tar.gz" \
&& tar xzf geckodriver-$GECKO_DRIVER_VERSION-linux64.tar.gz \
&& mkdir -p /opt/robotframework/drivers/ \
&& mv geckodriver /opt/robotframework/drivers/geckodriver \
&& rm geckodriver-$GECKO_DRIVER_VERSION-linux64.tar.gz \
&& tar xzf geckodriver-$GECKO_DRIVER_VERSION-linux64.tar.gz \
&& mkdir -p /opt/robotframework/drivers/ \
&& mv geckodriver /opt/robotframework/drivers/geckodriver \
&& rm geckodriver-$GECKO_DRIVER_VERSION-linux64.tar.gz \

&& dnf remove -y \
wget \
&& dnf clean all

# Clean up buildtime dependencies
&& apk del --no-cache --update-cache .build-deps
# Install the Node dependencies for the Browser library
# 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

# 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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Robot Framework in Docker Alpine, with Firefox and Chrome
# Robot Framework in Docker, with Firefox and Chrome

## What is it?

Expand Down
2 changes: 1 addition & 1 deletion bin/chromium-browser.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh

exec /usr/lib/chromium/chrome-original --disable-gpu --no-sandbox "$@"
exec /usr/lib64/chromium-browser/chromium-browser-original --disable-gpu --no-sandbox "$@"
20 changes: 16 additions & 4 deletions test/browser-library.robot
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,32 @@ Library Browser
*** Variables ***
# There is a conflict between browser names used by Selenium (using "chrome") and Browser (using "chromium")
# This is why the browser is currently fixed for the Browser Library.
${BROWSER} firefox
${BROWSER} %{BROWSER}

*** Test Cases ***
Visit Bing
New Browser ${BROWSER}
IF "${BROWSER}" == 'chrome'
New Browser chromium
ELSE
New Browser ${BROWSER}
END
New Page https://www.bing.com
Take Screenshot

Visit Google
New Browser ${BROWSER}
IF "${BROWSER}" == 'chrome'
New Browser chromium
ELSE
New Browser ${BROWSER}
END
New Page https://www.google.com
Take Screenshot

Visit Yahoo
New Browser ${BROWSER}
IF "${BROWSER}" == 'chrome'
New Browser chromium
ELSE
New Browser ${BROWSER}
END
New Page https://search.yahoo.com
Take Screenshot

0 comments on commit 81ab9a1

Please sign in to comment.