Skip to content

Commit 9d6310e

Browse files
authored
Merge pull request #30 from ppodgorsek/issue-18
Issue #18 - Allow to define the screen resolution as an environment variable
2 parents a29ecfe + bcef071 commit 9d6310e

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

Dockerfile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,18 @@ LABEL description Robot Framework in Docker.
66
VOLUME /opt/robotframework/reports
77
VOLUME /opt/robotframework/tests
88

9+
ENV SCREEN_COLOUR_DEPTH 24
10+
ENV SCREEN_HEIGHT 1080
11+
ENV SCREEN_WIDTH 1920
12+
913
RUN dnf upgrade -y\
1014
&& dnf install -y\
1115
chromedriver-61.0.3163.100-1.fc26\
1216
chromium-61.0.3163.100-1.fc26\
1317
firefox-57.0-2.fc26\
1418
python2-pip-9.0.1-9.fc26\
15-
xorg-x11-server-Xvfb-1.19.3-4.fc26\
1619
which-2.21-2.fc26\
20+
xorg-x11-server-Xvfb-1.19.3-4.fc26\
1721
&& dnf clean all
1822

1923
RUN pip install robotframework==3.0.2\
@@ -23,12 +27,12 @@ ADD drivers/geckodriver-v0.18.0-linux64.tar.gz /opt/robotframework/drivers/
2327

2428
COPY bin/chromedriver.sh /opt/robotframework/bin/chromedriver
2529
COPY bin/chromium-browser.sh /opt/robotframework/bin/chromium-browser
30+
COPY bin/run-tests-in-virtual-screen.sh /opt/robotframework/bin/
2631

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

3136
ENV PATH=/opt/robotframework/bin:/opt/robotframework/drivers:$PATH
3237

33-
ENTRYPOINT ["xvfb-run", "--server-args=-screen 0 1920x1080x24 -ac", "robot", "--outputDir", "/opt/robotframework/reports", "/opt/robotframework/tests"]
34-
38+
CMD ["run-tests-in-virtual-screen.sh"]

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ The versions used in the latest version are:
1717

1818
* Robot Framework 3.0.2
1919
* Robot Framework selenium2library 1.8.0
20-
* Firefox 55.0
21-
* Chromium 60.0
20+
* Firefox 57.0
21+
* Chromium 61.0
2222

2323
## Running the container
2424

@@ -33,3 +33,11 @@ This container can be run using the following command:
3333
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.
3434

3535
When running your tests, simply add `-e BROWSER=chrome` or `-e BROWSER=firefox` to the run command.
36+
37+
### Changing the container screen's resolution
38+
39+
It is possible to define the settings of the virtual screen in which the browser is run by changing several environment variables:
40+
41+
* `SCREEN_COLOUR_DEPTH` (default: 24)
42+
* `SCREEN_HEIGHT` (default: 1080)
43+
* `SCREEN_WIDTH` (default: 1920)

bin/run-tests-in-virtual-screen.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
xvfb-run --server-args="-screen 0 ${SCREEN_WIDTH}x${SCREEN_HEIGHT}x${SCREEN_COLOUR_DEPTH} -ac" robot --outputDir /opt/robotframework/reports /opt/robotframework/tests

0 commit comments

Comments
 (0)