I'm running some playwright tests in a pipeline but I'm having problems trying to fail the build when a test fails.
In my pipeline I call a make file that calls a shell script that installs playwright, does some setup, and then runs the command yarn playwright test
the script I call always returns an exit code 0 but Playwright returns an exit code 1 if a test fails.
Is it possible for me to get the exit code of Playwright so I can then pass it back up and handle it in my pipeline?
Update: The line in my makefile that calls the sh script is:
uiTests: node-install node-audit
$(DOCKER_RUN_NODE) bash /app/scripts/playwright.sh
My Playwright.sh script:
#!/usr/bin/env bash
apt-get update
apt-get install -y gnupg2 gnupg1 wget
docker pull mcr.microsoft.com/playwright/python:v1.27.0-focal
yarn install
yarn playwright install
yarn playwright install-deps
yarn run local & yarn run uiTests
rm -rf node_modules
This pulls the dependencies then starts the local instance of the site and runs the tests
yarn run uiTests runs this command "BASE_URL='http://localhost:3000' yarn playwright test"