A local-first personal finance app
Add run-vrt script to run vrt inside docker (#2762)
Joel Jeremy Marqueze63fb46c8f23
diff --git a/bin/run-vrt b/bin/run-vrtnew file mode 100755index 0000000000..8e7c65d44b--- /dev/null+++ b/bin/run-vrt@@ -0,0 +1,32 @@+#!/bin/sh++# See here for more information: https://github.com/actualbudget/actual/tree/master/packages/desktop-client#visual-regression++if [ ! -d "node_modules" ] || [ "$(ls -A node_modules)" = "" ]; then+ yarn+fi++E2E_START_URL="${E2E_START_URL:-https://localhost:3001}"+VRT_ARGS=""++# Loop through all arguments+while [ $# -gt 0 ]; do+ key="$1"+ case $key in+ --e2e-start-url)+ E2E_START_URL="$2"+ shift+ ;;+ *)+ VRT_ARGS="$VRT_ARGS $1"+ ;;+ esac+ shift+done++echo "Running VRT tests with the following parameters:"+echo "E2E_START_URL: $E2E_START_URL"+echo "VRT_ARGS: $VRT_ARGS"++docker run --rm --network host -v "$(pwd)":/work/ -w /work/ -it mcr.microsoft.com/playwright:v1.41.1-jammy /bin/bash \+ -c "E2E_START_URL=$E2E_START_URL yarn vrt $VRT_ARGS"diff --git a/package.json b/package.jsonindex 8b4245064d..0a12853c8c 100644--- a/package.json+++ b/package.json@@ -34,6 +34,7 @@"test:debug": "yarn workspaces foreach --all --verbose run test","e2e": "yarn workspaces foreach --all --parallel --verbose run e2e","vrt": "yarn workspaces foreach --all --parallel --verbose run vrt",+ "vrt:docker": "./bin/run-vrt","rebuild-electron": "./node_modules/.bin/electron-rebuild -f -m ./packages/loot-core","rebuild-node": "yarn workspace loot-core rebuild","lint": "eslint . --max-warnings 0 --ext .js,.jsx,.ts,.tsx",diff --git a/packages/desktop-client/README.md b/packages/desktop-client/README.mdindex fb9b36ac54..e87bbc222f 100644--- a/packages/desktop-client/README.md+++ b/packages/desktop-client/README.md@@ -45,7 +45,22 @@ HTTPS=true docker compose up --buildNote the network IP address and port the dev instance is listening on.-Next, navigate to the root of your project folder, run the standartised docker container, and launch the visual regression tests from within it.+Next, navigate to the root of your project folder, run the standardized docker container, and launch the visual regression tests from within it.++Run via yarn:++```sh+# By default, this connects to https://localhost:3001+yarn vrt:docker++ # To use a different ip and port:+ yarn vrt:docker --e2e-start-url https://ip:port++ # To update snapshots, use the following command:+ yarn vrt:docker --e2e-start-url https://ip:port --update-snapshots+```++Run manually:```sh# Run docker container@@ -54,7 +69,8 @@ docker run --rm --network host -v $(pwd):/work/ -w /work/ -it mcr.microsoft.com/# If you receive an error such as "docker: invalid reference format", please instead use the following command:docker run --rm --network host -v ${pwd}:/work/ -w /work/ -it mcr.microsoft.com/playwright:v1.41.1-jammy /bin/bash-# Run the VRT tests: important - they MUST be ran against a HTTPS server. Use the ip and port noted earlier+# Once inside the docker container, run the VRT tests: important - they MUST be ran against a HTTPS server.+# Use the ip and port noted earlierE2E_START_URL=https://ip:port yarn vrt# To update snapshots, use the following command:@@ -65,6 +81,15 @@ E2E_START_URL=https://ip:port yarn vrtYou can also run the tests against a remote server by passing the URL:+Run in standardized docker container:+```sh+E2E_START_URL=https://my-remote-server.com yarn vrt:docker++ # Or pass in server URL as argument+ yarn vrt:docker --e2e-start-url https://my-remote-server.com+```++Run locally:```shE2E_START_URL=https://my-remote-server.com yarn vrt```diff --git a/upcoming-release-notes/2762.md b/upcoming-release-notes/2762.mdnew file mode 100644index 0000000000..0d584bd895--- /dev/null+++ b/upcoming-release-notes/2762.md@@ -0,0 +1,6 @@+---+category: Maintenance+authors: [joel-jeremy]+---++Add run-vrt script to run vrt inside docker via yarn.