Rayrun
← Back to Discord Forum

connect playwright to slack

Hi, i am trying to connect playwright report to a slack channel. i did all the steps which are described in the slack instructions step by step i connected the app i created to the new channel i created i gave the correct permissions scope to the bot user i installed the app and i can see it in the slack app the playwright configuration looks as following: reporter: process.env.CI ? [ [ "./node_modules/playwright-slack-report/dist/src/SlackReporter.js", { channels: ["read-playwright-result"], // provide one or more Slack channels sendResults: "always", // "always" , "on-failure", "off", slackOAuthToken:"xoxb-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", open:"never", }, ], ["dot"], ["list"], ["html", { open: "never", outputFolder: "playwright-report" }], ["./reporter.ts"] ] :[["dot"], ["html",{ open: 'never' }],["./reporter.ts"]],

and after the ci running i cant see reault am i missing something?

This thread is trying to answer question "Why can't the user see the results of the playwright report in the Slack channel after the CI runs and how can they write the same configuration as a cloudbuild yml file?"

2 replies

how can i write the same as cloudbuild yml?

github-action.yml

- name: Send Slack Notification
    if: always()
    uses: 8398a7/action-slack@v3
    with:
      status: custom
      fields: repo,eventName,workflow,job,took
      custom_payload: |
        {
          attachments: [{
            color: '${{ job.status }}' === 'success' ? 'good' : 'danger',
            title: `Playwright Demo Automation Results :test_tube:`,
            fields: [{
              title: 'Site Under Test',
              value: '${{ env.APP_URL }}',
              short: true
            },
     
              title: 'Repo',
              value: `${process.env.AS_REPO}`,
              short: true
            },

              title: 'Workflow',
              value: `${process.env.AS_WORKFLOW}`,
              short: true
            },
            {
              title: 'Total Tests',
              value: (`${{ env.FAILURES }}`.match(/.spec.ts/g) || []).length + (`${{ env.PASSED }}`.match(/.spec.ts/g) || []).length,
              short: true
            },

            {
              title: 'Failures',
              value: `${{ env.FAILURES }}` === '' ? 'No failures' : `${{ env.FAILURES }}`.match(/.spec.ts/g).length > 10 ? `Too many failures to print. Please go to GitHub to see full list of failures` : '```${{ env.FAILURES }}```'.replace(/ /g, '\n'),
              short: false
            }]
          }]
        }  
    env:
      SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required

Related Discord Threads

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email luc@ray.run.