Could not connect to the playwright process at port XXXXX

Sorry for inactivity!

Exactly now, I managed to solve this problem! I spent days without working on it because I was exhausted from working on this issue so much and couldn’t make any progress.

My solution:
I noticed that both the playwright/robotframework-browser image and my own image installed everything correctly, but when running the test suite, the automation was trying to find a Playwright process in a different path. So, I started by setting an environment variable in an entrypoint .sh file:

export PLAYWRIGHT_BROWSERS_PATH=0

Just by doing this, the automation started finding the Playwright process. After that, I only needed to fix a virtual display issue using this command in the entrypoint:

xvfb-run --auto-servernum --server-args='-screen 0 1920x1080x24' robot /python/ui_test_automation/source/tests

Below, I show how my Dockerfile with the entrypoint looks:

Dockerfile:

FROM marketsquare/robotframework-browser:16.0.2

RUN python3 -m pip install --no-cache-dir \
    git+https://user:PAT@dev.azure.com/ORG/REPO/_git/UIAutomationCommons


WORKDIR /python/ui_test_automation

COPY . .

CMD ["./entrypoint.sh"]

entrypoint.sh

#!/bin/sh

export DISPLAY=:99
export PLAYWRIGHT_BROWSERS_PATH=0

Xvfb :99 -screen 0 1920x1080x24 &

xvfb-run --auto-servernum --server-args='-screen 0 1920x1080x24' robot /python/ui_test_automation/source/tests > /proc/1/fd/1 2>/proc/1/fd/2

2 Likes