@@ -104,6 +104,42 @@ testAgainstRunningApps({ withEnv: [appConfigs.envs.withBilling] })('pricing tabl
104104 // await expect(u.po.page.getByRole('button', { name: /resubscribe|re-subscribe/i }).first()).toBeVisible();
105105 // });
106106
107+ test . describe ( 'redirects' , ( ) => {
108+ test ( 'default navigates to afterSignInUrl' , async ( { page, context } ) => {
109+ const u = createTestUtils ( { app, page, context } ) ;
110+ await u . po . signIn . goTo ( ) ;
111+ await u . po . signIn . signInWithEmailAndInstantPassword ( { email : fakeUser . email , password : fakeUser . password } ) ;
112+ await u . po . page . goToRelative ( '/pricing-table' ) ;
113+ await u . po . pricingTable . waitForMounted ( ) ;
114+ await u . po . pricingTable . startCheckout ( { planSlug : 'pro' } ) ;
115+ await u . po . checkout . waitForMounted ( ) ;
116+ await u . po . checkout . clickPayOrSubscribe ( ) ;
117+ await expect ( u . po . page . getByText ( 'Success!' ) ) . toBeVisible ( ) ;
118+ await page
119+ . locator ( '.cl-checkout-root' )
120+ . getByRole ( 'button' , { name : / ^ c o n t i n u e $ / i } )
121+ . click ( ) ;
122+ await u . page . waitForAppUrl ( '/' ) ;
123+ } ) ;
124+
125+ test ( 'navigates to supplied newSubscriptionRedirectUrl' , async ( { page, context } ) => {
126+ const u = createTestUtils ( { app, page, context } ) ;
127+ await u . po . signIn . goTo ( ) ;
128+ await u . po . signIn . signInWithEmailAndInstantPassword ( { email : fakeUser . email , password : fakeUser . password } ) ;
129+ await u . po . page . goToRelative ( '/pricing-table?newSubscriptionRedirectUrl=/success' ) ;
130+ await u . po . pricingTable . waitForMounted ( ) ;
131+ await u . po . pricingTable . startCheckout ( { planSlug : 'plus' } ) ;
132+ await u . po . checkout . waitForMounted ( ) ;
133+ await u . po . checkout . clickPayOrSubscribe ( ) ;
134+ await expect ( u . po . page . getByText ( 'Success!' ) ) . toBeVisible ( ) ;
135+ await page
136+ . locator ( '.cl-checkout-root' )
137+ . getByRole ( 'button' , { name : / ^ c o n t i n u e $ / i } )
138+ . click ( ) ;
139+ await u . page . waitForAppUrl ( '/success' ) ;
140+ } ) ;
141+ } ) ;
142+
107143 test . describe ( 'in UserProfile' , ( ) => {
108144 test ( 'renders pricing table with plans' , async ( { page, context } ) => {
109145 const u = createTestUtils ( { app, page, context } ) ;
0 commit comments