LoginSignup
7
5

More than 1 year has passed since last update.

CypressでGitHub ActionsでのE2Eテストの状況をSlack動画通知する

Last updated at Posted at 2021-09-19

結論

Cypress Screenshot & Video Upload to Slackをよくみてクレメンス

ハマりどころ

Inputs
token
Required Slack app token. See Internal app tokens

Create an app
Under Bot Token Scopes, add files:write and chat: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 the OAuth & Permissions page
Add that token as a secret to your Github repo's Actions Secrets found under Settings -> Secrets (in the examples below we call it SLACK_TOKEN)

以下3点

  • Under Bot Token Scopes, add files:write and chat:write permissions
  • /invite botname
  • Grab the Bot User OAuth Token from the OAuth & Permissions page

ここはGitHubの設定

  • Add that token as a secret to your Github repo's Actions Secrets found under Settings -> Secrets (in the examples below we call it SLACK_TOKEN)

いざ実行

.github/workflows/e2e.yml
name: E2E Test

on:
  pull_request:
    branches: [ master ]

jobs:
  e2e-test:
    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/cypress-slack-video-upload-action@v1.3.0
        with:
          token: ${{ secrets.SLACK_TOKEN }}
          channels: 'proj-...'

      - name: 'Upload screenshots and videos to Slack'
        uses: trymbill/cypress-slack-video-upload-action@v1.3.0
        if: failure()
        with:
          token: ${{ secrets.SLACK_TOKEN }}
          channels: 'proj-...' 
          message-text: 'Cypress tests failed! They have been placed in this thread, good luck.'

スクリーンショット 2021-09-20 7.21.28.png

スクリーンショット 2021-09-20 7.22.11.png

参照

7
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
5