Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#7 - Fix webhook validation #8

Merged
merged 2 commits into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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