Commit e2a9f89b authored by Philippe Tassin's avatar Philippe Tassin Committed by Clement Bois
Browse files

fix(robot_cli): support running without xvfb-run

parent 6536173d
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -77,8 +77,9 @@ Notes:
custom certificate authorities (declared using either `$CUSTOM_CA_CERTS` or `$DEFAULT_CA_CERTS`). If you need it (need to call a server
with SSL certificate issued by a non-official certificate authority), then you'll have to build your own Docker image that either embeds
the required CA certificates, or that runs as `root` (thus the template will be able to install custom certificate authorities).
* The template runs [XVFB](https://www.x.org/releases/X11R7.6/doc/man/man1/Xvfb.1.xhtml) with `-screen` parameter
* The template runs [XVFB](https://www.x.org/releases/X11R7.6/doc/man/man1/Xvfb.1.xhtml) if available with `-screen` parameter
  `$ROBOT_SCREEN_WIDTHx$ROBOT_SCREEN_HEIGHTx$ROBOT_SCREEN_COLOUR_DEPTH` to run tests.
  When no xvfb-run command is available, robot/pabot are run directly (usefull for slim images when no playwright/browser is involved in tests, example : when testing REST APIs with Requests Library)
* Depending on the `ROBOT_THREADS` value, the template runs either [`robot`](https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#all-command-line-options)
  or [`pabot`](https://pabot.org/) (if `ROBOT_THREADS` > 1).
* Tests are run automatically on `master` and `develop` branches, and manually on others (may be overridden setting the
+9 −4
Original line number Diff line number Diff line
@@ -437,16 +437,21 @@ stages:
    then
      export ROBOT_SYSLOG_LEVEL=DEBUG
    fi
    # Build xvfb command if available
    if command -v xvfb-run > /dev/null
    then
      XVFB_PREFIX=(xvfb-run --server-args="-screen 0 ${ROBOT_SCREEN_WIDTH}x${ROBOT_SCREEN_HEIGHT}x${ROBOT_SCREEN_COLOUR_DEPTH} -ac")
    else
      XVFB_PREFIX=()
    fi
    if [ "$ROBOT_THREADS" -eq 1 ]
    then
      # shellcheck disable=SC2086
      xvfb-run \
        --server-args="-screen 0 ${ROBOT_SCREEN_WIDTH}x${ROBOT_SCREEN_HEIGHT}x${ROBOT_SCREEN_COLOUR_DEPTH} -ac" \
      "${XVFB_PREFIX[@]}" \
        robot $base_url_opt "$@"
    else
      # shellcheck disable=SC2086
      xvfb-run \
            --server-args="-screen 0 ${ROBOT_SCREEN_WIDTH}x${ROBOT_SCREEN_HEIGHT}x${ROBOT_SCREEN_COLOUR_DEPTH} -ac" \
      "${XVFB_PREFIX[@]}" \
            pabot \
            ${TRACE+--verbose} \
            --processes "$ROBOT_THREADS" $PABOT_OPTIONS $base_url_opt "$@"