@@ -28,6 +28,29 @@ testAgainstRunningApps({ withEnv: [appConfigs.envs.withBilling] })('pricing tabl
2828 await expect ( u . po . page . getByRole ( 'heading' , { name : 'Pro' } ) ) . toBeVisible ( ) ;
2929 } ) ;
3030
31+ test ( 'renders pricing details of a specific plan' , async ( { page, context } ) => {
32+ if ( ! app . name . includes ( 'next' ) ) {
33+ return ;
34+ }
35+
36+ const u = createTestUtils ( { app, page, context } ) ;
37+ await u . po . page . goToRelative ( '/billing/plan-details-btn' ) ;
38+
39+ await u . po . page . getByRole ( 'button' , { name : 'Plan details' } ) . click ( ) ;
40+
41+ await u . po . planDetails . waitForMounted ( ) ;
42+ const { root } = u . po . planDetails ;
43+ await expect ( root . getByRole ( 'heading' , { name : 'Plus' } ) ) . toBeVisible ( ) ;
44+ await expect ( root . getByText ( '$9.99' ) ) . toBeVisible ( ) ;
45+ await expect ( root . getByText ( 'This is the Plus plan!' ) ) . toBeVisible ( ) ;
46+ await expect ( root . getByText ( 'Feature One' ) ) . toBeVisible ( ) ;
47+ await expect ( root . getByText ( 'First feature' ) ) . toBeVisible ( ) ;
48+ await expect ( root . getByText ( 'Feature Two' ) ) . toBeVisible ( ) ;
49+ await expect ( root . getByText ( 'Second feature' ) ) . toBeVisible ( ) ;
50+ await expect ( root . getByText ( 'Feature Three' ) ) . toBeVisible ( ) ;
51+ await expect ( root . getByText ( 'Third feature' ) ) . toBeVisible ( ) ;
52+ } ) ;
53+
3154 test ( 'when signed out, clicking subscribe button navigates to sign in page' , async ( { page, context } ) => {
3255 const u = createTestUtils ( { app, page, context } ) ;
3356 await u . po . page . goToRelative ( '/pricing-table' ) ;
@@ -39,6 +62,10 @@ testAgainstRunningApps({ withEnv: [appConfigs.envs.withBilling] })('pricing tabl
3962 } ) ;
4063
4164 test ( 'when signed in, clicking get started button opens checkout drawer' , async ( { page, context } ) => {
65+ if ( ! app . name . includes ( 'next' ) ) {
66+ return ;
67+ }
68+
4269 const u = createTestUtils ( { app, page, context } ) ;
4370 await u . po . signIn . goTo ( ) ;
4471 await u . po . signIn . signInWithEmailAndInstantPassword ( { email : fakeUser . email , password : fakeUser . password } ) ;
@@ -64,6 +91,21 @@ testAgainstRunningApps({ withEnv: [appConfigs.envs.withBilling] })('pricing tabl
6491 await expect ( u . po . page . getByText ( 'Checkout' ) ) . toBeVisible ( ) ;
6592 } ) ;
6693
94+ test ( 'when signed in, clicking checkout button open checkout drawer' , async ( { page, context } ) => {
95+ if ( ! app . name . includes ( 'next' ) ) {
96+ return ;
97+ }
98+ const u = createTestUtils ( { app, page, context } ) ;
99+ await u . po . signIn . goTo ( ) ;
100+ await u . po . signIn . signInWithEmailAndInstantPassword ( { email : fakeUser . email , password : fakeUser . password } ) ;
101+ await u . po . page . goToRelative ( '/billing/checkout-btn' ) ;
102+
103+ await u . po . page . getByRole ( 'button' , { name : 'Checkout Now' } ) . click ( ) ;
104+ await u . po . checkout . waitForMounted ( ) ;
105+ await u . po . page . getByText ( / ^ C h e c k o u t $ / ) . click ( ) ;
106+ await u . po . checkout . fillTestCard ( ) ;
107+ } ) ;
108+
67109 test ( 'can subscribe to a plan' , async ( { page, context } ) => {
68110 const u = createTestUtils ( { app, page, context } ) ;
69111 await u . po . signIn . goTo ( ) ;
@@ -86,6 +128,25 @@ testAgainstRunningApps({ withEnv: [appConfigs.envs.withBilling] })('pricing tabl
86128 }
87129 } ) ;
88130
131+ test ( 'Displays subscription details drawer' , async ( { page, context } ) => {
132+ if ( ! app . name . includes ( 'next' ) ) {
133+ return ;
134+ }
135+ const u = createTestUtils ( { app, page, context } ) ;
136+ await u . po . signIn . goTo ( ) ;
137+ await u . po . signIn . signInWithEmailAndInstantPassword ( { email : fakeUser . email , password : fakeUser . password } ) ;
138+ await u . po . page . goToRelative ( '/billing/subscription-details-btn' ) ;
139+
140+ await u . po . page . getByRole ( 'button' , { name : 'Subscription details' } ) . click ( ) ;
141+
142+ await u . po . subscriptionDetails . waitForMounted ( ) ;
143+ await expect ( u . po . page . getByText ( 'Plus' ) ) . toBeVisible ( ) ;
144+ await expect ( u . po . page . getByText ( 'Subscription details' ) ) . toBeVisible ( ) ;
145+ await expect ( u . po . page . getByText ( 'Current billing cycle' ) ) . toBeVisible ( ) ;
146+ await expect ( u . po . page . getByText ( 'Next payment on' ) ) . toBeVisible ( ) ;
147+ await expect ( u . po . page . getByText ( 'Next payment amount' ) ) . toBeVisible ( ) ;
148+ } ) ;
149+
89150 test ( 'can upgrade to a new plan with saved card' , async ( { page, context } ) => {
90151 const u = createTestUtils ( { app, page, context } ) ;
91152 await u . po . signIn . goTo ( ) ;
0 commit comments