flights_gui_tests 0.0.1
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.
- checksums.yaml +7 -0
- data/Gemfile +3 -0
- data/features/data/host.yml +78 -0
- data/features/data/miles.yml +216 -0
- data/features/data/sites.yml +44 -0
- data/features/data/tag_microsoft.yml +68 -0
- data/features/step_definitions/checkout/checkout_steps.rb +24 -0
- data/features/step_definitions/checkout/form_steps.rb +20 -0
- data/features/step_definitions/checkout/load_steps.rb +36 -0
- data/features/step_definitions/conditional_steps.rb +12 -0
- data/features/step_definitions/cookies_steps.rb +8 -0
- data/features/step_definitions/flights_tracker/flights_tracker_steps.rb +30 -0
- data/features/step_definitions/landing/itineraries_steps.rb +75 -0
- data/features/step_definitions/landing/landing_steps.rb +59 -0
- data/features/step_definitions/landing/load_steps.rb +30 -0
- data/features/step_definitions/page_steps.rb +18 -0
- data/features/step_definitions/results/basefare_steps.rb +65 -0
- data/features/step_definitions/results/desambiguation_steps.rb +144 -0
- data/features/step_definitions/results/errors_steps.rb +23 -0
- data/features/step_definitions/results/filters_steps.rb +301 -0
- data/features/step_definitions/results/load_steps.rb +52 -0
- data/features/step_definitions/results/matrix_steps.rb +213 -0
- data/features/step_definitions/results/order_steps.rb +49 -0
- data/features/step_definitions/results/pagination_steps.rb +29 -0
- data/features/step_definitions/results/recommendation_steps.rb +75 -0
- data/features/step_definitions/results/results_steps.rb +40 -0
- data/features/step_definitions/results/reviews_steps.rb +16 -0
- data/features/step_definitions/results/tags_steps.rb +102 -0
- data/features/step_definitions/results/wish_list_steps.rb +114 -0
- data/features/step_definitions/thanks/load_steps.rb +10 -0
- data/features/step_definitions/thanks/thanks_steps.rb +12 -0
- data/features/support/classes/clusters/checkout_cluster.rb +117 -0
- data/features/support/classes/clusters/data/data.rb +33 -0
- data/features/support/classes/clusters/results/details_cluster.rb +36 -0
- data/features/support/classes/clusters/results/landing_cluster.rb +29 -0
- data/features/support/classes/clusters/results/render_cluster.rb +83 -0
- data/features/support/classes/clusters/results_cluster.rb +171 -0
- data/features/support/classes/date.rb +26 -0
- data/features/support/classes/element.rb +23 -0
- data/features/support/classes/price.rb +66 -0
- data/features/support/classes/process_manager.rb +104 -0
- data/features/support/classes/string.rb +16 -0
- data/features/support/env.rb +94 -0
- data/features/support/hooks.rb +20 -0
- data/features/support/matchers.rb +108 -0
- data/features/support/modules/accessor.rb +26 -0
- data/features/support/modules/browser.rb +80 -0
- data/features/support/modules/checkout/datos_de_facturacion.rb +64 -0
- data/features/support/modules/checkout/informacion_de_contacto.rb +30 -0
- data/features/support/modules/checkout/pasajeros.rb +71 -0
- data/features/support/modules/checkout/tarjeta.rb +71 -0
- data/features/support/modules/element.rb +12 -0
- data/features/support/modules/helpers.rb +64 -0
- data/features/support/modules/pages/cookies.rb +33 -0
- data/features/support/modules/pages/tags.rb +27 -0
- data/features/support/modules/results/filters.rb +37 -0
- data/features/support/modules/results/itineraries/bussines.rb +17 -0
- data/features/support/modules/results/itineraries/data.rb +25 -0
- data/features/support/modules/results/itineraries/details.rb +80 -0
- data/features/support/modules/results/itineraries/miles.rb +64 -0
- data/features/support/modules/results/itineraries/payments.rb +27 -0
- data/features/support/modules/results/matrix/matrix_airline.rb +52 -0
- data/features/support/modules/results/matrix/matrix_fare_chart.rb +21 -0
- data/features/support/modules/results/matrix/matrix_price.rb +18 -0
- data/features/support/modules/results/recommendation.rb +29 -0
- data/features/support/modules/results/search_params.rb +21 -0
- data/features/support/modules/results/wish_list.rb +33 -0
- data/features/support/pages/all_pages.rb +95 -0
- data/features/support/pages/checkout/checkout_page.rb +45 -0
- data/features/support/pages/checkout/popup_results_page.rb +39 -0
- data/features/support/pages/flights_tracker/search_page.rb +54 -0
- data/features/support/pages/landing/search_page.rb +94 -0
- data/features/support/pages/results/desambiguation_airports_page.rb +16 -0
- data/features/support/pages/results/desambiguation_city_page.rb +20 -0
- data/features/support/pages/results/search_page.rb +101 -0
- data/features/support/pages/thanks/thanks_page.rb +7 -0
- data/features/tests/checkout/book_ok.feature +209 -0
- data/features/tests/flights_tracker/search.feature +65 -0
- data/features/tests/landing/search.feature +152 -0
- data/features/tests/results/basefare.feature +90 -0
- data/features/tests/results/desambiguation/airports.feature +89 -0
- data/features/tests/results/desambiguation/city.feature +87 -0
- data/features/tests/results/errors.feature +198 -0
- data/features/tests/results/filters.feature +113 -0
- data/features/tests/results/itineraries.feature +93 -0
- data/features/tests/results/matrix/matrix_airlines.feature +46 -0
- data/features/tests/results/matrix/matrix_fare_chart.feature +41 -0
- data/features/tests/results/matrix/matrix_price.feature +41 -0
- data/features/tests/results/orders.feature +89 -0
- data/features/tests/results/pagination.feature +74 -0
- data/features/tests/results/recommendation.feature +111 -0
- data/features/tests/results/reviews_airlines.feature +84 -0
- data/features/tests/results/search.feature +209 -0
- data/features/tests/results/wish_list.feature +55 -0
- data/flights_gui_tests.gemspec +34 -0
- data/henry-context.yml +4938 -0
- metadata +306 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#encoding: utf-8
|
|
2
|
+
Entonces(/^cargo los pasajeros$/) do
|
|
3
|
+
@page.cargar_datos_pasajeros
|
|
4
|
+
end
|
|
5
|
+
Y(/^cargo los datos de la tarjeta$/) do
|
|
6
|
+
@page.cargar_datos_tarjeta
|
|
7
|
+
end
|
|
8
|
+
Y(/^cargo los datos de facturacion$/) do
|
|
9
|
+
if AllPages.site.upcase.match("AR")
|
|
10
|
+
@page.formulario_facturacion_element.should visible("formulario de factura")
|
|
11
|
+
@page.cuil_element.focus
|
|
12
|
+
end
|
|
13
|
+
@page.cargar_datos_facturacion
|
|
14
|
+
end
|
|
15
|
+
Y(/^cargo los datos de contacto$/) do
|
|
16
|
+
@page.cargar_datos_de_contacto
|
|
17
|
+
end
|
|
18
|
+
Y(/^acepto y compro$/) do
|
|
19
|
+
@page.aceptar_y_comprar
|
|
20
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
Cuando(/^espero que termine de cargar la pagina de checkout$/) do
|
|
3
|
+
@page = Checkout::CheckoutPage.new($browser)
|
|
4
|
+
@page.pasajeros_element.when_visible(timeout=120)
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
Entonces(/^verifico que ingrese al checkout$/) do
|
|
8
|
+
@page.pasajeros_element.should visible("Campos de carga de pasajeros")
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
Entonces(/^espero que termine el pedido de compra$/) do
|
|
12
|
+
@page.popup_transicion_compra_element.when_not_visible(timeout=200)
|
|
13
|
+
Watir::Wait.until(timeout=200){@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?}
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
Y(/^verifico si no trae errores$/) do
|
|
17
|
+
if @page.notificacion_error_element.present?
|
|
18
|
+
pending(@page.notificacion_error_element)
|
|
19
|
+
end
|
|
20
|
+
if @page.notificacion_error_ux_element.present?
|
|
21
|
+
pending(@page.notificacion_error_ux_element)
|
|
22
|
+
end
|
|
23
|
+
if @page.notificacion_warning_element.present?
|
|
24
|
+
@page.notificacion_warning_element.strip.no_accents.downcase.should_not match("lo sentimos, el vuelo que eligio no se encuentra disponible")
|
|
25
|
+
end
|
|
26
|
+
if @page.popup_nuevo_precio_element.present?
|
|
27
|
+
puts "Se mostro el popup de cambio de precio"
|
|
28
|
+
@page.boton_si_cambio_precio_element.click
|
|
29
|
+
step "espero que termine el pedido de compra"
|
|
30
|
+
end
|
|
31
|
+
unless @page.popup_nuevo_vuelo_element.present?
|
|
32
|
+
doc = Hpricot.parse(@page.html)
|
|
33
|
+
errores = (doc/"span.error-message").select{|error| error.attributes['style'].match(/block/)}
|
|
34
|
+
errores.should is_empty?
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
Cuando(/^una pagina de trackeo de vuelos en "(.*)"$/) do |pais|
|
|
3
|
+
Helpers.set_date_language(pais)
|
|
4
|
+
@page = FlightsTracker::SearchPage.new($browser)
|
|
5
|
+
@page.load_page("roundtrip",pais,$ENV)
|
|
6
|
+
@page.set_cookies
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
Entonces(/^realizo la busqueda con numero de vuelo "(.*)"$/) do |numero|
|
|
10
|
+
@page.buscar_por_numero("austral",numero,"manana")
|
|
11
|
+
@page.carga_element.when_not_visible(timeout=20)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
Entonces(/^realizo la busqueda con "(.*)" y "(.*)" de "(.*)"$/) do |origen,destino,hora|
|
|
15
|
+
@page.buscar_por_origen_destino("austral",origen,destino,"manana",hora)
|
|
16
|
+
@page.carga_element.when_not_visible(timeout=20)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
Y(/^verifico que los datos mostrados sean correctos$/) do
|
|
20
|
+
@page.info_element.should visible("con resultados")
|
|
21
|
+
doc=Hpricot.parse(@page.info_element.html)
|
|
22
|
+
(doc/"span.flight-info-number").inner_text.should equal("AU 2280")
|
|
23
|
+
(doc/"div.airport-info-outbound div.airport-info-description").inner_text.should match('Aeroporto Buenos Aires Ministro Pistarini Ezeiza \(EZE\) \- Buenos Aires|Aeropuerto Buenos Aires Ministro Pistarini Ezeiza \(EZE\) \- Buenos Aires|Buenos Aires Ministro Pistarini Ezeiza Airport \(EZE\) \- Buenos Aires')
|
|
24
|
+
(doc/"div.airport-info-inbound div.airport-info-description").inner_text.should match('Arturo Merino Benitez Airport \(SCL\) \- Santiago de Chile|Aeropuerto Arturo Merino Benitez \(SCL\) \- Santiago de Chile|Aeroporto Arturo Merino Benitez \(SCL\) \- Santiago')
|
|
25
|
+
(doc/"span.flight-info-airline-name").inner_text.no_accents.should equal("Austral")
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
Y(/^verifico que no muestre datos$/) do
|
|
29
|
+
@page.info_element.should_not visible("con resultados")
|
|
30
|
+
end
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
Entonces(/^levanto los datos de los itinerarios$/) do
|
|
3
|
+
@page.cargar_itinerarios
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
Y(/^comparo los datos de cluster contra los detalles$/) do
|
|
7
|
+
@page.cargar_detalles_itinerarios.each_with_index do |detail,i|
|
|
8
|
+
detail["idas"].each_with_index do |item,j|
|
|
9
|
+
item.tramos.first["clase"].should be_true
|
|
10
|
+
item.tramos.first["clase"].should_not equal("")
|
|
11
|
+
item.tramos.first["ciudad_origen"].should match(@page.datos_de_itinerarios[i].idas[j].origen.no_accents.strip)
|
|
12
|
+
(item.tramos.first["fecha_origen"].strftime("%d%m")).should match(@page.datos_de_itinerarios[i].idas[j].fecha.strftime("%d%m"))
|
|
13
|
+
(item.tramos.first["hora_origen"].strftime("%d%m")).should match(@page.datos_de_itinerarios[i].idas[j].hou_sal_ida.strftime("%d%m"))
|
|
14
|
+
item.duracion.to_s.should match((@page.datos_de_itinerarios[i].idas[j].duracion).to_s)
|
|
15
|
+
item.tramos.first["ciudad_destino"].should match(@page.datos_de_itinerarios[i].idas[j].destino.no_accents.strip)
|
|
16
|
+
(item.tramos.first["hora_destino"].strftime("%d%m")).should match(@page.datos_de_itinerarios[i].idas[j].hou_lle_ida.strftime("%d%m"))
|
|
17
|
+
end
|
|
18
|
+
detail["vueltas"].each_with_index do |item,j|
|
|
19
|
+
item.tramos.first["clase"].should be_true
|
|
20
|
+
item.tramos.first["clase"].should_not equal("")
|
|
21
|
+
item.tramos.first["ciudad_origen"].should match(@page.datos_de_itinerarios[i].vueltas[j].origen.no_accents.strip)
|
|
22
|
+
(item.tramos.first["fecha_origen"].strftime("%d%m")).should match(@page.datos_de_itinerarios[i].vueltas[j].fecha.strftime("%d%m"))
|
|
23
|
+
(item.tramos.first["hora_origen"].strftime("%H%M")).should match(@page.datos_de_itinerarios[i].vueltas[j].hou_sal_ida.strftime("%H%M"))
|
|
24
|
+
item.duracion.to_s.should match((@page.datos_de_itinerarios[i].vueltas[j].duracion).to_s)
|
|
25
|
+
item.tramos.first["ciudad_destino"].should match(@page.datos_de_itinerarios[i].vueltas[j].destino.no_accents.strip)
|
|
26
|
+
(item.tramos.first["hora_destino"].strftime("%d%m")).should match(@page.datos_de_itinerarios[i].vueltas[j].hou_lle_ida.strftime("%d%m"))
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
Y(/^verifico que no vengan mas de diez resultados por pagina$/) do
|
|
32
|
+
(@page.datos_de_itinerarios.length<11).should be_true
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
Y(/^verifico que traiga precios con formato correcto y positivos$/) do
|
|
36
|
+
@page.datos_de_itinerarios.each do |cluster|
|
|
37
|
+
if cluster.tarifas
|
|
38
|
+
tarifa = @page.dolares_element.present? ? cluster.tarifas['tarifa_adulto_dolar'] : cluster.tarifas['tarifa_adulto']
|
|
39
|
+
tarifa.to_s.match(/\,/).should_not be_true
|
|
40
|
+
tarifa.to_s.match(/\-/).should_not be_true
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
Y(/^verifico que traiga aeropuertos y concuerden con la ciudad buscada$/) do
|
|
46
|
+
@page.datos_de_itinerarios.each do |cluster|
|
|
47
|
+
(cluster.ida.origen_iata and cluster.ida.destino_iata).should be_true
|
|
48
|
+
if cluster.vuelta
|
|
49
|
+
(cluster.vuelta.origen_iata and cluster.vuelta.destino_iata).should be_true
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
Y(/^verifico que traiga fechas en formato correcto$/) do
|
|
55
|
+
@page.datos_de_itinerarios.each do |cluster|
|
|
56
|
+
cluster.idas.first.should be_true
|
|
57
|
+
ida_sitio = []
|
|
58
|
+
cluster.idas.each{|ida| ida_sitio << ida.fecha if ida.fecha}
|
|
59
|
+
if cluster.vueltas and cluster.vueltas.first
|
|
60
|
+
cluster.vueltas.first.should be_true
|
|
61
|
+
vuelta_sitio = []
|
|
62
|
+
cluster.vueltas.each{|vuelta| vuelta_sitio << vuelta.fecha if vuelta.fecha}
|
|
63
|
+
if ida_sitio.first and cluster.vueltas.first
|
|
64
|
+
vueltas_sitio = []
|
|
65
|
+
cluster.vueltas.each{|vuelta| vueltas_sitio << vuelta.fecha if vuelta.fecha}
|
|
66
|
+
if vueltas_sitio.first
|
|
67
|
+
vueltas_sitio.each do |vueltas|
|
|
68
|
+
ida = ida_sitio.select{|ida| vueltas < ida}
|
|
69
|
+
ida.should is_empty?
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
Cuando(/^elijo el tipo de vuelo "(.*)"$/) do |tipo|
|
|
3
|
+
@page.elegir_tipo_vuelo(tipo)
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
Cuando(/^verifico que la url sea la correcta$/) do
|
|
7
|
+
@url_parse = @page.url.match(/#{@page.manage_data.host()}\/(vuelos|passagens-aereas)\/(\D{3})\/(\D{3})\/(vuelos|passagens-aereas)-(a|para)-(.+)-(desde|saindo-de)-(.+)/)
|
|
8
|
+
@url_parse.should be_true
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
Y(/^verifico que la ciudad destino sea la que se eligio$/) do
|
|
12
|
+
doc = Hpricot.parse(@page.html)
|
|
13
|
+
ciudades = (doc/"div.mainTitle/h1").inner_text.strip.no_accents
|
|
14
|
+
ciudad_destino = ciudades.match(/ (para|a|to) ([^,]+)/)[2].strip
|
|
15
|
+
@page.ciudad_elegida.should equal(ciudad_destino) unless @page.ciudad_elegida.match(/Guarullos/)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
Entonces(/^valido el sorting de landing en "(.*)"$/) do |pais|
|
|
19
|
+
doc = Hpricot.parse(@page.orden_element.html)
|
|
20
|
+
options = (doc/"option").collect{|option| option.attributes['value']}
|
|
21
|
+
if pais=="BR"
|
|
22
|
+
@page.orden_element.value.should match("FARE_ASCENDING")
|
|
23
|
+
elsif pais != "MX"
|
|
24
|
+
@page.orden_element.value.should match("TOTALFARE_ASCENDING")
|
|
25
|
+
end
|
|
26
|
+
options.should include?("FARE_ASCENDING")
|
|
27
|
+
options.should include?("STOPSCOUNT_ASCENDING")
|
|
28
|
+
options.should include?("TOTALFARE_ASCENDING")
|
|
29
|
+
options.should_not include?("PERSONAL_ASCENDING")
|
|
30
|
+
options.should_not include?("DURATION_ASCENDING")
|
|
31
|
+
options.should_not include?("FARE_DESCENDING")
|
|
32
|
+
options.should_not include?("STOPSCOUNT_DESCENDING")
|
|
33
|
+
options.should_not include?("TOTALFARE_DESCENDING")
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
Cuando(/^elijo un itinerario en landing$/) do
|
|
37
|
+
@itinerario_landing = @page.elegir_itinerario(0)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
Y(/^ingreso checkout$/) do
|
|
41
|
+
@page.should equal("checkout")
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
Y(/^ingreso resultados$/) do
|
|
45
|
+
@page.should equal("results")
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
Entonces(/^verifico que sea la pagina de resultados correcta$/) do
|
|
49
|
+
if @page.tipo_de_busqueda=="roundtrip"
|
|
50
|
+
@page.url.should match("\/roundtrip\/#{@page.manage_data.city_from_1.code.downcase}\/#{@page.manage_data.city_to_1.code.downcase}\/#{@itinerario_landing.ida.fecha}\/#{@itinerario_landing.vuelta.fecha}\/2\/C\/0")
|
|
51
|
+
else
|
|
52
|
+
@page.url.should match("\/oneway\/#{@page.manage_data.city_from_1.code.downcase}\/#{@page.manage_data.city_to_1.code.downcase}\/#{@itinerario_landing.ida.fecha}\/2\/C\/0")
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
Y(/^verifico que el valor elejido en landing se encuentre en la lista de resultados$/) do
|
|
57
|
+
doc = Hpricot.parse(@page.html)
|
|
58
|
+
matchs = (doc/"div#clusters div.cluster span[@class='price-currency USD'] span.amount").select{|span| (span.inner_text.to_i - @page.datos_de_itinerarios.first.tarifa.valor).abs < 2 }
|
|
59
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
Cuando(/^una pagina de landing en "(.*)" del tipo "(.*)"$/) do |pais,tipo|
|
|
3
|
+
Helpers.set_date_language(pais)
|
|
4
|
+
@page = Landing::SearchPage.new($browser)
|
|
5
|
+
@page.load_page(tipo,pais,$ENV)
|
|
6
|
+
@page.set_cookies
|
|
7
|
+
@page.elegir_idioma
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
Entonces(/^espero que termine de cargar la pagina de landing$/) do
|
|
11
|
+
@page.titulo_element.when_visible(timeout=30)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
Y(/^verifico que traiga resultados de landing$/) do
|
|
15
|
+
pending(@page.mensaje_sin_resultados) if @page.mensaje_sin_resultados_element.present?
|
|
16
|
+
@page.simbolo_error_element.should_not visible
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
Y(/^verifico la pagina donde ingresa$/) do
|
|
20
|
+
@page = Results::SearchPage.new($browser)
|
|
21
|
+
@page = Checkout::CheckoutPage.new($browser)
|
|
22
|
+
puts " URL: #{@page.url}"
|
|
23
|
+
Watir::Wait.until(timeout = 300){@page.carga_element.present? or @page.pasajeros_element.present? or @page.notificacion_warning_element.present?}
|
|
24
|
+
if @page.pasajeros_element.present? or @page.notificacion_warning_element.present?
|
|
25
|
+
@page = "checkout"
|
|
26
|
+
else
|
|
27
|
+
@page = "results"
|
|
28
|
+
end
|
|
29
|
+
sleep(1)
|
|
30
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
Entonces(/^verifico que la pagina no rompa$/) do
|
|
3
|
+
Browser.error_http?($browser).should_not be_true
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
Entonces(/^el site es "(.*)"$/) do |sites|
|
|
7
|
+
AllPages.site.should match(sites)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
Entonces(/^el site no es "(.*)"$/) do |sites|
|
|
11
|
+
AllPages.site.should_not match(sites)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
Entonces(/^seteo el proveedor "(.*)"$/) do |provider|
|
|
15
|
+
@page.browser.execute_script("javascript:void(document.cookie='XDESP-FDBS-PROVIDER=#{provider};path=/');")
|
|
16
|
+
@page.manage_data.set_header_json({"XDESP-FDBS-PROVIDER"=>provider})
|
|
17
|
+
@page.refresh
|
|
18
|
+
end
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
Entonces(/^verifico los textos de las opciones del combo$/) do
|
|
3
|
+
combo_text = case AllPages.site
|
|
4
|
+
when "US" then "Recommended"
|
|
5
|
+
when "BR" then "Mais Escolhidos"
|
|
6
|
+
else "Mas Elegidos"
|
|
7
|
+
end
|
|
8
|
+
doc = Hpricot.parse(@page.orden_element.html)
|
|
9
|
+
options = (doc/"option").collect{|option| option.inner_text.no_accents.strip}
|
|
10
|
+
options.include?(combo_text).should be_true
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
Entonces(/^verifico las ociones de ordenamiento$/) do
|
|
14
|
+
doc = Hpricot.parse(@page.orden_element.html)
|
|
15
|
+
options = (doc/"option").collect{|option| option.attributes['value']}
|
|
16
|
+
if AllPages.site=="BR"
|
|
17
|
+
@page.orden_element.value.should match("FARE_ASCENDING")
|
|
18
|
+
end
|
|
19
|
+
options.should include?("FARE_ASCENDING")
|
|
20
|
+
options.should include?("STOPSCOUNT_ASCENDING")
|
|
21
|
+
options.should include?("TOTALFARE_ASCENDING")
|
|
22
|
+
options.should include?("DURATION_ASCENDING")
|
|
23
|
+
options.should include?("PERSONAL_ASCENDING")
|
|
24
|
+
options.should_not include?("FLIGHTCLASS_ASCENDING")
|
|
25
|
+
options.should_not include?("FARE_DESCENDING")
|
|
26
|
+
options.should_not include?("STOPSCOUNT_DESCENDING")
|
|
27
|
+
options.should_not include?("TOTALFARE_DESCENDING")
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
Entonces(/^elijo moneda local$/) do
|
|
31
|
+
@page.moneda_element.select_value(Helpers.currency(AllPages.site)) if @page.moneda_element.present?
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
Entonces(/^filtro por un itinerario en la matriz$/) do
|
|
35
|
+
@page.activar_aerolineas_en_matriz
|
|
36
|
+
if AllPages.site == "PE"
|
|
37
|
+
@page.seleccionar_itinerario_matriz_pe_element.click
|
|
38
|
+
else
|
|
39
|
+
@page.seleccionar_itinerario_matriz_element.click
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
Entonces(/^verifico la base tarifaria$/) do
|
|
44
|
+
if AllPages.site == "PE"
|
|
45
|
+
@page.precio_itinerario_pe_element.when_visible(timeout=20)
|
|
46
|
+
else
|
|
47
|
+
@page.precio_itinerario_element.when_visible(timeout=20)
|
|
48
|
+
end
|
|
49
|
+
map = {"adt"=>"MX,UY,PE,BR",
|
|
50
|
+
"abtesting"=>"AR,PA,US,CR,EC,VE,CL,CO"}
|
|
51
|
+
map.each_pair{|key,value| @basefare = key if value.match(/#{AllPages.site}/)}
|
|
52
|
+
price_cluster = Hash.new
|
|
53
|
+
doc = Hpricot.parse(@page.html)
|
|
54
|
+
price_matrix = (doc/"div#matrix span[@class='price-currency #{Helpers.currency(AllPages.site)} ']").first.inner_text.strip
|
|
55
|
+
price_cluster['adt'] = (doc/"div.cluster span.fare span[@class='price-currency #{Helpers.currency(AllPages.site)} ']").first.inner_text.strip
|
|
56
|
+
if @basefare=="tot"
|
|
57
|
+
price_cluster['tot'] = (doc/"div.cluster ul.fare-detail li.fare-price span[@class='price-currency #{Helpers.currency(AllPages.site)} ']").first.inner_text.strip
|
|
58
|
+
end
|
|
59
|
+
puts "#{price_cluster[@basefare]} != #{price_matrix}"
|
|
60
|
+
((price_cluster[@basefare] == price_matrix) or @basefare=="abtesting").should be_true
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
Entonces(/^verifico el breakdown$/) do
|
|
64
|
+
(@basefare=="abtesting" or ((@basefare=="adt")^(@page.detalle_precio_itinerario_elements.length > 0))).should be_true
|
|
65
|
+
end
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
Dado(/^una pagina de resultados en "(.*?)" para una busqueda "(.*?)" que desambigue por "(.*?)"$/) do |arg1, arg2, arg3|
|
|
3
|
+
Helpers.set_date_language(arg1)
|
|
4
|
+
@page = Results::DesambiguationAirportsPage.new($browser)
|
|
5
|
+
@page.load_page(arg2,arg1,$ENV,arg3,"true")
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
Cuando(/^espero que termine de cargar la pagina de desambiguacion$/) do
|
|
9
|
+
@page.mensaje_desambiguacion_element.when_visible(timeout=100)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
Entonces(/^verifico que ingrese a la pagina de desambiguacion$/) do
|
|
13
|
+
@page.mensaje_desambiguacion_element.should visible
|
|
14
|
+
@page.mensaje_desambiguacion_element.text.should match("Por favor seleccione uno de los siguientes aeropuertos cercanos|Veja abaixo os aeroportos mais|Please choose one of the following nearby airports")
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
Cuando(/^seteo las edades de los menores$/) do
|
|
18
|
+
@page.manage_data.get_childrens.to_i.times do | j |
|
|
19
|
+
@page.browser.li(:class,"ctn-select-age ctn-#{1+j}").selects[0].select_value(["I","C"][rand(2)])
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
Entonces(/^verifico que se muestre el mapa$/) do
|
|
24
|
+
doc = Hpricot.parse(@page.html)
|
|
25
|
+
(doc/"li.strech").each do |tramo|
|
|
26
|
+
(tramo/"div.map-container").should_not is_empty?
|
|
27
|
+
(tramo/"ul.airports").should_not is_empty?
|
|
28
|
+
(tramo/"ul/li").should_not is_empty?
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
Entonces(/^verifico que el combo de distancia este correcto$/) do
|
|
33
|
+
doc = Hpricot.parse(@page.html)
|
|
34
|
+
@distancia = (doc/"select.distances").first
|
|
35
|
+
@page.browser.select_list(:class,@distancia.attributes['class']).should visible
|
|
36
|
+
@page.browser.select_list(:class,@distancia.attributes['class']).select_value((@distancia/"option").last.attributes['value'])
|
|
37
|
+
sleep(0.5)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
Entonces(/^verifico cada opcion de aeropuerto "(.*?)" en "(.*?)"$/) do |type,city|
|
|
41
|
+
cities={"BZC"=>["GIG", "SDU", "JDF", "CFB", "CAW", "MEA", "IZA"],
|
|
42
|
+
"PCM"=>["CUN","CZM"]}
|
|
43
|
+
doc = Hpricot.parse(@page.html)
|
|
44
|
+
i = 0
|
|
45
|
+
(doc/"li.strech").each do |tramo|
|
|
46
|
+
airports = ((tramo/"ul.airports//li.airport").reject{|it| it.attributes['style'].match(/none/)})
|
|
47
|
+
airports.collect{ |airport| (airport/"p.description").inner_text[-4,3]}.should equal(cities[city])
|
|
48
|
+
option = rand(airports.length)
|
|
49
|
+
begin
|
|
50
|
+
aux = (tramo/"ul.airports//li.airport").length - airports.length
|
|
51
|
+
rescue
|
|
52
|
+
aux = 0
|
|
53
|
+
end
|
|
54
|
+
if type.downcase.match(/multipledestinations/)
|
|
55
|
+
if (tramo/"select").first.attributes["class"].downcase.match(/departure/)
|
|
56
|
+
@iata = (tramo/"ul.airports//p.description")[option+aux].inner_text[-4,3]
|
|
57
|
+
else
|
|
58
|
+
@iata = (tramo/"ul.airports//p.description")[option+aux].inner_text[-4,3]
|
|
59
|
+
end
|
|
60
|
+
else
|
|
61
|
+
if (tramo/"select").first.attributes["class"].downcase.match(/departure/)
|
|
62
|
+
@iata = (tramo/"ul.airports//p.description")[option+aux].inner_text[-4,3]
|
|
63
|
+
else
|
|
64
|
+
@iata = (tramo/"ul.airports//p.description")[option+aux].inner_text[-4,3]
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
puts @iata
|
|
68
|
+
@page.browser.li(:class=>"strech",:index=>i).radio(:class=>'radio',:index=>option+aux).click if @page.browser.li(:class=>"strech",:index=>i).radio(:class=>'radio',:index=>option+aux).exists?
|
|
69
|
+
i += 1
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
Entonces(/^paso a resultados$/) do
|
|
74
|
+
@page.boton_busqueda_element.click
|
|
75
|
+
@page = Results::SearchPage.new($browser)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
Entonces(/^verifico que el aeropuerto elegido sea el buscado$/) do
|
|
79
|
+
@page.url.should match("#{@iata}")
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
Cuando(/^ingreso un destino inexistente$/) do
|
|
83
|
+
@page = Results::DesambiguationCityPage.new($browser)
|
|
84
|
+
@page.load_page(@page.tipo_de_busqueda,AllPages.site,$ENV)
|
|
85
|
+
@page.url.should equal(@page.manage_data.generate_url_disambiguation_city.gsub(/search/,'disambiguation/cities'))
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
Entonces(/^verifico que se muestre correctamente la pagina de desambiguacion$/) do
|
|
89
|
+
@page.mensaje_desambiguacion_element.should visible
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
Cuando(/^elijo un nuevo destino desde desambiguacion de ciudades$/) do
|
|
93
|
+
countries = ["AR","BR","CL","CO","CR","PA","PE","MX","EC","UY","US","VE"]
|
|
94
|
+
@cities = []
|
|
95
|
+
@page.seleccionar_pais_element.select_value(AllPages.site)
|
|
96
|
+
sleep(1)
|
|
97
|
+
@cities << MockCity.new(AllPages.site).code
|
|
98
|
+
begin
|
|
99
|
+
@page.seleccionar_ciudad_element.select_value(@cities.last)
|
|
100
|
+
rescue Watir::Exception::NoValueFoundException
|
|
101
|
+
begin
|
|
102
|
+
sleep(2)
|
|
103
|
+
@page.seleccionar_ciudad_element.select_value(@cities.last)
|
|
104
|
+
rescue Watir::Exception::NoValueFoundException
|
|
105
|
+
sleep(3)
|
|
106
|
+
@page.seleccionar_ciudad_element.select_value(@cities.last)
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
countries.delete(AllPages.site)
|
|
110
|
+
@page.locaciones_elements.each_with_index do |option,i|
|
|
111
|
+
if i>0
|
|
112
|
+
country = countries[rand(countries.length)]
|
|
113
|
+
option.select(:class,'flights-select country').select_value(country)
|
|
114
|
+
sleep(1)
|
|
115
|
+
@cities << MockCity.new(country).code
|
|
116
|
+
begin
|
|
117
|
+
option.select(:class,'flights-select city').select_value(@cities.last)
|
|
118
|
+
rescue Watir::Exception::NoValueFoundException
|
|
119
|
+
begin
|
|
120
|
+
sleep(2)
|
|
121
|
+
option.select(:class,'flights-select city').select_value(@cities.last)
|
|
122
|
+
rescue Watir::Exception::NoValueFoundException
|
|
123
|
+
sleep(3)
|
|
124
|
+
option.select(:class,'flights-select city').select_value(@cities.last)
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
countries.delete(country)
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
Cuando(/^realizo una nueva busqueda desde desambiguacion de ciudades$/) do
|
|
133
|
+
url = @page.url
|
|
134
|
+
@page.boton_busqueda_element.click
|
|
135
|
+
Watir::Wait.until(timeout = 60){url != @page.url}
|
|
136
|
+
@page = Results::SearchPage.new($browser)
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
Cuando(/^verifico que las ciudades elegidas sean las correctas$/) do
|
|
140
|
+
puts @cities
|
|
141
|
+
@cities.each do |city|
|
|
142
|
+
@page.url.should match(city)
|
|
143
|
+
end
|
|
144
|
+
end
|