const address = { firstName : 'John' , lastName : 'Smith' , address : '100 Federal Street' , city : 'Boston' , state : 'MA' , zip : '02110' , } ; describe ( 'Checkout workflow' , function ( ) { it ( 'allows user to place an order' , function ( ) { cy . visit ( '/' ) ; cy . get ( '[data-testid="product"]' ) . contains ( 'iMac' ) . click ( ) ; cy . get ( '[data-testid="product"]' ) . contains ( 'MacBook Pro' ) . click ( ) ; cy . get ( '[data-testid="product"]' ) . contains ( 'iPad' ) . click ( ) ; cy . get ( '[data-testid="product"]' ) . contains ( 'Google Home Mini' ) . click ( ) ; cy . get ( '[data-testid="order-items"] > tbody > tr' ) . should ( 'have.length' , 4 ) ; cy . get ( '[data-testid="order-items"]' ) . contains ( 'MacBook Pro' ) . parent ( ) . find ( '[data-testid="delete-button"]' ) . click ( ) ; cy . get ( '[data-testid="order-items"] > tbody > tr' ) . should ( 'have.length' , 3 ) ; cy . contains ( 'Checkout' ) . click ( ) ; cy . contains ( 'Place your order' ) ; cy . get ( 'input[name="shippingAddress.firstName"]' ) . type ( address . firstName ) ; cy . get ( 'input[name="shippingAddress.lastName"]' ) . type ( address . lastName ) ; cy . get ( 'input[name="shippingAddress.address"]' ) . type ( address . address ) ; cy . get ( 'input[name="shippingAddress.city"]' ) . type ( address . city ) ; cy . get ( 'input[name="shippingAddress.state"]' ) . type ( address . state ) ; cy . get ( 'input[name="shippingAddress.zip"]' ) . type ( address . zip ) ; cy . contains ( 'Place your order' ) . click ( ) ; cy . contains ( 'John Smith' ) ; cy . contains ( '1,577.00' ) ; } ) ; } ) ;