1
1
import { type Page , expect , test } from "@playwright/test"
2
2
3
- import { randomEmail } from "./utils/random"
3
+ import { randomEmail , randomPassword } from "./utils/random"
4
4
5
5
test . use ( { storageState : { cookies : [ ] , origins : [ ] } } )
6
6
@@ -56,7 +56,7 @@ test("Log In link is visible", async ({ page }) => {
56
56
test ( "Sign up with valid name, email, and password" , async ( { page } ) => {
57
57
const full_name = "Test User"
58
58
const email = randomEmail ( )
59
- const password = "changethis"
59
+ const password = randomPassword ( )
60
60
61
61
await page . goto ( "/signup" )
62
62
await fillForm ( page , full_name , email , password , password )
@@ -79,20 +79,20 @@ test("Sign up with invalid email", async ({ page }) => {
79
79
} )
80
80
81
81
test ( "Sign up with existing email" , async ( { page } ) => {
82
- const full_name = "Test User"
82
+ const fullName = "Test User"
83
83
const email = randomEmail ( )
84
- const password = "changethis"
84
+ const password = randomPassword ( )
85
85
86
86
// Sign up with an email
87
87
await page . goto ( "/signup" )
88
88
89
- await fillForm ( page , full_name , email , password , password )
89
+ await fillForm ( page , fullName , email , password , password )
90
90
await page . getByRole ( "button" , { name : "Sign Up" } ) . click ( )
91
91
92
92
// Sign up again with the same email
93
93
await page . goto ( "/signup" )
94
94
95
- await fillForm ( page , full_name , email , password , password )
95
+ await fillForm ( page , fullName , email , password , password )
96
96
await page . getByRole ( "button" , { name : "Sign Up" } ) . click ( )
97
97
98
98
await page
@@ -101,13 +101,13 @@ test("Sign up with existing email", async ({ page }) => {
101
101
} )
102
102
103
103
test ( "Sign up with weak password" , async ( { page } ) => {
104
- const full_name = "Test User"
104
+ const fullName = "Test User"
105
105
const email = randomEmail ( )
106
106
const password = "weak"
107
107
108
108
await page . goto ( "/signup" )
109
109
110
- await fillForm ( page , full_name , email , password , password )
110
+ await fillForm ( page , fullName , email , password , password )
111
111
await page . getByRole ( "button" , { name : "Sign Up" } ) . click ( )
112
112
113
113
await expect (
@@ -116,53 +116,53 @@ test("Sign up with weak password", async ({ page }) => {
116
116
} )
117
117
118
118
test ( "Sign up with mismatched passwords" , async ( { page } ) => {
119
- const full_name = "Test User"
119
+ const fullName = "Test User"
120
120
const email = randomEmail ( )
121
- const password = "changethis"
122
- const password2 = "changethat"
121
+ const password = randomPassword ( )
122
+ const password2 = randomPassword ( )
123
123
124
124
await page . goto ( "/signup" )
125
125
126
- await fillForm ( page , full_name , email , password , password2 )
126
+ await fillForm ( page , fullName , email , password , password2 )
127
127
await page . getByRole ( "button" , { name : "Sign Up" } ) . click ( )
128
128
129
129
await expect ( page . getByText ( "Passwords do not match" ) ) . toBeVisible ( )
130
130
} )
131
131
132
132
test ( "Sign up with missing full name" , async ( { page } ) => {
133
- const full_name = ""
133
+ const fullName = ""
134
134
const email = randomEmail ( )
135
- const password = "changethis"
135
+ const password = randomPassword ( )
136
136
137
137
await page . goto ( "/signup" )
138
138
139
- await fillForm ( page , full_name , email , password , password )
139
+ await fillForm ( page , fullName , email , password , password )
140
140
await page . getByRole ( "button" , { name : "Sign Up" } ) . click ( )
141
141
142
142
await expect ( page . getByText ( "Full Name is required" ) ) . toBeVisible ( )
143
143
} )
144
144
145
145
test ( "Sign up with missing email" , async ( { page } ) => {
146
- const full_name = "Test User"
146
+ const fullName = "Test User"
147
147
const email = ""
148
- const password = "changethis"
148
+ const password = randomPassword ( )
149
149
150
150
await page . goto ( "/signup" )
151
151
152
- await fillForm ( page , full_name , email , password , password )
152
+ await fillForm ( page , fullName , email , password , password )
153
153
await page . getByRole ( "button" , { name : "Sign Up" } ) . click ( )
154
154
155
155
await expect ( page . getByText ( "Email is required" ) ) . toBeVisible ( )
156
156
} )
157
157
158
158
test ( "Sign up with missing password" , async ( { page } ) => {
159
- const full_name = ""
159
+ const fullName = ""
160
160
const email = randomEmail ( )
161
161
const password = ""
162
162
163
163
await page . goto ( "/signup" )
164
164
165
- await fillForm ( page , full_name , email , password , password )
165
+ await fillForm ( page , fullName , email , password , password )
166
166
await page . getByRole ( "button" , { name : "Sign Up" } ) . click ( )
167
167
168
168
await expect ( page . getByText ( "Password is required" ) ) . toBeVisible ( )
0 commit comments