@@ -180,9 +180,7 @@ const meWithAddresses: ShippingTestQuery$rawResponse["me"] = Object.assign(
180
180
)
181
181
182
182
const saveAndContinue = async ( ) => {
183
- await userEvent . click (
184
- screen . getByRole ( "button" , { name : "Save and Continue" } )
185
- )
183
+ await userEvent . click ( screen . getByText ( "Save and Continue" ) )
186
184
await flushPromiseQueue ( )
187
185
}
188
186
@@ -686,9 +684,7 @@ describe("Shipping", () => {
686
684
fillAddressFormTL ( validAddress )
687
685
userEvent . clear ( screen . getByPlaceholderText ( "Street address" ) )
688
686
689
- await userEvent . click (
690
- screen . getByRole ( "button" , { name : "Save and Continue" } )
691
- )
687
+ await userEvent . click ( screen . getByText ( "Save and Continue" ) )
692
688
693
689
expect ( screen . getByText ( "This field is required" ) ) . toBeVisible ( )
694
690
expect ( env . mock . getAllOperations ( ) ) . toHaveLength ( 0 )
@@ -732,9 +728,7 @@ describe("Shipping", () => {
732
728
)
733
729
734
730
fillAddressFormTL ( validAddress )
735
- await userEvent . click (
736
- screen . getByRole ( "button" , { name : "Save and Continue" } )
737
- )
731
+ await userEvent . click ( screen . getByText ( "Save and Continue" ) )
738
732
739
733
const mutation = env . mock . getMostRecentOperation ( )
740
734
expect ( mutation . request . node . operation . name ) . toEqual (
@@ -773,9 +767,7 @@ describe("Shipping", () => {
773
767
774
768
fillAddressFormTL ( validAddress )
775
769
userEvent . selectOptions ( screen . getByRole ( "combobox" ) , [ "TW" ] )
776
- await userEvent . click (
777
- screen . getByRole ( "button" , { name : "Save and Continue" } )
778
- )
770
+ await userEvent . click ( screen . getByText ( "Save and Continue" ) )
779
771
780
772
expect ( env . mock . getAllOperations ( ) ) . toHaveLength ( 0 )
781
773
} )
@@ -806,9 +798,7 @@ describe("Shipping", () => {
806
798
)
807
799
808
800
fillAddressFormTL ( validAddress )
809
- await userEvent . click (
810
- screen . getByRole ( "button" , { name : "Save and Continue" } )
811
- )
801
+ await userEvent . click ( screen . getByText ( "Save and Continue" ) )
812
802
813
803
expect ( env . mock . getAllOperations ( ) ) . toHaveLength ( 0 )
814
804
} )
@@ -825,9 +815,7 @@ describe("Shipping", () => {
825
815
826
816
fillAddressFormTL ( validAddress )
827
817
userEvent . selectOptions ( screen . getByRole ( "combobox" ) , [ "TW" ] )
828
- await userEvent . click (
829
- screen . getByRole ( "button" , { name : "Save and Continue" } )
830
- )
818
+ await userEvent . click ( screen . getByText ( "Save and Continue" ) )
831
819
832
820
const mutation = env . mock . getMostRecentOperation ( )
833
821
expect ( mutation . request . node . operation . name ) . toEqual (
@@ -970,9 +958,7 @@ describe("Shipping", () => {
970
958
relayEnv
971
959
)
972
960
973
- await userEvent . click (
974
- screen . getByRole ( "button" , { name : "Save and Continue" } )
975
- )
961
+ await userEvent . click ( screen . getByText ( "Save and Continue" ) )
976
962
977
963
// Address verification flow is not triggered.
978
964
expect ( env . mock . getAllOperations ( ) ) . toHaveLength ( 0 )
@@ -1143,7 +1129,7 @@ describe("Shipping", () => {
1143
1129
} ,
1144
1130
} )
1145
1131
1146
- userEvent . click ( screen . getByRole ( "radio" , { name : / P r e m i u m / } ) )
1132
+ userEvent . click ( screen . getByText ( / ^ P r e m i u m / ) )
1147
1133
await saveAndContinue ( )
1148
1134
1149
1135
expect ( mockCommitMutation ) . toHaveBeenCalledTimes ( 4 )
@@ -1252,10 +1238,9 @@ describe("Shipping", () => {
1252
1238
} ,
1253
1239
} )
1254
1240
1255
- userEvent . click ( screen . getByRole ( "radio" , { name : / P r e m i u m / } ) )
1256
- userEvent . click (
1257
- screen . getByRole ( "checkbox" , { name : / S a v e s h i p p i n g a d d r e s s / } )
1258
- )
1241
+ userEvent . click ( screen . getByText ( / ^ P r e m i u m / ) )
1242
+ userEvent . click ( screen . getByText ( / ^ S a v e s h i p p i n g a d d r e s s / ) )
1243
+
1259
1244
await saveAndContinue ( )
1260
1245
1261
1246
expect ( mockCommitMutation ) . toHaveBeenCalledTimes ( 4 )
@@ -1546,9 +1531,7 @@ describe("Shipping", () => {
1546
1531
} )
1547
1532
1548
1533
await flushPromiseQueue ( )
1549
- expect (
1550
- screen . getByRole ( "button" , { name : "Save and Continue" } )
1551
- ) . toBeEnabled ( )
1534
+ expect ( screen . getByText ( "Save and Continue" ) ) . toBeEnabled ( )
1552
1535
1553
1536
await saveAndContinue ( )
1554
1537
@@ -1601,10 +1584,8 @@ describe("Shipping", () => {
1601
1584
} )
1602
1585
await flushPromiseQueue ( )
1603
1586
1604
- userEvent . click ( screen . getByRole ( "radio" , { name : / ^ P r e m i u m / } ) )
1605
- expect (
1606
- screen . getByRole ( "button" , { name : "Save and Continue" } )
1607
- ) . toBeEnabled ( )
1587
+ userEvent . click ( screen . getByText ( / ^ P r e m i u m / ) )
1588
+ expect ( screen . getByText ( "Save and Continue" ) ) . toBeEnabled ( )
1608
1589
await saveAndContinue ( )
1609
1590
1610
1591
expect ( mockCommitMutation ) . toHaveBeenCalledTimes ( 2 )
@@ -1744,8 +1725,8 @@ describe("Shipping", () => {
1744
1725
/ A p t , f l o o r , s u i t e /
1745
1726
) [ 0 ]
1746
1727
userEvent . clear ( addressLine2 )
1747
- userEvent . type ( addressLine2 , "25th fl." )
1748
- userEvent . click ( screen . getByRole ( "button" , { name : " Save" } ) )
1728
+ userEvent . paste ( addressLine2 , "25th fl." )
1729
+ userEvent . click ( screen . getByText ( " Save") )
1749
1730
1750
1731
await flushPromiseQueue ( )
1751
1732
@@ -1880,8 +1861,8 @@ describe("Shipping", () => {
1880
1861
/ A p t , f l o o r , s u i t e /
1881
1862
) [ 0 ]
1882
1863
userEvent . clear ( addressLine2 )
1883
- userEvent . type ( addressLine2 , "25th fl." )
1884
- userEvent . click ( screen . getByRole ( "button" , { name : " Save" } ) )
1864
+ userEvent . paste ( addressLine2 , "25th fl." )
1865
+ userEvent . click ( screen . getByText ( " Save") )
1885
1866
1886
1867
await flushPromiseQueue ( )
1887
1868
0 commit comments