Fixes Auth UI (#1447)

This commit is contained in:
Mihovil Ilakovac 2023-09-16 00:13:37 +02:00 committed by GitHub
parent 99c9021f82
commit b9ba6fbaa4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 20 additions and 6 deletions

View File

@ -1,6 +1,8 @@
{{={= =}=}}
import { useContext } from 'react'
import { useForm, UseFormReturn } from 'react-hook-form'
import { styled } from '../../../../stitches.config'
import config from '../../../../config'
import { AuthContext } from '../../Auth'
import {

View File

@ -690,7 +690,7 @@
"file",
"web-app/src/auth/forms/internal/common/LoginSignupForm.tsx"
],
"f211f57dca3f10f08a3e618d27bf8006d26f6832bb7e40f8a22ae44f2d42531e"
"c44ab5ffb4e71ead2acd45b17786fe305db856b698c01b1112d140ee5bfe4d31"
],
[
[

View File

@ -1,5 +1,7 @@
import { useContext } from 'react'
import { useForm, UseFormReturn } from 'react-hook-form'
import { styled } from '../../../../stitches.config'
import config from '../../../../config'
import { AuthContext } from '../../Auth'
import {

View File

@ -1,3 +1,2 @@
TEST_ENV_VAR="I am test"
DATABASE_URL=postgresql://postgres:postgres@localhost/todoapp
#PORT=3001
GOOGLE_CLIENT_ID="mock-client-id"
GOOGLE_CLIENT_SECRET="mock-client-secret"

View File

@ -9,6 +9,7 @@ app todoApp {
],
auth: {
userEntity: User,
externalAuthEntity: SocialLogin,
methods: {
email: {
fromField: {
@ -25,6 +26,7 @@ app todoApp {
},
allowUnverifiedLogin: true,
},
google: {}
},
onAuthFailedRedirectTo: "/login",
onAuthSucceededRedirectTo: "/profile"

View File

@ -6,8 +6,9 @@
"scripts": {
"example-app:start": "node start.js",
"example-app:start-db": "npm run example-app:cleanup-db && cd ./examples/todoApp && cabal run wasp-cli start db",
"example-app:start-app": "npm run example-app:wait-for-db && cd ./examples/todoApp && cabal run wasp-cli db migrate-dev && cabal run wasp-cli start",
"example-app:start-app": "npm run example-app:wait-for-db && npm run example-app:prepare-env && cd ./examples/todoApp && cabal run wasp-cli db migrate-dev && cabal run wasp-cli start",
"example-app:wait-for-db": "sleep 5 && ./node_modules/.bin/wait-port 5432",
"example-app:prepare-env": "cp ./examples/todoApp/sample.env.server ./examples/todoApp/.env.server",
"example-app:cleanup-db": "(docker container rm $(docker container ls -f name=^wasp-dev-db-todoApp- -q) -f || true) && docker volume rm $(docker volume ls -f name=^wasp-dev-db-todoApp- -q) -f || true"
},
"keywords": [],

View File

@ -12,6 +12,14 @@ test.describe("signup and login", () => {
test.describe.configure({ mode: "serial" });
test("social button renders", async ({ page }) => {
await page.goto("/signup");
await page.waitForSelector("text=Create a new account");
await expect(page.locator("a[href='http://localhost:3001/auth/google/login']")).toBeVisible();
});
test("can sign up", async ({ page }) => {
await page.goto("/signup");
@ -19,7 +27,7 @@ test.describe("signup and login", () => {
await page.locator("input[type='email']").fill(randomEmail);
await page.locator("input[type='password']").fill(password);
await page.getByText("Sign up").click();
await page.locator("button").click();
await expect(page).toHaveURL("/profile");
});