@@ -130,12 +130,8 @@ describe('SubscriptionDetails', () => {
130130 expect ( queryByText ( 'Ends on' ) ) . toBeNull ( ) ;
131131 } ) ;
132132
133- const menuButton = getByRole ( 'button' , { name : / O p e n m e n u / i } ) ;
134- expect ( menuButton ) . toBeVisible ( ) ;
135- await userEvent . click ( menuButton ) ;
136-
137133 await waitFor ( ( ) => {
138- expect ( getByText ( 'Switch to annual $100 / year ' ) ) . toBeVisible ( ) ;
134+ expect ( getByText ( 'Switch to annual' ) ) . toBeVisible ( ) ;
139135 expect ( getByText ( 'Cancel subscription' ) ) . toBeVisible ( ) ;
140136 } ) ;
141137 } ) ;
@@ -237,12 +233,8 @@ describe('SubscriptionDetails', () => {
237233 expect ( queryByText ( 'Ends on' ) ) . toBeNull ( ) ;
238234 } ) ;
239235
240- const menuButton = getByRole ( 'button' , { name : / O p e n m e n u / i } ) ;
241- expect ( menuButton ) . toBeVisible ( ) ;
242- await userEvent . click ( menuButton ) ;
243-
244236 await waitFor ( ( ) => {
245- expect ( getByText ( 'Switch to monthly $10 / month ' ) ) . toBeVisible ( ) ;
237+ expect ( getByText ( 'Switch to monthly' ) ) . toBeVisible ( ) ;
246238 expect ( getByText ( 'Cancel subscription' ) ) . toBeVisible ( ) ;
247239 } ) ;
248240 } ) ;
@@ -319,7 +311,9 @@ describe('SubscriptionDetails', () => {
319311 expect ( queryByText ( 'Monthly' ) ) . toBeNull ( ) ;
320312 expect ( queryByText ( 'Next payment on' ) ) . toBeNull ( ) ;
321313 expect ( queryByText ( 'Next payment amount' ) ) . toBeNull ( ) ;
322- expect ( queryByRole ( 'button' , { name : / O p e n m e n u / i } ) ) . toBeNull ( ) ;
314+
315+ expect ( queryByText ( 'Cancel subscription' ) ) . toBeNull ( ) ;
316+ expect ( queryByText ( / S w i t c h t o / i) ) . toBeNull ( ) ;
323317 } ) ;
324318 } ) ;
325319
@@ -469,20 +463,10 @@ describe('SubscriptionDetails', () => {
469463 expect ( getByText ( 'Begins on' ) ) . toBeVisible ( ) ;
470464 } ) ;
471465
472- const [ menuButton , upcomingMenuButton ] = getAllByRole ( 'button' , { name : / O p e n m e n u / i } ) ;
473- await userEvent . click ( menuButton ) ;
474-
475466 await waitFor ( ( ) => {
476- expect ( getByText ( 'Switch to monthly $13 / month ' ) ) . toBeVisible ( ) ;
467+ expect ( getByText ( 'Switch to monthly' ) ) . toBeVisible ( ) ;
477468 expect ( getByText ( 'Resubscribe' ) ) . toBeVisible ( ) ;
478- expect ( queryByText ( 'Cancel subscription' ) ) . toBeNull ( ) ;
479- } ) ;
480-
481- await userEvent . click ( upcomingMenuButton ) ;
482-
483- await waitFor ( ( ) => {
484- expect ( getByText ( 'Switch to annual $90.99 / year' ) ) . toBeVisible ( ) ;
485- expect ( getByText ( 'Cancel subscription' ) ) . toBeVisible ( ) ;
469+ expect ( getAllByText ( 'Cancel subscription' ) . length ) . toBe ( 1 ) ;
486470 } ) ;
487471 } ) ;
488472
@@ -710,11 +694,6 @@ describe('SubscriptionDetails', () => {
710694 expect ( getByText ( 'Active' ) ) . toBeVisible ( ) ;
711695 } ) ;
712696
713- // Open the menu
714- const menuButton = getByRole ( 'button' , { name : / O p e n m e n u / i } ) ;
715- await userEvent . click ( menuButton ) ;
716-
717- // Wait for the cancel option to appear and click it
718697 await userEvent . click ( getByText ( 'Cancel subscription' ) ) ;
719698
720699 await waitFor ( ( ) => {
@@ -829,11 +808,6 @@ describe('SubscriptionDetails', () => {
829808 expect ( getByText ( 'Annual Plan' ) ) . toBeVisible ( ) ;
830809 } ) ;
831810
832- // Open the menu
833- const menuButton = getByRole ( 'button' , { name : / O p e n m e n u / i } ) ;
834- await userEvent . click ( menuButton ) ;
835-
836- // Wait for the Resubscribe option and click it
837811 await userEvent . click ( getByText ( 'Resubscribe' ) ) ;
838812
839813 // Assert resubscribe was called
@@ -934,11 +908,6 @@ describe('SubscriptionDetails', () => {
934908 expect ( getByText ( 'Annual Plan' ) ) . toBeVisible ( ) ;
935909 } ) ;
936910
937- // Open the menu
938- const menuButton = getByRole ( 'button' , { name : / O p e n m e n u / i } ) ;
939- await userEvent . click ( menuButton ) ;
940-
941- // Wait for the Switch to monthly option and click it
942911 await userEvent . click ( getByText ( / S w i t c h t o m o n t h l y / i) ) ;
943912
944913 // Assert switchToMonthly was called
@@ -1149,11 +1118,7 @@ describe('SubscriptionDetails', () => {
11491118 expect ( queryByText ( 'Next payment amount' ) ) . toBeNull ( ) ;
11501119 } ) ;
11511120
1152- // Test the menu shows free trial specific options
1153- const menuButton = getByRole ( 'button' , { name : / O p e n m e n u / i } ) ;
1154- expect ( menuButton ) . toBeVisible ( ) ;
1155- await userEvent . click ( menuButton ) ;
1156-
1121+ // Test the inline button shows free trial specific option
11571122 await waitFor ( ( ) => {
11581123 expect ( getByText ( 'Cancel free trial' ) ) . toBeVisible ( ) ;
11591124 } ) ;
@@ -1244,11 +1209,6 @@ describe('SubscriptionDetails', () => {
12441209 expect ( getByText ( 'Free trial' ) ) . toBeVisible ( ) ;
12451210 } ) ;
12461211
1247- // Open the menu
1248- const menuButton = getByRole ( 'button' , { name : / O p e n m e n u / i } ) ;
1249- await userEvent . click ( menuButton ) ;
1250-
1251- // Wait for the cancel option to appear and click it
12521212 await userEvent . click ( getByText ( 'Cancel free trial' ) ) ;
12531213
12541214 await waitFor ( ( ) => {
0 commit comments