Skip to content

Commit

Permalink
Issue #352 - Add support for Microsoft Edge
Browse files Browse the repository at this point in the history
* Merged the latest changes from the master branch

* Fixed issues with the CI tests, as the Browser library currently doesn't support Microsoft Edge by default
  • Loading branch information
ppodgorsek committed Sep 6, 2023
1 parent 2a66579 commit ca57193
Show file tree
Hide file tree
Showing 3 changed files with 158 additions and 10 deletions.
150 changes: 148 additions & 2 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 @@ -28,7 +28,6 @@ jobs:
include:
- browser: "chrome"
- browser: "firefox"
- browser: "edge"
env:
BROWSER: ${{ matrix.browser }}
steps:
Expand Down Expand Up @@ -76,3 +75,150 @@ jobs:
- 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

# 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:
docker 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 \
test
- 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
14 changes: 7 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ ENV CHROMIUM_VERSION 116.0
ENV DATABASE_LIBRARY_VERSION 1.2.4
ENV DATADRIVER_VERSION 1.8.1
ENV DATETIMETZ_VERSION 1.0.6
ENV EDGE_VERSION 101.0.1210.39
ENV MICROSOFT_EDGE_VERSION 116.0.1938.69
ENV FAKER_VERSION 5.0.0
ENV FIREFOX_VERSION 117.0
ENV FTP_LIBRARY_VERSION 1.9
Expand Down Expand Up @@ -119,23 +119,23 @@ RUN dnf install -y \
# 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 makecache \
&& dnf install -y \
microsoft-edge-stable-${EDGE_VERSION} \
microsoft-edge-stable-${MICROSOFT_EDGE_VERSION} \
wget \
zip \

&& wget -q "https://msedgedriver.azureedge.net/${EDGE_VERSION}/edgedriver_linux64.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/ \
&& 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
# IMPORTANT: don't remove the wget package because it's a dependency of Microsoft Edge
&& dnf remove -y \
zip \
&& dnf clean all

# Install the Node dependencies for the Browser library
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

Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ The versions used are:
* [Axe Selenium Library](https://github.com/mozilla-services/axe-selenium-python) 2.1.6
* Firefox 117.0
* Chromium 116.0
* Edge 101.0.1210.39
* 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 @@ -50,6 +50,8 @@ Browsers can be easily switched. It is recommended to define `${BROWSER} %{BROWS

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

It is possible to define the settings of the virtual screen in which the browser is run by changing several environment variables:
Expand Down

0 comments on commit ca57193

Please sign in to comment.