Module: Checkout
- Defined in:
- lib/page_objects/modules/checkout.rb
Instance Method Summary collapse
- #fill_billing_information(site) ⇒ Object
- #fill_contact_information ⇒ Object
- #fill_credit_card_information ⇒ Object
- #fill_flight_information ⇒ Object
- #fill_passenger_information ⇒ Object
- #fill_passenger_information_for_assistance ⇒ Object
- #fill_passenger_information_for_cart ⇒ Object
- #fill_pickup_information ⇒ Object
- #fill_risk_questions ⇒ Object
- #get_card_brand_by_name(brand) ⇒ Object
- #get_payment_methods(brand, installments) ⇒ Object
- #get_payment_methods_by_installments(installments) ⇒ Object
- #get_ticket_dates(calendar) ⇒ Object
- #select_ticket_date(calendar) ⇒ Object
Instance Method Details
#fill_billing_information(site) ⇒ Object
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
# File 'lib/page_objects/modules/checkout.rb', line 184 def fill_billing_information(site) case site when "AR" then browser.select_list(:id, 'addressDefinition-state').select_value(14061) browser.text_field(:id, 'city').set('la pla') sleep 10 browser.send_keys(:enter) browser.text_field(:id, 'billingDefinition-street').set('Direccion Test 1234') browser.text_field(:id, 'billingDefinition-number').set('123') browser.text_field(:id, 'billingDefinition-floor').set('1') browser.text_field(:id, 'billingDefinition-department').set('B') when "BR" then if browser.select_list(:id,'addressDefinition-state').present? browser.select_list(:id,'addressDefinition-state').select_value("12925") browser.text_field(:id,'city').set('rio') sleep 2 browser.send_keys(:tab) browser.text_field(:id,'billingDefinition-street').set('test address') browser.text_field(:id,'billingDefinition-number').set('123') browser.text_field(:id,'billingDefinition-postalCode').set('23943-075') end end end |
#fill_contact_information ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/page_objects/modules/checkout.rb', line 57 def fill_contact_information if BETA browser.text_field(:id, 'contact-email').set('[email protected]') browser.text_field(:id, 'contact-email-repeat').set('[email protected]') else browser.text_field(:id, 'contact-email').set('[email protected]') browser.text_field(:id, 'contact-email-repeat').set('[email protected]') end browser.text_field(:id, 'traveler-area-code-0').set('11') browser.text_field(:id, 'traveler-phone-number-0').set('12345678') browser.checkbox(:id, 'ux-common-checkoutchange-agreement-cb').click browser.checkbox(:id,'newsletterSubscription-cb').click end |
#fill_credit_card_information ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/page_objects/modules/checkout.rb', line 35 def fill_credit_card_information browser.text_field(:id, 'card-number').set('4000035496216613') browser.select_list(:id, 'card-expiration-month').select('2') browser.select_list(:id, 'card-expiration-year').select('2017') browser.text_field(:id, 'security-code').set('123') browser.text_field(:id, 'owner-name').set('Diego QA Romero') browser.select_list(:id, 'ux-checkout-passenger-gender').select_value('MALE') if browser.select_list(:id, 'ux-checkout-passenger-gender').present? if $SITE == 'BR' browser.text_field(:id, 'owner-document-creditcard').set('35057384171') if browser.text_field(:id, 'owner-document-creditcard').present? else browser.text_field(:id, 'owner-document-creditcard').set('33444555') if browser.text_field(:id, 'owner-document-creditcard').present? end end |
#fill_flight_information ⇒ Object
86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/page_objects/modules/checkout.rb', line 86 def fill_flight_information browser.text_field(:id, 'arrival-flight-airline').set('Test Airline') if browser.text_field(:id, 'arrival-flight-airline').present? browser.text_field(:id, 'arrival-flight-number').set('1234') if browser.text_field(:id, 'arrival-flight-number').present? browser.text_field(:id, 'departure-flight-airline').set('Test Airline') if browser.text_field(:id, 'departure-flight-airline').present? browser.text_field(:id, 'departure-flight-number').set('1234') if browser.text_field(:id, 'departure-flight-number').present? end |
#fill_passenger_information ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/page_objects/modules/checkout.rb', line 5 def fill_passenger_information browser.text_field(:name, 'dsInputDefinition.passengerDefinitions[0].firstName.value').set('TEST DS') browser.text_field(:name, 'dsInputDefinition.passengerDefinitions[0].lastName.value').set('BOT') browser.send_keys(:enter) sleep 2 browser.text_field(:id, 'traveler-document-number-1').set('33555444') if browser.text_field(:id, 'traveler-document-number-1').present? end |
#fill_passenger_information_for_assistance ⇒ Object
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 |
# File 'lib/page_objects/modules/checkout.rb', line 226 def fill_passenger_information_for_assistance pax_number = browser.divs(:class, 'ux-common-checkout-paxform').size 0.upto(pax_number - 1) do | i | browser.text_field(:name, "dsInputDefinition.passengerDefinitions[#{i}].firstName.value").set('TEST DS') browser.text_field(:name, "dsInputDefinition.passengerDefinitions[#{i}].lastName.value").set('BOT') browser.send_keys(:enter) sleep 2 dni = Time.now.to_i.to_s.slice(2,10) browser.text_field(:name, "dsInputDefinition.passengerDefinitions[#{i}].documentDefinition.number.value").set("#{dni}") if browser.text_field(:name, "dsInputDefinition.passengerDefinitions[#{i}].documentDefinition.number.value").present? end end |
#fill_passenger_information_for_cart ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/page_objects/modules/checkout.rb', line 19 def fill_passenger_information_for_cart pax = browser.div(:id,'ux-destination-services-paxform0') pax.text_field(:id, 'traveler-first-name-0').set('TEST DS') pax.text_field(:id, 'traveler-last-name-0').set('BOT') browser.send_keys(:enter) sleep 2 pax.text_field(:id, 'traveler-document-number-0').set('33555444') if pax.text_field(:id, 'traveler-document-number-0').present? end |
#fill_pickup_information ⇒ Object
77 78 79 80 81 82 83 84 |
# File 'lib/page_objects/modules/checkout.rb', line 77 def fill_pickup_information #browser.input(:class,'ux-destination-services-detail-hotel-radio-name').click if browser.input(:class,'ux-destination-services-detail-hotel-radio-name').present? if browser.div(:class, 'ux-destination-services-checkout-detail-hotel').present? browser.div(:class, 'ux-destination-services-checkout-detail-hotel').radios.last.click if browser.div(:class, 'ux-destination-services-checkout-detail-hotel').radios.size > 1 end end |
#fill_risk_questions ⇒ Object
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
# File 'lib/page_objects/modules/checkout.rb', line 129 def fill_risk_questions if $SITE == 'AR' else i = 2 i.upto 8 do browser.text_field(:name,"answerQuestions[#{i}].answer.text").set('Test') if browser.text_field(:name,"answerQuestions[#{i}].answer.text").present? i += 1 end sleep 1 browser.a(:id, 'securyty-form-btn').click if browser.a(:id, 'securyty-form-btn').present? end end |
#get_card_brand_by_name(brand) ⇒ Object
148 149 150 151 152 153 154 |
# File 'lib/page_objects/modules/checkout.rb', line 148 def get_card_brand_by_name(brand) brand = browser.select_list(:id, 'ux-common-checkout-creditcard-type')..reject { | option | !option.text.eql?("#{brand}") } brand unless brand.nil? end |
#get_payment_methods(brand, installments) ⇒ Object
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
# File 'lib/page_objects/modules/checkout.rb', line 166 def get_payment_methods(brand, installments) methods = get_payment_methods_by_installments(installments) available = [] methods.each do | method | method.radio(:class, 'ux-common-checkout-payment-method-radiobutton').click available << get_card_brand_by_name(brand).first unless get_card_brand_by_name(brand).first.nil? end available end |
#get_payment_methods_by_installments(installments) ⇒ Object
156 157 158 159 160 161 162 163 164 |
# File 'lib/page_objects/modules/checkout.rb', line 156 def get_payment_methods_by_installments(installments) payment_methods = browser.ul(:class,'ux-common-checkout-payment-method-payments').lis(:class, 'ux-common-checkout-payment-method-payments-list') methods = payment_methods.reject { | q | !(q.div(:class, 'ux-common-checkout-payment-method-quantity').text.include?("#{installments}")) } methods end |
#get_ticket_dates(calendar) ⇒ Object
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/page_objects/modules/checkout.rb', line 99 def get_ticket_dates(calendar) calendar.a(:class,'calendar-icon').wait_until_present(20) calendar.a(:class,'calendar-icon').click calendar.div(:class, 'datepicker').wait_until_present(20) dates = [] sleep 1 dates = calendar.div(:class, 'datepicker').table.tds(:class, 'in').select { | td | !td.a(:class, 'disabled').present? } calendar.span(:class, 'nibbler-common-overlay-close').wait_until_present(20) dates end |
#select_ticket_date(calendar) ⇒ Object
119 120 121 122 123 124 125 126 127 |
# File 'lib/page_objects/modules/checkout.rb', line 119 def select_ticket_date(calendar) get_ticket_dates(calendar).last.a.click unless !calendar.a(:class,'calendar-icon').present? sleep 3 calendar.span(:class, 'nibbler-common-overlay-close').click unless !calendar.span(:class, 'nibbler-common-overlay-close').visible? end |