You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I used the GitHub search to find a similar question and didn't find it.
I searched in the documentation/README.
I already searched in Google "How to do X" and didn't find any information.
I already read and followed all the tutorial in the docs/README and didn't find an answer.
Commit to Help
I commit to help with one of those options 👆
Example Code
The current spec has this code:
test("Sign up with existing email", async ({ page }) => {
const fullName = "Test User"
const email = randomEmail()
const password = randomPassword()
// Sign up with an email
await page.goto("/signup")
await fillForm(page, fullName, email, password, password)
await page.getByRole("button", { name: "Sign Up" }).click()
// Sign up again with the same email
await page.goto("/signup")
await fillForm(page, fullName, email, password, password)
await page.getByRole("button", { name: "Sign Up" }).click()
await page
.getByText("The user with this email already exists in the system")
.click()
})
Description
When the spec to test signing up with the same email address, the spec fails with an interesting problem:
The backend produces a 500 error because the database is unable to insert the ix_user_email that is not unique. It means the backend, when it searched for the users to detect a duplicate, was not able to find this user somehow.
This causes the spec to fail with a CORS error. This is super confusing, but after doing enough research, it's clear that 500 errors from fastapi result in CORS errors because they don't take the cors middleware configurations from the app.
And as I played with this, it became clear that the spec might just be moving too quickly for the backend to process --
So, a potential fix might look like this:
test("Sign up with existing email", async ({ page }) => {
const fullName = "Test User"
const email = randomEmail()
const password = randomPassword()
// Sign up with an email
await page.goto("/signup")
await fillForm(page, fullName, email, password, password)
await page.getByRole("button", { name: "Sign Up" }).click()
await page
.getByText("Your account has been created successfully")
.click()
// Sign up again with the same email
await page.goto("/signup")
await fillForm(page, fullName, email, password, password)
await page.getByRole("button", { name: "Sign Up" }).click()
await page
.getByText("The user with this email already exists in the system")
.click()
})```
### Operating System
macOS
### Operating System Details
M2 pro, sequoia 15.0.1
### Python Version
Python 3.11.10
### Additional Context
_No response_
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
First Check
Commit to Help
Example Code
Description
When the spec to test signing up with the same email address, the spec fails with an interesting problem:
So, a potential fix might look like this:
Beta Was this translation helpful? Give feedback.
All reactions