From bf2d713a15d644dad509b9bfbd0b1a43b5f8c379 Mon Sep 17 00:00:00 2001 From: Gabriel Chittolina Date: Tue, 2 Sep 2025 14:47:33 -0300 Subject: [PATCH 1/4] feat: add workflow to update screenshots --- ...n-tests-example-apps-write-screenshots.yml | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/run-tests-example-apps-write-screenshots.yml diff --git a/.github/workflows/run-tests-example-apps-write-screenshots.yml b/.github/workflows/run-tests-example-apps-write-screenshots.yml new file mode 100644 index 000000000..d7d33e69b --- /dev/null +++ b/.github/workflows/run-tests-example-apps-write-screenshots.yml @@ -0,0 +1,29 @@ +name: Run tests for example apps + +on: + workflow_dispatch: + +jobs: + run-tests-example-apps: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup node + uses: actions/setup-node@v4 + with: + node-version: 22 + cache: npm + + - name: Install dependencies + run: cd examples/tests && npm ci + + - name: Install Playwright browsers + run: cd examples/tests && npx playwright install --with-deps + + - name: Install http-server globally + run: npm install -g http-server + + - name: Run tests + run: cd examples/tests && npm test -- --update-snapshots \ No newline at end of file From abe7b3b42e7ec6190ae5300739ece8304f5ce046 Mon Sep 17 00:00:00 2001 From: Gabriel Chittolina Date: Tue, 2 Sep 2025 14:48:08 -0300 Subject: [PATCH 2/4] fix: add missing step --- .../run-tests-example-apps-write-screenshots.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/run-tests-example-apps-write-screenshots.yml b/.github/workflows/run-tests-example-apps-write-screenshots.yml index d7d33e69b..f5bb13d75 100644 --- a/.github/workflows/run-tests-example-apps-write-screenshots.yml +++ b/.github/workflows/run-tests-example-apps-write-screenshots.yml @@ -26,4 +26,10 @@ jobs: run: npm install -g http-server - name: Run tests - run: cd examples/tests && npm test -- --update-snapshots \ No newline at end of file + run: cd examples/tests && npm test -- --update-snapshots + + - name: Upload screenshots + run: | + git add . + git commit -m 'ci: update screenshots' --allow-empty + git push \ No newline at end of file From 424cfb6e00976bf973ccef840defff5b98f3fa2c Mon Sep 17 00:00:00 2001 From: Gabriel Chittolina Date: Tue, 2 Sep 2025 14:50:45 -0300 Subject: [PATCH 3/4] chore: renamed workflow job --- .github/workflows/run-tests-example-apps-write-screenshots.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-tests-example-apps-write-screenshots.yml b/.github/workflows/run-tests-example-apps-write-screenshots.yml index f5bb13d75..2ad7ed805 100644 --- a/.github/workflows/run-tests-example-apps-write-screenshots.yml +++ b/.github/workflows/run-tests-example-apps-write-screenshots.yml @@ -4,7 +4,7 @@ on: workflow_dispatch: jobs: - run-tests-example-apps: + update-screenshots-example-apps: runs-on: ubuntu-latest steps: - name: Checkout From 5252fd93b8e5a6f2f294ac1ec032899782975e67 Mon Sep 17 00:00:00 2001 From: Gabriel Chittolina Date: Tue, 2 Sep 2025 15:20:30 -0300 Subject: [PATCH 4/4] fix: use same workflow --- ...n-tests-example-apps-write-screenshots.yml | 35 ------------------- .github/workflows/run-tests-example-apps.yml | 26 +++++++++++++- 2 files changed, 25 insertions(+), 36 deletions(-) delete mode 100644 .github/workflows/run-tests-example-apps-write-screenshots.yml diff --git a/.github/workflows/run-tests-example-apps-write-screenshots.yml b/.github/workflows/run-tests-example-apps-write-screenshots.yml deleted file mode 100644 index 2ad7ed805..000000000 --- a/.github/workflows/run-tests-example-apps-write-screenshots.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: Run tests for example apps - -on: - workflow_dispatch: - -jobs: - update-screenshots-example-apps: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup node - uses: actions/setup-node@v4 - with: - node-version: 22 - cache: npm - - - name: Install dependencies - run: cd examples/tests && npm ci - - - name: Install Playwright browsers - run: cd examples/tests && npx playwright install --with-deps - - - name: Install http-server globally - run: npm install -g http-server - - - name: Run tests - run: cd examples/tests && npm test -- --update-snapshots - - - name: Upload screenshots - run: | - git add . - git commit -m 'ci: update screenshots' --allow-empty - git push \ No newline at end of file diff --git a/.github/workflows/run-tests-example-apps.yml b/.github/workflows/run-tests-example-apps.yml index b73c5c854..9584b8b58 100644 --- a/.github/workflows/run-tests-example-apps.yml +++ b/.github/workflows/run-tests-example-apps.yml @@ -2,11 +2,20 @@ name: Run tests for example apps on: workflow_dispatch: + inputs: + update-screenshots: + description: "Update screenshots" + required: false + default: "false" + # TODO: Enable this when we test this workflow manually # pull_request: # branches: # - develop +permissions: + contents: write + jobs: run-tests-example-apps: runs-on: ubuntu-latest @@ -30,4 +39,19 @@ jobs: run: npm install -g http-server - name: Run tests - run: cd examples/tests && npm test \ No newline at end of file + if: inputs.update-screenshots == 'false' + run: cd examples/tests && npm test + + - name: Run tests with updated screenshots + if: inputs.update-screenshots == 'true' + run: cd examples/tests && npm test -- --update-snapshots + + + - name: Upload screenshots + if: inputs.update-screenshots == 'true' + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git add . + git commit -m 'ci: update screenshots' --allow-empty + git push \ No newline at end of file