This GitHub action enables you to take the screenshots and videos generated by Cypress.
Required One of actions: start, finish, upload, where:
start
- starts thread with in progress
status
finish
- updates thread messages with run status
upload
- uploads assets
Required Slack app token. See Internal app tokens
- Create an app
- Under Bot Token Scopes, add
files:write
andchat:write
permissions - Install the app into your workspace
- Invite the bot to whatever channels you want to send the videos and screenshots to
/invite <botname>
- Grab the
Bot User OAuth Token
from theOAuth & Permissions
page - Add that token as a secret to your GitHub repo's
Actions Secrets
found underSettings -> Secrets
(in the examples below we call itSLACK_TOKEN
)
Required Slack channel name to upload to
Optional Slack channel ID to upload to. Supersedes channel
if both are provided.
Optional The folder where Cypress stores screenshots on the build machine.
Default: cypress/screenshots
(this relative path resolves to /home/runner/work/<REPO_NAME>/<REPO_NAME>/cypress/screenshots
)
If your project uses Cypress from the project root folder, the default value will work for you.
But if your project uses Cypress in a subfolder (like most monorepos), you'll need to provide the relative path to that folder
(i.e. e2e/cypress/screenshots
).
(Don't include a trailing slash on your path!)
Optional The folder where Cypress stores videos on the build machine.
Default: cypress/videos
(this relative path resolves to /home/runner/work/<REPO_NAME>/<REPO_NAME>/cypress/videos
)
If your project uses Cypress from the project root folder, the default value will work for you.
But if your project uses Cypress in a sub-folder (like most mono-repos), you'll need to provide the relative path to that folder
(i.e. e2e/cypress/videos
).
(Don't include a trailing slash on your path!)
Required Slack message text.
Optional/Required Thread ID to continue in (finish, upload)
Optional Status of run
Required Slack username of the author
...
jobs:
- name: 'Start thread in slack'
uses: tbayaa/cypress-slack-video-upload-action@v1
id: start
with:
token: ${{ secrets.SLACK_TOKEN }}
channel: ${{ github.event.client_payload.channel }}
message-text: "Starting Smoke Tests at ${{ github.event.client_payload.cypress_server }}"
author: ${{ github.event.client_payload.slack_user }}
action: start
- name: Cypress run
uses: cypress-io/github-action@v5
- name: 'Update thread in slack'
uses: tbayaa/cypress-slack-video-upload-action@v1
if: always()
with:
token: ${{ secrets.SLACK_TOKEN }}
channel: ${{ github.event.client_payload.channel }}
message-text: "Finished Smoke Tests at ${{ github.event.client_payload.cypress_server }}"
author: ${{ github.event.client_payload.slack_user }}
action: finish
thread-id: ${{ steps.start.outputs.thread-id }}
status: ${{ job.status }}
- name: 'Upload screenshots and videos to Slack'
uses: tbayaa/cypress-slack-video-upload-action@v1
if: failure()
with:
token: ${{ secrets.SLACK_TOKEN }}
channel: ${{ github.event.client_payload.channel }}
action: upload
thread-id: ${{ steps.start.outputs.thread-id }}