Skip to content

[LD-145] Add code coverage for E2E tests. #1017

[LD-145] Add code coverage for E2E tests.

[LD-145] Add code coverage for E2E tests. #1017

---
# Golden tests recording with Paparazzi configuration file
# Add [New snapshots] to the title of your PR to record new snapshots.
# Remove it to verify snapshots instead.
name: Snapshot recording
on:
pull_request:
types: [opened, edited, synchronize]
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
permissions:
checks: write
contents: write
statuses: write
pull-requests: write
actions: write
jobs:
generate_snapshots:
if: ${{contains(github.event.pull_request.title, '[New snapshots]')}}
name: Generate snapshots
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
lfs: true
- name: Gradle - Record snapshots with Paparazzi
id: testStep
run: ./gradlew components:recordPaparazziDebug
- name: Commit and push recorded screenshots
uses: stefanzweifel/git-auto-commit-action@v5
with:
branch: ${{ github.event.pull_request.head.ref || github.head_ref || github.ref }}
commit_message: "[Paparazzi] Record new snapshots"
- name: Upload snapshot record report
if: failure()
uses: actions/upload-artifact@v3
with:
name: snapshot-recording-failure-report
path: components/build/reports/tests/testDebugUnitTest/
- name: Find PR number
uses: jwalton/gh-find-current-pr@v1
id: findPRId
if: always()
with:
state: open
- name: Find Comment on PR
uses: peter-evans/find-comment@v2
id: findCommentId
if: always()
with:
issue-number: ${{ steps.findPRId.outputs.pr }}
comment-author: "github-actions[bot]"
body-regex: "Snapshot recording result:"
- name: Create or update comment on PR (Success)
uses: peter-evans/create-or-update-comment@v3
if: always() && steps.testStep.outcome == 'success'
with:
comment-id: ${{ steps.findCommentId.outputs.comment-id }}
issue-number: ${{ steps.findPRId.outputs.pr }}
body: |
Snapshot recording result: :heavy_check_mark:
New snapshots recorded! Everything looks good!
If there were changes in the user interface, a new commit has been created. You can review the new snapshots in the diff. If you find them acceptable, please proceed to merge this pull request.
However, if you did not intend to record new snapshots, please remove the '[New snapshots]' part from your title (and discard the commit that includes the new snapshots). It will cause to run snapshot verification instead of recording.
edit-mode: replace
reactions: |
heart
hooray
reactions-edit-mode: replace
- name: Create or update comment on PR (Failure)
uses: peter-evans/create-or-update-comment@v3
if: always() && steps.testStep.outcome == 'failure'
with:
comment-id: ${{ steps.findCommentId.outputs.comment-id }}
issue-number: ${{ steps.findPRId.outputs.pr }}
body: |
Snapshot recording result: :x:
Something went wrong during snapshot recording.
If you need further investigation:
- Head over to the artifacts section of the [CI Run](https://github.com/appunite/Loudius/actions/runs/${{ github.run_id }}).
- Download the zip.
- Unzip and you can find report showing the problem
If you not intended to record new snapshots please remove '[New snapshots]' part from your pull request title. It will cause to run snapshot verification instead of recording.
edit-mode: replace
reactions: |
confused
reactions-edit-mode: replace
- name: Include Slack Notification
if: failure() && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master')
uses: ./.github/actions/slack-notification
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_GIT_REF: ${{ github.ref }}
SLACK_WORKFLOW: ${{ github.workflow }}