fix: allow dots in username (#11706)
* fix: allow dots in username * test: added unit tests for slugify * test: add test for username change * tests: add test for username and dynamic booking * fix: type error --------- Co-authored-by: Peer Richelsen <[email protected]>
This commit is contained in:
1 parent
0014ca6865
commit
aa54c013f8
5 files changed
+53
-5
No files matched your search
@@ -43,9 +43,40 @@ test.describe("Change username on settings", () => {
|
||||
id: user.id,
|
||||
},
|
||||
});
|
||||
|
||||
expect(newUpdatedUser.username).toBe("demousernamex");
|
||||
});
|
||||
|
||||
test("User can change username to include periods(or dots)", async ({ page, users, prisma }) => {
|
||||
const user = await users.create();
|
||||
|
||||
await user.apiLogin();
|
||||
// Try to go homepage
|
||||
await page.goto("/settings/my-account/profile");
|
||||
// Change username from normal to normal
|
||||
const usernameInput = page.locator("[data-testid=username-input]");
|
||||
// User can change username to include dots(or periods)
|
||||
await usernameInput.fill("demo.username");
|
||||
await page.click("[data-testid=update-username-btn]");
|
||||
await Promise.all([
|
||||
page.click("[data-testid=save-username]"),
|
||||
page.getByTestId("toast-success").waitFor(),
|
||||
]);
|
||||
await page.waitForLoadState("networkidle");
|
||||
|
||||
const updatedUser = await prisma.user.findUniqueOrThrow({
|
||||
where: {
|
||||
id: user.id,
|
||||
},
|
||||
});
|
||||
|
||||
expect(updatedUser.username).toBe("demo.username");
|
||||
|
||||
// Check if user avatar can be accessed and response headers contain 'image/' in the content type
|
||||
const response = await page.goto("/demo.username/avatar.png");
|
||||
expect(response?.headers()?.["content-type"]).toContain("image/");
|
||||
});
|
||||
|
||||
test("User can update to PREMIUM username", async ({ page, users }, testInfo) => {
|
||||
// eslint-disable-next-line playwright/no-skipped-test
|
||||
test.skip(!IS_STRIPE_ENABLED, "It should only run if Stripe is installed");
|
||||
|
||||
@@ -13,7 +13,7 @@ test("dynamic booking", async ({ page, users }) => {
|
||||
const pro = await users.create();
|
||||
await pro.apiLogin();
|
||||
|
||||
const free = await users.create({ username: "free" });
|
||||
const free = await users.create({ username: "free.example" });
|
||||
await page.goto(`/${pro.username}+${free.username}`);
|
||||
|
||||
await test.step("book an event first day in next month", async () => {
|
||||
|
||||
@@ -635,7 +635,7 @@ export const TestData = {
|
||||
example: {
|
||||
name: "Example",
|
||||
email: "[email protected]",
|
||||
username: "example",
|
||||
username: "example.username",
|
||||
defaultScheduleId: 1,
|
||||
timeZone: Timezones["+5:30"],
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user