Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
file

GitHub Action

Cypress Screenshot & Video Upload to Slack

v1.2.0

Cypress Screenshot & Video Upload to Slack

file

Cypress Screenshot & Video Upload to Slack

After running a Cypress test in a Github action, upload the screenshots and videos directly to Slack

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Cypress Screenshot & Video Upload to Slack

uses: trymbill/[email protected]

Learn more about this action in trymbill/cypress-slack-video-upload-action

Choose a version

typescript-action status

Upload Cypress videos and screenshots directly to Slack

This Github action enables you to take the screenshots and videos generated by Cypress after a test run and upload them directly to a Slack channel of your choice. All files are contained within a single message thread to minimize noise.

Inputs

token

Required Slack app token. See Internal app tokens

  • Create an app
  • Add file:write and chat.postMessage 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 token from OAuth & Permissions page

channels

Required Slack channels to upload to

workdir

Optional The folder where Cypress stores screenshots and videos on the build machine.

Default: cypress

(this relative path resolves to /home/runner/work/<REPO_NAME>/<REPO_NAME>/cypress)

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). (Don't include a trailing slash on your path!)

message-text

Optional Custom Slack message text.

Default: A Cypress test just finished. I've placed the screenshots and videos in this thread. Good pie!

Examples

Upload results after every push

on: [push]

jobs:
  test-and-upload-results:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: 'Run tests'
        uses: cypress-io/github-action@v2

      - name: 'Upload screenshots and videos to Slack'
        uses: trymbill/[email protected]
        with:
          token: ${{ secrets.SLACK_TOKEN }}
          channels: 'engineering-ops'

Only upload when open PRs fail

on: [pull_request]

jobs:
  test-and-upload-results-on-fail:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: 'Run tests'
        uses: cypress-io/github-action@v2

      - name: 'Upload screenshots and videos to Slack'
        uses: trymbill/[email protected]
        if: failure()
        with:
          token: ${{ secrets.SLACK_TOKEN }}
          channels: 'engineering-ops'