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,95 @@
|
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
|
2
|
+
class AllPages
|
|
3
|
+
|
|
4
|
+
include PageObject
|
|
5
|
+
include RSpec::Matchers
|
|
6
|
+
|
|
7
|
+
def self.site
|
|
8
|
+
@@site
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def load_page(tipo,pais,ambiente,cabotaje="nil")
|
|
12
|
+
@@site = pais
|
|
13
|
+
@@manage_data = Class.const_get("MockSearch#{tipo.capitalize}").new(pais,ambiente,cabotaje)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def set_autocomplete(object,text)
|
|
17
|
+
send("#{object}=".to_sym,text)
|
|
18
|
+
sleep(0.5)
|
|
19
|
+
@browser.send_keys :enter
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def url
|
|
23
|
+
@browser.url
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def html
|
|
27
|
+
@browser.html
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def browser
|
|
31
|
+
@browser
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def refresh
|
|
35
|
+
@browser.refresh
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def manage_data
|
|
39
|
+
@@manage_data
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def tipo_de_busqueda
|
|
43
|
+
@@manage_data.description
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def elegir_idioma()
|
|
47
|
+
if @@site=="US"
|
|
48
|
+
if @browser.li(:class,'nibbler-common-header-language nibbler-user').image(:src,/es.png/).present?
|
|
49
|
+
@browser.li(:class,'nibbler-common-header-language nibbler-user').links[0].click
|
|
50
|
+
@browser.execute_script("javascript:void($(\".popup-languages a\").click());")
|
|
51
|
+
end
|
|
52
|
+
if @browser.li(:class,'nibbler-common-header-language').image(:src,/es.png/).present?
|
|
53
|
+
@browser.li(:class,'nibbler-common-header-language').links[0].click
|
|
54
|
+
@browser.execute_script("javascript:void($(\".nibbler-common-header-language-popup img\").click());")
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def add_cookie(type)
|
|
60
|
+
case type.upcase
|
|
61
|
+
when 'RESULTS' then "results-f-gui=beta"
|
|
62
|
+
when 'CHECKOUT' then "chkf-app=beta"
|
|
63
|
+
when 'LANDING' then "landing-f-gui=beta"
|
|
64
|
+
when 'FSM' then "fsm-rest=beta|fsm=beta"
|
|
65
|
+
when 'CHAS' then "chas-flight=beta"
|
|
66
|
+
when 'DEBASE' then "flights-dbs-new=flights-dbs-new-b"
|
|
67
|
+
when 'CHAS_CHECKOUT' then "chkf-app=beta|chas-flight=beta"
|
|
68
|
+
when 'PRISM' then "prism=beta"
|
|
69
|
+
else "landing-f-gui=beta|results-f-gui=beta|chkf-app=beta"
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def set_cookies()
|
|
74
|
+
dominio = case @@site
|
|
75
|
+
when 'BR' then 'decolar.com'
|
|
76
|
+
when 'CR' then 'despegar.co.cr'
|
|
77
|
+
when 'CL' then 'despegar.cl'
|
|
78
|
+
when 'US' then 'us.despegar.com'
|
|
79
|
+
else "despegar.com.#{@@site.downcase}"
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
uow = "ROBOTFGUI-#{Socket.gethostname}-#{rand(1000)}"
|
|
83
|
+
puts uow
|
|
84
|
+
@browser.execute_script("javascript:void(document.cookie = 'X-UOW-CUSTOM=#{uow}; Path=/')")
|
|
85
|
+
if $ENV.upcase=="BETA"
|
|
86
|
+
if $ENV.upcase=="BETA"
|
|
87
|
+
@browser.execute_script("javascript:void(document.cookie='X-Version-Override=#{add_cookie($HENRY_PARAMS['product'])};domain=#{dominio};path=/');")
|
|
88
|
+
end
|
|
89
|
+
@browser.refresh
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
sleep(2)
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
module Checkout
|
|
3
|
+
class CheckoutPage < AllPages
|
|
4
|
+
|
|
5
|
+
include Pages::Tags
|
|
6
|
+
include Pages::Cookies
|
|
7
|
+
include Checkout::Pasajeros
|
|
8
|
+
include Checkout::Tarjeta
|
|
9
|
+
include Checkout::DatosDeFacturacion
|
|
10
|
+
include Checkout::InformacionDeContacto
|
|
11
|
+
|
|
12
|
+
element(:pasajeros,:fieldset,:id=>"passengers")
|
|
13
|
+
checkbox(:condiciones_de_compra,:id=>"read-agreement")
|
|
14
|
+
link(:comprar,:id=>"submit")
|
|
15
|
+
div(:popup_transicion_compra,:id=>"popup-checkout-transition-template")
|
|
16
|
+
element(:checkout_id,:em,:class=>"checkout-id")
|
|
17
|
+
|
|
18
|
+
div(:popup_nuevo_precio,:id=>"popup-price-difference-template")
|
|
19
|
+
div(:popup_nuevo_vuelo,:id=>"popup-new-flight")
|
|
20
|
+
span(:error_datos,:class=>"error-message")
|
|
21
|
+
div(:notificacion_error,:class=>"notification-box error-box")
|
|
22
|
+
div(:notificacion_warning,:class=>"notification-box warn-box")
|
|
23
|
+
div(:notificacion_error_ux,:class=>"ux-common-error")
|
|
24
|
+
div(:boton_si_cambio_precio,:class=>"button-yes")
|
|
25
|
+
|
|
26
|
+
def cargar_datos_pasajeros
|
|
27
|
+
@browser.execute_script("javascript:void($('.other-passenger-inputs').css('display','block'));")
|
|
28
|
+
self.cargar_adultos
|
|
29
|
+
self.cargar_ninos
|
|
30
|
+
self.cargar_bebes
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def aceptar_y_comprar
|
|
34
|
+
unless condiciones_de_compra_checked?
|
|
35
|
+
@browser.execute_script("javascript:void($('#read-agreement').click());")
|
|
36
|
+
end
|
|
37
|
+
begin
|
|
38
|
+
@browser.execute_script("javascript:void($('#submit').click());")
|
|
39
|
+
rescue Selenium::WebDriver::Error::UnknownError
|
|
40
|
+
comprar_element.click
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
module Checkout
|
|
2
|
+
class PopupResultsPage < AllPages
|
|
3
|
+
include PageObject
|
|
4
|
+
|
|
5
|
+
elements(:buscar,:link,:class=>"buy btn-buy flights-button")
|
|
6
|
+
elements(:opciones_ida,:radio,:css=>"div.outbound input")
|
|
7
|
+
elements(:opciones_vuelta,:radio,:css=>"div.inbound input")
|
|
8
|
+
elements(:itinerarios, :div, :css=>"#clusters .cluster")
|
|
9
|
+
|
|
10
|
+
div(:itinerario,:class=>"cluster-content flights-cluster")
|
|
11
|
+
|
|
12
|
+
def cargar_itinerarios
|
|
13
|
+
@datos_de_itinerarios = []
|
|
14
|
+
itinerarios_elements.each do |itinerario|
|
|
15
|
+
@datos_de_itinerarios << RenderCluster.new(tipo_de_busqueda,Hpricot.parse(itinerario.html))
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def elegir_itinerario(index)
|
|
20
|
+
itinerarios_elements[index].div(:class,'sub-cluster outbound').radios[0].click unless tipo_de_busqueda=="multipledestinations"
|
|
21
|
+
itinerarios_elements[index].div(:class,'sub-cluster inbound').radios[0].click if tipo_de_busqueda=="roundtrip"
|
|
22
|
+
buscar_elements[index].click
|
|
23
|
+
return @datos_de_itinerarios[index]
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def sumar_aparicion
|
|
27
|
+
@apariciones += 1
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def apariciones
|
|
31
|
+
@apariciones
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def iniciar_apariciones
|
|
35
|
+
@apariciones = 0
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
|
2
|
+
module FlightsTracker
|
|
3
|
+
class SearchPage < AllPages
|
|
4
|
+
|
|
5
|
+
#text_fields
|
|
6
|
+
text_field(:aerolinea, :id=>"airline")
|
|
7
|
+
text_field(:numero_de_vuelo, :id=>"flightNumber")
|
|
8
|
+
text_field(:origen, :id=>"flight-tracker-origin-city")
|
|
9
|
+
text_field(:destino, :id=>"flight-tracker-destiny-city")
|
|
10
|
+
#radios
|
|
11
|
+
radio_button(:ayer, :value=> "YESTERDAY")
|
|
12
|
+
radio_button(:hoy, :value=> "TODAY")
|
|
13
|
+
radio_button(:manana, :value=> "TOMORROW")
|
|
14
|
+
#select
|
|
15
|
+
select_list(:horario,:id=>"flight-tracker-hours")
|
|
16
|
+
#checkboxes
|
|
17
|
+
checkbox(:sin_numero,:id=>"no-flight-number-checkbox")
|
|
18
|
+
#links
|
|
19
|
+
link(:buscar, :class=>"flights-search-button")
|
|
20
|
+
#divs
|
|
21
|
+
div(:error,:id=>"results-error")
|
|
22
|
+
div(:info,:id=>"flight-info")
|
|
23
|
+
div(:carga,:class=>"flight-tracker-loader-content")
|
|
24
|
+
|
|
25
|
+
def load_page(tipo,pais,ambiente,cabotaje="nil")
|
|
26
|
+
super(tipo,pais,ambiente,cabotaje)
|
|
27
|
+
puts "#{@manage_data.host}/flights/tracker/"
|
|
28
|
+
@browser.goto("#{@manage_data.host}/flights/tracker/")
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def buscar_por_numero(nombre_aerolinea, numero, dia)
|
|
32
|
+
set_autocomplete("aerolinea",nombre_aerolinea)
|
|
33
|
+
uncheck_sin_numero
|
|
34
|
+
self.numero_de_vuelo = numero
|
|
35
|
+
send("select_#{dia}")
|
|
36
|
+
buscar
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def buscar_por_origen_destino(nombre_aerolinea, ciudad_origen, ciudad_destino, dia, hora)
|
|
40
|
+
set_autocomplete("aerolinea",nombre_aerolinea)
|
|
41
|
+
check_sin_numero
|
|
42
|
+
set_autocomplete("origen",ciudad_origen)
|
|
43
|
+
set_autocomplete("destino",ciudad_destino)
|
|
44
|
+
send("select_#{dia}")
|
|
45
|
+
seleccionar_horario(hora)
|
|
46
|
+
buscar
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def seleccionar_horario(hora)
|
|
50
|
+
horario_temporal = self.horario_options.select{|option| option.match(hora.match("(.*)\-(.*)")[1]) and option.match(hora.match("(.*)\-(.*)")[2])}.first
|
|
51
|
+
self.horario=horario_temporal
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
module Landing
|
|
3
|
+
class SearchPage < AllPages
|
|
4
|
+
include PageObject
|
|
5
|
+
|
|
6
|
+
elements(:buscar,:link,:class=>"buy btn-buy flights-button")
|
|
7
|
+
elements(:opciones_ida,:radio,:name=>"0-outbound")
|
|
8
|
+
elements(:opciones_vuelta,:radio,:name=>"0-inbound")
|
|
9
|
+
elements(:itinerarios, :div, :css=>"#clusters .cluster")
|
|
10
|
+
|
|
11
|
+
div(:lista_itinerarios, :id=>"clusters")
|
|
12
|
+
div(:titulo,:class=>"mainTitle")
|
|
13
|
+
div(:popup_detalles,:id=>"popup-detail")
|
|
14
|
+
|
|
15
|
+
span(:mensaje_sin_resultados,:class=>"message")
|
|
16
|
+
span(:simbolo_error,:class=>'commonSprite warningSymbol')
|
|
17
|
+
span(:mostrar_mas_itinerarios,:class=>"showMoreItineraries")
|
|
18
|
+
span(:dolares,:class=>"price-currency USD ")
|
|
19
|
+
|
|
20
|
+
radio_button(:vuelo_oneway,:id=>"oneway")
|
|
21
|
+
radio_button(:vuelo_roundtrip,:id=>"roundtrip")
|
|
22
|
+
|
|
23
|
+
select_list(:orden,:id=>"orderby")
|
|
24
|
+
select_list(:adultos,:css=>"#searchPopup .adultsSelect")
|
|
25
|
+
select_list(:menores,:css=>"#searchPopup .childsSelect")
|
|
26
|
+
select_list(:edad,:css=>"#searchPopup .selectAge")
|
|
27
|
+
|
|
28
|
+
link(:buscar_popup,:css=>"#searchPopup .flights-search-button")
|
|
29
|
+
|
|
30
|
+
def load_page(tipo,pais,ambiente,cabotaje="nil")
|
|
31
|
+
super(tipo,pais,ambiente,cabotaje)
|
|
32
|
+
@datos_de_itinerarios = []
|
|
33
|
+
url_landing = self.manage_data.generate_url_landing_search(self.manage_data.city_from_1.code,self.manage_data.city_to_1.code)
|
|
34
|
+
puts " URL: #{url_landing}"
|
|
35
|
+
@browser.goto(url_landing)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def cargar_itinerarios
|
|
39
|
+
itinerarios_elements.each do |itinerario|
|
|
40
|
+
@datos_de_itinerarios << LandingCluster.new(tipo_de_busqueda,Hpricot.parse(itinerario.html))
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def datos_de_itinerarios
|
|
45
|
+
@datos_de_itinerarios
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def elegir_itinerario(index)
|
|
49
|
+
opciones_ida_elements[index].click unless tipo_de_busqueda=="multipledestinations"
|
|
50
|
+
opciones_vuelta_elements[index].click if tipo_de_busqueda=="roundtrip"
|
|
51
|
+
buscar_elements[index].click
|
|
52
|
+
sleep(0.5)
|
|
53
|
+
adultos_element.select(2)
|
|
54
|
+
menores_element.select(1)
|
|
55
|
+
edad_element.select_value(4)
|
|
56
|
+
buscar_popup_element.click
|
|
57
|
+
return @datos_de_itinerarios[index]
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def elegir_tipo_vuelo(tipo)
|
|
61
|
+
send("select_vuelo_#{tipo}")
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def ciudad_elegida
|
|
65
|
+
self.manage_data.city_to_1.name(@@site)
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def cargar_detalles_itinerarios()
|
|
69
|
+
clusters = Array.new
|
|
70
|
+
doc = Hpricot.parse(lista_itinerarios_element.html)
|
|
71
|
+
(doc/"div.cluster").each_with_index do |cluster,i|
|
|
72
|
+
_cluster = {"idas"=>Array.new,"vueltas"=>Array.new}
|
|
73
|
+
(cluster/"div.outbound li.cluster-item").each_with_index do |item,j|
|
|
74
|
+
itinerarios_elements[i].div(:class,'sub-cluster outbound').span(:class,'showMoreItineraries').click if itinerarios_elements[i].div(:class,'sub-cluster outbound').span(:class,'showMoreItineraries').present?
|
|
75
|
+
itinerarios_elements[i].div(:class,"sub-cluster outbound").li(:class=>'item itinerary cluster-item',:index=>j).li(:class,'stops').link(:class,'text').click
|
|
76
|
+
_cluster["idas"] << DetailsCluster.new(Hpricot.parse(popup_detalles_element.html))
|
|
77
|
+
popup_detalles_element.span(:class,'popup-close-button popup-close').click
|
|
78
|
+
sleep(0.25)
|
|
79
|
+
end
|
|
80
|
+
(cluster/"div.inbound li.cluster-item").each_with_index do |item,j|
|
|
81
|
+
itinerarios_elements[i].div(:class,'sub-cluster inbound').span(:class,'showMoreItineraries').click if itinerarios_elements[i].div(:class,'sub-cluster inbound').span(:class,'showMoreItineraries').present?
|
|
82
|
+
itinerarios_elements[i].div(:class,"sub-cluster inbound").li(:class=>'item itinerary cluster-item',:index=>j).li(:class,'stops').link(:class,'text').click
|
|
83
|
+
_cluster["vueltas"] << DetailsCluster.new(Hpricot.parse(popup_detalles_element.html))
|
|
84
|
+
popup_detalles_element.span(:class,'popup-close-button popup-close').click
|
|
85
|
+
sleep(0.25)
|
|
86
|
+
end
|
|
87
|
+
clusters << _cluster
|
|
88
|
+
break if i > 2
|
|
89
|
+
end
|
|
90
|
+
return clusters
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
end
|
|
94
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
|
2
|
+
module Results
|
|
3
|
+
class DesambiguationAirportsPage < AllPages
|
|
4
|
+
include PageObject
|
|
5
|
+
|
|
6
|
+
div(:mensaje_desambiguacion,:id=>"disambiguation-message")
|
|
7
|
+
|
|
8
|
+
link(:boton_busqueda,:class=>"ctn-searchbutton")
|
|
9
|
+
|
|
10
|
+
def load_page(tipo,pais,ambiente,city,cabotaje="nil")
|
|
11
|
+
super(tipo,pais,ambiente,cabotaje)
|
|
12
|
+
puts " URL: #{self.manage_data.generate_url_disambiguation_airports(city)}"
|
|
13
|
+
@browser.goto(self.manage_data.generate_url_disambiguation_airports(city))
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
|
2
|
+
module Results
|
|
3
|
+
class DesambiguationCityPage < AllPages
|
|
4
|
+
include PageObject
|
|
5
|
+
|
|
6
|
+
div(:mensaje_desambiguacion,:class=>"disambiguation-cities")
|
|
7
|
+
|
|
8
|
+
select_list(:seleccionar_pais,:class=>"flights-select country")
|
|
9
|
+
select_list(:seleccionar_ciudad,:class=>"flights-select city")
|
|
10
|
+
divs(:locaciones,:class=>"location")
|
|
11
|
+
|
|
12
|
+
link(:boton_busqueda,:class=>"flights-search-button disambiguation-button")
|
|
13
|
+
|
|
14
|
+
def load_page(tipo,pais,ambiente,cabotaje="nil")
|
|
15
|
+
super(tipo,pais,ambiente,cabotaje)
|
|
16
|
+
puts " URL: #{self.manage_data.generate_url_disambiguation_city}"
|
|
17
|
+
@browser.goto(self.manage_data.generate_url_disambiguation_city)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
|
2
|
+
module Results
|
|
3
|
+
class SearchPage < AllPages
|
|
4
|
+
|
|
5
|
+
include Pages::Tags
|
|
6
|
+
include Pages::Cookies
|
|
7
|
+
include Results::Matriz::MatrizAerolinea
|
|
8
|
+
include Results::Matriz::MatrizPrice
|
|
9
|
+
include Results::Matriz::MatrizFareChart
|
|
10
|
+
include Results::Itineraries::Miles
|
|
11
|
+
include Results::Itineraries::Bussines
|
|
12
|
+
include Results::Itineraries::Payments
|
|
13
|
+
include Results::Itineraries::Details
|
|
14
|
+
include Results::Itineraries::Data
|
|
15
|
+
include Results::SearchParams
|
|
16
|
+
include Results::Filters
|
|
17
|
+
include Results::Recommendation
|
|
18
|
+
include Results::WishList
|
|
19
|
+
|
|
20
|
+
div(:filtros_error , :id=>"filters-error")
|
|
21
|
+
div(:resultados_error, :id=>"results-error")
|
|
22
|
+
div(:carga, :id=>"results-loader")
|
|
23
|
+
div(:cluster_bussines,:class=>"cluster newCluster not-economy-cluster")
|
|
24
|
+
div(:actualizar_informacion,:class=>"update-message")
|
|
25
|
+
div(:actualizar_filtro,:id=>"update-message-overlay")
|
|
26
|
+
|
|
27
|
+
link(:link_mejor_precio,:id=>"best-price")
|
|
28
|
+
|
|
29
|
+
span(:header_mejor_precio,:class=>"nibbler-common-header-bestprice-inside ")
|
|
30
|
+
|
|
31
|
+
li(:pagina_previa,:class=>"pagination-button prev")
|
|
32
|
+
li(:pagina_siguiente,:class=>"pagination-button next")
|
|
33
|
+
|
|
34
|
+
elements(:buscar,:link,:class=>"buy btn-buy flights-button")
|
|
35
|
+
elements(:opciones_ida,:radio,:css=>"div.outbound input")
|
|
36
|
+
elements(:opciones_vuelta,:radio,:css=>"div.inbound input")
|
|
37
|
+
elements(:itinerarios, :div, :css=>"#clusters .cluster")
|
|
38
|
+
|
|
39
|
+
elements(:detalle_precio_itinerario, :li, :css=>"#clusters .cluster .fare-detail li")
|
|
40
|
+
element(:precio_itinerario, :span, :css=>".cluster .fare .price-currency")
|
|
41
|
+
element(:precio_itinerario_pe, :span, :css=>".cluster .fare .PEN")
|
|
42
|
+
|
|
43
|
+
select_list(:orden,:id=>"orderby")
|
|
44
|
+
select_list(:moneda,:id=>"currency")
|
|
45
|
+
|
|
46
|
+
def load_page(tipo,pais,ambiente,cabotaje="nil")
|
|
47
|
+
super(tipo,pais,ambiente,cabotaje)
|
|
48
|
+
@datos_de_itinerarios = []
|
|
49
|
+
puts " URL: #{self.manage_data.generate_url_results_search}"
|
|
50
|
+
@browser.goto(self.manage_data.generate_url_results_search)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def con_resultados?
|
|
54
|
+
if filtros_error_element.present? or resultados_error_element.present?
|
|
55
|
+
return nil
|
|
56
|
+
else
|
|
57
|
+
return !itinerarios_elements.empty?
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def get_results_search_service
|
|
62
|
+
self.manage_data.get_results_search_service
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def cargar_itinerarios
|
|
66
|
+
itinerarios_elements.each do |itinerario|
|
|
67
|
+
@datos_de_itinerarios << ResultsCluster.new(tipo_de_busqueda,Hpricot.parse(itinerario.html))
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def datos_de_itinerarios
|
|
72
|
+
return @datos_de_itinerarios
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def sanear_itinerarios(aerolineas)
|
|
76
|
+
index = 0
|
|
77
|
+
permitida = nil
|
|
78
|
+
get_results_search_service['result']['data']['items'].each do |item|
|
|
79
|
+
if tipo_de_busqueda!="multipledestinations"
|
|
80
|
+
item["itinerariesBox"]["matchingInfoMap"].each_pair do |key,value|
|
|
81
|
+
permitida = true unless aerolineas.include?(value["validatingCarrier"])
|
|
82
|
+
break
|
|
83
|
+
end
|
|
84
|
+
else
|
|
85
|
+
permitida = true if item["itinerary"]["routes"].select{|route| !route['airlines'].select{|airline| aerolineas.include?(airline['code'])}.empty?}.empty?
|
|
86
|
+
end
|
|
87
|
+
break if permitida
|
|
88
|
+
index = index + 1
|
|
89
|
+
end
|
|
90
|
+
return index, permitida
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def elegir_itinerario(index)
|
|
94
|
+
itinerarios_elements[index].div(:class,'sub-cluster outbound').radios[0].click unless tipo_de_busqueda=="multipledestinations"
|
|
95
|
+
itinerarios_elements[index].div(:class,'sub-cluster inbound').radios[0].click if tipo_de_busqueda=="roundtrip"
|
|
96
|
+
buscar_elements[index].click
|
|
97
|
+
return @datos_de_itinerarios[index]
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
end
|
|
101
|
+
end
|