Skip to content

Commit 81ab9a1

Browse files
authored
Merge pull request #400 from ppodgorsek/issue-386
Issue #386 - Upgrade the Robot Framework Browser library to version 12.2.0
2 parents df8224a + 20ddac9 commit 81ab9a1

File tree

5 files changed

+72
-78
lines changed

5 files changed

+72
-78
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
*~
22

33
.git/
4+
.github/
45
test/
56

67
.gitignore

Dockerfile

Lines changed: 53 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.9.12-alpine3.15
1+
FROM fedora:36
22

33
MAINTAINER Paul Podgorsek <[email protected]>
44
LABEL description Robot Framework in Docker.
@@ -38,7 +38,7 @@ ENV DATABASE_LIBRARY_VERSION 1.2.4
3838
ENV DATADRIVER_VERSION 1.6.0
3939
ENV DATETIMETZ_VERSION 1.0.6
4040
ENV FAKER_VERSION 5.0.0
41-
ENV FIREFOX_VERSION 91.7
41+
ENV FIREFOX_VERSION 98.0
4242
ENV FTP_LIBRARY_VERSION 1.9
4343
ENV GECKO_DRIVER_VERSION v0.30.0
4444
ENV IMAP_LIBRARY_VERSION 0.4.2
@@ -58,81 +58,62 @@ COPY bin/chromium-browser.sh /opt/robotframework/bin/chromium-browser
5858
COPY bin/run-tests-in-virtual-screen.sh /opt/robotframework/bin/
5959

6060
# Install system dependencies
61-
RUN apk update \
62-
&& apk --no-cache upgrade \
63-
&& apk --no-cache --virtual .build-deps add \
64-
65-
# Install dependencies for cryptography due to https://github.com/pyca/cryptography/issues/5771
66-
cargo \
67-
rust \
68-
69-
# Continue with system dependencies
70-
gcc \
71-
g++ \
72-
libffi-dev \
73-
linux-headers \
74-
make \
75-
musl-dev \
76-
openssl-dev \
77-
which \
78-
wget \
79-
&& apk --no-cache add \
80-
"chromium~$CHROMIUM_VERSION" \
81-
"chromium-chromedriver~$CHROMIUM_VERSION" \
82-
"firefox-esr~$FIREFOX_VERSION" \
61+
RUN dnf upgrade -y --refresh \
62+
&& dnf install -y \
63+
chromedriver-${CHROMIUM_VERSION}* \
64+
chromium-${CHROMIUM_VERSION}* \
65+
firefox-${FIREFOX_VERSION}* \
8366
npm \
8467
nodejs \
85-
xauth \
68+
python3-pip \
8669
tzdata \
87-
"xvfb-run~$XVFB_VERSION" \
88-
&& mv /usr/lib/chromium/chrome /usr/lib/chromium/chrome-original \
89-
&& ln -sfv /opt/robotframework/bin/chromium-browser /usr/lib/chromium/chrome \
90-
# FIXME: above is a workaround, as the path is ignored
91-
92-
# Install Robot Framework and Selenium Library
93-
&& pip3 install \
94-
--no-cache-dir \
95-
robotframework==$ROBOT_FRAMEWORK_VERSION \
96-
robotframework-browser==$BROWSER_LIBRARY_VERSION \
97-
robotframework-databaselibrary==$DATABASE_LIBRARY_VERSION \
98-
robotframework-datadriver==$DATADRIVER_VERSION \
99-
robotframework-datadriver[XLS] \
100-
robotframework-datetime-tz==$DATETIMETZ_VERSION \
101-
robotframework-faker==$FAKER_VERSION \
102-
robotframework-ftplibrary==$FTP_LIBRARY_VERSION \
103-
robotframework-imaplibrary2==$IMAP_LIBRARY_VERSION \
104-
robotframework-pabot==$PABOT_VERSION \
105-
robotframework-requests==$REQUESTS_VERSION \
106-
robotframework-seleniumlibrary==$SELENIUM_LIBRARY_VERSION \
107-
robotframework-sshlibrary==$SSH_LIBRARY_VERSION \
108-
axe-selenium-python==$AXE_SELENIUM_LIBRARY_VERSION \
109-
PyYAML \
110-
111-
# Install awscli to be able to upload test reports to AWS S3
112-
awscli==$AWS_CLI_VERSION \
113-
114-
# Install the node dependencies for the Browser library
115-
&& rfbrowser init \
116-
117-
# Download the glibc package for Alpine Linux from its GitHub repository
118-
&& wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub \
119-
&& wget -q "https://github.com/sgerrand/alpine-pkg-glibc/releases/download/$ALPINE_GLIBC/glibc-$ALPINE_GLIBC.apk" \
120-
&& wget -q "https://github.com/sgerrand/alpine-pkg-glibc/releases/download/$ALPINE_GLIBC/glibc-bin-$ALPINE_GLIBC.apk" \
121-
&& apk add glibc-$ALPINE_GLIBC.apk \
122-
&& apk add glibc-bin-$ALPINE_GLIBC.apk \
123-
&& rm glibc-$ALPINE_GLIBC.apk \
124-
&& rm glibc-bin-$ALPINE_GLIBC.apk \
125-
&& rm /etc/apk/keys/sgerrand.rsa.pub \
126-
127-
# Download Gecko drivers directly from the GitHub repository
70+
xorg-x11-server-Xvfb-${XVFB_VERSION}* \
71+
&& dnf clean all
72+
73+
# FIXME: below is a workaround, as the path is ignored
74+
RUN mv /usr/lib64/chromium-browser/chromium-browser /usr/lib64/chromium-browser/chromium-browser-original \
75+
&& ln -sfv /opt/robotframework/bin/chromium-browser /usr/lib64/chromium-browser/chromium-browser
76+
77+
# Install Robot Framework and associated libraries
78+
RUN pip3 install \
79+
--no-cache-dir \
80+
robotframework==$ROBOT_FRAMEWORK_VERSION \
81+
robotframework-browser==$BROWSER_LIBRARY_VERSION \
82+
robotframework-databaselibrary==$DATABASE_LIBRARY_VERSION \
83+
robotframework-datadriver==$DATADRIVER_VERSION \
84+
robotframework-datadriver[XLS] \
85+
robotframework-datetime-tz==$DATETIMETZ_VERSION \
86+
robotframework-faker==$FAKER_VERSION \
87+
robotframework-ftplibrary==$FTP_LIBRARY_VERSION \
88+
robotframework-imaplibrary2==$IMAP_LIBRARY_VERSION \
89+
robotframework-pabot==$PABOT_VERSION \
90+
robotframework-requests==$REQUESTS_VERSION \
91+
robotframework-seleniumlibrary==$SELENIUM_LIBRARY_VERSION \
92+
robotframework-sshlibrary==$SSH_LIBRARY_VERSION \
93+
axe-selenium-python==$AXE_SELENIUM_LIBRARY_VERSION \
94+
PyYAML \
95+
# Install awscli to be able to upload test reports to AWS S3
96+
awscli==$AWS_CLI_VERSION
97+
98+
# Gecko drivers
99+
RUN dnf install -y \
100+
wget \
101+
102+
# Download Gecko drivers directly from the GitHub repository
128103
&& wget -q "https://github.com/mozilla/geckodriver/releases/download/$GECKO_DRIVER_VERSION/geckodriver-$GECKO_DRIVER_VERSION-linux64.tar.gz" \
129-
&& tar xzf geckodriver-$GECKO_DRIVER_VERSION-linux64.tar.gz \
130-
&& mkdir -p /opt/robotframework/drivers/ \
131-
&& mv geckodriver /opt/robotframework/drivers/geckodriver \
132-
&& rm geckodriver-$GECKO_DRIVER_VERSION-linux64.tar.gz \
104+
&& tar xzf geckodriver-$GECKO_DRIVER_VERSION-linux64.tar.gz \
105+
&& mkdir -p /opt/robotframework/drivers/ \
106+
&& mv geckodriver /opt/robotframework/drivers/geckodriver \
107+
&& rm geckodriver-$GECKO_DRIVER_VERSION-linux64.tar.gz \
108+
109+
&& dnf remove -y \
110+
wget \
111+
&& dnf clean all
133112

134-
# Clean up buildtime dependencies
135-
&& apk del --no-cache --update-cache .build-deps
113+
# Install the Node dependencies for the Browser library
114+
# FIXME: Playright currently doesn't support relying on system browsers, which is why the `--skip-browsers` parameter cannot be used here.
115+
RUN rfbrowser init \
116+
&& 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
136117

137118
# Create the default report and work folders with the default user to avoid runtime issues
138119
# These folders are writeable by anyone, to ensure the user can be changed on the command line.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Robot Framework in Docker Alpine, with Firefox and Chrome
1+
# Robot Framework in Docker, with Firefox and Chrome
22

33
## What is it?
44

bin/chromium-browser.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/bin/sh
22

3-
exec /usr/lib/chromium/chrome-original --disable-gpu --no-sandbox "$@"
3+
exec /usr/lib64/chromium-browser/chromium-browser-original --disable-gpu --no-sandbox "$@"

test/browser-library.robot

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,32 @@ Library Browser
44
*** Variables ***
55
# There is a conflict between browser names used by Selenium (using "chrome") and Browser (using "chromium")
66
# This is why the browser is currently fixed for the Browser Library.
7-
${BROWSER} firefox
7+
${BROWSER} %{BROWSER}
88

99
*** Test Cases ***
1010
Visit Bing
11-
New Browser ${BROWSER}
11+
IF "${BROWSER}" == 'chrome'
12+
New Browser chromium
13+
ELSE
14+
New Browser ${BROWSER}
15+
END
1216
New Page https://www.bing.com
1317
Take Screenshot
1418

1519
Visit Google
16-
New Browser ${BROWSER}
20+
IF "${BROWSER}" == 'chrome'
21+
New Browser chromium
22+
ELSE
23+
New Browser ${BROWSER}
24+
END
1725
New Page https://www.google.com
1826
Take Screenshot
1927

2028
Visit Yahoo
21-
New Browser ${BROWSER}
29+
IF "${BROWSER}" == 'chrome'
30+
New Browser chromium
31+
ELSE
32+
New Browser ${BROWSER}
33+
END
2234
New Page https://search.yahoo.com
2335
Take Screenshot

0 commit comments

Comments
 (0)