diff --git a/.github/workflows/pipeline-segment-electron-test.yml b/.github/workflows/pipeline-segment-electron-test.yml index fb9e678023..ad3173fd93 100644 --- a/.github/workflows/pipeline-segment-electron-test.yml +++ b/.github/workflows/pipeline-segment-electron-test.yml @@ -187,10 +187,17 @@ jobs: runuser -u builduser -- xvfb-run script/actions/run-tests.sh script/yarn test --runners=main --trace-uncaught --enable-logging --files $tests_files fi fi + - name: Upload Test Artifacts + if: always() && !cancelled() + uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 + with: + name: test_artifacts_${{ env.ARTIFACT_KEY }} + path: src/electron/spec/artifacts + if-no-files-found: ignore - name: Wait for active SSH sessions if: always() && !cancelled() run: | while [ -f /var/.ssh-lock ] do sleep 60 - done \ No newline at end of file + done diff --git a/spec/.gitignore b/spec/.gitignore index b512c09d47..1e64585917 100644 --- a/spec/.gitignore +++ b/spec/.gitignore @@ -1 +1,2 @@ -node_modules \ No newline at end of file +node_modules +artifacts diff --git a/spec/lib/screen-helpers.ts b/spec/lib/screen-helpers.ts index 98f7ed2cb1..f2bdbcb646 100644 --- a/spec/lib/screen-helpers.ts +++ b/spec/lib/screen-helpers.ts @@ -167,11 +167,18 @@ export class ScreenCapture { } while (Date.now() < expiration); if (!gotExpectedResult) { + // Limit image to 720p to save on storage space + if (process.env.CI) { + const width = Math.floor(Math.min(frame.getSize().width, 720)); + frame = frame.resize({ width }); + } + // Save the image as an artifact for better debugging const artifactName = await createArtifactWithRandomId( (id) => `color-mismatch-${id}.png`, frame.toPNG() ); + throw new AssertionError( `Expected color at (${point.x}, ${point.y}) to ${ matchIsExpected ? 'match' : '*not* match'