npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

playwright-teams-notifications

v1.2.0

Published

Playwright MS Teams reporter with customizable notifications

Readme

playwright-teams-notifications

playwright-teams-notifications is a npm package that helps you to send notifications to MS Teams via Playwright custom reporter mechanism - Playwright reporters and MS Teams Incoming Webhooks connector.

It comes with plenty customization options to fit your needs.

I found only one existing reporter for MS Teams (playwright-msteams-reporter), but wanted to have something with more content and more customizable at the same time, thus delivering this reporter.

Prerequisites

This package works together with Playwright. Make sure your project is already dependent on it - Get Playwright.

You need to have MS Teams Incoming Webhook connector set up to get the webhook URL - Create Incoming Webhook

Installation in your project

Using npm

npm install -D playwright-teams-notifications

or using yarn:

yarn add -D playwright-teams-notifications

Usage

You have to add reporter configuration to playwright.config.ts file. It is enough to add the webhookUrl option only to make it work, other options are optional. If webhookUrl is not provided, reporter will do nothing.

import { defineConfig, ReporterDescription } from '@playwright/test'
import { StatusReporterOptions } from 'playwright-teams-notifications';

const myReporters: ReporterDescription[] = [
  ['list'],
  ['playwright-teams-notifications',
    <StatusReporterOptions>{
      webhookUrl: process.env.TEST_WEBHOOK_URL,
      title: 'Custom title',
      titleDescription: 'Custom description',
      linkUrl: 'test results link url',
      linkTitle: 'view in CI',
      includeChart: true,
      includeDetails: true,
      openDetails: true,
      includeTopBorder: true,
      includeBackgroundColor: true,
      sendOnFailureOnly: false,
      mentionOnFailure: true,
      additionalDetails: { buildNumber: process.env.BUILD_NUMBER || 'N/A', 
        buildDescription: process.env.BUILD_DESCRIPTION || 'N/A' },
    },
  ],
]

export default defineConfig({
  reporter: myReporters,
})

or you can create your own reporter file, e.g. myCustomReporter.ts and provide all the configuration + additional logic there (e.g. send report only for CI runs):

// myCustomReporter.ts
import { StatusReporter, StatusReporterOptions } from 'playwright-teams-notifications';
import type { FullResult } from '@playwright/test/reporter';

const {ENV, BUILD_ID, BUILD_NUMBER, PIPELINE_NAME} = process.env

export default class CustomReporter extends StatusReporter {
  constructor(props: StatusReporterOptions) {
    props.webhookUrl = process.env.TEST_WEBHOOK_URL, 
    props.title = 'Custom title from CustomReporter'
    props.titleDescription = `Pineline: ${PIPELINE_NAME}`
    props.linkUrl = `https://my.ci.system/builds/${BUILD_ID}?env=${ENV}`
    props.linkTitle = 'View in CI'
    props.includeChart = true
    props.chartType = 'bar',
    props.includeDetails = true,
    props.openDetails = true,
    props.includeTopBorder = true,
    props.includeBackgroundColor = true,
    props.sendOnFailureOnly = false,
    props.mentionOnFailure = true,
    props.additionalDetails = { buildNumber: BUILD_NUMBER || 'N/A', buildDescription: BUILD_ID || 'N/A' },
    super(props)
  }

  async onEnd(result: FullResult): Promise<void> {
    if (process.env.CI) {
      console.log('CI environment detected, sending report to Microsoft Teams.')
      return super.onEnd(result)
    } else {
      console.log('Non-CI environment detected, skipping report to Microsoft Teams.')
      return;
    }
  }
}

and then add it to playwright.config.ts:

export default defineConfig({
  reporter: [
    ['list'],
    ['./path/to/myCustomReporter.ts'],
  ],
})

[!NOTE] Make sure to provide all the env variables in the pipeline.

Options

The reporter supports the following configuration options:

| Option | Description | Type | Required | Default | |--------------------------|-------------------------------------------------------|-----------------------------|----------|---------------------------| | webhookUrl | The Microsoft Teams webhook URL | string | false | undefined | | title | The notification title | string | false | Playwright Test Results | | titleDescription | The notification title description | string | false | Duration: hh:mm:ss | | linkUrl | Link to the test run | string | false | undefined | | linkTitle | Link button title | string | false | View results | | includeChart | Show chart with results | boolean | false | true | | chartType | You can use either bar or donut charts | bar or donut | false | bar | | includeDetails | Show details section | boolean | false | true | | openDetails | Start with details table visible | boolean | false | false | | includeTopBorder | Use top border of notification card | boolean | false | true | | includeBackgroundColor | Use background color for notification card | boolean | false | true | | sendOnFailureOnly | Send only on test failure | boolean | false | false | | mentionOnFailure | Mention git change authors on failure | boolean | false | true | | additionalDetails | Additional details you want to show in notifications. | { [key: string]: string } | false | undefined |

Title description by default contains duration of test run.

Examples

Here you can see an example of notification with default settings (and expanded details section):
defaultSetupLook.png

Flaky status with donut chart and custom link:
flakyWithDonutChart.png

Notification without colors and top border:
noColors.png

All options set to false with custom title:
simplestLook.png

It supports narrow view as well:
narrowCard.png

Mentioning users on failure

You have to add captureGitInfo: { commit: true } to your Playwright config to capture git commit info, then the reporter will find the authors of the commits included in the test run and mention them in the notification when there are test failures.

export default defineConfig({
  captureGitInfo: { commit: true },
  reporter: [
    ['list'],
    ['playwright-teams-notifications', {webhookUrl: process.env.TEST_WEBHOOK_URL}]
  ],
})