From d251c82f6045e4039800957ac51be3f0af49414a Mon Sep 17 00:00:00 2001 From: Elio Struyf Date: Thu, 18 Jul 2024 17:20:19 +0200 Subject: [PATCH 1/2] #7 - Fix webhook validation --- CHANGELOG.md | 4 ++++ src/utils/validateWebhookUrl.test.ts | 9 +++++++++ src/utils/validateWebhookUrl.ts | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a0c9fd0..de86a00 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/utils/validateWebhookUrl.test.ts b/src/utils/validateWebhookUrl.test.ts index 71ab32c..15419b0 100644 --- a/src/utils/validateWebhookUrl.test.ts +++ b/src/utils/validateWebhookUrl.test.ts @@ -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( diff --git a/src/utils/validateWebhookUrl.ts b/src/utils/validateWebhookUrl.ts index 133fc52..5ee16cf 100644 --- a/src/utils/validateWebhookUrl.ts +++ b/src/utils/validateWebhookUrl.ts @@ -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/") From c00e96b7ff653b5a020ec5fe0c05911d5f501f9b Mon Sep 17 00:00:00 2001 From: Elio Struyf Date: Thu, 18 Jul 2024 17:20:58 +0200 Subject: [PATCH 2/2] 0.0.9 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 586d927..c5e6227 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "playwright-msteams-reporter", - "version": "0.0.8", + "version": "0.0.9", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "playwright-msteams-reporter", - "version": "0.0.8", + "version": "0.0.9", "license": "MIT", "devDependencies": { "@playwright/test": "^1.45.0", diff --git a/package.json b/package.json index c3e521f..06e48eb 100644 --- a/package.json +++ b/package.json @@ -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": {