├── .dockerignore
├── .github
├── FUNDING.yml
├── ISSUE_TEMPLATE
│ ├── bug_report.md
│ └── feature_request.md
└── workflows
│ └── docker-build.yml
├── .gitignore
├── Dockerfile
├── LICENSE
├── README.md
├── bin
├── chrome.sh
├── chromedriver.sh
└── run-tests-in-virtual-screen.sh
└── test
├── browser-library.robot
├── faker.robot
├── pip-dependencies
├── main.robot
└── requirements.txt
├── requests.robot
├── selenium.robot
└── timezones.robot
/.dockerignore:
--------------------------------------------------------------------------------
1 | *~
2 |
3 | .git/
4 | .github/
5 | test/
6 |
7 | .gitignore
8 | .travis.yml
9 | LICENSE
10 | README.md
11 |
12 | # Eclipse
13 | .settings/
14 | .project
15 |
16 | # IntelliJ
17 | .idea/
18 | *.iml
19 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: ppodgorsek # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4 | patreon: # Replace with a single Patreon username
5 | open_collective: # Replace with a single Open Collective username
6 | ko_fi: # Replace with a single Ko-fi username
7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9 | liberapay: # Replace with a single Liberapay username
10 | issuehunt: # Replace with a single IssueHunt username
11 | otechie: # Replace with a single Otechie username
12 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
13 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
14 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Describe the bug**
11 | A clear and concise description of what the bug is.
12 |
13 | **To Reproduce**
14 | Steps to reproduce the behavior:
15 | 1. Go to '...'
16 | 2. Click on '....'
17 | 3. Scroll down to '....'
18 | 4. See error
19 |
20 | **Expected behavior**
21 | A clear and concise description of what you expected to happen.
22 |
23 | **Robot template**
24 | Any Robot template which could help reproduce the issue.
25 |
26 | **Screenshots**
27 | If applicable, add screenshots to help explain your problem.
28 |
29 | **Please provide any relevant information, such as:**
30 | - OS: [e.g. iOS]
31 | - Browser [e.g. chrome, safari]
32 | - Version [e.g. 22]
33 |
34 | **Additional context**
35 | Add any other context about the problem here.
36 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Is your feature request related to a problem? Please describe.**
11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12 |
13 | **Describe the solution you'd like**
14 | A clear and concise description of what you want to happen.
15 |
16 | **Describe alternatives you've considered**
17 | A clear and concise description of any alternative solutions or features you've considered.
18 |
19 | **Additional context**
20 | Add any other context or screenshots about the feature request here.
21 |
--------------------------------------------------------------------------------
/.github/workflows/docker-build.yml:
--------------------------------------------------------------------------------
1 | name: Robot Framework in Docker
2 |
3 | on:
4 | push:
5 | # Publish `master` as Docker `latest` image.
6 | # Release branches will trigger the creation of a git tag if the build is successful
7 | branches:
8 | - master
9 | - release/*
10 |
11 | # Run tests for any PRs.
12 | pull_request:
13 |
14 | env:
15 | # The image name
16 | IMAGE_NAME: docker-robot-framework:ci
17 |
18 | jobs:
19 | # Build and run tests.
20 | # See also https://docs.docker.com/docker-hub/builds/automated-testing/
21 | build:
22 | runs-on: ubuntu-latest
23 | # run all our tests on each browser
24 | strategy:
25 | matrix:
26 | include:
27 | - browser: "chrome"
28 | - browser: "edge"
29 | - browser: "firefox"
30 | env:
31 | BROWSER: ${{ matrix.browser }}
32 | steps:
33 | - name: Checkout
34 | uses: actions/checkout@v2
35 | - name: Build image
36 | run:
37 | podman build . --tag $IMAGE_NAME --file Dockerfile
38 | - name: Basic Test
39 | run: |
40 | podman run --shm-size=1g \
41 | -v `pwd`/test/browser-library.robot:/opt/robotframework/tests/browser-library.robot:Z \
42 | -v `pwd`/test/faker.robot:/opt/robotframework/tests/faker.robot:Z \
43 | -v `pwd`/test/requests.robot:/opt/robotframework/tests/requests.robot:Z \
44 | -v `pwd`/test/selenium.robot:/opt/robotframework/tests/selenium.robot:Z \
45 | -v `pwd`/test/timezones.robot:/opt/robotframework/tests/timezones.robot:Z \
46 | -e BROWSER=$BROWSER \
47 | $IMAGE_NAME
48 | - name: Test dependency installation
49 | run: |
50 | podman run --shm-size=1g \
51 | -v `pwd`/test/pip-dependencies/main.robot:/opt/robotframework/tests/pip-dependencies.robot:Z \
52 | -v `pwd`/test/pip-dependencies/requirements.txt:/opt/robotframework/pip-requirements.txt:Z \
53 | -e BROWSER=$BROWSER \
54 | $IMAGE_NAME
55 | - name: Colour Depth 16 Test
56 | run: |
57 | podman run --shm-size=1g \
58 | -v `pwd`/test/browser-library.robot:/opt/robotframework/tests/browser-library.robot:Z \
59 | -v `pwd`/test/selenium.robot:/opt/robotframework/tests/selenium.robot:Z \
60 | -e BROWSER=$BROWSER \
61 | -e SCREEN_COLOUR_DEPTH=16 \
62 | $IMAGE_NAME
63 | - name: Screen Width 800x600 Test
64 | run: |
65 | podman run --shm-size=1g \
66 | -v `pwd`/test/browser-library.robot:/opt/robotframework/tests/browser-library.robot:Z \
67 | -v `pwd`/test/selenium.robot:/opt/robotframework/tests/selenium.robot:Z \
68 | -e BROWSER=$BROWSER \
69 | -e SCREEN_WIDTH=800 \
70 | -e SCREEN_HEIGHT=600 \
71 | $IMAGE_NAME
72 | - name: Screen Width 1024x768 Test
73 | run: |
74 | podman run --shm-size=1g \
75 | -v `pwd`/test/browser-library.robot:/opt/robotframework/tests/browser-library.robot:Z \
76 | -v `pwd`/test/selenium.robot:/opt/robotframework/tests/selenium.robot:Z \
77 | -e BROWSER=$BROWSER \
78 | -e SCREEN_WIDTH=1024 \
79 | -e SCREEN_HEIGHT=768 \
80 | $IMAGE_NAME
81 | - name: Screen Width 1280x1024 Test
82 | run: |
83 | podman run --shm-size=1g \
84 | -v `pwd`/test/browser-library.robot:/opt/robotframework/tests/browser-library.robot:Z \
85 | -v `pwd`/test/selenium.robot:/opt/robotframework/tests/selenium.robot:Z \
86 | -e BROWSER=$BROWSER \
87 | -e SCREEN_WIDTH=1280 \
88 | -e SCREEN_HEIGHT=1024 \
89 | $IMAGE_NAME
90 | - name: Screen Width 2560x1440 Test
91 | run: |
92 | podman run --shm-size=1g \
93 | -v `pwd`/test/browser-library.robot:/opt/robotframework/tests/browser-library.robot:Z \
94 | -v `pwd`/test/selenium.robot:/opt/robotframework/tests/selenium.robot:Z \
95 | -e BROWSER=$BROWSER \
96 | -e SCREEN_WIDTH=2560 \
97 | -e SCREEN_HEIGHT=1440 \
98 | $IMAGE_NAME
99 | - name: Screen Width 3840x2160 Test
100 | run: |
101 | podman run --shm-size=1g \
102 | -v `pwd`/test/browser-library.robot:/opt/robotframework/tests/browser-library.robot:Z \
103 | -v `pwd`/test/selenium.robot:/opt/robotframework/tests/selenium.robot:Z \
104 | -e BROWSER=$BROWSER \
105 | -e SCREEN_WIDTH=3840 \
106 | -e SCREEN_HEIGHT=2160 \
107 | $IMAGE_NAME
108 | - name: Debug Log Level Test
109 | run: |
110 | podman run --shm-size=1g \
111 | -v `pwd`/test/faker.robot:/opt/robotframework/tests/faker.robot:Z \
112 | -e BROWSER=$BROWSER \
113 | -e ROBOT_OPTIONS="--loglevel DEBUG" \
114 | $IMAGE_NAME
115 | - name: Basic Multithreaded Test
116 | run: |
117 | podman run --shm-size=1g \
118 | -v `pwd`/test/browser-library.robot:/opt/robotframework/tests/browser-library.robot:Z \
119 | -v `pwd`/test/faker.robot:/opt/robotframework/tests/faker.robot:Z \
120 | -v `pwd`/test/requests.robot:/opt/robotframework/tests/requests.robot:Z \
121 | -v `pwd`/test/selenium.robot:/opt/robotframework/tests/selenium.robot:Z \
122 | -v `pwd`/test/timezones.robot:/opt/robotframework/tests/timezones.robot:Z \
123 | -e BROWSER=$BROWSER \
124 | -e ROBOT_THREADS=4 \
125 | $IMAGE_NAME
126 | - name: Test Level Multithreaded Test
127 | run: |
128 | podman run --shm-size=1g \
129 | -v `pwd`/test/browser-library.robot:/opt/robotframework/tests/browser-library.robot:Z \
130 | -v `pwd`/test/faker.robot:/opt/robotframework/tests/faker.robot:Z \
131 | -v `pwd`/test/requests.robot:/opt/robotframework/tests/requests.robot:Z \
132 | -v `pwd`/test/selenium.robot:/opt/robotframework/tests/selenium.robot:Z \
133 | -v `pwd`/test/timezones.robot:/opt/robotframework/tests/timezones.robot:Z \
134 | -e BROWSER=$BROWSER \
135 | -e ROBOT_THREADS=4 \
136 | -e PABOT_OPTIONS="--testlevelsplit" \
137 | $IMAGE_NAME
138 | - name: Custom User Test
139 | run: |
140 | podman run --user=2000 --shm-size=1g \
141 | -v `pwd`/test/faker.robot:/opt/robotframework/tests/faker.robot:Z \
142 | -e BROWSER=$BROWSER \
143 | $IMAGE_NAME
144 | - name: Custom User and Group Test
145 | run: |
146 | podman run --user=2000:2000 --shm-size=1g \
147 | -v `pwd`/test/faker.robot:/opt/robotframework/tests/faker.robot:Z \
148 | -e BROWSER=$BROWSER \
149 | $IMAGE_NAME
150 | - name: Datetime
151 | run: |
152 | podman run --user=2000:2000 --shm-size=1g \
153 | -v `pwd`/test/timezones.robot:/opt/robotframework/tests/timezones.robot:Z \
154 | -e BROWSER=$BROWSER \
155 | -e TZ="America/New_York" \
156 | $IMAGE_NAME
157 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *~
2 | logs/
3 | reports/
4 |
5 | # Eclipse
6 | .settings/
7 | .project
8 |
9 | # IntelliJ
10 | .idea/
11 | *.iml
12 |
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM fedora:40
2 |
3 | LABEL authors Paul Podgorsek
4 | LABEL description Robot Framework in Docker.
5 |
6 | # Set the Python dependencies' directory environment variable
7 | ENV ROBOT_DEPENDENCY_DIR /opt/robotframework/dependencies
8 |
9 | # Set the reports directory environment variable
10 | ENV ROBOT_REPORTS_DIR /opt/robotframework/reports
11 |
12 | # Set the tests directory environment variable
13 | ENV ROBOT_TESTS_DIR /opt/robotframework/tests
14 |
15 | # Set the working directory environment variable
16 | ENV ROBOT_WORK_DIR /opt/robotframework/temp
17 |
18 | # Setup X Window Virtual Framebuffer
19 | ENV SCREEN_COLOUR_DEPTH 24
20 | ENV SCREEN_HEIGHT 1080
21 | ENV SCREEN_WIDTH 1920
22 |
23 | # Setup the timezone to use, defaults to UTC
24 | ENV TZ UTC
25 |
26 | # Set number of threads for parallel execution
27 | # By default, no parallelisation
28 | ENV ROBOT_THREADS 1
29 |
30 | # Define the default user who'll run the tests
31 | ENV ROBOT_UID 1000
32 | ENV ROBOT_GID 1000
33 |
34 | # Dependency versions
35 | ENV AWS_CLI_VERSION 1.38.31
36 | ENV AXE_SELENIUM_LIBRARY_VERSION 2.1.6
37 | ENV BROWSER_LIBRARY_VERSION 19.4.0
38 | ENV CHROME_VERSION 135.0.7049.84
39 | ENV DATABASE_LIBRARY_VERSION 2.1.3
40 | ENV DATADRIVER_VERSION 1.11.2
41 | ENV DATETIMETZ_VERSION 1.0.6
42 | ENV MICROSOFT_EDGE_VERSION 135.0.3179.54
43 | ENV FAKER_VERSION 5.0.0
44 | ENV FIREFOX_VERSION 137.0
45 | ENV FTP_LIBRARY_VERSION 1.9
46 | ENV GECKO_DRIVER_VERSION v0.36.0
47 | ENV IMAP_LIBRARY_VERSION 0.4.11
48 | ENV PABOT_VERSION 4.1.1
49 | ENV REQUESTS_VERSION 0.9.7
50 | ENV ROBOT_FRAMEWORK_VERSION 7.2.2
51 | ENV SELENIUM_LIBRARY_VERSION 6.7.1
52 | ENV SSH_LIBRARY_VERSION 3.8.0
53 | ENV XVFB_VERSION 1.20
54 |
55 | # By default, no reports are uploaded to AWS S3
56 | ENV AWS_UPLOAD_TO_S3 false
57 |
58 | # Prepare binaries to be executed
59 | COPY bin/chromedriver.sh /opt/robotframework/drivers/chromedriver
60 | COPY bin/chrome.sh /opt/robotframework/bin/chrome
61 | COPY bin/run-tests-in-virtual-screen.sh /opt/robotframework/bin/
62 |
63 | # Install system dependencies
64 | RUN dnf upgrade -y --refresh \
65 | && dnf install -y \
66 | dbus-glib \
67 | dnf-plugins-core \
68 | firefox-${FIREFOX_VERSION}* \
69 | gcc \
70 | gcc-c++ \
71 | nodejs \
72 | npm \
73 | python3-pip \
74 | python3-pyyaml \
75 | tzdata \
76 | wget \
77 | xorg-x11-server-Xvfb-${XVFB_VERSION}* \
78 | && dnf clean all
79 |
80 | # Install Chrome for Testing
81 | # https://developer.chrome.com/blog/chrome-for-testing/
82 | RUN npx @puppeteer/browsers install chrome@${CHROME_VERSION} \
83 | && npx @puppeteer/browsers install chromedriver@${CHROME_VERSION}
84 |
85 | # Install Robot Framework and associated libraries
86 | RUN pip3 install \
87 | --no-cache-dir \
88 | robotframework==$ROBOT_FRAMEWORK_VERSION \
89 | robotframework-browser==$BROWSER_LIBRARY_VERSION \
90 | robotframework-databaselibrary==$DATABASE_LIBRARY_VERSION \
91 | robotframework-datadriver==$DATADRIVER_VERSION \
92 | robotframework-datadriver[XLS] \
93 | robotframework-datetime-tz==$DATETIMETZ_VERSION \
94 | robotframework-faker==$FAKER_VERSION \
95 | robotframework-ftplibrary==$FTP_LIBRARY_VERSION \
96 | robotframework-imaplibrary2==$IMAP_LIBRARY_VERSION \
97 | robotframework-pabot==$PABOT_VERSION \
98 | robotframework-requests==$REQUESTS_VERSION \
99 | robotframework-seleniumlibrary==$SELENIUM_LIBRARY_VERSION \
100 | robotframework-sshlibrary==$SSH_LIBRARY_VERSION \
101 | axe-selenium-python==$AXE_SELENIUM_LIBRARY_VERSION \
102 | # Install awscli to be able to upload test reports to AWS S3
103 | awscli==$AWS_CLI_VERSION
104 |
105 | # Gecko drivers
106 | # Download Gecko drivers directly from the GitHub repository
107 | RUN wget -q "https://github.com/mozilla/geckodriver/releases/download/$GECKO_DRIVER_VERSION/geckodriver-$GECKO_DRIVER_VERSION-linux64.tar.gz" \
108 | && tar xzf geckodriver-$GECKO_DRIVER_VERSION-linux64.tar.gz \
109 | && mkdir -p /opt/robotframework/drivers/ \
110 | && mv geckodriver /opt/robotframework/drivers/geckodriver \
111 | && rm geckodriver-$GECKO_DRIVER_VERSION-linux64.tar.gz
112 |
113 | # Install Microsoft Edge & webdriver
114 | RUN rpm --import https://packages.microsoft.com/keys/microsoft.asc \
115 | && dnf config-manager --add-repo https://packages.microsoft.com/yumrepos/edge \
116 | && dnf install -y \
117 | microsoft-edge-stable-${MICROSOFT_EDGE_VERSION} \
118 | zip \
119 | && wget -q "https://msedgedriver.azureedge.net/${MICROSOFT_EDGE_VERSION}/edgedriver_linux64.zip" \
120 | && unzip edgedriver_linux64.zip -d edge \
121 | && mv edge/msedgedriver /opt/robotframework/drivers/msedgedriver \
122 | && rm -Rf edgedriver_linux64.zip edge/ \
123 | # IMPORTANT: don't remove the wget package because it's a dependency of Microsoft Edge
124 | && dnf remove -y \
125 | zip \
126 | && dnf clean all
127 |
128 | ENV PATH=/opt/microsoft/msedge:$PATH
129 |
130 | # FIXME: Playright currently doesn't support relying on system browsers, which is why the `--skip-browsers` parameter cannot be used here.
131 | # Additionally, it cannot run fully on any OS due to https://github.com/microsoft/playwright/issues/29559
132 | RUN rfbrowser init chromium firefox
133 |
134 | # Create the default report and work folders with the default user to avoid runtime issues
135 | # These folders are writeable by anyone, to ensure the user can be changed on the command line.
136 | RUN mkdir -p ${ROBOT_REPORTS_DIR} \
137 | && mkdir -p ${ROBOT_WORK_DIR} \
138 | && chown ${ROBOT_UID}:${ROBOT_GID} ${ROBOT_REPORTS_DIR} \
139 | && chown ${ROBOT_UID}:${ROBOT_GID} ${ROBOT_WORK_DIR} \
140 | && chmod ugo+w ${ROBOT_REPORTS_DIR} ${ROBOT_WORK_DIR}
141 |
142 | # Allow any user to write logs
143 | RUN chmod ugo+w /var/log \
144 | && chown ${ROBOT_UID}:${ROBOT_GID} /var/log
145 |
146 | # Update system path
147 | ENV PATH=/opt/robotframework/bin:/opt/robotframework/drivers:$PATH
148 |
149 | # Ensure the directory for Python dependencies exists
150 | RUN mkdir -p ${ROBOT_DEPENDENCY_DIR} \
151 | && chown ${ROBOT_UID}:${ROBOT_GID} ${ROBOT_DEPENDENCY_DIR} \
152 | && chmod 777 ${ROBOT_DEPENDENCY_DIR}
153 |
154 | # Set up a volume for the generated reports
155 | VOLUME ${ROBOT_REPORTS_DIR}
156 |
157 | USER ${ROBOT_UID}:${ROBOT_GID}
158 |
159 | # A dedicated work folder to allow for the creation of temporary files
160 | WORKDIR ${ROBOT_WORK_DIR}
161 |
162 | # Execute all robot tests
163 | CMD ["run-tests-in-virtual-screen.sh"]
164 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2016 Paul Podgorsek
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Robot Framework in Docker, with Firefox, Chrome and Microsoft Edge
2 |
3 | ## Table of contents
4 |
5 | * [What is it?](#what-is-it)
6 | * [Versioning](#versioning)
7 | * [Running the container](#running-the-container)
8 | * [Switching browsers](#switching-browsers)
9 | * [Changing the container's screen resolution](#changing-the-containers-screen-resolution)
10 | * [Changing the container's tests and reports directories](#changing-the-containers-tests-and-reports-directories)
11 | * [Parallelisation](#parallelisation)
12 | * [Parallelisation options](#parallelisation-options)
13 | * [Passing additional options](#passing-additional-options)
14 | * [Testing emails](#testing-emails)
15 | * [Dealing with Datetimes and Timezones](#dealing-with-datetimes-and-timezones)
16 | * [Installing additional dependencies](#installing-additional-dependencies)
17 | * [Security consideration](#security-consideration)
18 | * [Continuous integration](#continuous-integration)
19 | * [Azure DevOps pipeline](#ci-azure-devops)
20 | * [Jenkins pipeline](#ci-jenkins)
21 | * [Defining a test run ID](#defining-a-test-run-id)
22 | * [Upload test reports to an AWS S3 bucket](#upload-test-reports-to-an-aws-s3-bucket)
23 | * [Testing this project](#testing-this-project)
24 | * [Troubleshooting](#troubleshooting)
25 | * [Chromium is crashing](#chromium-is-crashing)
26 | * [Accessing the logs](#accessing-the-logs)
27 | * [Error: Suite contains no tests](#error-suite-contains-no-tests)
28 | * [Database tests are failing in spite of the DatabaseLibrary being present](#database-tests-are-failing-in-spite-of-the-databaselibrary-being-present)
29 | * [Supported devices and architectures](#supported-devices-and-architectures)
30 | * [Please contribute!](#please-contribute)
31 |
32 | -----
33 |
34 |
35 |
36 | ## What is it?
37 |
38 | This project consists of a container image containing a Robot Framework installation.
39 |
40 | This installation also contains Firefox, Chrome, Microsoft Edge, along with the Selenium and Playwright/RFBrowser library for Robot Framework.
41 |
42 |
43 |
44 | ## Versioning
45 |
46 | The versioning of this image follows the one of Robot Framework:
47 |
48 | * Major version matches the one of Robot Framework
49 | * Minor and patch versions are specific to this project (allows to update the versions of the other dependencies)
50 |
51 | The versions used are:
52 |
53 | * [Robot Framework](https://github.com/robotframework/robotframework) 7.2.2
54 | * [Robot Framework Browser (Playwright) Library](https://github.com/MarketSquare/robotframework-browser) 19.4.0
55 | * [Robot Framework DatabaseLibrary](https://github.com/franz-see/Robotframework-Database-Library) 2.1.3
56 | * [Robot Framework Datadriver](https://github.com/Snooz82/robotframework-datadriver) 1.11.2
57 | * [Robot Framework DateTimeTZ](https://github.com/testautomation/DateTimeTZ) 1.0.6
58 | * [Robot Framework Faker](https://github.com/guykisel/robotframework-faker) 5.0.0
59 | * [Robot Framework FTPLibrary](https://github.com/kowalpy/Robot-Framework-FTP-Library) 1.9
60 | * [Robot Framework IMAPLibrary 2](https://pypi.org/project/robotframework-imaplibrary2/) 0.4.11
61 | * [Robot Framework Pabot](https://github.com/mkorpela/pabot) 4.1.1
62 | * [Robot Framework Requests](https://github.com/bulkan/robotframework-requests) 0.9.7
63 | * [Robot Framework SeleniumLibrary](https://github.com/robotframework/SeleniumLibrary) 6.7.1
64 | * [Robot Framework SSHLibrary](https://github.com/robotframework/SSHLibrary) 3.8.0
65 | * [Axe Selenium Library](https://github.com/mozilla-services/axe-selenium-python) 2.1.6
66 | * Firefox 137.0
67 | * [Chrome for Testing](https://googlechromelabs.github.io/chrome-for-testing/) 135.0
68 | * Microsoft Edge 135.0
69 | * [Amazon AWS CLI](https://pypi.org/project/awscli/) 1.38.31
70 |
71 | 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.
72 |
73 |
74 |
75 | ## Running the container
76 |
77 | This container can be run using the following command:
78 |
79 | ```sh
80 | docker run \
81 | -v :/opt/robotframework/reports:Z \
82 | -v :/opt/robotframework/tests:Z \
83 | ppodgorsek/robot-framework:
84 | ```
85 |
86 |
87 |
88 | ### Switching browsers
89 |
90 | 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.
91 |
92 | When running your tests, simply add `-e BROWSER=chrome`, `-e BROWSER=firefox` or `-e BROWSER=edge`to the run command.
93 |
94 | 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.
95 |
96 |
97 |
98 | ### Changing the container's screen resolution
99 |
100 | It is possible to define the settings of the virtual screen in which the browser is run by changing several environment variables:
101 |
102 | * `SCREEN_COLOUR_DEPTH` (default: 24)
103 | * `SCREEN_HEIGHT` (default: 1080)
104 | * `SCREEN_WIDTH` (default: 1920)
105 |
106 |
107 |
108 | ### Changing the container's tests and reports directories
109 |
110 | It is possible to use different directories to read tests from and to generate reports to. This is useful when using a complex test file structure. To change the defaults, set the following environment variables:
111 |
112 | * `ROBOT_REPORTS_DIR` (default: /opt/robotframework/reports)
113 | * `ROBOT_TESTS_DIR` (default: /opt/robotframework/tests)
114 |
115 |
116 |
117 | ### Parallelisation
118 |
119 | It is possible to parallelise the execution of your test suites. Simply define the `ROBOT_THREADS` environment variable, for example:
120 |
121 | ```sh
122 | docker run \
123 | -e ROBOT_THREADS=4 \
124 | ppodgorsek/robot-framework:latest
125 | ```
126 |
127 | By default, there is no parallelisation.
128 |
129 |
130 |
131 | #### Parallelisation options
132 |
133 | When using parallelisation, it is possible to pass additional [pabot options](https://github.com/mkorpela/pabot#command-line-options), such as `--testlevelsplit`, `--argumentfile`, `--ordering`, etc. These can be passed by using the `PABOT_OPTIONS` environment variable, for example:
134 |
135 | ```sh
136 | docker run \
137 | -e ROBOT_THREADS=4 \
138 | -e PABOT_OPTIONS="--testlevelsplit" \
139 | ppodgorsek/robot-framework:latest
140 | ```
141 |
142 |
143 |
144 | ### Passing additional options
145 |
146 | RobotFramework supports many options such as `--exclude`, `--variable`, `--loglevel`, etc. These can be passed by using the `ROBOT_OPTIONS` environment variable, for example:
147 |
148 | ```sh
149 | docker run \
150 | -e ROBOT_OPTIONS="--loglevel DEBUG" \
151 | ppodgorsek/robot-framework:latest
152 | ```
153 |
154 |
155 |
156 | ### Testing emails
157 |
158 | This project includes the IMAP library which allows Robot Framework to connect to email servers.
159 |
160 | A suggestion to automate email testing is to run a [Mailcatcher instance in Docker which allows IMAP connections](https://github.com/estelora/docker-mailcatcher-imap). This will ensure emails are discarded once the tests have been run.
161 |
162 |
163 |
164 | ### Dealing with Datetimes and Timezones
165 |
166 | This project is meant to allow your tests to run anywhere. Sometimes that can be in a different timezone than your local one or of the location under test. To help solve such issues, this image includes the [DateTimeTZ Library](https://testautomation.github.io/DateTimeTZ/doc/DateTimeTZ.html).
167 |
168 | To set the timezone used inside the Docker image, you can set the `TZ` environment variable:
169 |
170 | ```sh
171 | docker run \
172 | -e TZ=America/New_York \
173 | ppodgorsek/robot-framework:latest
174 | ```
175 |
176 |
177 |
178 | ### Installing additional dependencies
179 |
180 | It is possible to install additional dependencies dynamically at runtime rather than having to extend this image.
181 |
182 | To do so, simply mount a text file containing the list of dependencies you would like to install using `pip`: (by default, this file is empty if not mounted)
183 |
184 | ```sh
185 | docker run \
186 | -v :/opt/robotframework/pip-requirements.txt:Z \
187 | -v :/opt/robotframework/tests:Z \
188 | ppodgorsek/robot-framework:latest
189 | ```
190 |
191 | The file must follow [Pip's official requirements file format](https://pip.pypa.io/en/stable/reference/requirements-file-format/).
192 |
193 | Here is a example of what such a file could contain:
194 |
195 | ```
196 | robotframework-docker==1.4.2
197 | rpa==1.50.0
198 | ```
199 |
200 | **For large dependencies, it is still recommended to extend the project's image and to add them there, to avoid delaying the CI/CD pipelines with repeated dependency installations.**
201 |
202 |
203 |
204 | ## Security consideration
205 |
206 | By default, containers are implicitly run using `--user=1000:1000`, please remember to adjust that command-line setting accordingly, for example:
207 |
208 | ```sh
209 | docker run \
210 | --user=1001:1001 \
211 | ppodgorsek/robot-framework:latest
212 | ```
213 |
214 | Remember that that UID/GID should be allowed to access the mounted volumes in order to read the test suites and to write the output.
215 |
216 | Additionally, it is possible to rely on user namespaces to further secure the execution. This is well described in the official container documentation:
217 |
218 | * Docker: [Introduction to User Namespaces in Docker Engine](https://success.docker.com/article/introduction-to-user-namespaces-in-docker-engine)
219 | * Podman: [Running rootless Podman as a non-root user](https://www.redhat.com/sysadmin/rootless-podman-makes-sense)
220 |
221 | This is a good security practice to make sure containers cannot perform unwanted changes on the host. In that sense, Podman is probably well ahead of Docker by not relying on a root daemon to run its containers.
222 |
223 |
224 |
225 | ## Continuous integration
226 |
227 |
228 |
229 | ### Azure DevOps pipeline
230 |
231 | Azure DevOps provides a `Docker@2` task but it only allows a limited number of commands, it is therefore required to use a `script` instead:
232 |
233 | ```yml
234 | - job: FunctionalRegressionTests
235 | displayName: Robot Framework tests
236 | steps:
237 | - script: |
238 | set -x
239 |
240 | mkdir -p $(Build.Repository.LocalPath)/robot-framework-reports
241 | chmod -R ugo+rwx $(Build.Repository.LocalPath)/robot-framework-reports
242 |
243 | # The ROBOT_OPTIONS allow to generate a specific output file that can be
244 | # used to publish test results in the Azure DevOps pipeline run
245 | # Remember to replace ${{ parameters.robotFrameworkFolder }} by the correct
246 | # folder name in your repository
247 | docker run --rm \
248 | --shm-size=1g \
249 | -v $(Build.Repository.LocalPath)/robot-framework-reports:/opt/robotframework/reports:Z \
250 | -v $(Build.Repository.LocalPath)/${{ parameters.robotFrameworkFolder }}:/opt/robotframework/tests:Z \
251 | -e ROBOT_OPTIONS="-x outputxunit.xml" \
252 | -t docker.io/ppodgorsek/robot-framework:latest
253 | displayName: Run Robot Framework tests
254 |
255 | - task: PublishTestResults@2
256 | condition: always()
257 | displayName: Publish Robot Framework test results
258 | inputs:
259 | testResultsFormat: 'JUnit'
260 | testResultsFiles: '**/outputxunit.xml'
261 | searchFolder: '$(Build.Repository.LocalPath)/robot-framework-reports'
262 | failTaskOnFailedTests: true
263 | failTaskOnFailureToPublishResults: true
264 | failTaskOnMissingResultsFile: true
265 | ```
266 |
267 |
268 |
269 | ### Jenkins pipeline
270 |
271 | It is possible to run the project from within a Jenkins pipeline by relying on the shell command line directly:
272 |
273 | ```yml
274 | pipeline {
275 | agent any
276 | stages {
277 | stage('Functional regression tests') {
278 | steps {
279 | sh "docker run --shm-size=1g -e BROWSER=firefox -v $WORKSPACE/robot-tests:/opt/robotframework/tests:Z -v $WORKSPACE/robot-reports:/opt/robotframework/reports:Z ppodgorsek/robot-framework:latest"
280 | }
281 | }
282 | }
283 | }
284 | ```
285 |
286 | The pipeline stage can also rely on a Docker agent, as shown in the example below:
287 |
288 | ```yml
289 | pipeline {
290 | agent none
291 | stages {
292 | stage('Functional regression tests') {
293 | agent { docker {
294 | image 'ppodgorsek/robot-framework:latest'
295 | args '--shm-size=1g -u root' }
296 | }
297 | environment {
298 | BROWSER = 'firefox'
299 | ROBOT_TESTS_DIR = "$WORKSPACE/robot-tests"
300 | ROBOT_REPORTS_DIR = "$WORKSPACE/robot-reports"
301 | }
302 | steps {
303 | sh '''
304 | /opt/robotframework/bin/run-tests-in-virtual-screen.sh
305 | '''
306 | }
307 | }
308 | }
309 | }
310 | ```
311 |
312 |
313 |
314 | ### Defining a test run ID
315 |
316 | When relying on Continuous Integration tools, it can be useful to define a test run ID such as the build number or branch name to avoid overwriting consecutive execution reports.
317 |
318 | For that purpose, the `ROBOT_TEST_RUN_ID` variable was introduced:
319 | * If the test run ID is empty, the reports folder will be: `${ROBOT_REPORTS_DIR}/`
320 | * If the test run ID was provided, the reports folder will be: `${ROBOT_REPORTS_DIR}/${ROBOT_TEST_RUN_ID}/`
321 |
322 | It can simply be passed during the execution, such as:
323 |
324 | ```sh
325 | docker run \
326 | -e ROBOT_TEST_RUN_ID="feature/branch-name" \
327 | ppodgorsek/robot-framework:latest
328 | ```
329 |
330 | By default, the test run ID is empty.
331 |
332 |
333 |
334 | ### Upload test reports to an AWS S3 bucket
335 |
336 | To upload the report of a test run to an S3 bucket, you need to define the following environment variables:
337 |
338 | ```sh
339 | docker run \
340 | -e AWS_ACCESS_KEY_ID= \
341 | -e AWS_SECRET_ACCESS_KEY= \
342 | -e AWS_DEFAULT_REGION= \
343 | -e AWS_BUCKET_NAME= \
344 | ppodgorsek/robot-framework:latest
345 | ```
346 |
347 |
348 |
349 | ## Testing this project
350 |
351 | Not convinced yet? Simple tests have been prepared in the `test/` folder, you can run them using the following commands:
352 |
353 | ```sh
354 | # Using Chromium
355 | docker run \
356 | -v `pwd`/reports:/opt/robotframework/reports:Z \
357 | -v `pwd`/test:/opt/robotframework/tests:Z \
358 | -e BROWSER=chrome \
359 | ppodgorsek/robot-framework:latest
360 |
361 | # Using Firefox
362 | docker run \
363 | -v `pwd`/reports:/opt/robotframework/reports:Z \
364 | -v `pwd`/test:/opt/robotframework/tests:Z \
365 | -e BROWSER=firefox \
366 | ppodgorsek/robot-framework:latest
367 | ```
368 |
369 | For Windows users who use **PowerShell**, the commands are slightly different:
370 |
371 | ```sh
372 | # Using Chromium
373 | docker run \
374 | -v ${PWD}/reports:/opt/robotframework/reports:Z \
375 | -v ${PWD}/test:/opt/robotframework/tests:Z \
376 | -e BROWSER=chrome \
377 | ppodgorsek/robot-framework:latest
378 |
379 | # Using Firefox
380 | docker run \
381 | -v ${PWD}/reports:/opt/robotframework/reports:Z \
382 | -v ${PWD}/test:/opt/robotframework/tests:Z \
383 | -e BROWSER=firefox \
384 | ppodgorsek/robot-framework:latest
385 | ```
386 |
387 | Screenshots of the results will be available in the `reports/` folder.
388 |
389 |
390 |
391 | ## Troubleshooting
392 |
393 |
394 |
395 | ### Chromium is crashing
396 |
397 | Chrome drivers might crash due to the small size of `/dev/shm` in the docker container:
398 |
399 | > UnknownError: session deleted because of page crash
400 |
401 | This is [a known bug of Chromium](https://bugs.chromium.org/p/chromium/issues/detail?id=715363).
402 |
403 | To avoid this error, please change the shm size when starting the container by adding the following parameter: `--shm-size=1g` (or any other size more suited to your tests)
404 |
405 |
406 |
407 | ### Accessing the logs
408 |
409 | In case further investigation is required, the logs can be accessed by mounting their folder. Simply add the following parameter to your `run` command:
410 |
411 | * Linux/Mac: ``-v `pwd`/logs:/var/log:Z``
412 | * Windows: ``-v ${PWD}/logs:/var/log:Z``
413 |
414 | Chromium allows to set additional environment properties, which can be useful when debugging:
415 |
416 | * `webdriver.chrome.verboseLogging=true`: enables the verbose logging mode
417 | * `webdriver.chrome.logfile=/path/to/chromedriver.log`: sets the path to Chromium's log file
418 |
419 |
420 |
421 | ### Error: Suite contains no tests
422 |
423 | When running tests, an unexpected error sometimes occurs:
424 |
425 | > [Error] Suite contains no tests.
426 |
427 | There are two main causes to this:
428 | * Either the test folder is not the right one,
429 | * Or the permissions on the test folder/test files are too restrictive.
430 |
431 | As there can sometimes be issues as to where the tests are run from, make sure the correct folder is used by trying the following actions:
432 | * Use a full path to the folder instead of a relative one,
433 | * Replace any`` `pwd` ``or `${PWD}` by the full path to the folder.
434 |
435 | It is also important to check if Robot Framework is allowed to access the resources it needs, i.e.:
436 | * The folder where the tests are located,
437 | * The test files themselves.
438 |
439 |
440 |
441 | ### Database tests are failing in spite of the DatabaseLibrary being present
442 |
443 | As per their official project page, the [Robot Framework DatabaseLibrary](https://github.com/franz-see/Robotframework-Database-Library) contains utilities meant for Robot Framework's usage. This can allow you to query your database after an action has been made to verify the results. This is compatible with any Database API Specification 2.0 module.
444 |
445 | It is anyway mandatory to extend the container image to install the specific database module relevant to your tests, such as:
446 | * [MS SQL](https://pymssql.readthedocs.io/en/latest/intro.html): `pip install pymssql`
447 | * [MySQL](https://dev.mysql.com/downloads/connector/python/): `pip install pymysql`
448 | * [Oracle](https://www.oracle.com/uk/database/technologies/appdev/python.html): `pip install py2oracle`
449 | * [PostgreSQL](http://pybrary.net/pg8000/index.html): `pip install pg8000`
450 |
451 |
452 |
453 | ### Supported devices and architectures
454 |
455 | As mentioned on the [Docker Hub](https://hub.docker.com/r/ppodgorsek/robot-framework), the project has been built and uploaded as a `linux/amd64` image only. This means ARM devices such as MacBook M1/M2 and Amazon EC2 Graviton won't be able to run the image with the default configuration.
456 |
457 | As mentioned in the official documentation, [Podman](https://docs.podman.io/en/latest/markdown/podman-run.1.html#platform-os-arch) and [Docker](https://docs.docker.com/build/building/multi-platform/) provide a `--platform` option which selects a given application architecture, such as:
458 |
459 | ```sh
460 | docker run \
461 | --platform linux/amd64 \
462 | -v :/opt/robotframework/reports:Z \
463 | -v :/opt/robotframework/tests:Z \
464 | ppodgorsek/robot-framework:
465 | ```
466 |
467 | Please note: builds and automated tests of this project will remain performed on a `linux/amd64` architecture so such emulation might not work, depending on your device and operating system.
468 |
469 | If this does not solve your platform-related issues, you will have to rebuild the image for your device/platform, specifying that `--platform` option during the build and run.
470 |
471 |
472 |
473 | ## Please contribute!
474 |
475 | Have you found an issue? Do you have an idea for an improvement? Feel free to contribute by submitting it [on the GitHub project](https://github.com/ppodgorsek/docker-robot-framework/issues).
476 |
--------------------------------------------------------------------------------
/bin/chrome.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | exec /chrome/linux-${CHROME_VERSION}/chrome-linux64/chrome --disable-gpu --no-sandbox "$@"
4 |
--------------------------------------------------------------------------------
/bin/chromedriver.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | exec /chromedriver/linux-${CHROME_VERSION}/chromedriver-linux64/chromedriver --verbose --log-path=/var/log/chromedriver --no-sandbox "$@"
4 |
--------------------------------------------------------------------------------
/bin/run-tests-in-virtual-screen.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | HOME=${ROBOT_WORK_DIR}
4 |
5 | if [ "${ROBOT_TEST_RUN_ID}" = "" ]
6 | then
7 | ROBOT_REPORTS_FINAL_DIR="${ROBOT_REPORTS_DIR}"
8 | else
9 | REPORTS_DIR_HAS_TRAILING_SLASH=`echo ${ROBOT_REPORTS_DIR} | grep -c '/$'`
10 |
11 | if [ ${REPORTS_DIR_HAS_TRAILING_SLASH} -eq 0 ]
12 | then
13 | ROBOT_REPORTS_FINAL_DIR="${ROBOT_REPORTS_DIR}${ROBOT_TEST_RUN_ID}"
14 | else
15 | ROBOT_REPORTS_FINAL_DIR="${ROBOT_REPORTS_DIR}/${ROBOT_TEST_RUN_ID}"
16 | fi
17 | fi
18 |
19 | # Ensure the output folder exists
20 | mkdir -p ${ROBOT_REPORTS_FINAL_DIR}
21 |
22 | # Check if additional dependencies should be installed via pip
23 | if [ -e "/opt/robotframework/pip-requirements.txt" ]
24 | then
25 | echo "Installing pip dependencies..."
26 |
27 | mkdir -p ${ROBOT_DEPENDENCY_DIR}
28 | pip install -r /opt/robotframework/pip-requirements.txt -t ${ROBOT_DEPENDENCY_DIR}
29 |
30 | export PYTHONPATH=${ROBOT_DEPENDENCY_DIR}:${PYTHONPATH}
31 | fi
32 |
33 | # No need for the overhead of Pabot if no parallelisation is required
34 | if [ $ROBOT_THREADS -eq 1 ]
35 | then
36 | xvfb-run \
37 | --server-args="-screen 0 ${SCREEN_WIDTH}x${SCREEN_HEIGHT}x${SCREEN_COLOUR_DEPTH} -ac" \
38 | robot \
39 | --outputDir $ROBOT_REPORTS_FINAL_DIR \
40 | ${ROBOT_OPTIONS} \
41 | $ROBOT_TESTS_DIR
42 | else
43 | xvfb-run \
44 | --server-args="-screen 0 ${SCREEN_WIDTH}x${SCREEN_HEIGHT}x${SCREEN_COLOUR_DEPTH} -ac" \
45 | pabot \
46 | --verbose \
47 | --processes $ROBOT_THREADS \
48 | ${PABOT_OPTIONS} \
49 | --outputDir $ROBOT_REPORTS_FINAL_DIR \
50 | ${ROBOT_OPTIONS} \
51 | $ROBOT_TESTS_DIR
52 | fi
53 |
54 | ROBOT_EXIT_CODE=$?
55 |
56 | if [ ${AWS_UPLOAD_TO_S3} = true ]
57 | then
58 | echo "Uploading report to AWS S3..."
59 | aws s3 sync $ROBOT_REPORTS_FINAL_DIR/ s3://${AWS_BUCKET_NAME}/robot-reports/
60 | echo "Reports have been successfully uploaded to AWS S3!"
61 | fi
62 |
63 | exit $ROBOT_EXIT_CODE
64 |
--------------------------------------------------------------------------------
/test/browser-library.robot:
--------------------------------------------------------------------------------
1 | *** Settings ***
2 | Library Browser
3 |
4 | *** Variables ***
5 | # There is a conflict between browser names used by Selenium (using "chrome") and Browser (using "chromium")
6 | # Additionally, the Browser library isn't flexible at all and forbids any branded browser
7 | # See SupportedBrowsers: https://marketsquare.github.io/robotframework-browser/Browser.html#New%20Browser
8 | ${BROWSER} %{BROWSER}
9 |
10 | *** Test Cases ***
11 | Visit Bing
12 | Run Keyword If "${BROWSER}" == 'chrome' or "${BROWSER}" == 'edge' New Browser chromium
13 | Run Keyword If "${BROWSER}" != 'chrome' and "${BROWSER}" != 'edge' New Browser browser=${BROWSER}
14 | New Page https://www.bing.com
15 | Take Screenshot
16 |
17 | Visit Google
18 | Run Keyword If "${BROWSER}" == 'chrome' or "${BROWSER}" == 'edge' New Browser chromium
19 | Run Keyword If "${BROWSER}" != 'chrome' and "${BROWSER}" != 'edge' New Browser browser=${BROWSER}
20 | New Page https://www.google.com
21 | Take Screenshot
22 |
23 | Visit Yahoo
24 | Run Keyword If "${BROWSER}" == 'chrome' or "${BROWSER}" == 'edge' New Browser chromium
25 | Run Keyword If "${BROWSER}" != 'chrome' and "${BROWSER}" != 'edge' New Browser browser=${BROWSER}
26 | New Page https://search.yahoo.com
27 | Take Screenshot
28 |
--------------------------------------------------------------------------------
/test/faker.robot:
--------------------------------------------------------------------------------
1 | *** Settings ***
2 | Force Tags faker
3 | Test Timeout 1 minute
4 | Library FakerLibrary
5 |
6 | *** Test Cases ***
7 | Can Get Fake Name
8 | ${name}= FakerLibrary.Name
9 | Should Not Be Empty ${name}
10 |
11 | Two Calls To Faker Should Give Different Results
12 | ${name}= FakerLibrary.Name
13 | Should Not Be Empty ${name}
14 | ${name2}= FakerLibrary.Name
15 | Should Not Be Empty ${name2}
16 | Should Not Be Equal As Strings ${name} ${name2}
17 |
18 | Can call Words with integer argument
19 | ${WordsList}= Words nb=${10}
20 | Log ${WordsList}
21 | Length Should Be ${WordsList} 10
22 |
23 | Can call Words with str integer argument
24 | ${WordsList}= Words nb=10
25 | Log ${WordsList}
26 | Length Should Be ${WordsList} 10
27 |
28 | Can call SHA-1
29 | SHA1
30 | SHA1 ${True}
31 | SHA1 ${False}
32 | SHA1 True
33 | SHA1 False
34 |
35 | Can Lexify
36 | ${lexed}= Lexify blah???
37 | Length Should Be ${lexed} 7
38 | Should Start With ${lexed} blah
39 |
40 | Can call Password
41 | ${pass}= Password
42 | Length Should Be ${pass} 10
43 | ${pass}= Password ${5}
44 | Length Should Be ${pass} 5
45 | ${pass}= Password 5
46 | Length Should Be ${pass} 5
47 | ${pass}= Password special_chars=${False}
48 | ${pass}= Password special_chars=${True}
49 | ${pass}= Password digits=${True}
50 | ${pass}= Password digits=${False}
51 | ${pass}= Password digits=True
52 | ${pass}= Password digits=False
53 | ${pass}= Password upper_case=${True}
54 | ${pass}= Password lower_case=${True}
55 | ${pass}= Password digits=${False}
56 | ${pass}= Password 5823 ${True} ${False} ${True} ${True}
57 | Length Should Be ${pass} 5823
58 | ${pass}= Password ${5823} ${True} ${False} ${True} ${True}
59 | Length Should Be ${pass} 5823
--------------------------------------------------------------------------------
/test/pip-dependencies/main.robot:
--------------------------------------------------------------------------------
1 | # This test scenario was taken from https://github.com/FormulatedAutomation/robotframework-otp
2 |
3 | *** Settings ***
4 | Library OTP
5 | Library DateTime
6 |
7 | *** Variables ***
8 | ${SECRET} base32secret
9 |
10 | *** Test Cases ***
11 | Get OTP from secret
12 | ${otp}= Get OTP ${SECRET}
13 | Log To Console ${SECRET}
14 | Should Match Regexp ${otp} \\d{6}
15 |
16 | Get OTP from secret with time
17 | ${timestamp}= Convert Date ${1402481262} epoch
18 | ${otp}= Get OTP ${SECRET} ${timestamp}
19 | Should Match Regexp ${otp} \\d{6}
20 | Should Be Equal As Strings ${otp} 055118
21 |
--------------------------------------------------------------------------------
/test/pip-dependencies/requirements.txt:
--------------------------------------------------------------------------------
1 | pyotp==2.9.0
2 | robotframework-otp==1.1.0
3 |
--------------------------------------------------------------------------------
/test/requests.robot:
--------------------------------------------------------------------------------
1 | *** Settings ***
2 | Library Collections
3 | Library String
4 | Library RequestsLibrary
5 | Library OperatingSystem
6 |
7 | Suite Teardown Delete All Sessions
8 |
9 | *** Test Cases ***
10 | Get Requests
11 | [Tags] get
12 | Create Session google http://www.google.com
13 | Create Session bing https://www.bing.com verify=True
14 | ${resp}= GET On Session google /
15 | Should Be Equal As Strings ${resp.status_code} 200
16 | ${resp}= GET On Session bing /
17 | Should Be Equal As Strings ${resp.status_code} 200
18 |
--------------------------------------------------------------------------------
/test/selenium.robot:
--------------------------------------------------------------------------------
1 | *** Settings ***
2 | Library SeleniumLibrary
3 |
4 | *** Variables ***
5 | ${BROWSER} %{BROWSER}
6 |
7 | *** Test Cases ***
8 | Visit Bing
9 | Open Browser https://www.bing.com ${BROWSER}
10 | Capture Page Screenshot
11 |
12 | Visit Google
13 | Open Browser https://www.google.com ${BROWSER}
14 | Capture Page Screenshot
15 |
--------------------------------------------------------------------------------
/test/timezones.robot:
--------------------------------------------------------------------------------
1 | *** Settings ***
2 | Force Tags timezone
3 | Test Timeout 1 minute
4 | Library DateTimeTZ
5 |
6 | *** Test Cases ***
7 | Get Time with Datetime
8 | ${ts}= Get Timestamp
9 | Set Test Message ${ts}
--------------------------------------------------------------------------------