@@ -7,27 +7,97 @@ describe('Single Debit', () => {
77 cy . contains ( 'App Component' )
88 } )
99
10- describe ( 'When fill debit payment details and submit ' , ( ) => {
10+ describe ( 'When fill debit payment details' , ( ) => {
1111 beforeEach ( ( ) => cy
1212 . get ( '.dynamic-form--name' ) . type ( 'John Doe' )
1313 . selectDebit ( {
1414 accountHolder : 'Joanna Doe' ,
1515 iban : 'DE12 1234 1234 1234 1234 12' ,
1616 bic : 'ABCDEF12' ,
1717 } )
18- . then ( ( ) => cy
19- . get ( '.dynamic-form--submit' ) . click ( )
20- )
2118 )
2219
23- it ( 'Should show submitted form value' , ( ) => {
24- cy . shouldShowSubmittedDebit ( {
20+ describe ( 'When submit' , ( ) => {
21+ beforeEach ( ( ) => cy . submitForm ( ) ) ;
22+
23+ it ( 'Should show submitted form value' , ( ) => {
24+ cy . shouldShowSubmittedDebit ( {
2525 name : 'John Doe' ,
2626 accountHolder : 'Joanna Doe' ,
2727 iban : 'DE12 1234 1234 1234 1234 12' ,
2828 bic : 'ABCDEF12' ,
29- }
29+ } )
30+ } )
31+ } )
32+
33+ describe ( 'When fill incorrect creditCard and switch back' , ( ) => {
34+ beforeEach ( ( ) => cy
35+ . selectCreditCard ( {
36+ cardNumber : '123456789012345a' , // invalid card number
37+ expiryDate : '12/23' ,
38+ cvv : '123' ,
39+ } )
40+ . then ( ( ) => cy
41+ . switchToDebit ( )
42+ ) . then ( ( ) => cy
43+ . submitForm ( )
44+ )
3045 )
46+
47+ it ( 'Should show submitted form value' , ( ) => {
48+ cy . shouldShowSubmittedDebit ( {
49+ name : 'John Doe' ,
50+ accountHolder : 'Joanna Doe' ,
51+ iban : 'DE12 1234 1234 1234 1234 12' ,
52+ bic : 'ABCDEF12' ,
53+ } )
54+ } )
55+ } )
56+ } ) ;
57+
58+ describe ( 'When load debit payment details' , ( ) => {
59+ beforeEach ( ( ) => cy . loadDebitPayment ( ) ) ;
60+
61+ it ( 'Should load debit payment details' , ( ) => {
62+ cy . get ( '.debit-form-input--accountHolder' ) . should ( 'have.value' , 'John Doe' )
63+ cy . get ( '.debit-form-input--iban' ) . should ( 'have.value' , 'DE12345678901234567890' )
64+ cy . get ( '.debit-form-input--bic' ) . should ( 'have.value' , 'GENODEF1M04' )
65+ } )
66+
67+ describe ( 'When submit' , ( ) => {
68+ beforeEach ( ( ) => cy . submitForm ( ) ) ;
69+
70+ it ( 'Should show submitted form value' , ( ) => {
71+ cy . shouldShowSubmittedDebit ( {
72+ name : 'John Doe' ,
73+ accountHolder : 'John Doe' ,
74+ iban : 'DE12345678901234567890' ,
75+ bic : 'GENODEF1M04' ,
76+ } )
77+ } )
78+ } )
79+
80+ describe ( 'When load creditCard payment details' , ( ) => {
81+ beforeEach ( ( ) => cy . loadCreditCardPayment ( ) ) ;
82+
83+ it ( 'Should show creditCard payment details' , ( ) => {
84+ cy . get ( '.creditcard-form-input--cardnumber' ) . should ( 'have.value' , '1234567890123456' )
85+ cy . get ( '.creditcard-form-input--expiryDate' ) . should ( 'have.value' , '12/22' )
86+ cy . get ( '.creditcard-form-input--cvv' ) . should ( 'have.value' , '123' )
87+ } )
88+
89+ describe ( 'When submit' , ( ) => {
90+ beforeEach ( ( ) => cy . submitForm ( ) ) ;
91+
92+ it ( 'Should show submitted form value' , ( ) => {
93+ cy . shouldShowSubmittedCreditCard ( {
94+ name : 'John Doe' ,
95+ cardNumber : '1234567890123456' ,
96+ expiryDate : '12/22' ,
97+ cvv : '123' ,
98+ } )
99+ } )
100+ } )
31101 } )
32102 } ) ;
33103} )
0 commit comments