Skip to content

Commit

Permalink
Merge pull request #8 from playwright-community/dev
Browse files Browse the repository at this point in the history
#7 - Fix webhook validation
  • Loading branch information
estruyf authored Jul 18, 2024
2 parents 1aff2d9 + c00e96b commit f359d5d
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

All notable changes to this project will be documented in this file.

## [0.0.9]

- [#7](https://github.com/playwright-community/playwright-msteams-reporter/issues/7): Fix for Power Automate webhook URL validation

## [0.0.8]

- [#4](https://github.com/playwright-community/playwright-msteams-reporter/issues/4): Added support for flaky tests
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "playwright-msteams-reporter",
"version": "0.0.8",
"version": "0.0.9",
"description": "Microsoft Teams reporter for Playwright which allows you to send notifications about the status of your E2E tests.",
"main": "dist/index.js",
"scripts": {
Expand Down
9 changes: 9 additions & 0 deletions src/utils/validateWebhookUrl.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ describe("validateWebhookUrl", () => {
).toBe(true);
});

it("Valid Power Automate webhook URL (France) (with argument)", () => {
expect(
validateWebhookUrl(
"https://prod2-00.francecentral.logic.azure.com:443/workflows/1234567890abcdef1234567890abcdef/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=1234567890abcdef1234567890abcdef",
"powerautomate"
)
).toBe(true);
});

it("Invalid Power Automate webhook URL 1", () => {
expect(
validateWebhookUrl(
Expand Down
2 changes: 1 addition & 1 deletion src/utils/validateWebhookUrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const validateWebhookUrl = (
// https://prod-{int}.{region}.logic.azure.com:443/workflows/{id}/triggers/manual/paths/invoke?api-version=2016-06-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig={sig}
return !!(
webhookUrl &&
webhookUrl.startsWith("https://prod-") &&
webhookUrl.startsWith("https://prod") &&
webhookUrl.includes("logic.azure.com") &&
webhookUrl.includes("/workflows/") &&
webhookUrl.includes("/triggers/")
Expand Down

0 comments on commit f359d5d

Please sign in to comment.