@@ -28,6 +28,29 @@ testAgainstRunningApps({ withEnv: [appConfigs.envs.withBilling] })('pricing tabl
28
28
await expect ( u . po . page . getByRole ( 'heading' , { name : 'Pro' } ) ) . toBeVisible ( ) ;
29
29
} ) ;
30
30
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
+
31
54
test ( 'when signed out, clicking subscribe button navigates to sign in page' , async ( { page, context } ) => {
32
55
const u = createTestUtils ( { app, page, context } ) ;
33
56
await u . po . page . goToRelative ( '/pricing-table' ) ;
@@ -39,6 +62,10 @@ testAgainstRunningApps({ withEnv: [appConfigs.envs.withBilling] })('pricing tabl
39
62
} ) ;
40
63
41
64
test ( 'when signed in, clicking get started button opens checkout drawer' , async ( { page, context } ) => {
65
+ if ( ! app . name . includes ( 'next' ) ) {
66
+ return ;
67
+ }
68
+
42
69
const u = createTestUtils ( { app, page, context } ) ;
43
70
await u . po . signIn . goTo ( ) ;
44
71
await u . po . signIn . signInWithEmailAndInstantPassword ( { email : fakeUser . email , password : fakeUser . password } ) ;
@@ -64,6 +91,21 @@ testAgainstRunningApps({ withEnv: [appConfigs.envs.withBilling] })('pricing tabl
64
91
await expect ( u . po . page . getByText ( 'Checkout' ) ) . toBeVisible ( ) ;
65
92
} ) ;
66
93
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
+
67
109
test ( 'can subscribe to a plan' , async ( { page, context } ) => {
68
110
const u = createTestUtils ( { app, page, context } ) ;
69
111
await u . po . signIn . goTo ( ) ;
@@ -86,6 +128,25 @@ testAgainstRunningApps({ withEnv: [appConfigs.envs.withBilling] })('pricing tabl
86
128
}
87
129
} ) ;
88
130
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
+
89
150
test ( 'can upgrade to a new plan with saved card' , async ( { page, context } ) => {
90
151
const u = createTestUtils ( { app, page, context } ) ;
91
152
await u . po . signIn . goTo ( ) ;
0 commit comments