11import { type Page , expect , test } from "@playwright/test"
22
3- import { randomEmail } from "./utils/random"
3+ import { randomEmail , randomPassword } from "./utils/random"
44
55test . use ( { storageState : { cookies : [ ] , origins : [ ] } } )
66
@@ -56,7 +56,7 @@ test("Log In link is visible", async ({ page }) => {
5656test ( "Sign up with valid name, email, and password" , async ( { page } ) => {
5757 const full_name = "Test User"
5858 const email = randomEmail ( )
59- const password = "changethis"
59+ const password = randomPassword ( )
6060
6161 await page . goto ( "/signup" )
6262 await fillForm ( page , full_name , email , password , password )
@@ -79,20 +79,20 @@ test("Sign up with invalid email", async ({ page }) => {
7979} )
8080
8181test ( "Sign up with existing email" , async ( { page } ) => {
82- const full_name = "Test User"
82+ const fullName = "Test User"
8383 const email = randomEmail ( )
84- const password = "changethis"
84+ const password = randomPassword ( )
8585
8686 // Sign up with an email
8787 await page . goto ( "/signup" )
8888
89- await fillForm ( page , full_name , email , password , password )
89+ await fillForm ( page , fullName , email , password , password )
9090 await page . getByRole ( "button" , { name : "Sign Up" } ) . click ( )
9191
9292 // Sign up again with the same email
9393 await page . goto ( "/signup" )
9494
95- await fillForm ( page , full_name , email , password , password )
95+ await fillForm ( page , fullName , email , password , password )
9696 await page . getByRole ( "button" , { name : "Sign Up" } ) . click ( )
9797
9898 await page
@@ -101,13 +101,13 @@ test("Sign up with existing email", async ({ page }) => {
101101} )
102102
103103test ( "Sign up with weak password" , async ( { page } ) => {
104- const full_name = "Test User"
104+ const fullName = "Test User"
105105 const email = randomEmail ( )
106106 const password = "weak"
107107
108108 await page . goto ( "/signup" )
109109
110- await fillForm ( page , full_name , email , password , password )
110+ await fillForm ( page , fullName , email , password , password )
111111 await page . getByRole ( "button" , { name : "Sign Up" } ) . click ( )
112112
113113 await expect (
@@ -116,53 +116,53 @@ test("Sign up with weak password", async ({ page }) => {
116116} )
117117
118118test ( "Sign up with mismatched passwords" , async ( { page } ) => {
119- const full_name = "Test User"
119+ const fullName = "Test User"
120120 const email = randomEmail ( )
121- const password = "changethis"
122- const password2 = "changethat"
121+ const password = randomPassword ( )
122+ const password2 = randomPassword ( )
123123
124124 await page . goto ( "/signup" )
125125
126- await fillForm ( page , full_name , email , password , password2 )
126+ await fillForm ( page , fullName , email , password , password2 )
127127 await page . getByRole ( "button" , { name : "Sign Up" } ) . click ( )
128128
129129 await expect ( page . getByText ( "Passwords do not match" ) ) . toBeVisible ( )
130130} )
131131
132132test ( "Sign up with missing full name" , async ( { page } ) => {
133- const full_name = ""
133+ const fullName = ""
134134 const email = randomEmail ( )
135- const password = "changethis"
135+ const password = randomPassword ( )
136136
137137 await page . goto ( "/signup" )
138138
139- await fillForm ( page , full_name , email , password , password )
139+ await fillForm ( page , fullName , email , password , password )
140140 await page . getByRole ( "button" , { name : "Sign Up" } ) . click ( )
141141
142142 await expect ( page . getByText ( "Full Name is required" ) ) . toBeVisible ( )
143143} )
144144
145145test ( "Sign up with missing email" , async ( { page } ) => {
146- const full_name = "Test User"
146+ const fullName = "Test User"
147147 const email = ""
148- const password = "changethis"
148+ const password = randomPassword ( )
149149
150150 await page . goto ( "/signup" )
151151
152- await fillForm ( page , full_name , email , password , password )
152+ await fillForm ( page , fullName , email , password , password )
153153 await page . getByRole ( "button" , { name : "Sign Up" } ) . click ( )
154154
155155 await expect ( page . getByText ( "Email is required" ) ) . toBeVisible ( )
156156} )
157157
158158test ( "Sign up with missing password" , async ( { page } ) => {
159- const full_name = ""
159+ const fullName = ""
160160 const email = randomEmail ( )
161161 const password = ""
162162
163163 await page . goto ( "/signup" )
164164
165- await fillForm ( page , full_name , email , password , password )
165+ await fillForm ( page , fullName , email , password , password )
166166 await page . getByRole ( "button" , { name : "Sign Up" } ) . click ( )
167167
168168 await expect ( page . getByText ( "Password is required" ) ) . toBeVisible ( )
0 commit comments