@@ -89,4 +89,62 @@ describe("Card number validation test", () => {
89
89
. and ( 'contain.text' , "Card Number cannot be empty" ) ;
90
90
} ) ;
91
91
92
+ it ( "19 digit unionpay card" , ( ) => {
93
+ const { cardNo, card_exp_month, card_exp_year, cvc } = stripeCards . unionPay19 ;
94
+
95
+ getIframeBody ( ) . find ( `[data-testid=${ testIds . cardNoInputTestId } ]` ) . type ( cardNo ) ;
96
+ getIframeBody ( ) . find ( `[data-testid=${ testIds . expiryInputTestId } ]` ) . type ( card_exp_month ) ;
97
+ getIframeBody ( ) . find ( `[data-testid=${ testIds . expiryInputTestId } ]` ) . type ( card_exp_year ) ;
98
+ getIframeBody ( ) . find ( `[data-testid=${ testIds . cardCVVInputTestId } ]` ) . type ( cvc ) ;
99
+ cy . wait ( 2000 ) ;
100
+
101
+ getIframeBody ( ) . get ( "#submit" ) . click ( ) ;
102
+
103
+
104
+ cy . contains ( "Thanks for your order!" ) . should ( "be.visible" ) ;
105
+ } ) ;
106
+
107
+
108
+ it ( "16 digit master card" , ( ) => {
109
+ const { cardNo, card_exp_month, card_exp_year, cvc } = stripeCards . masterCard16 ;
110
+
111
+ getIframeBody ( ) . find ( `[data-testid=${ testIds . cardNoInputTestId } ]` ) . type ( cardNo ) ;
112
+ getIframeBody ( ) . find ( `[data-testid=${ testIds . expiryInputTestId } ]` ) . type ( card_exp_month ) ;
113
+ getIframeBody ( ) . find ( `[data-testid=${ testIds . expiryInputTestId } ]` ) . type ( card_exp_year ) ;
114
+ getIframeBody ( ) . find ( `[data-testid=${ testIds . cardCVVInputTestId } ]` ) . type ( cvc ) ;
115
+
116
+ getIframeBody ( ) . get ( "#submit" ) . click ( ) ;
117
+
118
+
119
+ cy . contains ( "Thanks for your order!" ) . should ( "be.visible" ) ;
120
+ } ) ;
121
+
122
+ it ( "15 digit american express card" , ( ) => {
123
+ const { cardNo, card_exp_month, card_exp_year, cvc } = stripeCards . amexCard15 ;
124
+
125
+ getIframeBody ( ) . find ( `[data-testid=${ testIds . cardNoInputTestId } ]` ) . type ( cardNo ) ;
126
+ getIframeBody ( ) . find ( `[data-testid=${ testIds . expiryInputTestId } ]` ) . type ( card_exp_month ) ;
127
+ getIframeBody ( ) . find ( `[data-testid=${ testIds . expiryInputTestId } ]` ) . type ( card_exp_year ) ;
128
+ getIframeBody ( ) . find ( `[data-testid=${ testIds . cardCVVInputTestId } ]` ) . type ( cvc ) ;
129
+
130
+ getIframeBody ( ) . get ( "#submit" ) . click ( ) ;
131
+
132
+
133
+ cy . contains ( "Thanks for your order!" ) . should ( "be.visible" ) ;
134
+ } ) ;
135
+
136
+ it ( "14 digit diners club card" , ( ) => {
137
+ const { cardNo, card_exp_month, card_exp_year, cvc } = stripeCards . dinersClubCard14 ;
138
+
139
+ getIframeBody ( ) . find ( `[data-testid=${ testIds . cardNoInputTestId } ]` ) . type ( cardNo ) ;
140
+ getIframeBody ( ) . find ( `[data-testid=${ testIds . expiryInputTestId } ]` ) . type ( card_exp_month ) ;
141
+ getIframeBody ( ) . find ( `[data-testid=${ testIds . expiryInputTestId } ]` ) . type ( card_exp_year ) ;
142
+ getIframeBody ( ) . find ( `[data-testid=${ testIds . cardCVVInputTestId } ]` ) . type ( cvc ) ;
143
+
144
+ getIframeBody ( ) . get ( "#submit" ) . click ( ) ;
145
+
146
+
147
+ cy . contains ( "Thanks for your order!" ) . should ( "be.visible" ) ;
148
+ } ) ;
149
+
92
150
} ) ;
0 commit comments