Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate Cypress failure PR comment #3125

Open
GCHQ-Developer-530 opened this issue Jan 31, 2025 · 1 comment
Open

Investigate Cypress failure PR comment #3125

GCHQ-Developer-530 opened this issue Jan 31, 2025 · 1 comment
Milestone

Comments

@GCHQ-Developer-530
Copy link
Contributor

Summary

At the moment, no matter how the Cypress tests fail, it comments on the PR saying "Visual tests failed". However, in some cases the visual tests haven't failed and the PR comment links to pages that don't exist.

💬 Description

This ticket would be to see if there's a way to determine what the error message is for the failed Cypress tests and only add the PR comment if it talks about test thresholds etc.

Why do we need it?

It would just be nice to have so we don't have redundant PR comments lying about.

Additional notes

Also not sure if this is possible, but it would be good if the PR comment alerting to the failed visual tests deleted itself after a push (or when the cypress tests run again)

@GCHQ-Developer-530
Copy link
Contributor Author

It does seem that this might be possible, I've found this example -

- name: Run Cypress tests
        id: run_cypress_tests
        run: |
          set -o pipefail
          npm run cypress:run 2>&1 | tee cypress_output.txt || exit 1

      - name: Check for specific error message
        id: check_error_message
        run: |
          if grep -q "specific error message" cypress_output.txt; then
            echo "::set-output name=error_message::true"
          else
            echo "::set-output name=error_message::false"
          fi

And then we'd just need a check for steps.check_error_message.outputs.error_message == 'true'

"specific error message" here would presumably be about test thresholds
and error_message would probably be visual_tests_failed

@MI6-255 MI6-255 added this to the PI 12 V3 milestone Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Refinement
Development

No branches or pull requests

2 participants