-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: suggestions/feedback popup (#74)
test: Added test for sentry feedback
- Loading branch information
Showing
5 changed files
with
57 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
VITE_BACKEND_URL="https://testleaphyeasybloqs.com:8443" | ||
VITE_BACKEND_URL="https://testleaphyeasybloqs.com:8443" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
VITE_BACKEND_URL="https://testleaphyeasybloqs.com:8443" | ||
VITE_SENTRY_DSN="https://[email protected]:8443/2" | ||
VITE_SENTRY_SAMPLE_RATE="1.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { expect, test } from "@playwright/test"; | ||
import { goToHomePage, openExample } from "./utils"; | ||
|
||
test.beforeEach(goToHomePage); | ||
|
||
test("User Feedback", async ({ page }) => { | ||
await page.getByText("Leaphy Click").click(); | ||
|
||
await page.getByRole("button", { name: "Tips" }).click(); | ||
await page.getByRole("cell", { name: "Suggestion / Feedback" }).click(); | ||
await page.getByPlaceholder("Your name...").fill("test"); | ||
await page.getByPlaceholder("Email").fill("test@ing"); | ||
await page.locator("textarea").fill("test123"); | ||
|
||
// Make sure no requests are actually done | ||
await page.route("**/api/2/envelope/*", (route) => { | ||
route.fulfill({ | ||
status: 200, | ||
body: "", | ||
}); | ||
}); | ||
|
||
// Wait for the user_report feedback | ||
const feedbackPromise = page.waitForRequest((request) => { | ||
if (!/.*\/api\/2\/envelope\/.*/.test(request.url())) { | ||
return false; | ||
} | ||
|
||
let messages = request | ||
.postData() | ||
?.split("\n") | ||
.map((line) => JSON.parse(line)); | ||
|
||
return messages !== undefined && messages[1].type === "user_report"; | ||
}); | ||
|
||
await page.getByRole("button", { name: "Send" }).click(); | ||
let request = await feedbackPromise; | ||
|
||
let postData = request.postData(); | ||
expect(postData).toBeTruthy(); | ||
|
||
let messages = (postData as string) | ||
.split("\n") | ||
.map((line) => JSON.parse(line)); | ||
|
||
let feedback = messages[2]; | ||
expect(feedback.name).toBe("test"); | ||
expect(feedback.email).toBe("test@ing"); | ||
expect(feedback.comments).toBe("test123"); | ||
}); |