{"id":31677248,"url":"https://github.com/estruyf/playwright-msteams-reporter","last_synced_at":"2025-10-08T05:07:39.697Z","repository":{"id":246866692,"uuid":"824501354","full_name":"estruyf/playwright-msteams-reporter","owner":"estruyf","description":"Microsoft Teams reporter for Playwright","archived":false,"fork":false,"pushed_at":"2025-09-12T14:00:58.000Z","size":411,"stargazers_count":16,"open_issues_count":2,"forks_count":6,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-10-02T07:11:55.541Z","etag":null,"topics":["e2e","msteams","playwright","playwright-tests","reporter","testing"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/playwright-msteams-reporter","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/estruyf.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-05T09:11:33.000Z","updated_at":"2025-09-12T13:59:46.000Z","dependencies_parsed_at":"2024-08-05T09:40:52.347Z","dependency_job_id":"88bf7fbd-5b76-4aab-88f5-ebc5ef1c5e73","html_url":"https://github.com/estruyf/playwright-msteams-reporter","commit_stats":null,"previous_names":["estruyf/playwright-msteams-reporter","playwright-community/playwright-msteams-reporter"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/estruyf/playwright-msteams-reporter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/estruyf%2Fplaywright-msteams-reporter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/estruyf%2Fplaywright-msteams-reporter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/estruyf%2Fplaywright-msteams-reporter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/estruyf%2Fplaywright-msteams-reporter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/estruyf","download_url":"https://codeload.github.com/estruyf/playwright-msteams-reporter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/estruyf%2Fplaywright-msteams-reporter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278891753,"owners_count":26063858,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["e2e","msteams","playwright","playwright-tests","reporter","testing"],"created_at":"2025-10-08T05:02:23.549Z","updated_at":"2025-10-08T05:07:39.689Z","avatar_url":"https://github.com/estruyf.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Microsoft Teams reporter for Playwright\n\n[![npm version](https://badge.fury.io/js/playwright-msteams-reporter.svg)](https://badge.fury.io/js/playwright-msteams-reporter)\n[![Downloads](https://img.shields.io/npm/dt/playwright-msteams-reporter)](https://www.npmjs.com/package/playwright-msteams-reporter)\n![License](https://img.shields.io/github/license/estruyf/playwright-msteams-reporter)\n\nThis reporter for Playwright allows you to send the test results to a Microsoft Teams channel and mention users on failure.\n\nHere you can see an example card for successful test results:\n\n![Microsoft Teams card for successful test results](./assets/success.png)\n\nHere you can see an example card for failed test results:\n\n![Microsoft Teams card for failed test results](./assets/failure.png)\n\n## Prerequisites\n\nTo use this reporter, you must have a Microsoft Teams webhook URL. You can create a webhook URL using the Microsoft Teams Power Automate connector or the Microsoft Teams incoming webhook functionality.\n\nAs the incoming webhook functionality will stop working on October 1, 2024 (extended to December 2025), it is recommended to use the Power Automate connector functionality.\n\n\u003e **Important**: You need to copy the `webhook URL` from the configuration, as you will need it to configure the reporter.\n\n\u003e **Info**: The [Retirement of Office 365 connectors within Microsoft Teams](https://devblogs.microsoft.com/microsoft365dev/retirement-of-office-365-connectors-within-microsoft-teams/) article provides more information on the retirement of the incoming webhook functionality.\n\n### Microsoft Teams Power Automate webhook\n\nTo create a Power Automate webhook for Microsoft Teams, you can follow these steps:\n\n- Start with the following [Post to a channel when a webhook request is received](https://make.preview.powerautomate.com/galleries/public/templates/d271a6f01c2545a28348d8f2cddf4c8f/post-to-a-channel-when-a-webhook-request-is-received) template\n- Click continue to use the template\n- Click on the **Post your own adaptive card as the Flow bot to a channel** action\n- Configure the action with the following settings:\n  - **Team**: Select the team where you want to post the message\n  - **Channel**: Select the channel where you want to post the message\n\n![Power Automate connector configuration](./assets/powerautomate-settings.png)\n\n- Click on the **Save** button\n- Click on **When a Teams webhook request is received** and copy the **HTTP URL**\n\n\u003e [!WARNING]\n\u003e When using the PowerAutomate template, a template footer will automatically be included like: `\u003cname\u003e used a Workflow template to send this card. Get template`.\n\u003e You can remove this footer by creating a copy of the flow, and use the new one instead.\n\u003e You can find more information about this procedure in the following blog post: [How to remove \"\u003cName\u003e used a Workflow template to send this card. Get template\"](https://docs.hetrixtools.com/microsoft-teams-how-to-remove-name-used-a-workflow-template-to-send-this-card-get-template/).\n\n### Microsoft Teams incoming webhook (retiring October 1, 2024)\n\nTo use this reporter, you need to create an incoming webhook for your Microsoft Teams channel. You can find more information on how to do this in the [Microsoft documentation](https://learn.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook?tabs=newteams%2Cdotnet#create-an-incoming-webhook).\n\n\u003e **Important**: You need to copy the `webhook URL` from the configuration, as you will need it to configure the reporter.\n\n## Installation\n\nInstall from npm:\n\n```bash\nnpm install playwright-msteams-reporter\n```\n\n## Usage\n\nYou can configure the reporter by adding it to the `playwright.config.js` file:\n\n```javascript\nimport { defineConfig } from '@playwright/test';\nimport type { MsTeamsReporterOptions } from \"playwright-msteams-reporter\";\n\nexport default defineConfig({\n  reporter: [\n    ['list'],\n    [\n      'playwright-msteams-reporter',\n      \u003cMsTeamsReporterOptions\u003e{\n        webhookUrl: \"\u003cwebhookUrl\u003e\",\n        webhookType: \"powerautomate\", // or \"msteams\"\n      }\n    ]\n  ],\n});\n```\n\n\u003e More information on how to use reporters can be found in the [Playwright documentation](https://playwright.dev/docs/test-reporters).\n\n## Configuration\n\nThe reporter supports the following configuration options:\n\n| Option                 | Description                                                     | Type                     | Required | Default                                        |\n| ---------------------- | --------------------------------------------------------------- | ------------------------ | -------- | ---------------------------------------------- |\n| `webhookUrl`           | The Microsoft Teams webhook URL                                 | `boolean`                | `true`   | `undefined`                                    |\n| `webhookType`          | The type of the webhook (`msteams` or `powerautomate`)          | `string`                 | `false`  | `powerautomate`                                |\n| `title`                | The notification title                                          | `string`                 | `false`  | `Playwright Test Results`                      |\n| `linkToResultsUrl`     | Link to the test results                                        | `string \\| () =\u003e string` | `false`  | `undefined`                                    |\n| `linkToResultsText`    | Text for the link to the test results                           | `string`                 | `false`  | `View test results`                            |\n| `linkUrlOnFailure`     | Link to page where you can view, trigger, etc. the failed tests | `string \\| () =\u003e string` | `false`  | `undefined`                                    |\n| `linkTextOnFailure`    | Text for the failed tests link action                           | `string`                 | `false`  | `undefined`                                    |\n| `notifyOnSuccess`      | Notify on success                                               | `boolean`                | `false`  | `true`                                         |\n| `mentionOnFailure`     | Mention users on failure (comma separated list)                 | `string`                 | `false`  | `undefined`                                    |\n| `mentionOnFailureText` | Text to mention users on failure                                | `string`                 | `false`  | `{mentions} please validate the test results.` |\n| `enableEmoji`          | Show an emoji based on the test status                          | `boolean`                | `false`  | `false`                                        |\n| `quiet`                | Do not show any output in the console                           | `boolean`                | `false`  | `false`                                        |\n| `debug`                | Show debug information                                          | `boolean`                | `false`  | `false`                                        |\n| `shouldRun`            | Conditional reporting                                           | ` Suite =\u003e boolean`      | `false`  | `true`                                         |\n| `reportOnEmpty`        | Prevents sending a report when no tests are run                 | `boolean`                | `false`  | `false`                                        |\n| `enableDuration`       | Show the test run duration                                      | `boolean`                | `false`  | `false`                                        |\n| `mentionAuthors`       | Use git metadata to mention authors of the commit or PR         | `boolean`                | `false`  | `false`                                        |\n\n### Mention users\n\nWith the `mentionOnFailure` option, you can mention users in the Microsoft Teams channel when a test fails. You can provide an array of users to mention.\n\n### Mention users with the Power Automate connector\n\nYou can mention users by providing their email addresses when using the Power Automate connector. The reporter will replace the `{mentions}` placeholder in the `mentionOnFailureText` with the mentioned users.\n\n```javascript\n{\n  mentionOnFailure: \"mail1@elio.dev,mail2@elio.dev\",\n  mentionOnFailureText: \"{mentions} check those failed tests!\"\n}\n```\n\n### Mention users with the Microsoft Teams Incoming Webhook\n\nThe format can be either the full name and email (`\"Full name \u003cemail\u003e\"`) or just the email address (`email`). The reporter will replace the `{mentions}` placeholder in the `mentionOnFailureText` with the mentioned users.\n\n```javascript\n{\n  mentionOnFailure: \"Elio Struyf \u003cmail@elio.dev\u003e,mail@elio.dev\",\n  mentionOnFailureText: \"{mentions} check those failed tests!\"\n}\n```\n\n### Link to the results\n\nWith the `linkToResultsUrl` option, you can provide a link to the test results. For example, you can view the test results on your CI/CD platform.\n\n### Conditional reporting (shouldRun)\n\nExample (report only from jenkins runs - project name set as 'dev\\_\\_jenkins'):\n\n```javascript\nshouldRun: (suite) =\u003e {\n  if (suite.suites[0].project()?.name.includes(\"_jenkins\")) return true;\n\n  return false;\n};\n```\n\n#### Github\n\n```javascript\n{\n  // The link to your GitHub Actions workflow run\n  linkToResultsUrl: `${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}`,\n}\n```\n\n#### Azure Devops\n\n```javascript\n{\n  // The link to your Azure DevOps pipeline run (add \u0026view=artifacts\u0026type=publishedArtifacts to access linked artifacts directly)\n  linkToResultsUrl: `${process.env.AZURE_SERVER_URL}/${process.env.AZURE_PROJECT}/_build/results?buildId=${process.env.AZURE_RUN_ID}`,\n}\n```\n\nMake sure to provide the environment variables in your Azure DevOps pipeline:\n\n```yaml\n- script: npx playwright test\n  displayName: \"Run Playwright tests\"\n  name: \"playwright\"\n  env:\n    CI: \"true\"\n    AZURE_SERVER_URL: $(System.CollectionUri)\n    AZURE_PROJECT: $(System.TeamProject)\n    AZURE_RUN_ID: $(Build.BuildId)\n```\n\n### Combine the reporter with the Playwright Azure Reporter\n\nYou can combine the Microsoft Teams reporter with the Playwright Azure Reporter to link to create a link to the test plan results on Azure DevOps. The following example shows how you can combine both reporters:\n\n```typescript\nimport { defineConfig } from \"@playwright/test\";\nimport type { AzureReporterOptions } from \"@alex_neo/playwright-azure-reporter\";\nimport type { MsTeamsReporterOptions } from \"playwright-msteams-reporter\";\n\nexport default defineConfig({\n  reporter: [\n    [\"list\"],\n    // First define the Azure reporter\n    [\n      \"@alex_neo/playwright-azure-reporter\",\n      \u003cAzureReporterOptions\u003e{\n        ...\n      },\n    ],\n    // Then define the Microsoft Teams reporter\n    [\n      'playwright-msteams-reporter',\n      \u003cMsTeamsReporterOptions\u003e{\n        webhookUrl: \"\u003cwebhookUrl\u003e\",\n        // Instead of providing the URL directly, you need to provide a function that returns the URL.\n        // The AZURE_PW_TEST_RUN_ID variable is only available once the Azure reporter has run.\n        linkToResultsUrl: () =\u003e `${process.env.AZURE_SERVER_URL}/${process.env.AZURE_PROJECT}/_testManagement/runs?runId=${process.env.AZURE_PW_TEST_RUN_ID}\u0026_a=runCharts`,\n        linkToResultsText: \"View test plan results\",\n      }\n    ]\n  ]\n});\n```\n\nMake sure to provide the environment variables in your Azure DevOps pipeline:\n\n```yaml\n- script: npx playwright test\n  displayName: \"Run Playwright tests\"\n  name: \"playwright\"\n  env:\n    CI: \"true\"\n    AZURE_SERVER_URL: $(System.CollectionUri)\n    AZURE_PROJECT: $(System.TeamProject)\n    AZURE_RUN_ID: $(Build.BuildId)\n```\n\n\u003cbr /\u003e\n\n[![Visitors](https://api.visitorbadge.io/api/visitors?path=https%3A%2F%2Fgithub.com%2Festruyf%2Fplaywright-msteams-reporter\u0026countColor=%23263759)](https://visitorbadge.io/status?path=https%3A%2F%2Fgithub.com%2Festruyf%2Fplaywright-msteams-reporter)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Festruyf%2Fplaywright-msteams-reporter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Festruyf%2Fplaywright-msteams-reporter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Festruyf%2Fplaywright-msteams-reporter/lists"}