@@ -50,21 +50,7 @@ export default function RootLayout({ children }: { children: React.ReactNode })
5050}` ,
5151 )
5252 . addFile (
53- 'src/app/hash/user/[[...catchall]]/page.tsx' ,
54- ( ) => `
55- import { UserProfile, UserButton } from '@clerk/nextjs';
56-
57- export default function Page() {
58- return (
59- <div>
60- <UserButton />
61- <UserProfile routing="hash" />
62- </div>
63- );
64- }` ,
65- )
66- . addFile (
67- 'src/app/hash/sign-in/[[...catchall]]/page.tsx' ,
53+ 'src/app/hash/sign-in/page.tsx' ,
6854 ( ) => `
6955import { SignIn } from '@clerk/nextjs';
7056
@@ -91,129 +77,47 @@ export default function Page() {
9177 await app . teardown ( ) ;
9278 } ) ;
9379
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- // });
80+ test ( 'sign in with path routing' , async ( { page, context } ) => {
81+ const u = createTestUtils ( { app, page, context } ) ;
82+ await u . po . signIn . goTo ( ) ;
83+ await u . po . signIn . waitForMounted ( ) ;
84+
85+ await u . po . signIn . setIdentifier ( fakeUser . email ) ;
86+ await u . po . signIn . continue ( ) ;
87+ await u . page . waitForURL ( `${ app . serverUrl } /sign-in/factor-one` ) ;
88+
89+ await u . po . signIn . setPassword ( fakeUser . password ) ;
90+ await u . po . signIn . continue ( ) ;
91+
92+ await u . po . expect . toBeSignedIn ( ) ;
93+ } ) ;
94+
95+ test ( 'sign in with hash routing' , async ( { page, context } ) => {
96+ const u = createTestUtils ( { app, page, context } ) ;
97+ await u . page . goToRelative ( '/hash/sign-in' ) ;
98+ await u . po . signIn . waitForMounted ( ) ;
99+
100+ await u . po . signIn . setIdentifier ( fakeUser . email ) ;
101+ await u . po . signIn . continue ( ) ;
102+ await u . page . waitForURL ( `${ app . serverUrl } /hash/sign-in#/factor-one` ) ;
103+
104+ await u . po . signIn . setPassword ( fakeUser . password ) ;
105+ await u . po . signIn . continue ( ) ;
106+
107+ await u . po . expect . toBeSignedIn ( ) ;
108+ } ) ;
109+
110+ test ( 'sign in with path routing navigates to previous page' , async ( { page, context } ) => {
111+ const u = createTestUtils ( { app, page, context } ) ;
112+ await u . po . signIn . goTo ( ) ;
113+ await u . po . signIn . waitForMounted ( ) ;
114+
115+ await u . po . signIn . getGoToSignUp ( ) . click ( ) ;
116+ await u . po . signUp . waitForMounted ( ) ;
117+ await u . page . waitForURL ( `${ app . serverUrl } /sign-up?redirect_url=${ encodeURIComponent ( app . serverUrl + '/' ) } ` ) ;
118+
119+ await page . goBack ( ) ;
120+ await u . po . signIn . waitForMounted ( ) ;
121+ await u . page . waitForURL ( `${ app . serverUrl } /sign-in` ) ;
122+ } ) ;
219123} ) ;
0 commit comments