flights_gui_henry_tests 1.8.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (143) hide show
  1. checksums.yaml +15 -0
  2. data/Gemfile +3 -0
  3. data/features/data/home-offers-config.csv +883 -0
  4. data/features/data/host.yml +72 -0
  5. data/features/data/miles.yml +216 -0
  6. data/features/data/search.yml +27 -0
  7. data/features/data/sites.yml +39 -0
  8. data/features/data/tag_microsoft.yml +68 -0
  9. data/features/step_definitions/checkout/agencia_steps.rb +6 -0
  10. data/features/step_definitions/checkout/chat_steps.rb +43 -0
  11. data/features/step_definitions/checkout/checkout_steps.rb +144 -0
  12. data/features/step_definitions/checkout/cupones_steps.rb +26 -0
  13. data/features/step_definitions/checkout/error_messages.rb +251 -0
  14. data/features/step_definitions/checkout/seguros_steps.rb +78 -0
  15. data/features/step_definitions/checkout/thanks_steps.rb +75 -0
  16. data/features/step_definitions/content/contents_steps.rb +140 -0
  17. data/features/step_definitions/desambiguation/disambiguation_airports_steps.rb +73 -0
  18. data/features/step_definitions/desambiguation/disambiguation_city_steps.rb +43 -0
  19. data/features/step_definitions/filter/filters_airlines.rb +38 -0
  20. data/features/step_definitions/filter/filters_airports_steps.rb +31 -0
  21. data/features/step_definitions/filter/filters_price_steps.rb +87 -0
  22. data/features/step_definitions/filter/filters_stops_steps.rb +44 -0
  23. data/features/step_definitions/filter/filters_time_steps.rb +143 -0
  24. data/features/step_definitions/filter/matrix_steps.rb +249 -0
  25. data/features/step_definitions/landing/landing_checkout_steps.rb +45 -0
  26. data/features/step_definitions/landing/landing_filters_steps.rb +17 -0
  27. data/features/step_definitions/landing/landing_home_alerts_steps.rb +21 -0
  28. data/features/step_definitions/landing/landing_home_steps.rb +82 -0
  29. data/features/step_definitions/landing/landing_long_tail.rb +58 -0
  30. data/features/step_definitions/landing/landing_negative_steps.rb +127 -0
  31. data/features/step_definitions/landing/landing_passenger_review_steps.rb +8 -0
  32. data/features/step_definitions/landing/landing_steps.rb +325 -0
  33. data/features/step_definitions/orders/orders.rb +67 -0
  34. data/features/step_definitions/others/advancedgui_steps.rb +28 -0
  35. data/features/step_definitions/others/advancednogui_steps.rb +34 -0
  36. data/features/step_definitions/others/anticipatedsearch_steps.rb +13 -0
  37. data/features/step_definitions/others/flights_tracker_steps.rb +73 -0
  38. data/features/step_definitions/others/generic_steps.rb +35 -0
  39. data/features/step_definitions/others/newsletter_steps.rb +50 -0
  40. data/features/step_definitions/others/one_day_search.rb +58 -0
  41. data/features/step_definitions/others/print_steps.rb +26 -0
  42. data/features/step_definitions/others/querystringparameters_steps.rb +6 -0
  43. data/features/step_definitions/others/recommendation_steps.rb +80 -0
  44. data/features/step_definitions/others/render_steps.rb +70 -0
  45. data/features/step_definitions/others/tag_steps.rb +157 -0
  46. data/features/step_definitions/others/upgrade_bussines_steps.rb +27 -0
  47. data/features/step_definitions/results/load_steps.rb +69 -0
  48. data/features/step_definitions/results/results_steps.rb +21 -0
  49. data/features/step_definitions/results/search_steps.rb +82 -0
  50. data/features/step_definitions/search/alerts_steps.rb +132 -0
  51. data/features/step_definitions/search/basefare_steps.rb +64 -0
  52. data/features/step_definitions/search/bestprices_steps.rb +70 -0
  53. data/features/step_definitions/search/cross_sell_row_hoteles.rb +78 -0
  54. data/features/step_definitions/search/cross_sell_steps.rb +15 -0
  55. data/features/step_definitions/search/delays_steps.rb +67 -0
  56. data/features/step_definitions/search/details_steps.rb +9 -0
  57. data/features/step_definitions/search/ecoflights_steps.rb +9 -0
  58. data/features/step_definitions/search/fenix_steps.rb +119 -0
  59. data/features/step_definitions/search/flight_gui_steps.rb +312 -0
  60. data/features/step_definitions/search/miles_step.rb +13 -0
  61. data/features/step_definitions/search/pagination_steps.rb +41 -0
  62. data/features/step_definitions/search/reviews_step.rb +56 -0
  63. data/features/step_definitions/search/search_no_gui_steps.rb +185 -0
  64. data/features/step_definitions/search/wish_list_steps.rb +123 -0
  65. data/features/support/env.rb +61 -0
  66. data/features/support/lib/clusters/data/datos_new.rb +33 -0
  67. data/features/support/lib/clusters/details/details_cluster.rb +30 -0
  68. data/features/support/lib/clusters/results/landing_cluster.rb +29 -0
  69. data/features/support/lib/clusters/results/render_cluster.rb +43 -0
  70. data/features/support/lib/clusters/results_cluster.rb +140 -0
  71. data/features/support/lib/clusters.rb +5 -0
  72. data/features/support/lib/helpers/browser.rb +212 -0
  73. data/features/support/lib/helpers/checkout.rb +31 -0
  74. data/features/support/lib/helpers/clusters.rb +234 -0
  75. data/features/support/lib/helpers/landing.rb +117 -0
  76. data/features/support/lib/helpers/render.rb +135 -0
  77. data/features/support/lib/helpers.rb +5 -0
  78. data/features/support/lib/price.rb +66 -0
  79. data/features/support/lib/services/fenix.rb +14 -0
  80. data/features/support/lib/services/landing.rb +18 -0
  81. data/features/support/lib/services/results.rb +62 -0
  82. data/features/support/lib/services.rb +4 -0
  83. data/features/support/matchers.rb +120 -0
  84. data/features/support/redefinitions.rb +42 -0
  85. data/features/tests/checkout/agency.feature +33 -0
  86. data/features/tests/checkout/button_cac.feature +52 -0
  87. data/features/tests/checkout/chat.feature +20 -0
  88. data/features/tests/checkout/cupones.feature +54 -0
  89. data/features/tests/checkout/error_messages.feature +64 -0
  90. data/features/tests/checkout/integration.feature +215 -0
  91. data/features/tests/checkout/low_cost.feature +55 -0
  92. data/features/tests/checkout/seguros.feature +37 -0
  93. data/features/tests/contents/costs.feature +29 -0
  94. data/features/tests/contents/rules.feature +58 -0
  95. data/features/tests/contents/webcheckin.feature +26 -0
  96. data/features/tests/desambiguation/airports.feature +89 -0
  97. data/features/tests/desambiguation/city.feature +86 -0
  98. data/features/tests/filters/filters.feature +160 -0
  99. data/features/tests/fixes/advancedgui.feature +171 -0
  100. data/features/tests/fixes/advancednogui.feature +60 -0
  101. data/features/tests/fixes/book_no_gui.feature +21 -0
  102. data/features/tests/fixes/cross_sell_row_hoteles.feature +70 -0
  103. data/features/tests/fixes/facebook.feature +31 -0
  104. data/features/tests/fixes/landing_home_alerts.feature +82 -0
  105. data/features/tests/fixes/matrix_stops.feature +104 -0
  106. data/features/tests/fixes/one_day_search.feature +63 -0
  107. data/features/tests/fixes/print.feature +87 -0
  108. data/features/tests/fixes/searches_no_gui.feature +85 -0
  109. data/features/tests/landing/landing_alerts.feature +93 -0
  110. data/features/tests/landing/landing_checkout.feature +286 -0
  111. data/features/tests/landing/landing_filters.feature +176 -0
  112. data/features/tests/landing/landing_home.feature +68 -0
  113. data/features/tests/landing/landing_integration.feature +153 -0
  114. data/features/tests/landing/landing_long_tail.feature +162 -0
  115. data/features/tests/landing/landing_matrix.feature +156 -0
  116. data/features/tests/landing/landing_negative.feature +157 -0
  117. data/features/tests/landing/landing_orders.feature +107 -0
  118. data/features/tests/landing/landing_pagination.feature +142 -0
  119. data/features/tests/landing/landing_passenger_review.feature +139 -0
  120. data/features/tests/landing/landing_positive.feature +155 -0
  121. data/features/tests/landing/landing_reviews.feature +139 -0
  122. data/features/tests/landing/landing_tags.feature +148 -0
  123. data/features/tests/matrix/matrix_airlines.feature +104 -0
  124. data/features/tests/matrix/matrix_fare_chart.feature +24 -0
  125. data/features/tests/matrix/matrix_price.feature +35 -0
  126. data/features/tests/others/alerts.feature +89 -0
  127. data/features/tests/others/anticipatedsearch.feature +82 -0
  128. data/features/tests/others/flights_tracker.feature +94 -0
  129. data/features/tests/others/newsletter.feature +131 -0
  130. data/features/tests/others/querystringparameters.feature +82 -0
  131. data/features/tests/others/recommendation.feature +170 -0
  132. data/features/tests/others/semaphore.feature +206 -0
  133. data/features/tests/others/upgrade_bussines.feature +100 -0
  134. data/features/tests/search/basefare.feature +88 -0
  135. data/features/tests/search/itineraries.feature +85 -0
  136. data/features/tests/search/orders.feature +100 -0
  137. data/features/tests/search/pagination.feature +70 -0
  138. data/features/tests/search/reviews.feature +84 -0
  139. data/features/tests/search/searches.feature +197 -0
  140. data/features/tests/search/wish_list.feature +102 -0
  141. data/flights_gui_henry_tests.gemspec +32 -0
  142. data/henry-context.yml +14733 -0
  143. metadata +324 -0
@@ -0,0 +1,312 @@
1
+ # -*- encoding : utf-8 -*-
2
+ Then /^Verifico cada cluster "(.*)"$/ do |type|
3
+ json = @search.get_results_search_service
4
+ i=0
5
+ BROWSER.div(:id,'clusters').divs(:class,'cluster flights-cluster oldCluster').each do |cluster|
6
+ itinerary = ResultsCluster.new(type,Hpricot.parse(cluster.html))
7
+ validate_cluster_miles(json,type,cluster,i)
8
+ validate_cluster_details(json,type,cluster,i,itinerary)
9
+ validate_itins_cluster_details(json,type,cluster,i)
10
+ validate_fare_detail(json,cluster,i)
11
+ validate_cluster_ancillaries(json,type,cluster,i)
12
+ validate_cluster_payments(cluster)
13
+ i += 1
14
+ break if i == 2
15
+ end
16
+ end
17
+
18
+ Then /^Verifico los cluster nuevos con encabezados$/ do
19
+ i=0
20
+ BROWSER.div(:id,'clusters').divs(:class,'cluster flights-cluster').each do |cluster|
21
+ validate_cluster_with_headers(@search.type,cluster,i) if cluster.li(:class,'itineraries-title').present?
22
+ end
23
+ end
24
+
25
+ When /^Elijo un itinerario y paso a checkout$/ do
26
+ json = @search.get_results_search_service
27
+ @item_json = json['result']['data']['items'][0]
28
+ @itinerario = ResultsCluster.new(@search.description,Hpricot.parse(BROWSER.div(:id,'clusters').div(:class,'cluster').html))
29
+ BROWSER.div(:id,'clusters').div(:class,'cluster').radio(:id,'0-outbound-0').click if BROWSER.div(:id,'clusters').div(:class,'cluster').radio(:id,'0-outbound-0').present?
30
+ BROWSER.div(:id,'clusters').div(:class,'cluster').radio(:id,'0-inbound-0').click if BROWSER.div(:id,'clusters').div(:class,'cluster').radio(:id,'0-inbound-0').present?
31
+ begin
32
+ BROWSER.div(:id,'clusters').div(:class,'cluster').link(:class,'buy btn-buy flights-button').click
33
+ rescue Timeout::Error
34
+ stop_browser(BROWSER)
35
+ end
36
+ end
37
+
38
+ When /^Elijo un itinerario con proveedor "(.*)" y paso a checkout$/ do |prov|
39
+ type = $SITE=="US" ? "new" : "old"
40
+ json = @search.get_results_search_service
41
+ i = 0
42
+ page = 1
43
+ encontro = nil
44
+ begin
45
+ unless page == 1
46
+ json = @search.paginate(page)
47
+ BROWSER.div(:class,'pagination').li(:class,'pagination-button next').click
48
+ step "Espero que termine de cargar"
49
+ end
50
+ BROWSER.div(:id,'clusters').divs(:class,"cluster flights-cluster #{type}Cluster").each do |cluster|
51
+ if json['result']['data']['items'][i]['provider']==prov
52
+ @item_json = json['result']['data']['items'][i]
53
+ encontro = true
54
+ break
55
+ end
56
+ i += 1
57
+ end
58
+ if !encontro
59
+ page += 1
60
+ i=0
61
+ end
62
+ end while !encontro and BROWSER.div(:class,'pagination').li(:class,'pagination-button next').present?
63
+
64
+ json['result']['data']['items'][i]['provider'].should equal(prov)
65
+
66
+ @itinerario = ResultsCluster.new(@search.description,Hpricot.parse(BROWSER.div(:id,'clusters').divs(:class,'cluster')[i].html))
67
+ BROWSER.div(:id,'clusters').divs(:class,'cluster')[i].radio(:id,"#{i}-outbound-0").click if BROWSER.div(:id,'clusters').divs(:class,'cluster')[i].radio(:id,"#{i}-outbound-0").present?
68
+ BROWSER.div(:id,'clusters').divs(:class,'cluster')[i].radio(:id,"#{i}-inbound-0").click if BROWSER.div(:id,'clusters').divs(:class,'cluster')[i].radio(:id,"#{i}-inbound-0").present?
69
+ begin
70
+ BROWSER.div(:id,'clusters').divs(:class,'cluster')[i].link(:class,'buy btn-buy flights-button').click
71
+ rescue Timeout::Error
72
+ stop_browser(BROWSER)
73
+ end
74
+ end
75
+
76
+ Then /^Verifico que ingrese al checkout$/ do
77
+ if BROWSER.div(:id,'popup-cross-sell-row').present?
78
+ begin
79
+ BROWSER.div(:id,'popup-cross-sell-row').link(:class,"checkout-button").click
80
+ rescue Timeout::Error
81
+ puts "Timeout"
82
+ end
83
+ end
84
+ step "Verifico que la pagina no rompa"
85
+ Watir::Wait.until(timeout = 300){BROWSER.fieldset(:id,'passengers').div(:class,'passenger background').present? or BROWSER.div(:class,'notification-box warn-box').present? or BROWSER.div(:id,'divMainhotelsResults').present?}
86
+ pending("Se redirigio a la pagina de productos combinados") if BROWSER.div(:id,'divMainhotelsResults').present?
87
+ BROWSER.fieldset(:id,'passengers').div(:class,'passenger background').should visible("Formulario del check out")
88
+ @intentos = 0
89
+ end
90
+
91
+ Then /^Completo el formulario de pasajeros$/ do
92
+ container = BROWSER.fieldset(:id,'passengers')
93
+ plus_name=["A","B","C","D","E","F","G","H","I","J","k"]
94
+ index = 0
95
+ @search.adt.times do |adulto|
96
+ container.text_field(:id,"passenger-first-name-#{index}").set("Martin QA" + plus_name[index]) if container.text_field(:id,"passenger-first-name-#{index}").present?
97
+ container.text_field(:id,"passenger-last-name-#{index}").set("Diez" + plus_name[index]) if container.text_field(:id,"passenger-last-name-#{index}").present?
98
+ container.select_list(:id,"nationality-#{index}").select_value($SITE) if container.select_list(:id,"nationality-#{index}").present?
99
+ container.select_list(:id,"document-type-#{index}").select_value("PASSPORT") if container.select_list(:id,"document-type-#{index}").present?
100
+ container.text_field(:id,"document-number-#{index}").set("3245673#{index}") if container.text_field(:id,"document-number-#{index}").present?
101
+ container.select_list(:id,"passenger-birthday-day-#{index}").select(index+1) if container.select_list(:id,"passenger-birthday-day-#{index}").present?
102
+ container.select_list(:id,"passenger-birthday-month-#{index}").select(3) if container.select_list(:id,"passenger-birthday-month-#{index}").present?
103
+ container.select_list(:id,"passenger-birthday-year-#{index}").select_value("197#{index}") if container.select_list(:id,"passenger-birthday-year-#{index}").present?
104
+ container.select_list(:id,"passenger-gender-#{index}").select_value("MALE") if container.select_list(:id,"passenger-gender-#{index}").present?
105
+ index += 1
106
+ end
107
+ @search.cnn.times do |nino|
108
+ container.text_field(:id,"passenger-first-name-#{index}").set("Diego qa" + plus_name[index]) if container.text_field(:id,"passenger-first-name-#{index}").present?
109
+ container.text_field(:id,"passenger-last-name-#{index}").set("Romero jr" + plus_name[index]) if container.text_field(:id,"passenger-last-name-#{index}").present?
110
+ container.select_list(:id,"nationality-#{index}").select_value($SITE) if container.select_list(:id,"nationality-#{index}").present?
111
+ container.select_list(:id,"document-type-#{index}").select_value("PASSPORT") if container.select_list(:id,"document-type-#{index}").present?
112
+ container.text_field(:id,"document-number-#{index}").set("3012343#{index}") if container.text_field(:id,"document-number-#{index}").present?
113
+ container.select_list(:id,"passenger-birthday-day-#{index}").select(index+2) if container.select_list(:id,"passenger-birthday-day-#{index}").present?
114
+ container.select_list(:id,"passenger-birthday-month-#{index}").select(5) if container.select_list(:id,"passenger-birthday-month-#{index}").present?
115
+ container.select_list(:id,"passenger-birthday-year-#{index}").select_value(2008) if container.select_list(:id,"passenger-birthday-year-#{index}").present?
116
+ container.select_list(:id,"passenger-gender-#{index}").select_value("MALE") if container.select_list(:id,"passenger-gender-#{index}").present?
117
+ index += 1
118
+ end
119
+ @search.inf.times do |bebe|
120
+ container.text_field(:id,"passenger-first-name-#{index}").set("Maribel qa" + plus_name[index]) if container.text_field(:id,"passenger-first-name-#{index}").present?
121
+ container.text_field(:id,"passenger-last-name-#{index}").set("Dias Herr jrb" + plus_name[index]) if container.text_field(:id,"passenger-last-name-#{index}").present?
122
+ container.select_list(:id,"nationality-#{index}").select_value($SITE) if container.select_list(:id,"nationality-#{index}").present?
123
+ container.select_list(:id,"document-type-#{index}").select_value("PASSPORT") if container.select_list(:id,"document-type-#{index}").present?
124
+ container.text_field(:id,"document-number-#{index}").set("4569734#{index}") if container.text_field(:id,"document-number-#{index}").present?
125
+ container.select_list(:id,"passenger-birthday-day-#{index}").select(index+3) if container.select_list(:id,"passenger-birthday-day-#{index}").present?
126
+ container.select_list(:id,"passenger-birthday-month-#{index}").select(7) if container.select_list(:id,"passenger-birthday-month-#{index}").present?
127
+ container.select_list(:id,"passenger-birthday-year-#{index}").select_value(2012) if container.select_list(:id,"passenger-birthday-year-#{index}").present?
128
+ container.select_list(:id,"passenger-gender-#{index}").select_value("FEMALE") if container.select_list(:id,"passenger-gender-#{index}").present?
129
+ index += 1
130
+ end
131
+ end
132
+
133
+ And /^Completo el formulario de tarjeta$/ do
134
+ container = BROWSER.fieldset(:id,'payment')
135
+ container.radio(:value,/CREDIT/).click
136
+ container.select_list(:id,'card-brand').select("Visa")
137
+ container.text_field(:id,'card-number').set("4242424242424242")
138
+ container.select_list(:id,'card-expiration-month').select('10')
139
+ container.select_list(:id,'card-expiration-year').select(Date.today.year+1)
140
+ container.text_field(:id,'security-code').set("123")
141
+ container.text_field(:id,"other-bank-name").set("/Banco Emisor/") if container.text_field(:id,"other-bank-name").present?
142
+ container.text_field(:id,"owner-name").set("Diego Qa Romero") if container.text_field(:id,"owner-name").present?
143
+ container.select_list(:id,'owner-gender').select_value("MALE") if container.select_list(:id,'owner-gender').present?
144
+ if container.text_field(:id,"owner-document-number").present?
145
+ number = case $SITE
146
+ when "CL" then "7028168-6"
147
+ when "BR" then "22233366638"
148
+ else "32456734"
149
+ end
150
+ container.text_field(:id,"owner-document-number").set(number)
151
+ end
152
+ ###############BillingAddressDefinition############################################################################################
153
+ container.select_list(:id,'billing-address-state').options[4].select if container.select_list(:id,"billing-address-state").present?
154
+ container.text_field(:id,"billing-address-city").set("Ciudad") if container.text_field(:id,"billing-address-city").present?
155
+ container.text_field(:id,"billing-address-postal-code").set("12345") if container.text_field(:id,"billing-address-postal-code").present?
156
+ container.text_field(:id,"billing-address-street").set("Calle") if container.text_field(:id,"billing-address-street").present?
157
+ container.text_field(:id,"billing-address-number").set("470") if container.text_field(:id,"billing-address-number").present?
158
+ end
159
+
160
+ And /^Completo los datos de resolucion AFIP$/ do
161
+ container = BROWSER.fieldset(:id,'payment')
162
+ if $SITE == "AR" and !@search.cabotage
163
+ container.text_field(:id,'owner-document-number').should visible
164
+ container.select_list(:id,'owner-gender').should visible
165
+ else
166
+ container.select_list(:id,'owner-gender').should_not visible
167
+ end
168
+ end
169
+
170
+ And /^Completo los datos de contacto/ do
171
+ container = BROWSER.fieldset(:id,'contact')
172
+ container.text_field(:id,"contact-email").set("bookingvuelos@despegar.com")
173
+ container.text_field(:id,"contact-email-repeat").set("bookingvuelos@despegar.com")
174
+ container.select_list(:id,"phone-type-0").options[2].select
175
+ container.text_field(:id,'country-code-0').set("AR")
176
+ container.text_field(:id,'country-code-0').send_keys :enter
177
+ container.text_field(:id,"area-code-0").set("055")
178
+ container.text_field(:id,"phone-number-0").set("123456")
179
+ end
180
+
181
+ And /^Realizo la compra$/ do
182
+ BROWSER.checkbox(:id=>'read-agreement').set(true)
183
+ begin
184
+ BROWSER.a(:id=>'submit').click
185
+ rescue Watir::Wait::TimeoutError, Timeout::Error
186
+ stop_browser(BROWSER)
187
+ end
188
+ end
189
+
190
+ Then /^Verifico que dirija a la pagina de gracias$/ do
191
+ step "Verifico que la pagina no rompa"
192
+ begin
193
+ Watir::Wait.until(timeout = 200){BROWSER.div(:class,'notification-box error-box').present? or BROWSER.span(:class =>'checkout-id').present? or BROWSER.em(:class =>'checkout-id').present? or BROWSER.div(:id =>'popup-new-flight').exist? or BROWSER.span(:class,/error-message/).present? or BROWSER.div(:class, 'notification-box warn-box').present? or BROWSER.div(:class, 'ux-common-warning ux-common-error').present?}
194
+ rescue Timeout::Error
195
+ pending("Timeout de 400 segundos al ingresar a la pagina de gracias")
196
+ end
197
+ text = BROWSER.div(:class,'notification-box error-box').text if BROWSER.div(:class,'notification-box error-box').present?
198
+ if BROWSER.div(:class,'notification-box error-box').present?
199
+ pending(BROWSER.div(:class,'notification-box error-box').text)
200
+ end
201
+ if BROWSER.div(:class, 'ux-common-warning ux-common-error').present?
202
+ pending(BROWSER.div(:class,'ux-common-warning ux-common-error').text)
203
+ end
204
+ if BROWSER.div(:class,'notification-box warn-box').present?
205
+ BROWSER.div(:class,'notification-box warn-box').text.strip.no_accents.downcase.should_not match("lo sentimos, el vuelo que eligio no se encuentra disponible")
206
+ end
207
+ doc = Hpricot.parse(BROWSER.html)
208
+ errores = (doc/"span.error-message").select{|error| error.attributes['style'].match(/block/)}
209
+ errores.should is_empty
210
+ end
211
+
212
+ Then /^Verifico que genere id cro$/ do
213
+ if BROWSER.div(:class,'ux-common-warning-content ').present?
214
+ pending(BROWSER.div(:class,'ux-common-warning-content ').text)
215
+ end
216
+ if BROWSER.span(:class =>'checkout-id').present?
217
+ BROWSER.span(:class =>'checkout-id').should visible("Numero de reserva")
218
+ puts " ID CRO:#{BROWSER.span(:class =>'checkout-id').text} "
219
+ @id_cro = BROWSER.span(:class =>'checkout-id').text
220
+ else
221
+ BROWSER.em(:class =>'checkout-id').should visible("Numero de reserva")
222
+ puts " ID CRO:#{BROWSER.em(:class =>'checkout-id').text} "
223
+ @id_cro = BROWSER.em(:class =>'checkout-id').text
224
+ end
225
+ end
226
+
227
+ Then /^se muestra el popup de no disponibilidad$/ do
228
+ BROWSER.div(:id =>'popup-new-flight').should visible
229
+ end
230
+
231
+ Then /^elijo otro vuelo$/ do
232
+ if BROWSER.div(:class,'ux-common-warning-content ').present?
233
+ pending(BROWSER.div(:class,'ux-common-warning-content ').text)
234
+ end
235
+ @intentos += 1
236
+ puts @intentos
237
+ if @intentos>5
238
+ pending("Se visualizo el popup mas de #{@intentos} veces")
239
+ end
240
+ @pop_up = true
241
+ Watir::Wait.until(timeout = 200){BROWSER.div(:class,'cluster').present? or BROWSER.div(:class,'notification-box warn-box').present?}
242
+ BROWSER.div(:class,'notification-box warn-box').should_not visible
243
+ sleep(1)
244
+ BROWSER.radio(:id, "0-outbound-0").click if BROWSER.radio(:id, "0-outbound-0").present?
245
+ BROWSER.radio(:id, "0-inbound-0").click if BROWSER.radio(:id, "0-inbound-0").present?
246
+ BROWSER.a(:class=>'buy btn-buy flights-button').click
247
+ Watir::Wait.until(timeout = 120){BROWSER.fieldset(:id,'passengers').div(:class,'passenger background').present?}
248
+ end
249
+
250
+ Then /^debo completar de vuelta el formulario$/ do
251
+ BROWSER.div(:class,/notification-box warn-box|ux-common-warning-content ux-common-warning-no-icon/).should visible
252
+ end
253
+
254
+ Then /^completo el formulario$/ do
255
+ puts "pop up"
256
+ step "Completo el formulario de pasajeros"
257
+ step "Completo el formulario de tarjeta"
258
+ step "Completo los datos de contacto"
259
+ step "Realizo la compra"
260
+ step "Verifico que dirija a la pagina de gracias"
261
+ step "Si se muestra el popup de no disponibilidad, elijo otro vuelo"
262
+ step "Si debo completar de vuelta el formulario, completo el formulario"
263
+ end
264
+
265
+ Then /^completo el formulario para reservas CAC$/ do
266
+ step "Completo el formulario de pasajeros"
267
+ step "Completo los datos para reservas CAC"
268
+ step "Completo los datos de contacto"
269
+ step "Realizo la compra"
270
+ step "Verifico que dirija a la pagina de gracias"
271
+ step "Si se muestra el popup de no disponibilidad, elijo otro vuelo"
272
+ step "Si debo completar de vuelta el formulario, completo el formulario"
273
+ end
274
+
275
+ Then /^el checkout me pide mas datos de tarjeta$/ do
276
+ text = BROWSER.div(:class,'notification-box warn-box').text if BROWSER.div(:class,'notification-box warn-box').present?
277
+ BROWSER.div(:class, 'notification-box warn-box').should visible(text)
278
+ end
279
+
280
+ Then /^lleno los datos de tarjeta adicionales$/ do
281
+ puts "adicionales"
282
+ container = BROWSER.fieldset(:class,'billing-address section')
283
+ container.select_list(:id,'invoice-country').options[1].select if container.select_list(:id,"invoice-country").present?
284
+ container.text_field(:id,"invoice-other-state").set("Estado") if container.text_field(:id,"invoice-other-state").present?
285
+ container.text_field(:id,"invoice-city").set("Ciudad") if container.text_field(:id,"invoice-city").present?
286
+ container.text_field(:id,"invoice-postal-code").set("12345") if container.text_field(:id,"invoice-postal-code").present?
287
+ container.text_field(:id,"invoice-street").set("Calle") if container.text_field(:id,"invoice-street").present?
288
+ container.text_field(:id,"invoice-address-number").set("470") if container.text_field(:id,"invoice-address-number").present?
289
+ BROWSER.link(:id,'submit').click if BROWSER.link(:id,'submit').present?
290
+ end
291
+
292
+ When /^pide factura fiscal$/ do
293
+ BROWSER.checkbox(:id,'invoice-check').should visible
294
+ end
295
+
296
+ And /^Completo los campos de factura fiscal$/ do
297
+ container = BROWSER.fieldset(:id,'invoice')
298
+ container.checkbox(:id,'invoice-check').set(true)
299
+ container.text_field(:id,'invoice-fiscal-id').set("3334445556")
300
+ container.text_field(:id,'invoice-card-holder-name').set("diego qa romero")
301
+ container.select_list(:id,'invoice-state').options[2].select
302
+ container.text_field(:id,'invoice-city').set("Rosario")
303
+ container.text_field(:id,'invoice-street').set("corrientes")
304
+ if $SITE.upcase.match("MX")
305
+ container.text_field(:id,'invoice-email').set("bookingvuelos@despegar.com")
306
+ container.text_field(:id,'invoice-other-state').set("Chiapas") if container.text_field(:id,'invoice-other-state').present?
307
+ container.text_field(:id,'invoice-postal-code').set("7111")
308
+ container.text_field(:id,'invoice-address-number').set("123")
309
+ container.text_field(:id,'invoice-address-floor').set("1")
310
+ container.text_field(:id,'invoice-address-deparment').set("1")
311
+ end
312
+ end
@@ -0,0 +1,13 @@
1
+ # -*- encoding : utf-8 -*-
2
+ When /^Ordeno por "(.*)"$/ do |order|
3
+ BROWSER.select_list(:id,'orderby').select_value(order)
4
+ end
5
+
6
+ Then /^Verifico las millas en cada cluster "(.*)"$/ do |type|
7
+ json = @search.get_results_search_service
8
+ i = 0
9
+ BROWSER.div(:id,'clusters').divs(:class,'cluster').each do |cluster|
10
+ validate_cluster_miles(json,type,cluster,i)
11
+ i += 1
12
+ end
13
+ end
@@ -0,0 +1,41 @@
1
+ # -*- encoding : utf-8 -*-
2
+ When /^Verifico que funcione el paginado correctamente en resultados$/ do
3
+ iterator = 2
4
+ while(BROWSER.div(:class,'flights-pagination pagination').li(:class,'pagination-button next').present? and iterator < 7)do
5
+ BROWSER.div(:class,'flights-pagination pagination').li(:class,'pagination-button next').links[0].click
6
+ sleep(3)
7
+ iterator += 1
8
+ end
9
+ end
10
+
11
+ #And /^Verifico que el paginado mantenga los filtros en resultados$/ do
12
+ # BROWSER.ul(:class,'filterPanelItems accordion-content').links[0].click
13
+ # sleep(0.5)
14
+ # if BROWSER.div(:class,'flights-pagination pagination').li(:class,'pagination-button next').present?
15
+ # url_with_filter = BROWSER.url
16
+ # BROWSER.div(:class,'flights-pagination pagination').li(:class,'pagination-button next').links[0].click
17
+ # Watir::Wait.until(timeout = 5){url_with_filter != BROWSER.url}
18
+ # BROWSER.url.strip.should equal(url_with_filter.strip.gsub(/\/1\//,"/2/"))
19
+ # end
20
+ # reset_filter
21
+ #end
22
+
23
+ Then /^Vuelvo a la primer pagina en resultados$/ do
24
+ Watir::Wait.until(timeout = 20){!BROWSER.div(:class,'update-message').present? and !BROWSER.div(:id,'results-update').present? and !BROWSER.div(:class,'results-update').present?}
25
+ while BROWSER.li(:class,'pagination-button prev').present?
26
+ BROWSER.li(:class,'pagination-button prev').links[0].click
27
+ begin
28
+ Watir::Wait.until(timeout = 60){!BROWSER.div(:class,'update-message').present? and !BROWSER.div(:id,'results-update').present? and !BROWSER.div(:class,'results-update').present?}
29
+ rescue Timeout::Error, Watir::Wait::TimeoutError
30
+ pending("Timeout al volver a la primer pagina")
31
+ end
32
+ end
33
+ sleep(1)
34
+ end
35
+
36
+ When /^Verifico que el paginado no traiga mas de "(.*)" paginas en resultados$/ do |limit_pages|
37
+ doc = Hpricot.parse(BROWSER.html)
38
+ if (doc/"li.page ")[-2]
39
+ ((doc/"li.page ")[-2].inner_text.to_i <= limit_pages.to_i).should be_true
40
+ end
41
+ end
@@ -0,0 +1,56 @@
1
+ # -*- encoding : utf-8 -*-
2
+ Then /^Verifico cada review "(.*)"$/ do |site|
3
+ json = @search.get_results_search_service
4
+ valor_link = String.new
5
+ i=0
6
+ BROWSER.div(:class,'flights-tab-header flights-tab-airlinePricesMatrix ').click if !BROWSER.div(:class,/matrix-airlines matrix/).present?
7
+ BROWSER.div(:id,'matrix').div(:class,"matrix-airlines-container").uls.each do |ul|
8
+ BROWSER.span(:class,'matrix-next').click until ul.class_name.match(/visible/)
9
+ if ul.link(:class,"review-description").present?
10
+ ul.link(:class,"review-description").click
11
+ valor_link = ul.link(:class,"review-description").text
12
+ Watir::Wait.until{BROWSER.div(:id,'popup-reviews').present?}
13
+ if BROWSER.div(:id,'popup-reviews').present?
14
+ doc = Hpricot.parse(BROWSER.div(:id,'popup-reviews').html)
15
+ ul.div(:class,'airline-logo').images[0].src.strip.downcase.should match((doc/"span.logo/img").first.attributes['src'].strip.downcase)
16
+ ul.div(:class,'airline-name').text.strip.downcase.should equal(BROWSER.div(:id,'popup-reviews').h4(:class,'name').text.strip.downcase)
17
+ BROWSER.div(:id,'popup-reviews').span(:class,'popup-close-button popup-close').click
18
+ Watir::Wait.until{!BROWSER.div(:id,'popup-reviews').present?}
19
+ end
20
+ else
21
+ ul.link(:class,"review-description").should visible("reviews de aerolineas")
22
+ end
23
+ if ul.span(:class,"main-sprite icon-full-leaf").present?
24
+ footprint = (json['result']['data']['pricesSummary']['matrix'][i]['footprint'] * 100).to_i
25
+ footprint.should equal(ul.span(:class,"main-sprite icon-full-leaf").style.match(/(\d+)(\.|\%)/)[1].to_i)
26
+ level = case footprint
27
+ when 0..24 then "Nivel de preservacion: Poco ecologico|nivel de preservacao: pouco ecologico"
28
+ when 25..74 then "Nivel de preservacion: Medianamente ecologico|nivel de preservacao: medio ecologico"
29
+ when 75..100 then "Nivel de preservacion: Muy ecologico|nivel de preservacao: muito ecologico"
30
+ else puts "Huella ecologica no valida"
31
+ end
32
+ ul.span(:class,'ecological-flight main-sprite icon-empty-leaf').title.downcase.no_accents.strip.should match(level.downcase)
33
+ end
34
+ i += 1
35
+ end
36
+ end
37
+
38
+ Then /^Verifico el pop up de ecologicos en la matriz$/ do
39
+ abtesting_layout = get_abtesting("layout")
40
+ if BROWSER.span(:class,"commonSprite questionIcon preservation-level-detail-icon").present?
41
+ abtesting_layout.should_not is_greater_than(50)
42
+ BROWSER.span(:class,"commonSprite questionIcon preservation-level-detail-icon").click
43
+ BROWSER.div(:class,"flights-popup popup-preservation-level").present?
44
+ if !(BROWSER.div(:class,"ecological-feedback-container ecological-feedback-yes-answer").present?)
45
+ BROWSER.span(:class,"ecological-feedback-button ecological-feedback-yes").present?
46
+ BROWSER.span(:class,"icon-thumbs-up").click
47
+ BROWSER.div(:class,"ecological-feedback-container ecological-feedback-yes-answer").present?
48
+ else
49
+ BROWSER.span(:class,'popup-close-button popup-close').click
50
+ end
51
+ else
52
+ unless $SITE!="AR" or @search.cabotage
53
+ #abtesting_layout.should_not is_greater_than(50)
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,185 @@
1
+ # -*- encoding : utf-8 -*-
2
+ Then /^Verifico que el pedido responda "(.*)"$/ do |code|
3
+ if @get.code != 200
4
+ nil.should be_true
5
+ end
6
+ end
7
+
8
+ When /^Genero el respond de la busqueda$/ do
9
+ begin
10
+ @get = HTTParty.get(@search.generate_url_results_search,:headers=>{"x-uow"=>"ROBOT"})
11
+ rescue Errno::ECONNRESET, Timeout::Error
12
+ lambda{@get = HTTParty.get(@search.generate_url_results_search,:headers=>{"x-uow"=>"ROBOT"})}.should_not raise_error
13
+ end
14
+ end
15
+
16
+ When /^Llamo al servicio de resultados$/ do
17
+ @json = @search.get_results_search_service
18
+ if @json.code != 200
19
+ nil.should be_true
20
+ end
21
+ if @json['result']['data']['items'].nil?
22
+ nil.should be_true
23
+ end
24
+ end
25
+
26
+ When /^Elijo un itinerario del servicio y paso a checkout$/ do
27
+ url = @search.host().gsub(/http/,'https')
28
+ @checkout_url = case @search.description
29
+ when /roundtrip/ then url = url + "/book/flights/checkout/#{@json['result']['data']['metadata']['ticket']['hash']}/#{@json['result']['data']['metadata']['ticket']['version']}/#{@json['result']['data']['items'][0]['itinerariesBox']['matchingInfoMap']['_0_0']['id']}/?box=0"
30
+ when /oneway/ then url = url + "/book/flights/checkout/#{@json['result']['data']['metadata']['ticket']['hash']}/#{@json['result']['data']['metadata']['ticket']['version']}/#{@json['result']['data']['items'][0]['itinerariesBox']['matchingInfoMap']['_0_-1']['id']}/?box=0"
31
+ when /multipledestinations/ then url = url + "/book/flights/checkout/#{@json['result']['data']['metadata']['ticket']['hash']}/#{@json['result']['data']['metadata']['ticket']['version']}/#{@json['result']['data']['items'][0]['itinerary']['itineraryInfo']['id']}/?box=0"
32
+ end
33
+ puts @checkout_url
34
+ uri = URI.parse(@checkout_url)
35
+ http = Net::HTTP.new(uri.host, 443)
36
+ http.use_ssl = true
37
+ request = Net::HTTP::Get.new(uri.request_uri)
38
+ @response = http.request(request)
39
+ @response.code.to_s.should match("200|303")
40
+ end
41
+
42
+ Then /^Verifico que las datos de la pagina sean consistente a la busqueda realizada$/ do
43
+ html = Hpricot.parse(@get)
44
+ (html/"span.search-info").inner_text.no_accents.downcase.should match(@search.city_from_1.name.downcase) unless @search.description=="multipledestinations"
45
+ (html/"span.search-info").inner_text.no_accents.downcase.should match(@search.city_to_1.name.downcase) unless @search.description=="multipledestinations"
46
+ (!(html/"div.search").length.zero?).should be_true
47
+ (!(html/"div#flights-alerts").length.zero?).should be_true if @search.description=="roundtrip"
48
+ (!(html/"div#filters").length.zero?).should be_true unless @search.description=="multipledestinations"
49
+ end
50
+
51
+ Then /^Verifico que los datos de cada cluster sean consistente a la busqueda realizada$/ do
52
+ unless @search.description == "multipledestinations"
53
+ @json['result']['data']['items'].each do |cluster|
54
+ cluster["itinerariesBox"]["outboundLocations"]["departure"]["city"]["code"].should equal(@search.city_from_1.code)
55
+ cluster["itinerariesBox"]["outboundLocations"]["departure"]["city"]["description"].no_accents.should match(@search.city_from_1.name)
56
+ cluster["itinerariesBox"]["outboundLocations"]["departure"]["code"].should equal(@search.city_from_1.code)
57
+ cluster["itinerariesBox"]["outboundLocations"]["arrival"]["city"]["code"].should equal(@search.city_to_1.code)
58
+ cluster["itinerariesBox"]["outboundLocations"]["arrival"]["city"]["description"].no_accents.should match(@search.city_to_1.name)
59
+ cluster["itinerariesBox"]["outboundLocations"]["arrival"]["code"].should equal(@search.city_to_1.code)
60
+ if @search.description == "roundtrip"
61
+ cluster["itinerariesBox"]["inboundLocations"]["departure"]["city"]["code"].should equal(@search.city_to_1.code)
62
+ cluster["itinerariesBox"]["inboundLocations"]["departure"]["city"]["description"].no_accents.should match(@search.city_to_1.name)
63
+ cluster["itinerariesBox"]["inboundLocations"]["departure"]["code"].should equal(@search.city_to_1.code)
64
+ cluster["itinerariesBox"]["inboundLocations"]["arrival"]["city"]["code"].should equal(@search.city_from_1.code)
65
+ cluster["itinerariesBox"]["inboundLocations"]["arrival"]["city"]["description"].no_accents.should match(@search.city_from_1.name)
66
+ cluster["itinerariesBox"]["inboundLocations"]["arrival"]["code"].should equal(@search.city_from_1.code)
67
+ end
68
+ cluster['itinerariesBox']['itinerariesBoxPriceInfoList'].each do |a_price|
69
+ a_price["currencyCode"].should be_true
70
+ a_price["total"]["fare"]["formatted"]["code"].should be_true
71
+ a_price["total"]["fare"]["formatted"]["amount"].should is_greater_than(0)
72
+ a_price["total"]["fare"]["formatted"]["mask"].should be_true unless $SITE == "UY"
73
+ if a_price["total"]["taxes"]
74
+ a_price["total"]["taxes"]["formatted"]["code"].should be_true
75
+ a_price["total"]["taxes"]["formatted"]["amount"].should is_greater_than(-1)
76
+ a_price["total"]["taxes"]["formatted"]["mask"].should be_true unless $SITE == "UY"
77
+ end
78
+ if a_price["total"]["charges"]
79
+ a_price["total"]["charges"]["formatted"]["code"].should be_true
80
+ a_price["total"]["charges"]["formatted"]["amount"].should is_greater_than(-1)
81
+ a_price["total"]["charges"]["formatted"]["mask"].should be_true unless $SITE == "UY"
82
+ end
83
+ a_price["adult"]["quantity"].to_i.should equal(@search.adt)
84
+ a_price["adult"]["baseFare"]["formatted"]["code"].should be_true
85
+ a_price["adult"]["baseFare"]["formatted"]["amount"].should is_greater_than(0)
86
+ a_price["adult"]["baseFare"]["formatted"]["mask"].should be_true unless $SITE == "UY"
87
+ a_price["adult"]["totalFare"]["formatted"]["code"].should be_true
88
+ a_price["adult"]["totalFare"]["formatted"]["amount"].should is_greater_than(0)
89
+ a_price["adult"]["totalFare"]["formatted"]["mask"].should be_true unless $SITE == "UY"
90
+ if a_price["child"]
91
+ a_price["child"]["quantity"].to_i.should equal(@search.cnn)
92
+ a_price["child"]["baseFare"]["formatted"]["code"].should be_true
93
+ a_price["child"]["baseFare"]["formatted"]["amount"].should is_greater_than(-1)
94
+ a_price["child"]["baseFare"]["formatted"]["mask"].should be_true unless $SITE == "UY"
95
+ a_price["child"]["totalFare"]["formatted"]["code"].should be_true
96
+ a_price["child"]["totalFare"]["formatted"]["amount"].should is_greater_than(-1)
97
+ a_price["child"]["totalFare"]["formatted"]["mask"].should be_true unless $SITE == "UY"
98
+ end
99
+ if a_price["infant"]
100
+ a_price["infant"]["quantity"].to_i.should equal(@search.inf)
101
+ a_price["infant"]["baseFare"]["formatted"]["code"].should be_true
102
+ a_price["infant"]["baseFare"]["formatted"]["amount"].should is_greater_than(-1)
103
+ a_price["infant"]["baseFare"]["formatted"]["mask"].should be_true unless $SITE == "UY"
104
+ a_price["infant"]["totalFare"]["formatted"]["code"].should be_true
105
+ a_price["infant"]["totalFare"]["formatted"]["amount"].should is_greater_than(-1)
106
+ a_price["infant"]["totalFare"]["formatted"]["mask"].should be_true unless $SITE == "UY"
107
+ end
108
+ end
109
+ cluster["itinerariesBox"]["paymentsInfo"].should be_true
110
+ cluster["itinerariesBox"]["paymentsInfo"]["numberOfInstalments"].should be_true
111
+ cluster["itinerariesBox"]["paymentsInfo"]["payments"].should be_true
112
+ cluster["itinerariesBox"]["paymentsInfo"]["payments"].each do |payment|
113
+ payment["availableInstalments"].each do |availableInstalment|
114
+ if availableInstalment
115
+ availableInstalment["quantity"].should is_greater_than(0)
116
+ availableInstalment["prices"].each do |price|
117
+ price["formatted"]["code"].should be_true
118
+ price["formatted"]["amount"].should is_greater_than(0)
119
+ price["formatted"]["mask"].should be_true unless $SITE == "UY"
120
+ end
121
+ end
122
+ end
123
+ payment["maxNumberOfInstalments"].should is_greater_than(0)
124
+ payment["creditCard"]["code"].should be_true
125
+ end
126
+ end
127
+ end
128
+ end
129
+
130
+ Then /^Verifico que el pedido alla ingresado correctamente$/ do
131
+ if @response =~ /Han pasado varios minutos sin actividad. Por favor seleccione nuevamente su vuelo|O tempo de espera foi excedido. Por favor selecione novamente seu voo/
132
+ nil.should be_true
133
+ end
134
+
135
+ if @response =~ /Estamos trabajando para mejorar los servicios que le brindamos/
136
+ nil.should be_true
137
+ end
138
+ end
139
+
140
+ When /^realizo el post a purchase$/ do
141
+
142
+ data = Hash.new
143
+ data["passengerDefinitions[0].firstName.value"]="Diego QA"
144
+ data["passengerDefinitions[0].lastName.value"]="Romero"
145
+ data["passengerDefinitions[0].nationality.value"]="AR"
146
+ data["passengerDefinitions[0].documentDefinition.type.value"]="LOCAL"
147
+ data["passengerDefinitions[0].documentDefinition.number.value"]=12345678
148
+ data["supportedOperation.value"]="PURCHASE"
149
+ data["paymentDefinition.installments.value"]="1_VI-CREDIT_CA-CREDIT_AX-CREDIT"
150
+ data["paymentDefinition.installments.subValues['3']"]="6_VI-CREDIT"
151
+ data["paymentDefinition.paymentMethod.value"]="1_CREDIT_VI_null"
152
+ data["paymentDefinition.cardDefinition.number.value"]=4242424242424242
153
+ data["paymentDefinition.cardDefinition.expiration.month.value"]=5
154
+ data["paymentDefinition.cardDefinition.expiration.year.value"]=2015
155
+ data["paymentDefinition.cardDefinition.securityCode.value"]=123
156
+ data["paymentDefinition.cardDefinition.ownerName.value"]="Diego QA Romero"
157
+ data["paymentDefinition.cardDefinition.ownerDocumentDefinition.number.value"]=12345678
158
+ data["paymentDefinition.cardDefinition.ownerGender.value"]="MALE"
159
+ data["offlinePaymentDefinition.documentDefinition.type.value"]="LOCAL"
160
+ data["offlinePaymentDefinition.documentDefinition.number.value"]=nil
161
+ data["offlinePaymentDefinition.gender.value"]=nil
162
+ data["contactDefinition.contactFullName.value"]=nil
163
+ data["contactDefinition.email.value"]="bookingvuelos@despegar.com"
164
+ data["contactDefinition.emailRepeat.value"]="bookingvuelos@despegar.com"
165
+ data["contactDefinition.phoneDefinitions[0].type.value"]="CELULAR"
166
+ data["contactDefinition.phoneDefinitions[0].countryCode.value"]=54
167
+ data["contactDefinition.phoneDefinitions[0].areaCode.value"]=011
168
+ data["contactDefinition.phoneDefinitions[0].number.value"]=12345678
169
+ data["agreement.value"]="on"
170
+ data["vouchersDefinition.codes[0].value"]=1
171
+ data["commentDefinition.referenceCode.value"]=nil
172
+
173
+ to_send = data.to_json
174
+
175
+ @purchase_url = "https://www.despegar.com.ar" + @response.response.header.to_hash["location"].first.gsub(/checkout/,"purchase")
176
+ puts @purchase_url
177
+ uri = URI.parse(@purchase_url)
178
+ http = Net::HTTP.new(uri.host, 443)
179
+ http.use_ssl = true
180
+
181
+ request = Net::HTTP::Post.new(uri.path, initheader = {"Content-Type"=>"application/x-www-form-urlencoded","User-Agent"=>"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/536.11 (KHTML, like Gecko) Ubuntu/12.04 Chromium/20.0.1132.47 Chrome/20.0.1132.47 Safari/536.11"})
182
+ request.body = "[ #{to_send} ]"
183
+ @response_purchase = http.request(request)
184
+ puts "Response #{ @response_purchase.code} #{ @response_purchase.message}: #{ @response_purchase.body}"
185
+ end