From db18fecfc68be8c0437f244154c2587c9c709dc5 Mon Sep 17 00:00:00 2001 From: Christian Zahl Date: Thu, 2 Apr 2026 11:38:57 +0200 Subject: [PATCH 01/16] test: .bat to run the container on windows --- scripts/run-in-test-container.bat | 1 + 1 file changed, 1 insertion(+) create mode 100644 scripts/run-in-test-container.bat diff --git a/scripts/run-in-test-container.bat b/scripts/run-in-test-container.bat new file mode 100644 index 0000000..a771b68 --- /dev/null +++ b/scripts/run-in-test-container.bat @@ -0,0 +1 @@ +docker run -it --rm --ipc=host -v.:/robotframework-dashboard test-dashboard /bin/bash -c "pip install .; %*" From 9b3dd923562eb090874a88b6ad98b9f915d88862 Mon Sep 17 00:00:00 2001 From: Christian Zahl Date: Fri, 3 Apr 2026 08:37:14 +0200 Subject: [PATCH 02/16] fix: relative directory level after refactor --- tests/robot/resources/keywords/general-keywords.resource | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/robot/resources/keywords/general-keywords.resource b/tests/robot/resources/keywords/general-keywords.resource index a67ce5d..64e76c6 100644 --- a/tests/robot/resources/keywords/general-keywords.resource +++ b/tests/robot/resources/keywords/general-keywords.resource @@ -44,7 +44,7 @@ Generate Dashboard Log ${output} Remove Database And Dashboard - ${files} List Files In Directory path=${CURDIR}/../../.. + ${files} List Files In Directory path=${CURDIR}/../../../.. FOR ${file} IN @{files} IF ('.db' in $file or '.html' in $file) and not ('robotresults_' in $file or 'robotdashboard_' in $file) Remove File path=${file} From 03e4f20fa45c426e1c99ce1e1e86de6ba4ad135b Mon Sep 17 00:00:00 2001 From: Christian Zahl Date: Fri, 3 Apr 2026 09:05:05 +0200 Subject: [PATCH 03/16] test: carve out dockerfile to build test image --- scripts/create-test-image.sh | 25 +++---------------------- tests/test-image.dockerfile | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+), 22 deletions(-) create mode 100644 tests/test-image.dockerfile diff --git a/scripts/create-test-image.sh b/scripts/create-test-image.sh index 5bbf669..e750b72 100644 --- a/scripts/create-test-image.sh +++ b/scripts/create-test-image.sh @@ -7,30 +7,11 @@ die() { echo "FATAL: $*"; exit 1; } docker -v || die "docker seems not being installed" -docker build --tag test-dashboard -f - . < Date: Fri, 3 Apr 2026 09:05:32 +0200 Subject: [PATCH 04/16] test: support docker tests under windows --- scripts/create-test-image.bat | 13 +++++++++++++ scripts/run-in-test-container.bat | 27 ++++++++++++++++++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 scripts/create-test-image.bat diff --git a/scripts/create-test-image.bat b/scripts/create-test-image.bat new file mode 100644 index 0000000..f21fcc7 --- /dev/null +++ b/scripts/create-test-image.bat @@ -0,0 +1,13 @@ +@REM Creates a docker image to used to run tests locally, without +@REM installing all the required tool into your system + +docker build --tag test-dashboard -f tests\test-image.dockerfile %* . + +@REM To run the container in an interactive mode: +@REM docker run -it --rm --ipc=host -v.:/robotframework-dashboard test-dashboard +@REM Within the container install the current code from the working directory +@REM pip install . +@REM add the ~/.local/bin to your path +@REM export PATH=$PATH:~/.local/bin +@REM and run the tests, e.g. +@REM robot tests/robot/testsuites/06_filters.robot diff --git a/scripts/run-in-test-container.bat b/scripts/run-in-test-container.bat index a771b68..8782465 100644 --- a/scripts/run-in-test-container.bat +++ b/scripts/run-in-test-container.bat @@ -1 +1,26 @@ -docker run -it --rm --ipc=host -v.:/robotframework-dashboard test-dashboard /bin/bash -c "pip install .; %*" +@docker -v +@IF %ERRORLEVEL% == 0 GOTO DOCKER_FOUND +@ECHO Could not start the docker command. Make sure that you have installed +@ECHO Docker Desktop on your system (see CONTRIBUTING.md) +@EXIT 1 + +:DOCKER_FOUND +@SET IMAGE_ID= +@FOR /F %%I IN ('docker image ls -q test-dashboard') DO @SET "IMAGE_ID=%%I" +@IF NOT [%IMAGE_ID%] == [] GOTO IMAGE_FOUND + +:IMAGE_FOUND +@IF exist robotframework_dashboard\robotdashboard.py GOTO WORKSPACE_FOUND +@ECHO It looks like that you are not in the top-level workspace directory of the +@ECHO robotframework_dashboard repository. Please start this script from there. +@EXIT 1 + +:WORKSPACE_FOUND +@IF NOT [%1] == [] GOTO CMD_GIVEN +docker run -it --rm --ipc=host -v.:/robotframework-dashboard test-dashboard +@GOTO END + +:CMD_GIVEN +@docker run -it --rm --ipc=host -v.:/robotframework-dashboard test-dashboard /bin/bash -c "pip install .; %*" + +:END From 67750c24b2e2ec933a3d55aae1fb8b473d4f40b4 Mon Sep 17 00:00:00 2001 From: Christian Zahl Date: Fri, 3 Apr 2026 09:17:24 +0200 Subject: [PATCH 05/16] doc: docker usage and setup for testing under windows --- CONTRIBUTING.md | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 77617a0..1ac1639 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -63,15 +63,25 @@ Using a Docker container to run the tests in avoids both, messing up your local To run all the tests in the Docker container in the same way as in the GitHub action: ```bash +# Linux bash scripts/run-in-test-container.sh bash scripts/robot-tests.sh +# Windows +C:> scripts\run-in-test-container.bat bash scripts/robot-tests.sh ``` + To run a individual tests out of a suite: ```bash +# Linux bash scripts/run-in-test-container.sh robot -t "*version*" tests/robot/testsuites/00_cli.robot +# Windows +C:> scripts\run-in-test-container.bat robot -t "*version*" tests/robot/testsuites/00_cli.robot ``` To run a single test suite in such a container: ```bash +# Linux bash scripts/run-in-test-container.sh robot tests/robot/testsuites/02_overview.robot +# Windows +C:> scripts\run-in-test-container.bat robot tests/robot/testsuites/02_overview.robot ``` > Note: It is not required to run any `pip install .` as this will be done by the script within the Docker container. @@ -88,16 +98,23 @@ Using the script requires that you are in the top-level directory of your workin #### Prerequisuites and Setup Running the tests in a Docker container requires a working docker installation. To check if your system has Docker installed check for the version: ```bash +# Linux $ docker -v Docker version 29.3.0, build 5927d80 +# Windows +C:> docker -v +Docker version 29.3.1, build c2be9cc ``` -If you have no Docker installer yet, follow the instructions to [Install Docker Engine](https://docs.docker.com/engine/install/) depending on your OS. One way is to use the *convenient script*: +If you have no Docker installer yet, follow the instructions to [Install Docker Engine](https://docs.docker.com/engine/install/) depending on your Linux OS. One way is to use the *convenient script*: ```bash $ curl -fsSL https://get.docker.com -o get-docker.sh $ sudo sh get-docker.sh ``` +If you are running on Windows, follow the instructions in [Install Docker Desktop on Windows](https://docs.docker.com/desktop/setup/install/windows-install/) + Once Docker is available verify if you are allowed to run docker commands. ```bash +# Linux $ docker ps permission denied while trying to connect to the docker API at unix:///var/run/docker.sock ``` @@ -107,10 +124,13 @@ $ sudo usermod -aG docker $USER ``` Don't forget to relogin to make the new group membership effective for your user. -#### Creating the the Docker Image +#### Creating the Docker Image Once Docker is working you need to generate an *image*. The image can be easily created by: ```bash +# Linux $ bash scripts/create-test-image.sh +# Windows +C:> scripts\create-test-image.bat ``` > Note: If you are not familar with docker, imagine an *image* as an ISO image of a Linux live-CD. It is an immutable preconfigured setup of an OS which can be used to run it without installing. @@ -121,7 +141,13 @@ The image is created in the following steps: - Installs all the project requirements to perform the tests from `requirements-test.txt` - Initializes the `robotframework-browser` library - Creates a working directory `/robotframework-dashboard` -The image created is being used whenever a new docker container is launched by the `scripts/run-in-test-container.sh`. The image is static. To address changes in the `requirements-test.txt` you can recreate (and replace) the image by running the `create-test-image.sh` once again. +The image created is being used whenever a new docker container is launched by the `scripts/run-in-test-container.sh`. The image is static. To address changes in the `requirements-test.txt` you can recreate (and replace) the image by running the `create-test-image.sh` or `create-test-image.bat` once again. You can also force a complete requild of the image by: +```bash +# Linux +$ bash scripts/create-test-image.sh --no-cache +# Windows +C:> scripts\create-test-image.bat --no-cache +``` ## 📖 Docs From 774662f6724f91461e87b92b4af3634cec80974f Mon Sep 17 00:00:00 2001 From: Christian Zahl Date: Sun, 5 Apr 2026 12:01:34 +0200 Subject: [PATCH 06/16] doc: (from tim) fix script names after refactoring --- CONTRIBUTING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1ac1639..e8d1968 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -21,7 +21,7 @@ There are three levels of tests in this project: ### Python Unit Tests Python unit tests are located in `tests/python/` and run with pytest. ```sh -bash scripts/unittests.sh +bash scripts/python-tests.sh ``` ### JavaScript Unit Tests @@ -32,7 +32,7 @@ npm run test:js ``` Or on Windows: ``` -scripts\jstests.bat +scripts\javascript-tests.bat ``` To run in watch mode during development: ```sh From 449633f76d8aa58b303c703fd12b3ef7a849ab84 Mon Sep 17 00:00:00 2001 From: Christian Zahl Date: Sun, 5 Apr 2026 12:02:20 +0200 Subject: [PATCH 07/16] test: refactor docker scripts --- scripts/{ => docker}/create-test-image.sh | 13 ++++++-- scripts/docker/run-in-container.sh | 24 +++++++++++++++ scripts/docker/run-in-robot-container.sh | 6 ++++ .../docker/test-dashboard-robot.dockerfile | 0 scripts/run-in-test-container.sh | 30 ------------------- 5 files changed, 41 insertions(+), 32 deletions(-) rename scripts/{ => docker}/create-test-image.sh (59%) create mode 100644 scripts/docker/run-in-container.sh create mode 100644 scripts/docker/run-in-robot-container.sh rename tests/test-image.dockerfile => scripts/docker/test-dashboard-robot.dockerfile (100%) delete mode 100644 scripts/run-in-test-container.sh diff --git a/scripts/create-test-image.sh b/scripts/docker/create-test-image.sh similarity index 59% rename from scripts/create-test-image.sh rename to scripts/docker/create-test-image.sh index e750b72..7852656 100644 --- a/scripts/create-test-image.sh +++ b/scripts/docker/create-test-image.sh @@ -5,12 +5,21 @@ die() { echo "FATAL: $*"; exit 1; } +IMAGE= + +[ $# -gt 0 ] || die "Missing argument for container type (robot, python, js) to use" +[ "$1" = robot ] && IMAGE=test-dashboard-robot +[ "$1" = python ] && IMAGE=test-dashboard-python +[ "$1" = js ] && IMAGE=test-dashboard-js +[ -n "$IMAGE" ] || die "Unknown container type ($1)" +shift + docker -v || die "docker seems not being installed" -docker build --tag test-dashboard -f tests/test-image.dockerfile "${@}" . +docker build --tag $IMAGE -f scripts/docker/$IMAGE.dockerfile "${@}" . # To run the container in an interactive mode: -# docker run -it --rm --ipc=host -v.:/robotframework-dashboard --user 1000:1000 test-dashboard +# docker run -it --rm --ipc=host -v.:/robotframework-dashboard --user 1000:1000 test-dashboard-robot # Within the container install the current code from the working directory # pip install . # add the ~/.local/bin to your path diff --git a/scripts/docker/run-in-container.sh b/scripts/docker/run-in-container.sh new file mode 100644 index 0000000..c416910 --- /dev/null +++ b/scripts/docker/run-in-container.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +die() { echo "FATAL: $*"; exit 1; } +IMAGE= + +[ $# -gt 0 ] || die "Missing argument for container type (robot, python, js) to use" +[ $# -gt 1 ] || die "Missing command to run in the container" +[ "$1" = robot ] && IMAGE=test-dashboard-robot +[ "$1" = python ] && IMAGE=test-dashboard-python +[ "$1" = js ] && IMAGE=test-dashboard-js +[ -n "$IMAGE" ] || die "Unknown container type ($1)" +shift + +docker -v 2> /dev/null || + die "Docker seems not being installed" +[ -n "$(docker images -q "$IMAGE" 2> /dev/null)" ] || + die "Docker image $IMAGE not found, please run 'scripts/docker/create-test-image.sh $1'" +[ -d .git ] || + die "you need to start this script from the toplevel directory of the robotframework-dashboard repository" + +my_uid=$(id -u) +my_gid=$(id -g) + +docker run -it --rm --ipc=host -v.:/robotframework-dashboard --user ${my_uid}:${my_gid} $IMAGE "${@}" diff --git a/scripts/docker/run-in-robot-container.sh b/scripts/docker/run-in-robot-container.sh new file mode 100644 index 0000000..0204468 --- /dev/null +++ b/scripts/docker/run-in-robot-container.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +echo "Deploying current workingdirectory into the container and running" +echo " $*" +echo "" +bash scripts/docker/run-in-container.sh robot /bin/bash -c "pip install .; export PATH=\$PATH:~/.local/bin; ${*}" diff --git a/tests/test-image.dockerfile b/scripts/docker/test-dashboard-robot.dockerfile similarity index 100% rename from tests/test-image.dockerfile rename to scripts/docker/test-dashboard-robot.dockerfile diff --git a/scripts/run-in-test-container.sh b/scripts/run-in-test-container.sh deleted file mode 100644 index ece9c93..0000000 --- a/scripts/run-in-test-container.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env bash - -IMAGE=test-dashboard - -die() { echo "FATAL: $*"; exit 1; } - -docker -v 2> /dev/null || - die "docker seems not being installed" -[ -n "$(docker images -q "$IMAGE" 2> /dev/null)" ] || - die "image $IMAGE not found, please run scripts/create-test-image.sh" -[ -d .git ] || - die "you need to start this script from the toplevel directory of the robotframework-dashboard repository" - -my_uid=$(id -u) -my_gid=$(id -g) - -if [ $# = 0 ]; then - echo "No arguments given, starting container with interactive terminal" - echo "Hint: don't forget to install the dashboard from the git repository in the container:" - echo " pip install . && export PATH=\$PATH:~/.local/bin" - echo "" - docker run -it --rm --ipc=host -v.:/robotframework-dashboard --user ${my_uid}:${my_gid} test-dashboard -else - echo "Deploying current workingdirectory into the container and running" - echo " $*" - echo "" - docker run -it --rm --ipc=host -v.:/robotframework-dashboard --user ${my_uid}:${my_gid} test-dashboard \ - /bin/bash -c \ - "pip install .; export PATH=\$PATH:~/.local/bin; ${*}" -fi From 05deab5881b8ef827670994e0a66add3cc3f23fe Mon Sep 17 00:00:00 2001 From: Christian Zahl Date: Sun, 5 Apr 2026 12:02:44 +0200 Subject: [PATCH 08/16] test: add docker image for python tests --- scripts/docker/run-in-python-container.sh | 3 +++ .../docker/test-dashboard-python.dockerfile | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 scripts/docker/run-in-python-container.sh create mode 100644 scripts/docker/test-dashboard-python.dockerfile diff --git a/scripts/docker/run-in-python-container.sh b/scripts/docker/run-in-python-container.sh new file mode 100644 index 0000000..641ffcb --- /dev/null +++ b/scripts/docker/run-in-python-container.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +bash scripts/docker/run-in-container.sh python "${@}" diff --git a/scripts/docker/test-dashboard-python.dockerfile b/scripts/docker/test-dashboard-python.dockerfile new file mode 100644 index 0000000..7482fec --- /dev/null +++ b/scripts/docker/test-dashboard-python.dockerfile @@ -0,0 +1,19 @@ +# Base of the image is the latest ubuntu like 24.04 LTS +FROM ubuntu:latest + +RUN << FOE + # install python + apt-get update + + apt-get install -y python3.12 python3 python-is-python3 python3-pip +FOE + +# we need the test requirements file withing the image to install them +COPY requirements-dev.txt /tmp/requirements-dev.txt +RUN << FOE + # Install requirements + pip3 install -r /tmp/requirements-dev.txt --break-system-packages +FOE + +# create a workspace directory, where we mount the repo into +WORKDIR /robotframework-dashboard From 14b650e4f73f6d2fbf220c0f7124522c34d1f67a Mon Sep 17 00:00:00 2001 From: Christian Zahl Date: Mon, 6 Apr 2026 08:25:36 +0200 Subject: [PATCH 09/16] test: run container in git bash --- scripts/docker/run-in-container.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/docker/run-in-container.sh b/scripts/docker/run-in-container.sh index c416910..b2a50d9 100644 --- a/scripts/docker/run-in-container.sh +++ b/scripts/docker/run-in-container.sh @@ -18,7 +18,7 @@ docker -v 2> /dev/null || [ -d .git ] || die "you need to start this script from the toplevel directory of the robotframework-dashboard repository" -my_uid=$(id -u) -my_gid=$(id -g) +USER_MAPPING="--user $(id -i):$(id -g)" +[ "$(uname -o)" = Msys ] && USER_MAPPING="" -docker run -it --rm --ipc=host -v.:/robotframework-dashboard --user ${my_uid}:${my_gid} $IMAGE "${@}" +docker run -it --rm --ipc=host -v"./$(pwd)":/robotframework-dashboard $USER_MAPPING $IMAGE "${@}" From 4393cf4cb5dca95e0bf8178234f927dc03bd0b76 Mon Sep 17 00:00:00 2001 From: Christian Zahl Date: Mon, 6 Apr 2026 08:36:34 +0200 Subject: [PATCH 10/16] test: fix typo --- scripts/docker/run-in-container.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/docker/run-in-container.sh b/scripts/docker/run-in-container.sh index b2a50d9..112f38a 100644 --- a/scripts/docker/run-in-container.sh +++ b/scripts/docker/run-in-container.sh @@ -18,7 +18,7 @@ docker -v 2> /dev/null || [ -d .git ] || die "you need to start this script from the toplevel directory of the robotframework-dashboard repository" -USER_MAPPING="--user $(id -i):$(id -g)" +USER_MAPPING="--user $(id -u):$(id -g)" [ "$(uname -o)" = Msys ] && USER_MAPPING="" -docker run -it --rm --ipc=host -v"./$(pwd)":/robotframework-dashboard $USER_MAPPING $IMAGE "${@}" +docker run -it --rm --ipc=host -v"/$(pwd)":/robotframework-dashboard $USER_MAPPING $IMAGE "${@}" From 6e06ffc718f27c60ea4486f2c5af2183f4574312 Mon Sep 17 00:00:00 2001 From: Christian Zahl Date: Thu, 9 Apr 2026 22:01:05 +0200 Subject: [PATCH 11/16] test: script fro running in js container --- scripts/create-test-image.bat | 13 ----------- scripts/docker/run-in-container.sh | 2 +- scripts/docker/run-in-js-container.sh | 5 ++++ scripts/docker/test-dashboard-js.dockerfile | 24 +++++++++++++++++++ scripts/run-in-test-container.bat | 26 --------------------- 5 files changed, 30 insertions(+), 40 deletions(-) delete mode 100644 scripts/create-test-image.bat create mode 100644 scripts/docker/run-in-js-container.sh create mode 100644 scripts/docker/test-dashboard-js.dockerfile delete mode 100644 scripts/run-in-test-container.bat diff --git a/scripts/create-test-image.bat b/scripts/create-test-image.bat deleted file mode 100644 index f21fcc7..0000000 --- a/scripts/create-test-image.bat +++ /dev/null @@ -1,13 +0,0 @@ -@REM Creates a docker image to used to run tests locally, without -@REM installing all the required tool into your system - -docker build --tag test-dashboard -f tests\test-image.dockerfile %* . - -@REM To run the container in an interactive mode: -@REM docker run -it --rm --ipc=host -v.:/robotframework-dashboard test-dashboard -@REM Within the container install the current code from the working directory -@REM pip install . -@REM add the ~/.local/bin to your path -@REM export PATH=$PATH:~/.local/bin -@REM and run the tests, e.g. -@REM robot tests/robot/testsuites/06_filters.robot diff --git a/scripts/docker/run-in-container.sh b/scripts/docker/run-in-container.sh index 112f38a..47a70bb 100644 --- a/scripts/docker/run-in-container.sh +++ b/scripts/docker/run-in-container.sh @@ -15,7 +15,7 @@ docker -v 2> /dev/null || die "Docker seems not being installed" [ -n "$(docker images -q "$IMAGE" 2> /dev/null)" ] || die "Docker image $IMAGE not found, please run 'scripts/docker/create-test-image.sh $1'" -[ -d .git ] || +[ -f robotframework_dashboard/robotdashboard.py ] || die "you need to start this script from the toplevel directory of the robotframework-dashboard repository" USER_MAPPING="--user $(id -u):$(id -g)" diff --git a/scripts/docker/run-in-js-container.sh b/scripts/docker/run-in-js-container.sh new file mode 100644 index 0000000..e923039 --- /dev/null +++ b/scripts/docker/run-in-js-container.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +echo "Installing node.js dependencies and running '$*'" + +bash scripts/docker/run-in-container.sh js bash -c "npm ci; ${*}" diff --git a/scripts/docker/test-dashboard-js.dockerfile b/scripts/docker/test-dashboard-js.dockerfile new file mode 100644 index 0000000..bedc0e0 --- /dev/null +++ b/scripts/docker/test-dashboard-js.dockerfile @@ -0,0 +1,24 @@ +# Base of the image is the latest ubuntu like 24.04 LTS +FROM ubuntu:latest + +RUN << FOE + # Install prereqs + apt-get update + + apt install -y curl +FOE + +RUN << FOE + # Download and install nvm: + curl -fsSL https://deb.nodesource.com/setup_24.x | bash - + apt install -y nodejs + + # Verify the Node.js version: + node -v # Should print "v24.14.1". + + # Verify npm version: + npm -v # Should print "11.11.0". +FOE + +# create a workspace directory, where we mount the repo into +WORKDIR /robotframework-dashboard diff --git a/scripts/run-in-test-container.bat b/scripts/run-in-test-container.bat deleted file mode 100644 index 8782465..0000000 --- a/scripts/run-in-test-container.bat +++ /dev/null @@ -1,26 +0,0 @@ -@docker -v -@IF %ERRORLEVEL% == 0 GOTO DOCKER_FOUND -@ECHO Could not start the docker command. Make sure that you have installed -@ECHO Docker Desktop on your system (see CONTRIBUTING.md) -@EXIT 1 - -:DOCKER_FOUND -@SET IMAGE_ID= -@FOR /F %%I IN ('docker image ls -q test-dashboard') DO @SET "IMAGE_ID=%%I" -@IF NOT [%IMAGE_ID%] == [] GOTO IMAGE_FOUND - -:IMAGE_FOUND -@IF exist robotframework_dashboard\robotdashboard.py GOTO WORKSPACE_FOUND -@ECHO It looks like that you are not in the top-level workspace directory of the -@ECHO robotframework_dashboard repository. Please start this script from there. -@EXIT 1 - -:WORKSPACE_FOUND -@IF NOT [%1] == [] GOTO CMD_GIVEN -docker run -it --rm --ipc=host -v.:/robotframework-dashboard test-dashboard -@GOTO END - -:CMD_GIVEN -@docker run -it --rm --ipc=host -v.:/robotframework-dashboard test-dashboard /bin/bash -c "pip install .; %*" - -:END From 8724d14f0c8667ecb9634f382868d00c71c8c198 Mon Sep 17 00:00:00 2001 From: Christian Zahl Date: Thu, 9 Apr 2026 22:01:38 +0200 Subject: [PATCH 12/16] test: docker related scripts for windows cmd --- scripts/docker/create-test-image.bat | 44 +++++++++++++++++++ scripts/docker/run-in-container.bat | 49 ++++++++++++++++++++++ scripts/docker/run-in-js-container.bat | 1 + scripts/docker/run-in-python-container.bat | 1 + scripts/docker/run-in-robot-container.bat | 3 ++ 5 files changed, 98 insertions(+) create mode 100644 scripts/docker/create-test-image.bat create mode 100644 scripts/docker/run-in-container.bat create mode 100644 scripts/docker/run-in-js-container.bat create mode 100644 scripts/docker/run-in-python-container.bat create mode 100644 scripts/docker/run-in-robot-container.bat diff --git a/scripts/docker/create-test-image.bat b/scripts/docker/create-test-image.bat new file mode 100644 index 0000000..2b25f62 --- /dev/null +++ b/scripts/docker/create-test-image.bat @@ -0,0 +1,44 @@ +@ECHO OFF +REM Creates a docker image to used to run tests locally, without +REM installing all the required tool into your system + +SET IMAGE= +IF [%1] == [] GOTO ARGS_MISSING +IF %1 == python SET IMAGE=test-dashboard-python +IF %1 == robot SET IMAGE=test-dashboard-robot +IF %1 == js SET IMAGE=test-dashboard-js +IF [%IMAGE%] == [] GOTO TYPE_UNKNOWN +SET IMAGE_TYPE=%1 +SHIFT + +REM Check for docker installation +docker -v +IF NOT %ERRORLEVEL% == 0 GOTO DOCKER_NOT_FOUND + +REM Start docker container +docker build --tag %IMAGE% -f scripts/docker/%IMAGE%.dockerfile %1 %2 %3 %4 %5 %6 %7 %8 %9 . + +REM To run the container in an interactive mode: +REM docker run -it --rm --ipc=host -v.:/robotframework-dashboard test-dashboard-robot +REM Within the container install the current code from the working directory +REM pip install . +REM add the ~/.local/bin to your path +REM export PATH=$PATH:~/.local/bin +REM and run the tests, e.g. +REM robot tests/robot/testsuites/06_filters.robot +GOTO END + +:ARGS_MISSING +ECHO Missing argument for container type (robot, python, js) to use +GOTO END + +:TYPE_UNKNOWN +ECHO Unknown container type (robot, python, js) to use +GOTO END + +:DOCKER_NOT_FOUND +ECHO Make sure that you have installed Docker Desktop on your system (see CONTRIBUTING.md) +GOTO END + +:END + diff --git a/scripts/docker/run-in-container.bat b/scripts/docker/run-in-container.bat new file mode 100644 index 0000000..ebdd2b4 --- /dev/null +++ b/scripts/docker/run-in-container.bat @@ -0,0 +1,49 @@ +@ECHO OFF + +SET IMAGE= +IF [%1] == [] GOTO ARGS_MISSING +IF %1 == python SET IMAGE=test-dashboard-python +IF %1 == robot SET IMAGE=test-dashboard-robot +IF %1 == js SET IMAGE=test-dashboard-js +IF [%IMAGE%] == [] GOTO TYPE_UNKNOWN +SET IMAGE_TYPE=%1 +SHIFT + +REM Check for docker installation +docker -v +IF NOT %ERRORLEVEL% == 0 GOTO DOCKER_NOT_FOUND + +REM Check for docker image +SET FOUND= +FOR /F %%I IN ('docker image ls -q %IMAGE%') DO SET "FOUND=%%I" +IF [%FOUND%] == [] GOTO IMAGE_NOT_FOUND + +REM Check for workspace +IF NOT EXIST robotframework_dashboard\robotdashboard.py GOTO WORKSPACE_NOT_FOUND + +REM Start docker container +docker run -it --rm --ipc=host -v.:/robotframework-dashboard %IMAGE% %1 %2 %3 %4 %5 %6 %7 %8 %9 +GOTO END + +:ARGS_MISSING +ECHO Missing argument for container type (robot, python, js) to use +GOTO END + +:TYPE_UNKNOWN +ECHO Unknown container type (%1) to use +GOTO END + +:IMAGE_NOT_FOUND +ECHO Missing container image %IMAGE%. You need to run scripts\docker\create-test-image.bat %IMAGE_TYPE% +GOTO END + +:WORKSPACE_NOT_FOUND +ECHO It looks like that you are not in the top-level workspace directory of the +ECHO robotframework_dashboard repository. Please start this script from there. +GOTO END + +:DOCKER_NOT_FOUND +ECHO Make sure that you have installed Docker Desktop on your system (see CONTRIBUTING.md) +GOTO END + +:END diff --git a/scripts/docker/run-in-js-container.bat b/scripts/docker/run-in-js-container.bat new file mode 100644 index 0000000..4d451f8 --- /dev/null +++ b/scripts/docker/run-in-js-container.bat @@ -0,0 +1 @@ +@scripts\docker\run-in-container.bat js bash -c "npm ci; %*" diff --git a/scripts/docker/run-in-python-container.bat b/scripts/docker/run-in-python-container.bat new file mode 100644 index 0000000..9eb958c --- /dev/null +++ b/scripts/docker/run-in-python-container.bat @@ -0,0 +1 @@ +@scripts\docker\run-in-container.bat python %* diff --git a/scripts/docker/run-in-robot-container.bat b/scripts/docker/run-in-robot-container.bat new file mode 100644 index 0000000..d603c10 --- /dev/null +++ b/scripts/docker/run-in-robot-container.bat @@ -0,0 +1,3 @@ +@ECHO OFF +ECHO Deploying current workingdirectory into the container and running "%*" +scripts\docker\run-in-container.bat robot /bin/bash -c "pip install .; export PATH=\$PATH:~/.local/bin; %*" From 44928d9e1e44b1dcfa0c94db1e110476efa91c6d Mon Sep 17 00:00:00 2001 From: Christian Zahl Date: Thu, 9 Apr 2026 22:02:15 +0200 Subject: [PATCH 13/16] doc: update for docker image usage for testing --- CONTRIBUTING.md | 86 +++++++++++++++++++++++++++++++++++++------------ 1 file changed, 65 insertions(+), 21 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e8d1968..6af23e2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -54,46 +54,68 @@ All tests run automatically in GitHub Actions. They are triggered through the `. Results can be found at the `PR > checks > Upload robot logs`. The check will have a failed status if any tests has failed. -### Running Tests Locally -Perhaps you want to run the tests locally on your PC before pushing and waiting for the results from the GitHub actions. But this requires to install the required components in your native PC. In most cases this will not work as expected bacause of the differemt versions used. E.g. screenshots taken during the tests may differ, so that the tests will fail. +## Running Tests Locally - in a Docker Container +Run the tests locally on your PC before pushing and waiting for the results from the GitHub actions is always a good idea. But this requires to install the required components in your native PC. In some cases this will not work as expected bacause of the differemt versions used. E.. screenshots taken during the tests may differ, so that the tests might fail. -Using a Docker container to run the tests in avoids both, messing up your local system with installing the required parts for the tests and getting failed tests due to your setup. +Using a Docker container to run the tests in avoids both, messing up your local system with installing the required parts for the tests and getting failed tests due to your setup. You just need to create the respective docker *images* by running the scripts as described below. > Note: To use this methond there is no need to understand how Docker is working in detail. -To run all the tests in the Docker container in the same way as in the GitHub action: +### Python Unit Tests - in Docker Container +To run the python based tests in a docker container, execute: ```bash # Linux -bash scripts/run-in-test-container.sh bash scripts/robot-tests.sh +bash scripts/docker/run-in-python-container.sh bash scripts/python-tests.sh # Windows -C:> scripts\run-in-test-container.bat bash scripts/robot-tests.sh +C:> scripts\docker\run-in-python-container.bat bash scripts/python-tests.sh +``` + +### JavaScript Unit Tests - in Docker Container +To run the javascript based tests in a docker container, execute: +```bash +# Linux +bash scripts/docker/run-in-js-container.sh bash scripts/javascript-tests.sh +# Windows +C:> scripts\docker\run-in-js-container.bat bash scripts/javascript-tests.sh +``` + +### Robot Framework End-to-End Tests - in Docker Container +To run all the robot framework end-to-end tests in the Docker container in the same way as in the GitHub action: +```bash +# Linux +bash scripts/docker/run-in-robot-container.sh bash scripts/robot-tests.sh +# Windows +C:> scripts\docker\run-in-robot-container.bat bash scripts/robot-tests.sh ``` To run a individual tests out of a suite: ```bash # Linux -bash scripts/run-in-test-container.sh robot -t "*version*" tests/robot/testsuites/00_cli.robot +bash scripts/docker/run-in-robot-container.sh robot -t "*version*" tests/robot/testsuites/00_cli.robot # Windows -C:> scripts\run-in-test-container.bat robot -t "*version*" tests/robot/testsuites/00_cli.robot +C:> scripts\docker\run-in-robot-container.bat robot -t "*version*" tests/robot/testsuites/00_cli.robot ``` To run a single test suite in such a container: ```bash # Linux -bash scripts/run-in-test-container.sh robot tests/robot/testsuites/02_overview.robot +bash scripts/docker/run-in-robot-container.sh robot tests/robot/testsuites/02_overview.robot # Windows -C:> scripts\run-in-test-container.bat robot tests/robot/testsuites/02_overview.robot +C:> scripts\docker\run-in-robot-container.bat robot tests/robot/testsuites/02_overview.robot ``` > Note: It is not required to run any `pip install .` as this will be done by the script within the Docker container. #### How does it Work -Using the script requires that you are in the top-level directory of your working copy of the git repository. When using the script, the following happens: +Using the scripts require that you are in the top-level directory of your working copy of the git repository. When using the script, the following happens: - It is launching a new Docker container based on the image created (see below) - The current working directory is getting mounted to `/robotframework-dashboard` within the container -- In the container the working copy is installed by `pip install .` +- Depending on the script / image you use: + - The python based container contains all the setup required to run the python utit tests. + - The javascript based container contains all the setup of node.js and npm. The dependenies are getting installed automatically by `npm ci`. + - The robot based container contains the setup to run robot framework tests. Your current version of the dashboard from the working directory is installed by `pip install .` - The arguments you provide are executed as a bash command within the container - Due to the mounted working directory all the generated results can be accessed directly -- Once the command is completed, the running container is stopped and throw away +- Once the command is completed, the running container is stopped and thrown away #### Prerequisuites and Setup Running the tests in a Docker container requires a working docker installation. To check if your system has Docker installed check for the version: @@ -124,29 +146,51 @@ $ sudo usermod -aG docker $USER ``` Don't forget to relogin to make the new group membership effective for your user. -#### Creating the Docker Image -Once Docker is working you need to generate an *image*. The image can be easily created by: +#### Creating the Docker Images +Once Docker is working you need to generate an *image* for each type of tests (python, javascript, robot framework). +> Note: If you are not familar with docker, imagine an *image* as an ISO image of a Linux live-CD. It is an immutable preconfigured setup of an OS which can be used to run it without installing. + +The respective image can be easily created by one of the following: ```bash # Linux -$ bash scripts/create-test-image.sh +$ bash scripts/docker/create-test-image.sh python +$ bash scripts/docker/create-test-image.sh js +$ bash scripts/docker/create-test-image.sh robot # Windows -C:> scripts\create-test-image.bat +C:> scripts\docker\create-test-image.bat python +C:> scripts\docker\create-test-image.bat js +C:> scripts\docker\create-test-image.bat robot ``` -> Note: If you are not familar with docker, imagine an *image* as an ISO image of a Linux live-CD. It is an immutable preconfigured setup of an OS which can be used to run it without installing. The image is created in the following steps: +##### Image for Python Tests +For the python based one: +- It is based on the public image `ubuntu:latest`, as of writing 24.04 LTS. +- Installs the latest `python3` and `pip` from the distribution +- Installs all the project requirements to perform the tests from `requirements-dev.txt` +- Creates and go into the working directory `/robotframework-dashboard` + +##### Image for Javascript Tests +For the javascript based one: +- It is based on the public image `ubuntu:latest`, as of writing 24.04 LTS. +- Installs `curl` and the latest `node.js v24` from the distribution +- Creates and go into the working directory `/robotframework-dashboard` + +##### Image for Robot Framework Tests +For the robot framework based one: - It is based on the public image `mcr.microsoft.com/playwright:v1.56.0-jammy`, a *framework for Web Testing and Automation*. - which is based on `ubuntu:jammy` (ubuntu 22.04) - Installs the latest `python3-pip` from the distribution - Installs all the project requirements to perform the tests from `requirements-test.txt` - Initializes the `robotframework-browser` library - Creates a working directory `/robotframework-dashboard` -The image created is being used whenever a new docker container is launched by the `scripts/run-in-test-container.sh`. The image is static. To address changes in the `requirements-test.txt` you can recreate (and replace) the image by running the `create-test-image.sh` or `create-test-image.bat` once again. You can also force a complete requild of the image by: + +The image created is being used whenever a new docker container is launched by the `scripts/docker/run-in-test-container.sh`. The image is static. To address changes in the `requirements-test.txt` you can recreate (and replace) the image by running the `create-test-image.sh` or `create-test-image.bat` once again. You can also force a complete requild of the image by: ```bash # Linux -$ bash scripts/create-test-image.sh --no-cache +$ bash scripts/docker/create-test-image.sh python --no-cache # Windows -C:> scripts\create-test-image.bat --no-cache +C:> scripts\docker\create-test-image.bat python --no-cache ``` ## 📖 Docs From ccf2451c7f67df5d73c182327451844557726e70 Mon Sep 17 00:00:00 2001 From: Tim de Groot Date: Mon, 13 Apr 2026 01:32:22 +0200 Subject: [PATCH 14/16] feat: add .gitattributes for automatic text handling and line endings for dockerfiles --- .gitattributes | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..642bfee --- /dev/null +++ b/.gitattributes @@ -0,0 +1,4 @@ +* text=auto + +*.dockerfile text eol=lf +*.sh text eol=lf From e910da2b5285ecebda8de9cbf3735dc1269fe91d Mon Sep 17 00:00:00 2001 From: Tim de Groot Date: Mon, 13 Apr 2026 01:32:37 +0200 Subject: [PATCH 15/16] fix: correct escaping of dollar sign in run-in-robot-container.bat --- scripts/docker/run-in-robot-container.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/docker/run-in-robot-container.bat b/scripts/docker/run-in-robot-container.bat index d603c10..9f5f2fe 100644 --- a/scripts/docker/run-in-robot-container.bat +++ b/scripts/docker/run-in-robot-container.bat @@ -1,3 +1,3 @@ @ECHO OFF ECHO Deploying current workingdirectory into the container and running "%*" -scripts\docker\run-in-container.bat robot /bin/bash -c "pip install .; export PATH=\$PATH:~/.local/bin; %*" +scripts\docker\run-in-container.bat robot /bin/bash -c "pip install .; export PATH=$PATH:~/.local/bin; %*" From 1640b9f3e393c578e9786bc2a2f847b23f052d9c Mon Sep 17 00:00:00 2001 From: Tim de Groot Date: Mon, 13 Apr 2026 01:33:49 +0200 Subject: [PATCH 16/16] doc: fix typos --- CONTRIBUTING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6af23e2..0b6a59c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -55,11 +55,11 @@ Results can be found at the `PR > checks > Upload robot logs`. The check will have a failed status if any tests has failed. ## Running Tests Locally - in a Docker Container -Run the tests locally on your PC before pushing and waiting for the results from the GitHub actions is always a good idea. But this requires to install the required components in your native PC. In some cases this will not work as expected bacause of the differemt versions used. E.. screenshots taken during the tests may differ, so that the tests might fail. +Run the tests locally on your PC before pushing and waiting for the results from the GitHub actions is always a good idea. But this requires to install the required components in your native PC. In some cases this will not work as expected bacause of the differemt versions used. E.g. screenshots taken during the tests may differ, so that the tests might fail. Using a Docker container to run the tests in avoids both, messing up your local system with installing the required parts for the tests and getting failed tests due to your setup. You just need to create the respective docker *images* by running the scripts as described below. -> Note: To use this methond there is no need to understand how Docker is working in detail. +> Note: To use this method there is no need to understand how Docker is working in detail. ### Python Unit Tests - in Docker Container To run the python based tests in a docker container, execute: