Jump to content

Selenium/How-to/Make the browser visible or hidden

From mediawiki.org

Follow the instructions located at Run tests targeting MediaWiki-Docker. For information on which environments support a visible browser, see the Selenium/Reference/Running tests page.

Browser visibility in Docker is controlled by the DISPLAY environment variable. This variable is by default not set on macOS. It is by default set on Ubuntu Linux.

Visible

[edit]

To make the browser visible, make sure the DISPLAY environment variable is set to any value.

export DISPLAY=:1

If the value for your DISPLAY variable starts with a colon, it will trigger ffmpeg to record a video of the test running. Since video recordings are only supported on Linux, if you are on a different OS, make sure your value for DISPLAY does not start with a colon.

export DISPLAY=1

Hidden

[edit]

To make the browser hidden, make sure the DISPLAY environment variable is not set.

unset DISPLAY

Run Selenium tests

[edit]
npm run selenium-test