@@ -50,7 +50,7 @@ export default function RootLayout({ children }: { children: React.ReactNode })
50
50
}` ,
51
51
)
52
52
. addFile (
53
- 'src/app/hash/user/[[...catchall]]/ page.tsx' ,
53
+ 'src/app/hash/user/page.tsx' ,
54
54
( ) => `
55
55
import { UserProfile, UserButton } from '@clerk/nextjs';
56
56
@@ -64,7 +64,7 @@ export default function Page() {
64
64
}` ,
65
65
)
66
66
. addFile (
67
- 'src/app/hash/sign-in/[[...catchall]]/ page.tsx' ,
67
+ 'src/app/hash/sign-in/page.tsx' ,
68
68
( ) => `
69
69
import { SignIn } from '@clerk/nextjs';
70
70
@@ -91,129 +91,130 @@ export default function Page() {
91
91
await app . teardown ( ) ;
92
92
} ) ;
93
93
94
- //TODO-RETHEME: Refactor this, because this path doesn't exist anymore
95
- // test('user profile with path routing', async ({ page, context }) => {
96
- // const u = createTestUtils({ app, page, context });
97
- // await u.po.signIn.goTo();
98
- // await u.po.signIn.waitForMounted();
99
- // await u.po.signIn.signInWithEmailAndInstantPassword({ email: fakeUser.email, password: fakeUser.password });
100
- // await u.po.expect.toBeSignedIn();
101
- //
102
- // await u.po.userProfile.goTo();
103
- // await u.po.userProfile.waitForMounted();
104
- //
105
- // await u.page.getByText(/Set username/i).click();
106
- //
107
- // await u.page.waitForURL(`${app.serverUrl}/user/username`);
108
- //
109
- // await u.page.getByText(/Cancel/i).click();
110
- //
111
- // await u.page.waitForURL(`${app.serverUrl}/user`);
112
- //
113
- // await u.page.getByText(/Add email address/i).click();
114
- //
115
- // await u.page.waitForURL(`${app.serverUrl}/user/email-address`);
116
- //
117
- // await u.page.getByText(/Cancel/i).click();
118
- //
119
- // await u.page.waitForURL(`${app.serverUrl}/user`);
120
- // });
121
-
122
- //TODO-RETHEME: Refactor this, because this path doesn't exist anymore
123
- // test('user profile with hash routing', async ({ page, context }) => {
124
- // const u = createTestUtils({ app, page, context });
125
- // await u.po.signIn.goTo();
126
- // await u.po.signIn.waitForMounted();
127
- // await u.po.signIn.signInWithEmailAndInstantPassword({ email: fakeUser.email, password: fakeUser.password });
128
- // await u.po.expect.toBeSignedIn();
129
- //
130
- // await u.page.goToRelative('/hash/user');
131
- // await u.po.userProfile.waitForMounted();
132
- //
133
- // await u.page.getByText(/Set username/i).click();
134
- //
135
- // expect(u.page.url()).toBe(`${app.serverUrl}/hash/user#/username`);
136
- //
137
- // await u.page.getByText(/Cancel/i).click();
138
- //
139
- // expect(u.page.url()).toBe(`${app.serverUrl}/hash/user#`);
140
- //
141
- // await u.page.getByText(/Add email address/i).click();
142
- //
143
- // expect(u.page.url()).toBe(`${app.serverUrl}/hash/user#/email-address`);
144
- //
145
- // await u.page.getByText(/Cancel/i).click();
146
- //
147
- // expect(u.page.url()).toBe(`${app.serverUrl}/hash/user#`);
148
- // });
149
-
150
- // TODO-RETHEME: fix this test
151
- // test('sign in with path routing', async ({ page, context }) => {
152
- // const u = createTestUtils({ app, page, context });
153
- // await u.po.signIn.goTo();
154
- // await u.po.signIn.waitForMounted();
155
- //
156
- // await u.po.signIn.setIdentifier(fakeUser.email);
157
- // await u.po.signIn.continue();
158
- // await u.page.waitForURL(`${app.serverUrl}/sign-in/factor-one`);
159
- //
160
- // await u.po.signIn.setPassword(fakeUser.password);
161
- // await u.po.signIn.continue();
162
- //
163
- // await u.po.expect.toBeSignedIn();
164
- // });
165
-
166
- // TODO-RETHEME: fix this test
167
- // test('sign in with hash routing', async ({ page, context }) => {
168
- // const u = createTestUtils({ app, page, context });
169
- // await u.page.goToRelative('/hash/sign-in');
170
- // await u.po.signIn.waitForMounted();
171
- //
172
- // await u.po.signIn.setIdentifier(fakeUser.email);
173
- // await u.po.signIn.continue();
174
- // await u.page.waitForURL(`${app.serverUrl}/hash/sign-in#/factor-one`);
175
- //
176
- // await u.po.signIn.setPassword(fakeUser.password);
177
- // await u.po.signIn.continue();
178
- //
179
- // await u.po.expect.toBeSignedIn();
180
- // });
181
-
182
- // TODO-RETHEME: fix this test
183
- // test('user profile from user button navigates correctly', async ({ page, context }) => {
184
- // const u = createTestUtils({ app, page, context });
185
- // await u.po.signIn.goTo();
186
- // await u.po.signIn.waitForMounted();
187
- // await u.po.signIn.signInWithEmailAndInstantPassword({ email: fakeUser.email, password: fakeUser.password });
188
- // await u.po.expect.toBeSignedIn();
189
- //
190
- // await u.page.goToRelative('/');
191
- // await u.page.waitForClerkComponentMounted();
192
- //
193
- // await u.page.getByRole('button', { name: 'Open user button' }).click();
194
- //
195
- // await u.page.getByText(/Manage account/).click();
196
- //
197
- // await u.page.waitForSelector('.cl-modalContent > .cl-userProfile-root', { state: 'attached' });
198
- //
199
- // await u.page.getByText(/Set username/i).click();
200
- // await u.page.getByText(/Cancel/i).click();
201
- //
202
- // await u.page.getByText(/Add email address/i).click();
203
- // await u.page.getByText(/Cancel/i).click();
204
- // });
205
- //
206
- // test('sign in with path routing navigates to previous page', async ({ page, context }) => {
207
- // const u = createTestUtils({ app, page, context });
208
- // await u.po.signIn.goTo();
209
- // await u.po.signIn.waitForMounted();
210
- //
211
- // await u.po.signIn.getGoToSignUp().click();
212
- // await u.po.signUp.waitForMounted();
213
- // await u.page.waitForURL(`${app.serverUrl}/sign-up?redirect_url=${encodeURIComponent(app.serverUrl + '/')}`);
214
- //
215
- // await page.goBack();
216
- // await u.po.signIn.waitForMounted();
217
- // await u.page.waitForURL(`${app.serverUrl}/sign-in`);
218
- // });
94
+ test ( 'user profile with path routing' , async ( { page, context } ) => {
95
+ const u = createTestUtils ( { app, page, context } ) ;
96
+ await u . po . signIn . goTo ( ) ;
97
+ await u . po . signIn . waitForMounted ( ) ;
98
+ await u . po . signIn . signInWithEmailAndInstantPassword ( { email : fakeUser . email , password : fakeUser . password } ) ;
99
+ await u . po . expect . toBeSignedIn ( ) ;
100
+
101
+ await u . po . userProfile . goTo ( ) ;
102
+ await u . po . userProfile . waitForMounted ( ) ;
103
+
104
+ await u . po . userProfile . clickSetUsername ( ) ;
105
+
106
+ u . page . getByText ( / U p d a t e u s e r n a m e / i) ;
107
+
108
+ await u . po . userProfile . typeUsername ( 'some_username' ) ;
109
+
110
+ await u . page . getByText ( / C a n c e l / i) . click ( ) ;
111
+
112
+ await u . page . waitForSelector ( '.cl-profileSectionContent__username .cl-headerTitle' , { state : 'detached' } ) ;
113
+
114
+ await u . po . userProfile . clickAddEmailAddress ( ) ;
115
+
116
+ u . page . getByText ( / a n e m a i l c o n t a i n i n g / i) ;
117
+
118
+ await u . po . userProfile . typeEmailAddress ( 'some@email.com' ) ;
119
+
120
+ await u . page . getByText ( / C a n c e l / i) . click ( ) ;
121
+ } ) ;
122
+
123
+ test ( 'user profile with hash routing' , async ( { page, context } ) => {
124
+ const u = createTestUtils ( { app, page, context } ) ;
125
+ await u . po . signIn . goTo ( ) ;
126
+ await u . po . signIn . waitForMounted ( ) ;
127
+ await u . po . signIn . signInWithEmailAndInstantPassword ( { email : fakeUser . email , password : fakeUser . password } ) ;
128
+ await u . po . expect . toBeSignedIn ( ) ;
129
+
130
+ await u . page . goToRelative ( '/hash/user' ) ;
131
+ await u . po . userProfile . waitForMounted ( ) ;
132
+
133
+ await u . po . userProfile . clickSetUsername ( ) ;
134
+
135
+ u . page . getByText ( / U p d a t e u s e r n a m e / i) ;
136
+
137
+ await u . po . userProfile . typeUsername ( 'some_username' ) ;
138
+
139
+ await u . page . getByText ( / C a n c e l / i) . click ( ) ;
140
+
141
+ await u . page . waitForSelector ( '.cl-profileSectionContent__username .cl-headerTitle' , { state : 'detached' } ) ;
142
+
143
+ await u . po . userProfile . clickAddEmailAddress ( ) ;
144
+
145
+ u . page . getByText ( / a n e m a i l c o n t a i n i n g / i) ;
146
+
147
+ await u . po . userProfile . typeEmailAddress ( 'some@email.com' ) ;
148
+
149
+ await u . page . getByText ( / C a n c e l / i) . click ( ) ;
150
+ } ) ;
151
+
152
+ test ( 'sign in with path routing' , async ( { page, context } ) => {
153
+ const u = createTestUtils ( { app, page, context } ) ;
154
+ await u . po . signIn . goTo ( ) ;
155
+ await u . po . signIn . waitForMounted ( ) ;
156
+
157
+ await u . po . signIn . setIdentifier ( fakeUser . email ) ;
158
+ await u . po . signIn . continue ( ) ;
159
+ await u . page . waitForURL ( `${ app . serverUrl } /sign-in/factor-one` ) ;
160
+
161
+ await u . po . signIn . setPassword ( fakeUser . password ) ;
162
+ await u . po . signIn . continue ( ) ;
163
+
164
+ await u . po . expect . toBeSignedIn ( ) ;
165
+ } ) ;
166
+
167
+ test ( 'sign in with hash routing' , async ( { page, context } ) => {
168
+ const u = createTestUtils ( { app, page, context } ) ;
169
+ await u . page . goToRelative ( '/hash/sign-in' ) ;
170
+ await u . po . signIn . waitForMounted ( ) ;
171
+
172
+ await u . po . signIn . setIdentifier ( fakeUser . email ) ;
173
+ await u . po . signIn . continue ( ) ;
174
+ await u . page . waitForURL ( `${ app . serverUrl } /hash/sign-in#/factor-one` ) ;
175
+
176
+ await u . po . signIn . setPassword ( fakeUser . password ) ;
177
+ await u . po . signIn . continue ( ) ;
178
+
179
+ await u . po . expect . toBeSignedIn ( ) ;
180
+ } ) ;
181
+
182
+ test ( 'user profile from user button navigates correctly' , async ( { page, context } ) => {
183
+ const u = createTestUtils ( { app, page, context } ) ;
184
+ await u . po . signIn . goTo ( ) ;
185
+ await u . po . signIn . waitForMounted ( ) ;
186
+ await u . po . signIn . signInWithEmailAndInstantPassword ( { email : fakeUser . email , password : fakeUser . password } ) ;
187
+ await u . po . expect . toBeSignedIn ( ) ;
188
+
189
+ await u . page . goToRelative ( '/' ) ;
190
+ await u . page . waitForClerkComponentMounted ( ) ;
191
+
192
+ await u . page . getByRole ( 'button' , { name : 'Open user button' } ) . click ( ) ;
193
+
194
+ await u . page . getByText ( / M a n a g e a c c o u n t / ) . click ( ) ;
195
+
196
+ await u . page . waitForSelector ( '.cl-modalContent > .cl-userProfile-root' , { state : 'attached' } ) ;
197
+
198
+ await u . po . userProfile . clickSetUsername ( ) ;
199
+ await u . page . getByText ( / C a n c e l / i) . click ( ) ;
200
+
201
+ await u . page . waitForSelector ( '.cl-profileSectionContent__username .cl-headerTitle' , { state : 'detached' } ) ;
202
+
203
+ await u . po . userProfile . clickAddEmailAddress ( ) ;
204
+ await u . page . getByText ( / C a n c e l / i) . click ( ) ;
205
+ } ) ;
206
+
207
+ test ( 'sign in with path routing navigates to previous page' , async ( { page, context } ) => {
208
+ const u = createTestUtils ( { app, page, context } ) ;
209
+ await u . po . signIn . goTo ( ) ;
210
+ await u . po . signIn . waitForMounted ( ) ;
211
+
212
+ await u . po . signIn . getGoToSignUp ( ) . click ( ) ;
213
+ await u . po . signUp . waitForMounted ( ) ;
214
+ await u . page . waitForURL ( `${ app . serverUrl } /sign-up?redirect_url=${ encodeURIComponent ( app . serverUrl + '/' ) } ` ) ;
215
+
216
+ await page . goBack ( ) ;
217
+ await u . po . signIn . waitForMounted ( ) ;
218
+ await u . page . waitForURL ( `${ app . serverUrl } /sign-in` ) ;
219
+ } ) ;
219
220
} ) ;
0 commit comments