flights_gui_tests 0.4.3 → 0.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/features/step_definitions/checkout/checkout_steps.rb +1 -0
  3. data/features/step_definitions/checkout/load_steps.rb +18 -5
  4. data/features/step_definitions/page_steps.rb +1 -32
  5. data/features/step_definitions/results/filters_steps.rb +34 -55
  6. data/features/step_definitions/results/load_steps.rb +3 -1
  7. data/features/step_definitions/results/new_filters_steps.rb +85 -137
  8. data/features/step_definitions/results/results_steps.rb +14 -4
  9. data/features/step_definitions/thanks/load_steps.rb +2 -1
  10. data/features/support/classes/clusters/results/details_cluster.rb +1 -1
  11. data/features/support/classes/clusters/results/new_details_cluster.rb +1 -1
  12. data/features/support/modules/checkout/checkout.rb +1 -0
  13. data/features/support/modules/checkout/clusters/cluster.rb +86 -0
  14. data/features/support/modules/results/filters.rb +15 -0
  15. data/features/support/modules/results/itineraries.rb +7 -2
  16. data/features/support/modules/results/itineraries/bussines.rb +1 -1
  17. data/features/support/modules/results/itineraries/cluster.rb +104 -0
  18. data/features/support/modules/results/itineraries/details.rb +1 -1
  19. data/features/support/modules/results/itineraries/payments.rb +1 -1
  20. data/features/support/modules/results/new_filters.rb +27 -55
  21. data/features/support/pages/all_pages.rb +1 -1
  22. data/features/support/pages/checkout/checkout_page.rb +1 -0
  23. data/features/support/pages/checkout/new_checkout_page.rb +1 -1
  24. data/features/support/pages/results/search_page.rb +16 -4
  25. data/features/tests/checkout/agency.feature +1 -23
  26. data/features/tests/checkout/book_ok.feature +1 -0
  27. data/features/tests/checkout/cac.feature +2 -0
  28. data/features/tests/checkout/cash_payment.feature +2 -1
  29. data/features/tests/checkout/compras_duplicadas.feature +1 -0
  30. data/features/tests/checkout/cupones.feature +2 -1
  31. data/features/tests/checkout/error_messages.feature +1 -0
  32. data/features/tests/checkout/online_payment.feature +2 -1
  33. data/features/tests/checkout/price_jump.feature +2 -2
  34. data/features/tests/checkout/seguros.feature +2 -0
  35. data/features/tests/results/basefare.feature +6 -5
  36. data/features/tests/results/busquedas_promo.feature +0 -0
  37. data/features/tests/results/filters.feature +7 -6
  38. data/features/tests/results/itineraries.feature +6 -5
  39. data/features/tests/results/matrix/matrix_price.feature +6 -0
  40. data/features/tests/results/new_filters.feature +18 -14
  41. data/features/tests/results/search.feature +10 -1
  42. data/features/tests/results/wish_list.feature +6 -0
  43. data/flights_gui_tests.gemspec +1 -1
  44. data/henry-context.yml +6 -97
  45. metadata +4 -4
  46. data/features/data/promos.csv +0 -30
  47. data/features/tests/results/new_itineraries.feature +0 -103
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ba2ddc63afbd44068eb60201f8da3cc59eab3d7d
4
- data.tar.gz: 5d81c67e6d574198eea220e52754934060e426b6
3
+ metadata.gz: 8990739f58062c30af0fe7018ce9e7e53bbd401b
4
+ data.tar.gz: beee4347050e8f5d19ea7ce71ae739d0af3a6276
5
5
  SHA512:
6
- metadata.gz: 1acd1682444831c8e2184eacb3ed4247eaa51dbf1fe1e923c85bbc281ef6ff0a70474b258ee133d7fae14ea3ae68adecbf8dce24215caaad6b6bb7526d591eb4
7
- data.tar.gz: 907b2ac2184924693fd157689c258db19d8caf5642005e4d5c518723ec8dcb1109ebe4753d9c590186f47d48d3f6263757b7ac16ce2c5c248268512f0dfd3e94
6
+ metadata.gz: 94376922dde732dc946cf1d6b103e5ffdcbf49f639fa90bbf0cb898caa7cedb320d9c6371e1ac509b29d43008dd055bf65b71ecb6f1d7303a2764923d7db402b
7
+ data.tar.gz: e9106aa43bf34d8f0614cc04e4bdafef1b22b8eb73981e64214809775ed4b6239cba7ccfa311e072a6d80dd3e545816d302cff0affe5f1097403c245d782cd47
@@ -13,6 +13,7 @@ end
13
13
  Entonces(/^elijo un itinerario del popup de no disponibilidad$/) do
14
14
  @popup_no_disponibilidad_page.sumar_aparicion
15
15
  pending("La cantidad de compras supero las #{@popup_no_disponibilidad_page.apariciones} apariciones") if @popup_no_disponibilidad_page.apariciones > 4
16
+ @popup_no_disponibilidad_page.itinerario_element.when_visible(timeout=60)
16
17
  @popup_no_disponibilidad_page.cargar_itinerarios
17
18
  @itinerario_checkout = @popup_no_disponibilidad_page.elegir_itinerario(0)
18
19
  step "verifico que ingrese al checkout"
@@ -21,11 +21,11 @@ Cuando(/^ingreso a un checkout directo para una busqueda '(.*?)' del tipo '(.*?)
21
21
  pending("No se encontraron resultados para la busqueda #{@page.manage_data.generate_url_results_search}")
22
22
  end
23
23
 
24
- Cuando(/^espero que termine de cargar la (pagina|nueva pagina) de checkout$/) do |pagina|
25
- if pagina == "pagina"
26
- @page = Checkout::CheckoutPage.new($browser)
27
- else
24
+ Cuando(/^espero que termine de cargar la pagina de checkout$/) do
25
+ if @nuevo_checkout
28
26
  @page = Checkout::NewCheckoutPage.new($browser)
27
+ else
28
+ @page = Checkout::CheckoutPage.new($browser)
29
29
  end
30
30
  @page.popup_transicion_inicial_element.when_not_visible(timeout=120)
31
31
  @page.pasajeros_element.when_visible(timeout=120)
@@ -38,7 +38,7 @@ end
38
38
 
39
39
  Entonces(/^espero que termine el pedido de compra$/) do
40
40
  @page.popup_transicion_compra_element.when_not_visible(timeout=200)
41
- Watir::Wait.until(timeout=200){@page.mensaje_error_ux_element.present? or @page.notificacion_warning_ux_element.present? or @page.checkout_id_cash_element.present? or @page.checkout_id_element.present? or @page.popup_nuevo_vuelo_element.present? or @page.popup_nuevo_precio_element.present? or @page.error_datos_element.present? or @page.notificacion_error_element.present? or @page.notificacion_warning_element.present? or @page.notificacion_error_ux_element.present?}
41
+ Watir::Wait.until(timeout=200){@page.mensaje_error_ux_element.present? or @page.notificacion_warning_ux_element.present? or @page.checkout_id_cash_element.present? or @page.checkout_id_element.present? or @page.popup_nuevo_vuelo_element.present? or @page.popup_nuevo_precio_element.present? or @page.notificacion_error_element.present? or @page.notificacion_warning_element.present? or @page.notificacion_error_ux_element.present?}
42
42
  end
43
43
 
44
44
  Y(/^(?:verifico|valido) si no trae errores$/) do
@@ -77,6 +77,19 @@ Cuando(/^ingreso al checkout con cookie "(.*?)" al "(.*?)"/) do |name,value|
77
77
  step "espero que termine de cargar la pagina de resultados"
78
78
  step "elijo un itinerario y paso a checkout"
79
79
  step "verifico que la pagina no rompa"
80
+ step "espero que termine de cargar la #{@pagina} de checkout"
81
+ step "verifico que ingrese al checkout"
82
+ end
83
+
84
+ Cuando(/^seteo el checkout a ingresar$/) do
85
+ step "fuerzo el abztesting de \"showNewCheckout\" al \"#{$HENRY_PARAMS['checkout'].to_i}\""
86
+ @page.volver
87
+ @page = Results::SearchPage.new($browser)
88
+ step "verifico que la pagina no rompa"
89
+ step "espero que termine de cargar la pagina de resultados"
90
+ step "elijo un itinerario y paso a checkout"
91
+ step "verifico que la pagina no rompa"
92
+ @nuevo_checkout = ($HENRY_PARAMS['checkout'].to_i > 49) ? false : true
80
93
  step "espero que termine de cargar la pagina de checkout"
81
94
  step "verifico que ingrese al checkout"
82
95
  end
@@ -19,35 +19,4 @@ end
19
19
 
20
20
  Entonces(/^es ida y vuelta$/) do
21
21
  @page.manage_data.description.should equal("roundtrip")
22
- end
23
-
24
- Cuando(/^realizo las busquedas para promos$/) do
25
- dia = Date.today
26
- puts dia.strftime("%d%m%y")
27
- file=File.open("features/data/promos.csv")
28
- file.each_line do |line|
29
- data=line.split(';')
30
- puts data
31
- data[3].to_i.times do |i|
32
- aux = Date.parse(data[2])
33
- date = aux + i
34
- url_rt = "http://www.decolar.com/shop/flights/results/roundtrip/#{data[0]}/#{data[1]}/#{date}/#{date+8}/1/0/0"
35
- url_ow = "http://www.decolar.com/shop/flights/results/oneway/#{data[0]}/#{data[1]}/#{date}/1/0/0"
36
- rt = "http://www.decolar.com/shop/flights/data/search/roundtrip/#{data[0]}/#{data[1]}/#{date}/#{date+8}/1/0/0/TOTALFARE/ASCENDING/NA/NA/NA/NA/NA?hashForData=#{Digest::MD5.hexdigest(url_rt+'despegar')}"
37
- ow = "http://www.decolar.com/shop/flights/data/search/oneway/#{data[0]}/#{data[1]}/#{date}/1/0/0/TOTALFARE/ASCENDING/NA/NA/NA/NA?hashForData=#{Digest::MD5.hexdigest(url_ow+'despegar')}"
38
- begin
39
- get_rt = HTTParty.get(rt,:headers => {"X-UOW" => "ROBOT_ALERTA_PRCIO","referer"=>url_rt})
40
- puts rt
41
- rescue Errno::ECONNRESET,Timeout::Error
42
- puts "fail: #{rt}"
43
- end
44
- begin
45
- get_ow = HTTParty.get(ow,:headers => {"X-UOW" => "ROBOT_ALERTA_PRCIO","referer"=>url_ow})
46
- puts ow
47
- rescue Errno::ECONNRESET,Timeout::Error
48
- puts "fail: #{ow}"
49
- end
50
- sleep(3)
51
- end
52
- end
53
- end
22
+ end
@@ -5,7 +5,6 @@ Cuando(/^(?:verifico|valido) que el cambio de moneda no muestre limpiar filtros$
5
5
  sleep(0.5)
6
6
  @page.moneda_dolar_element.set
7
7
  sleep(0.5)
8
- #@page.limpiar_filtro_precio_element.should_not visible('boton de limpiar filtro')
9
8
  end
10
9
  @page.aplicar_filtro_precio_element.text.should match('Aplicar|Apply')
11
10
  end
@@ -58,7 +57,7 @@ Cuando(/^elijo un aeropuerto (outbound|inbound) a aplicar$/) do |_class|
58
57
  else
59
58
  _clase = 'destiny'
60
59
  end
61
- options = (doc / "div.ux-flights-filter-#{_clase}airports li.item").select { |option| !(option / "input")[0].attributes['id'].match(/airport-#{_class}-all|airport-#{_class}-unique/) and !(option / "input.ux-common-filter-disabled")[0]}
60
+ options = (doc / "div.ux-flights-filter-#{_clase}airports li.item").select { |option| !(option / "input")[0].attributes['id'].match(/airport-#{_class}-all|airport-#{_class}-unique/) and !(option / "input.ux-common-filter-disabled")[0] and (option / "input")[0].attributes["disabled"].empty?}
62
61
  @airport = options[rand(options.length)]
63
62
  @total = (@airport / 'span.total').inner_text.strip.to_i
64
63
  end
@@ -86,14 +85,14 @@ end
86
85
 
87
86
  Cuando(/^elijo una escala a aplicar$/) do
88
87
  doc = Hpricot.parse(@page.html)
89
- options = (doc/"div.ux-flights-filter-stops li.item").select { |option| !(option / "input")[0].attributes["class"].match(/ux-common-filter-disabled/)}
88
+ options = (doc/"div.ux-flights-filter-stops li.item").select { |option| !(option / "input")[0].attributes["class"].match(/ux-common-filter-disabled/) and (option / "input")[0].attributes["disabled"].empty? }
90
89
  @stop = options[rand(options.length)]
91
90
  @cant = (@stop/"span.label").inner_text.gsub(/\D/,'').strip.to_i
92
91
  @total = (@stop/"span.total").inner_text.strip.to_i
93
92
  end
94
93
 
95
94
  Entonces(/^filtro por escala$/) do
96
- @page.browser.checkbox(:id,(@stop/"input").first.attributes['id']).set
95
+ @page.browser.checkbox(:id,(@stop/"input").first.attributes['id']).set
97
96
  end
98
97
 
99
98
  Entonces(/^(?:verifico|valido) que los contadores respecto a las escalas sean correctos$/) do
@@ -103,7 +102,7 @@ end
103
102
 
104
103
  Entonces(/^(?:verifico|valido) que la primer pagina muestre correctamente los filtros de escalas$/) do
105
104
  doc = Hpricot.parse(@page.html)
106
- (doc/"div#clusters div.cluster li.stops").each do |stop|
105
+ (doc/"div#clusters div.cluster li.stops span.stops-text").each do |stop|
107
106
  applied_stop = @cant
108
107
  stop_displayed = stop.inner_text.gsub(/\D/,'').strip.to_i
109
108
  if applied_stop == 2
@@ -185,52 +184,36 @@ end
185
184
 
186
185
  Cuando(/^limpio el filtro de horario (outbound|inbound)$/) do |_class|
187
186
  box=@page.browser.div(:class,"ux-common-filter-section ux-common-filter-slider ux-flights-filter-hours-slider ux-flights-filter-#{_class}hours-slider")
188
- box.link(:class,'ux-common-filter-reset').click if box.link(:class,'ux-common-filter-reset').present?
187
+ box.link(:class,'ux-common-filter-reset').click if box.link(:class,'ux-common-filter-reset').present?
189
188
  end
190
189
 
191
190
  Cuando(/^elijo una duracion (outbound|inbound) a aplicar$/) do |_class|
192
191
  unless((_class=="inbound")and(@page.tipo_de_busqueda=="oneway"))
193
192
  box=@page.browser.div(:class,"flights-filter ux-common-filter-section ux-common-filter-slider ux-flights-filter-hours-slider ux-flights-filter-duration-slider ux-flights-filter-#{_class}duration-slider")
194
- @from_time=box.span(:class,'flights-slider-min').spans.first.text
195
- @to_time=box.span(:class,'flights-slider-max').spans.first.text
196
- diff="#{@to_time.split(':')[0].to_i-1}:#{@from_time.split(':')[1]}"
197
- while(@to_time!=diff and @to_time!=@from_time)
193
+ @from_time=@page.devolver_duracion_filtro_viejo(box.span(:class,'flights-slider-min').spans.first.text)
194
+ @to_time =@page.devolver_duracion_filtro_viejo(box.span(:class,'flights-slider-max').spans.first.text)
195
+ diff=Duracion.new(@to_time.horas-1,@from_time.minutos)
196
+ while(@to_time!=diff and @to_time!=@from_time)
198
197
  box.link(:class,'ui-slider-handle ui-state-default ui-corner-all ui-slider-handle-min').send_keys :left
199
- @to_time=box.span(:class,'flights-slider-max').spans.first.text
198
+ @to_time=@page.devolver_duracion_filtro_viejo(box.span(:class,'flights-slider-max').spans.first.text)
200
199
  end
201
200
  end
202
201
  end
203
202
 
204
203
  Entonces(/^filtro por duracion (outbound|inbound)$/) do |_class|
205
204
  unless((_class=="inbound")and(@page.tipo_de_busqueda=="oneway"))
206
- box=@page.browser.div(:class,"ux-common-filter-section ux-common-filter-slider ux-flights-filter-hours-slider ux-flights-filter-duration-slider ux-flights-filter-#{_class}duration-slider")
207
- box.link(:class,'ux-common-filter-apply').click
208
- end
205
+ box=@page.browser.div(:class,"ux-common-filter-section ux-common-filter-slider ux-flights-filter-hours-slider ux-flights-filter-duration-slider ux-flights-filter-#{_class}duration-slider")
206
+ box.link(:class,'ux-common-filter-apply').click
207
+ end
209
208
  end
210
209
 
211
210
  Entonces(/^(?:verifico|valido) que la primer pagina muestre correctamente los filtros de duracion (outbound|inbound)$/) do |_class|
212
211
  unless((_class=="inbound")and(@page.tipo_de_busqueda=="oneway"))
213
212
  doc = Hpricot.parse(@page.html)
214
213
  (doc/"div#clusters div.cluster div.#{_class} ul.itineraries-group li.itinerary").each do |itineraries|
215
- time = (itineraries/"li.time span").inner_text.strip.split(' ')
216
- if time.length==1
217
- aux = time.first
218
- if(aux.match(/h/))
219
- time[0]=aux
220
- time[1]="00m"
221
- else
222
- time[0]="00h"
223
- time[1]=aux
224
- end
225
- end
226
- (time[0].gsub(/\D/,'').to_i >= @from_time.split(':')[0].to_i).should be_true
227
- (time[0].gsub(/\D/,'').to_i <= @to_time.split(':')[0].to_i).should be_true
228
- if ((time[0].gsub(/\D/,'').to_i == @from_time.split(':')[0].to_i)and(time[1]))
229
- time[1].gsub(/\D/,'').to_i.should es_mayor_igual_que(@from_time.split(':')[1].to_i)
230
- end
231
- if ((time[0].gsub(/\D/,'').to_i == @to_time.split(':')[0].to_i)and(time[1]))
232
- time[1].gsub(/\D/,'').to_i.should es_menor_igual_que(@to_time.split(':')[1].to_i)
233
- end
214
+ time = @page.devolver_duracion((itineraries/"li.time span").inner_text)
215
+ time.should es_mayor_igual_que(@from_time)
216
+ time.should es_menor_igual_que(@to_time)
234
217
  end
235
218
  end
236
219
  end
@@ -256,42 +239,38 @@ Cuando(/^Recupero los precios limites de la lista$/) do
256
239
  end
257
240
 
258
241
  Entonces(/^filtro por precio mayor$/) do
242
+ @price_up=@price_up-(@price_up*0.1)
259
243
  @page.execute_script("javascript:void($('.price-max').val(''))")
260
- @page.filtro_precio_mayor_element.set(@price_up+3)
261
- price=@page.filtro_precio_mayor_element.value.to_i
262
- while(price>@price_up)
263
- @page.slider_precio_mayor_element.send_keys :left
264
- price=@page.filtro_precio_mayor_element.value.to_i
265
- end
266
- @price_up=price
267
- @page.aplicar_filtro_precio_element.click
244
+ @page.filtro_precio_mayor_element.set(@price_up)
245
+ @page.enviar_tecla :enter
246
+ @price_up=@page.filtro_precio_mayor_element.value.to_i
247
+ @page.aplicar_filtro_precio_element.click
268
248
  step "espero que termine de cargar la pagina de resultados"
269
249
  end
270
250
 
271
251
  Entonces(/^(?:verifico|valido) que la primer pagina muestre correctamente los filtros de precio$/) do
252
+ sleep(1)
272
253
  doc = Hpricot.parse(@page.html)
254
+ @page.reset_itinerarios
273
255
  @page.cargar_itinerarios
274
256
  @page.datos_de_itinerarios.each do |itinerario|
275
257
  if AllPages.site.match("MX|UY|PE|BR|CR|PA")
276
- itinerario.tarifas['tarifa_adulto'].value.should es_mayor_igual_que(@price_down)
277
- itinerario.tarifas['tarifa_adulto'].value.should es_menor_igual_que(@price_up)
258
+ itinerario.tarifas['tarifa_adulto'].value.should es_mayor_igual_que(@price_down)
259
+ itinerario.tarifas['tarifa_adulto'].value.should es_menor_igual_que(@price_up)
278
260
  else
279
- itinerario.tarifas['total'].value.should es_mayor_igual_que(@price_down)
280
- itinerario.tarifas['total'].value.should es_menor_igual_que(@price_up)
261
+ itinerario.tarifas['total'].value.should es_mayor_igual_que(@price_down)
262
+ itinerario.tarifas['total'].value.should es_menor_igual_que(@price_up)
281
263
  end
282
264
  end
283
265
  end
284
266
 
285
267
  Entonces(/^filtro por precio menor$/) do
286
- @page.execute_script("javascript:void($('.price-min').val(''))")
287
- @page.filtro_precio_menor_element.set(@price_down-2)
288
- price=@page.filtro_precio_menor_element.value.to_i
289
- while(price<@price_down)
290
- @page.slider_precio_menor_element.send_keys :right
291
- price=@page.filtro_precio_menor_element.value.to_i
292
- end
293
- @price_down=price
294
- @page.aplicar_filtro_precio_element.click
268
+ @price_down=@price_down+(@price_down*0.1)
269
+ @page.execute_script("javascript:void($('.price-min').val(''))")
270
+ @page.filtro_precio_menor_element.set(@price_down)
271
+ @page.enviar_tecla :enter
272
+ @price_down=@page.filtro_precio_menor_element.value.to_i
273
+ @page.aplicar_filtro_precio_element.click
295
274
  step "espero que termine de cargar la pagina de resultados"
296
275
  end
297
276
 
@@ -300,6 +279,6 @@ Cuando(/^limpio el filtro de precio$/) do
300
279
  end
301
280
 
302
281
  Cuando(/^elijo moneda local como precio de filtrado$/) do
303
- @page.filtros_precio_element.radio(:value,Helpers.currency(AllPages.site.upcase)).click if @page.filtros_precio_element.radio(:value,Helpers.currency(AllPages.site.upcase)).present?
282
+ @page.filtros_precio_element.radio(:value,Helpers.currency(AllPages.site.upcase)).click if @page.filtros_precio_element.radio(:value,Helpers.currency(AllPages.site.upcase)).present?
304
283
  sleep(2)
305
284
  end
@@ -31,11 +31,12 @@ Cuando(/^(?:realizo|genero|ingreso) la busqueda$/) do
31
31
  @page.set_cookies
32
32
  puts "URL: #{@page.url_busqueda}"
33
33
  puts "UOW: #{@page.uow}"
34
+ puts "PARAMS: #{$HENRY_PARAMS}"
34
35
  @page.elegir_idioma
35
36
  end
36
37
 
37
38
  Cuando(/^espero que (?:termine|finalize|acabe) de cargar la pagina de resultados$/) do
38
- @page.carga_element.when_not_visible(timeout=60)
39
+ @page.carga_element.when_not_visible(timeout=120)
39
40
  @page.actualizar_filtro_element.when_not_visible(timeout=120)
40
41
  end
41
42
 
@@ -50,4 +51,5 @@ Entonces(/^(?:verifico|valido) que (?:traiga|vengan|tenga) resultados$/) do
50
51
  json["result"]["data"]["metadata"]["status"]["code"].should equal("NO_RESULTS")
51
52
  end
52
53
  end
54
+ @page.definir_nuevo_cluster(@page.nuevo_cluster_element.present?) #seteo el itinerario que viene por default
53
55
  end
@@ -1,129 +1,91 @@
1
1
  # encoding: utf-8
2
- Cuando(/^elijo una aerolinea a aplicar - filtros nuevo -$/) do
3
- if @page.filtro_aerolineas_visible_element.present?
4
- @page.filtro_aerolineas_visible_element.click
5
- else
6
- @page.ver_filtro(@page.ver_filtro_aerolineas_visible_element)
7
- end
8
- @aerolinea = @page.opciones_aerolineas_elements[rand(@page.opciones_aerolineas_elements.size)]
9
- end
10
-
11
- Entonces(/^filtro por aerolinea - filtros nuevo -$/) do
12
- @aerolinea.click
13
- @page.aplicar_filtros_element.click
2
+ Cuando(/^abro los filtros de aerolineas$/) do
3
+ unless @page.filtro_aerolineas_visible_element.present?
4
+ @page.ver_filtro_aerolineas_visible_element.click
5
+ end
6
+ @page.filtro_aerolineas_visible_element.when_visible(timeout=10)
14
7
  end
15
8
 
16
- Entonces(/^(?:verifico|valido) que la primer pagina muestre correctamente los filtros de aerolineas - filtros nuevo -$/) do
17
- group_airlines = [["UA","CM","AM","US","AA","DL"],["LA","4M","XL","4C","JJ","PZ"],["AV","TA","LR"]]
9
+ Cuando(/^elijo una aerolinea a aplicar - filtros nuevo -$/) do
18
10
  doc = Hpricot.parse(@page.html)
19
- airlines = []
20
- (doc/"div#clusters div.cluster ul.itineraries-group").each do |itineraries|
21
- airlines += (itineraries/"li.logo img").collect{|img| img.attributes['src'].match(/\/(.{1,7})\.png/)[1]}
22
- airlines += (itineraries/"li.airlines img").collect{|img| img.attributes['src'].match(/\/(.{1,7})\.png/)[1]}
23
- airlines += (itineraries/"li.airlinesShort img").collect{|img| img.attributes['src'].match(/\/(.{1,7})\.png/)[1]}
24
- group_airlines.each{|airlines_tmp| airlines.concat(airlines_tmp) if airlines_tmp.include?(@aerolinea.value)}
25
- end
26
- airlines.should include?(@aerolinea.value)
11
+ options = (doc / 'div.inline-filters-detail-airlines')[0]
12
+ options = (options/"li.item").select { |option| !(option / "input")[0].attributes['id'].match(/airlines-unique|airlines-all/) and !(option / "input.ux-common-filter-disabled")[0]}
13
+ @airline = options[rand(options.length)]
14
+ @total = (@airline / 'span.total').inner_text.gsub(/\D/,'').to_i
27
15
  end
28
16
 
29
17
  Cuando(/^limpio el filtro de aerolineas - filtros nuevo -$/) do
30
- @page.remover_filtro_de_aerolinea(@aerolinea.value).click
31
- @page.aplicar_filtros_element.click
18
+ @page.remover_filtro_de_aerolinea_element.click
32
19
  end
33
20
 
34
- Cuando(/^elijo un aeropuerto de origen a aplicar - filtros nuevo -$/) do
35
- if @page.filtro_aeropuertos_visible_element.present?
36
- @page.filtro_aeropuertos_visible_element.click
37
- else
38
- @page.ver_filtro(@page.ver_filtro_aeropuertos_visible_element)
39
- end
40
- @aeropuerto = @page.opciones_aeropuerto_origen_elements[rand(@page.opciones_aeropuerto_origen_elements.size)]
21
+ Cuando(/^abro los filtros de aeropuertos$/) do
22
+ unless @page.filtro_aeropuertos_visible_element.present?
23
+ @page.ver_filtro_aeropuertos_visible_element.click
24
+ end
25
+ @page.filtro_aeropuertos_visible_element.when_visible(timeout=10)
41
26
  end
42
27
 
43
- Cuando(/^elijo un aeropuerto de destino a aplicar - filtros nuevo -$/) do
44
- if @page.filtro_aeropuertos_visible_element.present?
45
- @page.filtro_aeropuertos_visible_element.click unless @page.filtros_aeropuerto_element.present?
46
- else
47
- @page.ver_filtro(@page.ver_filtro_aeropuertos_visible_element)
48
- end
49
- @aeropuerto = @page.opciones_aeropuerto_destino_elements[rand(@page.opciones_aeropuerto_destino_elements.size)]
50
- end
51
-
52
- Entonces(/^filtro por aeropuerto - filtros nuevo -$/) do
53
- @aeropuerto.click
54
- @page.aplicar_filtros_element.click
55
- end
56
-
57
- Entonces(/^(?:verifico|valido) que la primer pagina muestre correctamente los filtros de aeropuertos de origen - filtros nuevo -$/) do
58
- doc = Hpricot.parse(@page.html)
59
- @aeropuerto.value.strip.should equal((doc/"div#clusters div.cluster div.outbound span.airport a").first.inner_text.strip)
28
+ Cuando(/^elijo un aeropuerto de origen a aplicar - filtros nuevo -$/) do
29
+ doc = Hpricot.parse(@page.html)
30
+ options = (doc / "div.inline-filters-detail-airports div.inline-filters-2-panel")[0]
31
+ options = (options/ "li.item").select { |option| !(option / "input")[0].attributes['id'].match(/airport-outbound-all|airport-outbound-unique/) and !(option / "input.ux-common-filter-disabled")[0]}
32
+ @airport = options[rand(options.length)]
33
+ @total = (@airport / 'span.total').inner_text.gsub(/\D/,'').to_i
60
34
  end
61
35
 
62
- Entonces(/^(?:verifico|valido) que la primer pagina muestre correctamente los filtros de aeropuertos de destino - filtros nuevo -$/) do
63
- doc = Hpricot.parse(@page.html)
64
- @aeropuerto.value.strip.should equal((doc/"div#clusters div.cluster div.inbound span.airport a").first.inner_text.strip)
36
+ Cuando(/^elijo un aeropuerto de destino a aplicar - filtros nuevo -$/) do
37
+ doc = Hpricot.parse(@page.html)
38
+ options = (doc / "div.inline-filters-detail-airports div.inline-filters-2-panel")[1]
39
+ options = (options/ "li.item").select { |option| !(option / "input")[0].attributes['id'].match(/airport-inbound-all|airport-inbound-unique/) and !(option / "input.ux-common-filter-disabled")[0]}
40
+ @airport = options[rand(options.length)]
41
+ @total = (@airport / 'span.total').inner_text.gsub(/\D/,'').to_i
65
42
  end
66
43
 
67
44
  Cuando(/^limpio el filtro de aeropuertos de origen - filtros nuevo -$/) do
68
- @page.remover_filtro_de_aeropuerto_origen(@aeropuerto.value).click
69
- @page.aplicar_filtros_element.click
45
+ @page.remover_filtro_de_aeropuerto_origen_element.click
70
46
  end
71
47
 
72
48
  Cuando(/^limpio el filtro de aeropuertos de destino - filtros nuevo -$/) do
73
- @page.remover_filtro_de_aeropuerto_destino(@aeropuerto.value).click
74
- @page.aplicar_filtros_element.click
49
+ @page.remover_filtro_de_aeropuerto_destino_element.click
75
50
  end
76
51
 
77
- Cuando(/^elijo una escala a aplicar - filtros nuevo -$/) do
78
- if @page.filtro_escalas_visible_element.present?
79
- @page.filtro_escalas_visible_element.click
80
- else
81
- @page.ver_filtro(@page.ver_filtro_escalas_visible_element)
82
- end
83
- escalas_habilitadas = @page.opciones_escalas_elements.reject{|escala| escala.class_name.match(/ux-common-filter-disabled/)}
84
- @escalas = escalas_habilitadas[rand(escalas_habilitadas.size)]
52
+ Cuando(/^abro los filtros de escalas$/) do
53
+ unless @page.filtro_escalas_visible_element.present?
54
+ @page.ver_filtro_escalas_visible_element.click
55
+ end
56
+ @page.filtro_escalas_visible_element.when_visible(timeout=10)
85
57
  end
86
58
 
87
- Entonces(/^filtro por escala - filtros nuevo -$/) do
88
- @escalas.click
89
- @page.aplicar_filtros_element.click
59
+ Cuando(/^elijo una escala a aplicar - filtros nuevo -$/) do
60
+ doc = Hpricot.parse(@page.html)
61
+ options = (doc/"div.inline-filters-detail-scales li.item").select { |option| !(option / "input")[0].attributes["class"].match(/ux-common-filter-disabled/) and (option / "input")[0].attributes["disabled"].empty? }
62
+ @stop = options[rand(options.length)]
63
+ @cant = (@stop/"span.label").inner_text.gsub(/\D/,'').strip.to_i
64
+ @total = (@stop/"span.total").inner_text.gsub(/\D/,'').strip.to_i
90
65
  end
91
66
 
92
- Entonces(/^(?:verifico|valido) que la primer pagina muestre correctamente los filtros de escalas - filtros nuevo -$/) do
93
- doc = Hpricot.parse(@page.html)
94
- (doc/"div#clusters div.cluster li.stops").each do |stop|
95
- applied_stop = @page.cantidad_de_escalas(@escalas.value)
96
- stop_displayed = stop.inner_text.gsub(/\D/,'').strip.to_i
97
- if applied_stop == 2
98
- (applied_stop<=>stop_displayed).should be_true
99
- elsif applied_stop == 1
100
- (applied_stop>=stop_displayed).should be_true
101
- else
102
- applied_stop.should equal(stop_displayed)
103
- end
104
- end
67
+ Cuando(/^limpio el filtro de escalas - filtros nuevo -$/) do
68
+ @page.remover_filtro_de_escalas_element.click
105
69
  end
106
70
 
107
- Cuando(/^limpio el filtro de escalas - filtros nuevo -$/) do
108
- @page.remover_filtro_de_escalas(@escalas.value).click
109
- @page.aplicar_filtros_element.click
71
+ Cuando(/^abro los filtros de horarios$/) do
72
+ unless @page.filtro_horarios_visible_element.present?
73
+ @page.ver_filtro_horarios_visible_element.click
74
+ end
75
+ @page.filtro_horarios_visible_element.when_visible(timeout=10)
110
76
  end
111
77
 
112
78
  Cuando(/^elijo un horario a aplicar - filtros nuevo -$/) do
113
- if @page.filtro_horarios_visible_element.present?
114
- @page.filtro_horarios_visible_element.click unless @page.filtros_horarios_element.present?
115
- else
116
- @page.ver_filtro(@page.ver_filtro_horarios_visible_element)
117
- end
118
79
  doc = Hpricot.parse(@page.html)
119
- options = (doc/"div#inline-filters-detail-time div.inline-filters-slider-panel")
80
+ options = (doc/"div.inline-filters-detail-time div.inline-filters-slider-panel")
120
81
  options = (options[0]/"ul.hour-filter-range-links li")
121
82
  @time = options[rand(options.length)]
122
83
  end
123
84
 
124
85
  Entonces(/^filtro por horario de ida - filtros nuevo -$/) do
125
- @page.browser.div(:id,'inline-filters-detail-time').div(:class=>"inline-filters-slider-panel",:index=>0).link(:text,@time.inner_text).click
126
- @page.aplicar_filtros_element.click
86
+ @page.browser.div(:class,'inline-filters-detail-time').div(:class=>"inline-filters-slider-panel",:index=>0).link(:text,@time.inner_text).click
87
+ sleep(0.5)
88
+ @page.browser.div(:class,'inline-filters-detail-time').div(:class=>"inline-filters-slider-panel",:index=>0).link(:class,"ux-common-filter-apply").click
127
89
  end
128
90
 
129
91
  Entonces(/^(?:verifico|valido) que la primer pagina muestre correctamente los filtros de horario de ida - filtros nuevo -$/) do
@@ -161,13 +123,13 @@ Entonces(/^(?:verifico|valido) que la primer pagina muestre correctamente los fi
161
123
  end
162
124
 
163
125
  Cuando(/^limpio el filtro de horario de ida - filtros nuevo -$/) do
164
- @page.remover_filtro_de_horario_de_ida_element.click
165
- @page.aplicar_filtros_element.click
126
+ @page.browser.div(:class,'inline-filters-detail-time').div(:class=>"inline-filters-slider-panel",:index=>0).link(:class,"ux-common-filter-reset").click
166
127
  end
167
128
 
168
129
  Entonces(/^filtro por horario de vuelta - filtros nuevo -$/) do
169
- @page.browser.div(:id,'inline-filters-detail-time').div(:class=>"inline-filters-slider-panel",:index=>1).link(:text,@time.inner_text).click
170
- @page.aplicar_filtros_element.click
130
+ @page.browser.div(:class,'inline-filters-detail-time').div(:class=>"inline-filters-slider-panel",:index=>1).link(:text,@time.inner_text).click
131
+ sleep(0.5)
132
+ @page.browser.div(:class,'inline-filters-detail-time').div(:class=>"inline-filters-slider-panel",:index=>1).link(:class,"ux-common-filter-apply").click
171
133
  end
172
134
 
173
135
  Entonces(/^(?:verifico|valido) que la primer pagina muestre correctamente los filtros de horario de vuelta - filtros nuevo -$/) do
@@ -205,34 +167,30 @@ Entonces(/^(?:verifico|valido) que la primer pagina muestre correctamente los fi
205
167
  end
206
168
 
207
169
  Cuando(/^limpio el filtro de horario de vuelta - filtros nuevo -$/) do
208
- @page.remover_filtro_de_horario_de_vuelta_element.click
209
- @page.aplicar_filtros_element.click
170
+ @page.browser.div(:class,'inline-filters-detail-time').div(:class=>"inline-filters-slider-panel",:index=>1).link(:class,"ux-common-filter-reset").click
210
171
  end
211
172
 
212
173
  Cuando(/^recupero los precios limites de la lista - filtros nuevo -$/) do
213
- if @page.filtro_precio_visible_element.present?
214
- @page.filtro_precio_visible_element.click unless @page.filtros_precio_element.present?
215
- else
216
- @page.ver_filtro(@page.ver_filtro_precio_visible_element)
217
- end
174
+ unless @page.filtro_precio_visible_element.present?
175
+ @page.ver_filtro_precio_visible_element.click
176
+ end
177
+ @page.filtro_precio_visible_element.when_visible(timeout=10)
218
178
  @price_down=Price.new(@page.valor_minimo(@page.filtros_precio_element).text).value
219
179
  @price_up=Price.new(@page.valor_maximo(@page.filtros_precio_element).text).value
220
180
  end
221
181
 
222
182
  Entonces(/^filtro por precio mayor - filtros nuevo -$/) do
223
- @page.execute_script("javascript:void($('#inline-filters-detail-price .price-max').val(''))")
224
- @page.nuevo_filtro_precio_mayor_element.set(@price_up+3)
225
- price=@page.nuevo_filtro_precio_mayor_element.value.to_i
226
- while(price>@price_up)
227
- @page.slider_nuevo_precio_mayor_element.send_keys :left
228
- price=@page.nuevo_filtro_precio_mayor_element.value.to_i
229
- end
230
- @price_up=price
231
- @page.aplicar_filtros_element.click
183
+ @price_up=@price_up-(@price_up * 0.1).to_i
184
+ @page.execute_script("javascript:void($('.inline-filters-detail-price .price-max').val(''))")
185
+ @page.nuevo_filtro_precio_mayor_element.set(@price_up)
186
+ @page.enviar_tecla :enter
187
+ @price_up=@page.nuevo_filtro_precio_mayor_element.value.to_i
188
+ @page.browser.div(:class,'inline-filters-detail-price').link(:class,"ux-common-filter-apply").click
232
189
  step "espero que termine de cargar la pagina de resultados"
233
190
  end
234
191
 
235
192
  Entonces(/^(?:verifico|valido) que la primer pagina muestre correctamente los filtros de precio - filtros nuevo -$/) do
193
+ sleep(1)
236
194
  doc = Hpricot.parse(@page.html)
237
195
  @page.cargar_itinerarios
238
196
  @page.datos_de_itinerarios.each do |itinerario|
@@ -247,29 +205,23 @@ Entonces(/^(?:verifico|valido) que la primer pagina muestre correctamente los fi
247
205
  end
248
206
 
249
207
  Entonces(/^filtro por precio menor - filtros nuevo -$/) do
250
- @page.execute_script("javascript:void($('#inline-filters-detail-price .price-min').val(''))")
251
- @page.nuevo_filtro_precio_menor_element.set(@price_down-2)
252
- price=@page.nuevo_filtro_precio_menor_element.value.to_i
253
- while(price<@price_down)
254
- @page.slider_nuevo_precio_menor_element.send_keys :right
255
- price=@page.filtro_precio_menor_element.value.to_i
256
- end
257
- @price_down=price
258
- @page.aplicar_filtros_element.click
208
+ @price_down=@price_down+(@price_down * 0.1).to_i
209
+ @page.execute_script("javascript:void($('.inline-filters-detail-price .price-min').val(''))")
210
+ @page.nuevo_filtro_precio_menor_element.set(@price_down)
211
+ @page.enviar_tecla :enter
212
+ @price_down=@page.nuevo_filtro_precio_menor_element.value.to_i
213
+ @page.browser.div(:class,'inline-filters-detail-price').link(:class,"ux-common-filter-apply").click
259
214
  step "espero que termine de cargar la pagina de resultados"
260
215
  end
261
216
 
262
217
  Cuando(/^limpio el filtro de precio - filtros nuevo -$/) do
263
- @page.remover_filtro_de_precio_element.click
264
- @page.aplicar_filtros_element.click
218
+ @page.browser.div(:class,'inline-filters-detail-price').link(:class,"ux-common-filter-reset").click
265
219
  end
266
220
 
267
221
  Cuando(/^elijo una duracion de salida a aplicar - filtros nuevo -$/) do
268
- if @page.filtro_duracion_visible_element.present?
269
- @page.filtro_duracion_visible_element.click unless @page.filtros_duracion_element.present?
270
- else
271
- @page.ver_filtro(@page.ver_filtro_duracion_visible_element)
272
- end
222
+ unless @page.filtro_duracion_visible_element.present?
223
+ @page.ver_filtro_duracion_visible_element.click
224
+ end
273
225
  @from_time=@page.devolver_duracion(@page.valor_minimo(@page.nuevo_filtro_duracion_salida_element).text)
274
226
  @to_time =@page.devolver_duracion(@page.valor_maximo(@page.nuevo_filtro_duracion_salida_element).text)
275
227
  end
@@ -280,7 +232,7 @@ Entonces(/^filtro por duracion de salida - filtros nuevo -$/) do
280
232
  @page.slider_nuevo_filtro_duracion_salida_element.send_keys :left
281
233
  @to_time = @page.devolver_duracion(@page.valor_maximo(@page.nuevo_filtro_duracion_salida_element).text)
282
234
  end
283
- @page.aplicar_filtros_element.click
235
+ @page.browser.div(:class,'inline-filters-detail-duration').div(:class=>"inline-filters-slider-panel",:index=>0).link(:class,"ux-common-filter-apply").click
284
236
  end
285
237
 
286
238
  Entonces(/^(?:verifico|valido) que la primer pagina muestre correctamente los filtros de duracion de salida - filtros nuevo -$/) do
@@ -293,16 +245,13 @@ Entonces(/^(?:verifico|valido) que la primer pagina muestre correctamente los fi
293
245
  end
294
246
 
295
247
  Entonces(/^limpio el filtro de duracion de salida - filtros nuevo -$/) do
296
- @page.remover_filtro_de_duracion_de_ida_element.click
297
- @page.aplicar_filtros_element.click
248
+ @page.browser.div(:class,'inline-filters-detail-duration').div(:class=>"inline-filters-slider-panel",:index=>0).link(:class,"ux-common-filter-reset").click
298
249
  end
299
250
 
300
251
  Cuando(/^elijo una duracion de llegada a aplicar - filtros nuevo -$/) do
301
- if @page.filtro_duracion_visible_element.present?
302
- @page.filtro_duracion_visible_element.click unless @page.filtros_duracion_element.present?
303
- else
304
- @page.ver_filtro(@page.ver_filtro_duracion_visible_element)
305
- end
252
+ unless @page.filtro_duracion_visible_element.present?
253
+ @page.ver_filtro_duracion_visible_element.click
254
+ end
306
255
  @from_time=@page.devolver_duracion(@page.valor_minimo(@page.nuevo_filtro_duracion_llegada_element).text)
307
256
  @to_time =@page.devolver_duracion(@page.valor_maximo(@page.nuevo_filtro_duracion_llegada_element).text)
308
257
  end
@@ -313,7 +262,7 @@ Entonces(/^filtro por duracion de llegada - filtros nuevo -$/) do
313
262
  @page.slider_nuevo_filtro_duracion_llegada_element.send_keys :left
314
263
  @to_time=@page.devolver_duracion(@page.valor_maximo(@page.nuevo_filtro_duracion_llegada_element).text)
315
264
  end
316
- @page.aplicar_filtros_element.click
265
+ @page.browser.div(:class,'inline-filters-detail-duration').div(:class=>"inline-filters-slider-panel",:index=>1).link(:class,"ux-common-filter-apply").click
317
266
  end
318
267
 
319
268
  Entonces(/^(?:verifico|valido) que la primer pagina muestre correctamente los filtros de duracion de llegada - filtros nuevo -$/) do
@@ -326,6 +275,5 @@ Entonces(/^(?:verifico|valido) que la primer pagina muestre correctamente los fi
326
275
  end
327
276
 
328
277
  Entonces(/^limpio el filtro de duracion de llegada - filtros nuevo -$/) do
329
- @page.remover_filtro_de_duracion_de_vuelta_element.click
330
- @page.aplicar_filtros_element.click
278
+ @page.browser.div(:class,'inline-filters-detail-duration').div(:class=>"inline-filters-slider-panel",:index=>1).link(:class,"ux-common-filter-reset").click
331
279
  end