feat: implement turnstile on signup (#13913)
* wip * feat: turnstile + removal of trpcState * fix: use react-turnstile * fix: i18n hydration errors * wip: server side validation for cf token * fix: hide in e2e tests * feat:throw on error of token * fix: set correct form values onVerify * fix: use getIp for remoteIp and use correct header for token input * chore: update .env.example * fix: Update .env.example * Update apps/web/pages/signup.tsx * chore: fix typo * fix: typo * feat: hide until error * feat: appearance interaction only * remove cloudflare from e2e * fix: legacyBehavior * fix links + wait for load * fix: signup tests * test: wait for load state --------- Co-authored-by: Keith Williams <[email protected]> Co-authored-by: Udit Takkar <[email protected]>
This commit is contained in:
11 files changed
+243
-102
No files matched your search
@@ -25,6 +25,7 @@ test.describe("Signup Flow Test", async () => {
|
||||
});
|
||||
|
||||
await page.goto("/signup");
|
||||
await page.waitForLoadState("networkidle");
|
||||
|
||||
const alertMessage = "Username or email is already taken";
|
||||
|
||||
@@ -51,6 +52,7 @@ test.describe("Signup Flow Test", async () => {
|
||||
});
|
||||
|
||||
await page.goto("/signup");
|
||||
await page.waitForLoadState("networkidle");
|
||||
|
||||
const alertMessage = "Username or email is already taken";
|
||||
|
||||
@@ -81,6 +83,7 @@ test.describe("Signup Flow Test", async () => {
|
||||
|
||||
// Signup with premium username name
|
||||
await page.goto("/signup");
|
||||
await page.waitForLoadState("networkidle");
|
||||
|
||||
// Fill form
|
||||
await page.locator('input[name="username"]').fill("rock");
|
||||
@@ -108,6 +111,7 @@ test.describe("Signup Flow Test", async () => {
|
||||
});
|
||||
|
||||
await page.goto("/signup");
|
||||
await page.waitForLoadState("networkidle");
|
||||
|
||||
// Fill form
|
||||
await page.locator('input[name="username"]').fill(userToCreate.username);
|
||||
@@ -115,10 +119,7 @@ test.describe("Signup Flow Test", async () => {
|
||||
await page.locator('input[name="password"]').fill(userToCreate.password);
|
||||
|
||||
await page.click('button[type="submit"]');
|
||||
await page.waitForLoadState("networkidle");
|
||||
// Find the newly created user and add it to the fixture store
|
||||
const newUser = await users.set(userToCreate.email);
|
||||
expect(newUser).not.toBeNull();
|
||||
await page.waitForURL("/auth/verify-email**");
|
||||
|
||||
// Check that the URL matches the expected URL
|
||||
expect(page.url()).toContain("/auth/verify-email");
|
||||
@@ -177,8 +178,8 @@ test.describe("Signup Flow Test", async () => {
|
||||
});
|
||||
|
||||
const signupUrlWithToken = `/signup?token=${token}`;
|
||||
|
||||
await page.goto(signupUrlWithToken);
|
||||
await page.waitForLoadState("networkidle");
|
||||
|
||||
const usernameField = page.locator('input[name="username"]');
|
||||
const emailField = page.locator('input[name="email"]');
|
||||
|
||||
Reference in new issue
Block a user