diff --git a/.github/workflows/test-and-deploy.yml b/.github/workflows/test-and-deploy.yml index 513d299..d49cf23 100644 --- a/.github/workflows/test-and-deploy.yml +++ b/.github/workflows/test-and-deploy.yml @@ -73,14 +73,18 @@ jobs: run: npm test - name: Start server (in background) run: npm run start & - # Within a PR, Lost Pixel Platform generates separate GitHub Status Checks (which are set to 'required' in the Branch protection rule), - # so we don't need to also fail the build. For a build on the master branch, we do want to fail the build if there are differences. - - name: ${{ github.event_name != 'pull_request' && 'Test with' || 'Capture images for' }} Lost Pixel + + - name: Check for unintentional UI changes with Lost Pixel + id: lp uses: lost-pixel/lost-pixel@v3.16.0 - env: - LOST_PIXEL_API_KEY: ${{ secrets.LOST_PIXEL_API_KEY }} - LOST_PIXEL_FAIL_ON_DIFFERENCE: ${{ github.event_name != 'pull_request' }} - + + - name: Upload Lost Pixel artefacts + uses: actions/upload-artifact@v3 + if: ${{ failure() && steps.lp.conclusion == 'failure' }} + with: + name: lost-pixel-artefacts + path: .lostpixel + deploy-site: needs: [test-site, test-models, test-data-model-validator, test-rpde-validator] if: ${{ github.ref == 'refs/heads/master' }} @@ -112,11 +116,17 @@ jobs: git push heroku master -f - name: Smoke test with Lost Pixel + id: lp uses: lost-pixel/lost-pixel@v3.16.0 env: - LOST_PIXEL_API_KEY: ${{ secrets.LOST_PIXEL_API_KEY }} LOST_PIXEL_BASE_URL: https://validator-staging.openactive.io - LOST_PIXEL_FAIL_ON_DIFFERENCE: true + + - name: Upload Lost Pixel artefacts + uses: actions/upload-artifact@v3 + if: ${{ failure() && steps.lp.conclusion == 'failure' }} + with: + name: lost-pixel-artefacts + path: .lostpixel promote-site: needs: deploy-site diff --git a/.github/workflows/update-lost-pixel-baseline.yml b/.github/workflows/update-lost-pixel-baseline.yml index f8cc783..6e37478 100644 --- a/.github/workflows/update-lost-pixel-baseline.yml +++ b/.github/workflows/update-lost-pixel-baseline.yml @@ -24,15 +24,22 @@ jobs: - name: Start server (in background) run: npm run start & + - name: Create .lostpixel directory if it doesn't exist + # This is a workaround for https://github.com/lost-pixel/lost-pixel/issues/344 + run: mkdir -p .lostpixel/baseline + - name: Lost Pixel id: lp - uses: lost-pixel/lost-pixel@v3.8.0 + uses: lost-pixel/lost-pixel@v3.16.0 env: LOST_PIXEL_MODE: update + - name: Create Pull Request - uses: peter-evans/create-pull-request@v4 + id: cpr + uses: peter-evans/create-pull-request@v6 if: ${{ failure() && steps.lp.conclusion == 'failure' }} with: + path: ./ token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }} commit-message: Update lost-pixel baselines committer: openactive-bot @@ -41,7 +48,15 @@ jobs: branch: 'lost-pixel-update/${{ github.ref_name }}' delete-branch: true title: 'Lost Pixel update - ${{ github.ref_name }}' - body: Automated baseline update PR created by Lost Pixel + body: | + Automated baseline update PR created by Lost Pixel + + Please check the updated baseline images are as expected before merging this PR. labels: | automated pr - draft: false \ No newline at end of file + draft: false + + - name: Check outputs + run: | + echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" + echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" \ No newline at end of file diff --git a/.lostpixel/.gitignore b/.lostpixel/.gitignore new file mode 100644 index 0000000..a60a089 --- /dev/null +++ b/.lostpixel/.gitignore @@ -0,0 +1,2 @@ +current +difference diff --git a/.lostpixel/baseline/model-validator-home.png b/.lostpixel/baseline/model-validator-home.png new file mode 100644 index 0000000..2e1b2e7 Binary files /dev/null and b/.lostpixel/baseline/model-validator-home.png differ diff --git a/.lostpixel/baseline/rpde-validator-home.png b/.lostpixel/baseline/rpde-validator-home.png new file mode 100644 index 0000000..e267c53 Binary files /dev/null and b/.lostpixel/baseline/rpde-validator-home.png differ diff --git a/.lostpixel/baseline/scheduledsession.png b/.lostpixel/baseline/scheduledsession.png new file mode 100644 index 0000000..d228b91 Binary files /dev/null and b/.lostpixel/baseline/scheduledsession.png differ diff --git a/.lostpixel/baseline/sessionseries.png b/.lostpixel/baseline/sessionseries.png new file mode 100644 index 0000000..d94fbe9 Binary files /dev/null and b/.lostpixel/baseline/sessionseries.png differ diff --git a/lostpixel.config.js b/lostpixel.config.js index 39690d7..ad4fc99 100644 --- a/lostpixel.config.js +++ b/lostpixel.config.js @@ -8,9 +8,7 @@ module.exports = { ], baseUrl: process.env.LOST_PIXEL_BASE_URL || 'http://172.17.0.1:8080', }, - lostPixelProjectId: 'clzitt4s52b6dlcoguswodrsj', - failOnDifference: process.env.LOST_PIXEL_FAIL_ON_DIFFERENCE === 'true' || false, + generateOnly: true, // OSS mode + failOnDifference: true, threshold: 0, - setPendingStatusCheck: process.env.LOST_PIXEL_FAIL_ON_DIFFERENCE !== 'true', - apiKey: process.env.LOST_PIXEL_API_KEY, };