flights_gui_henry_tests 1.8.7
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 +15 -0
- data/Gemfile +3 -0
- data/features/data/home-offers-config.csv +883 -0
- data/features/data/host.yml +72 -0
- data/features/data/miles.yml +216 -0
- data/features/data/search.yml +27 -0
- data/features/data/sites.yml +39 -0
- data/features/data/tag_microsoft.yml +68 -0
- data/features/step_definitions/checkout/agencia_steps.rb +6 -0
- data/features/step_definitions/checkout/chat_steps.rb +43 -0
- data/features/step_definitions/checkout/checkout_steps.rb +144 -0
- data/features/step_definitions/checkout/cupones_steps.rb +26 -0
- data/features/step_definitions/checkout/error_messages.rb +251 -0
- data/features/step_definitions/checkout/seguros_steps.rb +78 -0
- data/features/step_definitions/checkout/thanks_steps.rb +75 -0
- data/features/step_definitions/content/contents_steps.rb +140 -0
- data/features/step_definitions/desambiguation/disambiguation_airports_steps.rb +73 -0
- data/features/step_definitions/desambiguation/disambiguation_city_steps.rb +43 -0
- data/features/step_definitions/filter/filters_airlines.rb +38 -0
- data/features/step_definitions/filter/filters_airports_steps.rb +31 -0
- data/features/step_definitions/filter/filters_price_steps.rb +87 -0
- data/features/step_definitions/filter/filters_stops_steps.rb +44 -0
- data/features/step_definitions/filter/filters_time_steps.rb +143 -0
- data/features/step_definitions/filter/matrix_steps.rb +249 -0
- data/features/step_definitions/landing/landing_checkout_steps.rb +45 -0
- data/features/step_definitions/landing/landing_filters_steps.rb +17 -0
- data/features/step_definitions/landing/landing_home_alerts_steps.rb +21 -0
- data/features/step_definitions/landing/landing_home_steps.rb +82 -0
- data/features/step_definitions/landing/landing_long_tail.rb +58 -0
- data/features/step_definitions/landing/landing_negative_steps.rb +127 -0
- data/features/step_definitions/landing/landing_passenger_review_steps.rb +8 -0
- data/features/step_definitions/landing/landing_steps.rb +325 -0
- data/features/step_definitions/orders/orders.rb +67 -0
- data/features/step_definitions/others/advancedgui_steps.rb +28 -0
- data/features/step_definitions/others/advancednogui_steps.rb +34 -0
- data/features/step_definitions/others/anticipatedsearch_steps.rb +13 -0
- data/features/step_definitions/others/flights_tracker_steps.rb +73 -0
- data/features/step_definitions/others/generic_steps.rb +35 -0
- data/features/step_definitions/others/newsletter_steps.rb +50 -0
- data/features/step_definitions/others/one_day_search.rb +58 -0
- data/features/step_definitions/others/print_steps.rb +26 -0
- data/features/step_definitions/others/querystringparameters_steps.rb +6 -0
- data/features/step_definitions/others/recommendation_steps.rb +80 -0
- data/features/step_definitions/others/render_steps.rb +70 -0
- data/features/step_definitions/others/tag_steps.rb +157 -0
- data/features/step_definitions/others/upgrade_bussines_steps.rb +27 -0
- data/features/step_definitions/results/load_steps.rb +69 -0
- data/features/step_definitions/results/results_steps.rb +21 -0
- data/features/step_definitions/results/search_steps.rb +82 -0
- data/features/step_definitions/search/alerts_steps.rb +132 -0
- data/features/step_definitions/search/basefare_steps.rb +64 -0
- data/features/step_definitions/search/bestprices_steps.rb +70 -0
- data/features/step_definitions/search/cross_sell_row_hoteles.rb +78 -0
- data/features/step_definitions/search/cross_sell_steps.rb +15 -0
- data/features/step_definitions/search/delays_steps.rb +67 -0
- data/features/step_definitions/search/details_steps.rb +9 -0
- data/features/step_definitions/search/ecoflights_steps.rb +9 -0
- data/features/step_definitions/search/fenix_steps.rb +119 -0
- data/features/step_definitions/search/flight_gui_steps.rb +312 -0
- data/features/step_definitions/search/miles_step.rb +13 -0
- data/features/step_definitions/search/pagination_steps.rb +41 -0
- data/features/step_definitions/search/reviews_step.rb +56 -0
- data/features/step_definitions/search/search_no_gui_steps.rb +185 -0
- data/features/step_definitions/search/wish_list_steps.rb +123 -0
- data/features/support/env.rb +61 -0
- data/features/support/lib/clusters/data/datos_new.rb +33 -0
- data/features/support/lib/clusters/details/details_cluster.rb +30 -0
- data/features/support/lib/clusters/results/landing_cluster.rb +29 -0
- data/features/support/lib/clusters/results/render_cluster.rb +43 -0
- data/features/support/lib/clusters/results_cluster.rb +140 -0
- data/features/support/lib/clusters.rb +5 -0
- data/features/support/lib/helpers/browser.rb +212 -0
- data/features/support/lib/helpers/checkout.rb +31 -0
- data/features/support/lib/helpers/clusters.rb +234 -0
- data/features/support/lib/helpers/landing.rb +117 -0
- data/features/support/lib/helpers/render.rb +135 -0
- data/features/support/lib/helpers.rb +5 -0
- data/features/support/lib/price.rb +66 -0
- data/features/support/lib/services/fenix.rb +14 -0
- data/features/support/lib/services/landing.rb +18 -0
- data/features/support/lib/services/results.rb +62 -0
- data/features/support/lib/services.rb +4 -0
- data/features/support/matchers.rb +120 -0
- data/features/support/redefinitions.rb +42 -0
- data/features/tests/checkout/agency.feature +33 -0
- data/features/tests/checkout/button_cac.feature +52 -0
- data/features/tests/checkout/chat.feature +20 -0
- data/features/tests/checkout/cupones.feature +54 -0
- data/features/tests/checkout/error_messages.feature +64 -0
- data/features/tests/checkout/integration.feature +215 -0
- data/features/tests/checkout/low_cost.feature +55 -0
- data/features/tests/checkout/seguros.feature +37 -0
- data/features/tests/contents/costs.feature +29 -0
- data/features/tests/contents/rules.feature +58 -0
- data/features/tests/contents/webcheckin.feature +26 -0
- data/features/tests/desambiguation/airports.feature +89 -0
- data/features/tests/desambiguation/city.feature +86 -0
- data/features/tests/filters/filters.feature +160 -0
- data/features/tests/fixes/advancedgui.feature +171 -0
- data/features/tests/fixes/advancednogui.feature +60 -0
- data/features/tests/fixes/book_no_gui.feature +21 -0
- data/features/tests/fixes/cross_sell_row_hoteles.feature +70 -0
- data/features/tests/fixes/facebook.feature +31 -0
- data/features/tests/fixes/landing_home_alerts.feature +82 -0
- data/features/tests/fixes/matrix_stops.feature +104 -0
- data/features/tests/fixes/one_day_search.feature +63 -0
- data/features/tests/fixes/print.feature +87 -0
- data/features/tests/fixes/searches_no_gui.feature +85 -0
- data/features/tests/landing/landing_alerts.feature +93 -0
- data/features/tests/landing/landing_checkout.feature +286 -0
- data/features/tests/landing/landing_filters.feature +176 -0
- data/features/tests/landing/landing_home.feature +68 -0
- data/features/tests/landing/landing_integration.feature +153 -0
- data/features/tests/landing/landing_long_tail.feature +162 -0
- data/features/tests/landing/landing_matrix.feature +156 -0
- data/features/tests/landing/landing_negative.feature +157 -0
- data/features/tests/landing/landing_orders.feature +107 -0
- data/features/tests/landing/landing_pagination.feature +142 -0
- data/features/tests/landing/landing_passenger_review.feature +139 -0
- data/features/tests/landing/landing_positive.feature +155 -0
- data/features/tests/landing/landing_reviews.feature +139 -0
- data/features/tests/landing/landing_tags.feature +148 -0
- data/features/tests/matrix/matrix_airlines.feature +104 -0
- data/features/tests/matrix/matrix_fare_chart.feature +24 -0
- data/features/tests/matrix/matrix_price.feature +35 -0
- data/features/tests/others/alerts.feature +89 -0
- data/features/tests/others/anticipatedsearch.feature +82 -0
- data/features/tests/others/flights_tracker.feature +94 -0
- data/features/tests/others/newsletter.feature +131 -0
- data/features/tests/others/querystringparameters.feature +82 -0
- data/features/tests/others/recommendation.feature +170 -0
- data/features/tests/others/semaphore.feature +206 -0
- data/features/tests/others/upgrade_bussines.feature +100 -0
- data/features/tests/search/basefare.feature +88 -0
- data/features/tests/search/itineraries.feature +85 -0
- data/features/tests/search/orders.feature +100 -0
- data/features/tests/search/pagination.feature +70 -0
- data/features/tests/search/reviews.feature +84 -0
- data/features/tests/search/searches.feature +197 -0
- data/features/tests/search/wish_list.feature +102 -0
- data/flights_gui_henry_tests.gemspec +32 -0
- data/henry-context.yml +14733 -0
- metadata +324 -0
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
|
2
|
+
def set_cookies(browser)
|
|
3
|
+
if $SITE == 'BR'
|
|
4
|
+
dominio='decolar.com'
|
|
5
|
+
elsif $SITE == 'CR'
|
|
6
|
+
dominio='despegar.co.cr'
|
|
7
|
+
elsif $SITE == 'CL'
|
|
8
|
+
dominio='despegar.cl'
|
|
9
|
+
elsif $SITE == 'US'
|
|
10
|
+
dominio='us.despegar.com'
|
|
11
|
+
else
|
|
12
|
+
dominio="despegar.com.#{$SITE.downcase}"
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
begin
|
|
16
|
+
add_cookie("X-UOW-CUSTOM","ROBOT-#{rand(1000)}",{:path=>"/"})
|
|
17
|
+
if $ENV.upcase=="BETA"
|
|
18
|
+
add_cookie("X-Version-Override",COOKIE,{:path=>"/"})
|
|
19
|
+
#browser.execute_script("javascript:void(document.cookie='X-Version-Override=landing-f-gui=beta|results-f-gui=beta;domain=#{dominio};path=/');")
|
|
20
|
+
browser.refresh
|
|
21
|
+
end
|
|
22
|
+
rescue Timeout::Error
|
|
23
|
+
stop_browser(browser)
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
sleep(2)
|
|
27
|
+
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def get_abtesting(abtesting)
|
|
31
|
+
return BROWSER.cookies.to_a.select{|cookie| cookie[:name]=="abzTestingId"}.first[:value].split(',').select{|option| option.match(/#{abtesting}/)}.first.gsub(/\D/,'').to_i
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def get_cookie(name)
|
|
35
|
+
return BROWSER.cookies.to_a.select{|cookie| cookie[:name]==name}.first
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def delete_cookie(name)
|
|
39
|
+
BROWSER.cookies.delete name
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def add_cookie(name,value,opts = {})
|
|
43
|
+
begin
|
|
44
|
+
BROWSER.cookies.add(name,value,opts)
|
|
45
|
+
rescue Selenium::WebDriver::Error::InvalidCookieDomainError
|
|
46
|
+
puts "No se pudo setear la cookie #{name}"
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def stop_browser(browser)
|
|
51
|
+
begin
|
|
52
|
+
browser.send_keys(:escape)#browser.refresh
|
|
53
|
+
rescue Timeout::Error
|
|
54
|
+
begin
|
|
55
|
+
browser.send_keys(:escape)
|
|
56
|
+
rescue Timeout::Error
|
|
57
|
+
end
|
|
58
|
+
rescue Selenium::WebDriver::Error::UnknownError
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def currency(site)
|
|
63
|
+
currency = { 'CL' => 'CLP',
|
|
64
|
+
'AR' => 'ARS',
|
|
65
|
+
'BR' => 'BRL',
|
|
66
|
+
'MX' => 'MXN',
|
|
67
|
+
'PE' => 'PEN',
|
|
68
|
+
'VE' => 'VEF',
|
|
69
|
+
'CO' => 'COP',
|
|
70
|
+
'CR' => 'CRC',
|
|
71
|
+
'PA' => 'USD',
|
|
72
|
+
'UY' => 'USD',
|
|
73
|
+
'EC' => 'USD',
|
|
74
|
+
'US' => 'USD'
|
|
75
|
+
}[site.upcase]
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def cerrar_popup
|
|
79
|
+
BROWSER.div(:class,"flights-popup popup-detail").span(:class,'popup-close-button popup-close').click
|
|
80
|
+
sleep(0.5)
|
|
81
|
+
BROWSER.div(:class,"flights-popup popup-detail").present?.should be_false
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def cargar_brasil
|
|
85
|
+
|
|
86
|
+
Time.const_set("RFC2822_DAY_NAME" , %w(dom seg ter qua qui sex s�b))
|
|
87
|
+
Time.const_set("RFC2822_MONTH_NAME" , [nil] + %w(jan fev mar abr mai jun jul ago set out nov dez))
|
|
88
|
+
Time.const_set("MonthValue",{ 'JAN' => 1, 'FEV' => 2, 'MAR' => 3, 'ABR' => 4, 'MAI' => 5, 'JUN' => 6,'JUL' => 7, 'AGO' => 8, 'SET' => 9, 'OUT' => 10, 'NOV' => 11, 'DEZ' => 12 })
|
|
89
|
+
Date.const_set("MONTHNAMES" , [nil] + %w(Janeiro Fevereiro Marco Abril Maio Junho Julho Agosto Setembro Outubro Novembro Dezembro))
|
|
90
|
+
Date.const_set("ABBR_MONTHNAMES", [nil] + %w(jan fev mar abr mai jun jul ago set out nov dez))
|
|
91
|
+
Date.const_set("DAYNAMES", ["Domingo", "segunda-feira", "terca-feira", "quarta-feira", "quinta-feira", "sexta-feira", "S�bado"])
|
|
92
|
+
Date.const_set("ABBR_DAYNAMES", %w(dom seg ter qua qui sex s�b))
|
|
93
|
+
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def cargar_latino
|
|
97
|
+
|
|
98
|
+
Time.const_set("RFC2822_DAY_NAME", %w(dom lun mar mi� jue vie s�b))
|
|
99
|
+
Time.const_set("RFC2822_MONTH_NAME",[nil] + %w(ene feb mar abr may jun jul ago sep oct nov dic))
|
|
100
|
+
Time.const_set("MonthValue", { 'ENE' => 1, 'FEB' => 2, 'MAR' => 3, 'ABR' => 4, 'MAY' => 5, 'JUN' => 6,'JUL' => 7, 'AGO' => 8, 'SEP' => 9, 'OCT' => 10, 'NOV' => 11, 'DIC' => 12 })
|
|
101
|
+
Date.const_set("MONTHNAMES", [nil] + %w(Enero Febrero Marzo Abril Mayo Junio Julio Agosto Septiembre Octubre Noviembre Diciembre))
|
|
102
|
+
Date.const_set("ABBR_MONTHNAMES", [nil] + %w(ene feb mar abr may jun jul ago sep oct nov dic))
|
|
103
|
+
Date.const_set("DAYNAMES" , %w(Domingo Lunes Martes Mi�rcoles Jueves Viernes S�bado))
|
|
104
|
+
Date.const_set("ABBR_DAYNAMES" , %w(dom lun mar mi� jue vie s�b))
|
|
105
|
+
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def cargar_usa
|
|
109
|
+
|
|
110
|
+
Time.const_set("RFC2822_DAY_NAME", %w(sun mon tue wed thu fri sat))
|
|
111
|
+
Time.const_set("RFC2822_MONTH_NAME",[nil] + %w(jan feb mar apr may jun jul aug sep oct nov dec))
|
|
112
|
+
Time.const_set("MonthValue", { 'JAN' => 1, 'FEB' => 2, 'MAR' => 3, 'APR' => 4, 'MAY' => 5, 'JUN' => 6,'JUL' => 7, 'AUG' => 8, 'SEP' => 9, 'OCT' => 10, 'NOV' => 11, 'DEC' => 12 })
|
|
113
|
+
Date.const_set("MONTHNAMES", [nil] + %w(January February March April May June July August September October November December))
|
|
114
|
+
Date.const_set("ABBR_MONTHNAMES", [nil] + %w(jan feb mar apr may jun jul aug sep oct nov dec))
|
|
115
|
+
Date.const_set("DAYNAMES" , %w(Sunday Monday Tuesday Wednesday Thursday Friday Saturday))
|
|
116
|
+
Date.const_set("ABBR_DAYNAMES" , %w(sun mon tue wed thu fri sat))
|
|
117
|
+
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
def set_site(site)
|
|
121
|
+
$SITE = site
|
|
122
|
+
case site
|
|
123
|
+
when "BR" then cargar_brasil
|
|
124
|
+
when "US" then cargar_usa
|
|
125
|
+
else cargar_latino
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
def set_language(site)
|
|
130
|
+
begin
|
|
131
|
+
if site=="US"
|
|
132
|
+
if BROWSER.li(:class,'nibbler-common-header-language nibbler-user').image(:src,/es.png/).present?
|
|
133
|
+
BROWSER.li(:class,'nibbler-common-header-language nibbler-user').links[0].click
|
|
134
|
+
BROWSER.div(:class,'popup-languages nibbler-header-popup big').image(:src,/en.png/).click
|
|
135
|
+
end
|
|
136
|
+
if BROWSER.li(:class,'ux-common-header-language nibbler-user').image(:src,/es.png/).present?
|
|
137
|
+
BROWSER.li(:class,'ux-common-header-language nibbler-user').links[0].click
|
|
138
|
+
BROWSER.div(:class,'popup-languages nibbler-header-popup big').image(:src,/en.png/).click
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
rescue Timeout::Error
|
|
142
|
+
stop_browser(BROWSER)
|
|
143
|
+
end
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
def errores_http(browser,data="")
|
|
147
|
+
|
|
148
|
+
begin
|
|
149
|
+
|
|
150
|
+
begin
|
|
151
|
+
pagina = Hpricot.parse(browser.html)
|
|
152
|
+
rescue Hpricot::ParseError
|
|
153
|
+
return false
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
if (pagina/"div#errorInfo").length>0
|
|
157
|
+
raise((pagina/"div#errorInfo").inner_html)
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
if (pagina/"div.errorPageContenido h2#disculpaLangES").inner_text.match(/Estamos trabajando/i)
|
|
161
|
+
true.should be_true
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
browser_text = Sanitize.clean(browser.html)
|
|
165
|
+
|
|
166
|
+
(browser.div(:class,"errorPageContenido").present?).should_not be_true
|
|
167
|
+
|
|
168
|
+
(browser_text =~ /Server Error/i or browser_text == nil).should_not be_true
|
|
169
|
+
|
|
170
|
+
(browser_text =~ /(HTTP error 404)|(Internet Explorer no puede mostrar la)|(Problema al cargar la)|(HTTP 403)|(El URL solicitado no se ha podido conseguir)|Service Unavailable|Bad Request|Servidor no encontrado|Proxy Error/i).should_not be_true
|
|
171
|
+
|
|
172
|
+
(browser.title =~ /Server Error in \'\/\' Application./i).should_not be_true
|
|
173
|
+
|
|
174
|
+
(browser_text =~ /Bienvenido a la agencia/i).should_not be_true
|
|
175
|
+
|
|
176
|
+
(browser.title =~ /ERROR: The requested URL could not be retrieved/i).should_not be_true
|
|
177
|
+
|
|
178
|
+
rescue Timeout::Error
|
|
179
|
+
puts "Rompio errores http"
|
|
180
|
+
rescue DRb::DRbConnError
|
|
181
|
+
puts "DRb::DRbConnError"
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
def brought_results?(browser)
|
|
187
|
+
begin
|
|
188
|
+
if browser.div(:id,'filters-error').present? or BROWSER.div(:id,'results-error').present?
|
|
189
|
+
return nil
|
|
190
|
+
else
|
|
191
|
+
doc = Hpricot.parse(browser.html)
|
|
192
|
+
return !(doc/"div#clusters/div.cluster").empty?
|
|
193
|
+
end
|
|
194
|
+
rescue Timeout::Error
|
|
195
|
+
stop_browser(browser)
|
|
196
|
+
end
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
def attach_browser(browser, how, url, timeout=10)
|
|
200
|
+
visible = nil
|
|
201
|
+
times = 0
|
|
202
|
+
while((!visible)and(times < timeout))
|
|
203
|
+
begin
|
|
204
|
+
browser.driver.switch_to.window(browser.driver.window_handles[0])
|
|
205
|
+
browser.window(how, /#{url}/).use
|
|
206
|
+
visible = true
|
|
207
|
+
rescue Watir::Exception::NoMatchingWindowFoundException
|
|
208
|
+
sleep(1)
|
|
209
|
+
times += 1
|
|
210
|
+
end
|
|
211
|
+
end
|
|
212
|
+
end
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
|
2
|
+
def validar_cuota_un_pago()
|
|
3
|
+
|
|
4
|
+
end
|
|
5
|
+
def validar_cuota_sin_intereses(total_1,total_2)
|
|
6
|
+
if BROWSER.fieldset(:class,'payment').li(:class,/selected/).span(:class,"installments-price").present?
|
|
7
|
+
doc = Hpricot.parse(BROWSER.fieldset(:class,'payment').li(:class,/selected/).span(:class,"installments-price").html)
|
|
8
|
+
inicial = (doc/"span.first-installment").inner_text.downstrip.gsub(/\./,'').match(/(\d+)$/)[1].to_i
|
|
9
|
+
valor_restantes = (doc/"span.all-installments/span.currency/span.amount").inner_text.gsub(/\./,'').to_i
|
|
10
|
+
cant_restantes = (doc/"span.all-installments").inner_text.gsub(/\./,'').match(/\+ (\d)/)[1].to_i
|
|
11
|
+
((total_2 - (inicial + (cant_restantes * valor_restantes))).abs <= 2).should be_true
|
|
12
|
+
total_1.should equal(total_2)
|
|
13
|
+
else
|
|
14
|
+
total_1.should equal(total_2)
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
def validar_cuota_con_intereses(total_1,total_2)
|
|
18
|
+
if BROWSER.ul(:class,'list').li(:class,/sub-selected/).present?
|
|
19
|
+
doc = Hpricot.parse(BROWSER.ul(:class,'list').li(:class,/sub-selected/).html)
|
|
20
|
+
unless (doc/"span.interest").inner_text.empty?
|
|
21
|
+
costo_financiero = (doc/"span.interest").inner_text.downstrip.gsub(/\./,'').match(/(\d+)$/)[1].to_i
|
|
22
|
+
inicial = (doc/"span.first-installment").inner_text.downstrip.gsub(/\./,'').match(/(\d+)$/)[1].to_i
|
|
23
|
+
cant_restantes = (doc/"span.all-installments").inner_text.downstrip.gsub(/\./,'').match(/\+ (\d{1,2})/)[1].to_i
|
|
24
|
+
valor_restantes = (doc/"span.all-installments/span.price/span.currency/span.amount").inner_text.gsub(/\./,'').to_i
|
|
25
|
+
((total_2 - (inicial + (cant_restantes * valor_restantes))).abs <= 2).should be_true
|
|
26
|
+
costo_financiero.should equal(total_2 - total_1)
|
|
27
|
+
end
|
|
28
|
+
else
|
|
29
|
+
total_1.should equal(total_2)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
|
2
|
+
def validate_fare_detail(json,cluster,i)
|
|
3
|
+
cluster_html = Hpricot.parse(cluster.html)
|
|
4
|
+
if $SITE=="PE"
|
|
5
|
+
(cluster_html/"div.fare-container span.breakdown-text").inner_text.should match('\+ Impuestos|a incluir tasas y cargos')
|
|
6
|
+
end
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def validate_cluster_miles(json,type,cluster,i)
|
|
10
|
+
cluster_html = Hpricot.parse(cluster.html)
|
|
11
|
+
if cluster.link(:class,'frequent-flyer').present?
|
|
12
|
+
if type != "multipledestinations"
|
|
13
|
+
airline = json['result']['data']['items'][i]['itinerariesBox']['frequentFlyerInfo']['airline']['code']
|
|
14
|
+
miles = json['result']['data']['items'][i]['itinerariesBox']['frequentFlyerInfo']['points']['formatted']
|
|
15
|
+
unit = json['result']['data']['items'][i]['itinerariesBox']['frequentFlyerInfo']['distanceUnit']
|
|
16
|
+
else
|
|
17
|
+
airline = json['result']['data']['items'][i]['itinerary']['itineraryInfo']['frequentFlyerInfo']['airline']['code']
|
|
18
|
+
miles = json['result']['data']['items'][i]['itinerary']['itineraryInfo']['frequentFlyerInfo']['points']['formatted']
|
|
19
|
+
unit = json['result']['data']['items'][i]['itinerary']['itineraryInfo']['frequentFlyerInfo']['distanceUnit']
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
country = case $SITE
|
|
23
|
+
when "US" then "US"
|
|
24
|
+
when "BR" then "BR"
|
|
25
|
+
else "DF"
|
|
26
|
+
end
|
|
27
|
+
data = YAML.load(File.open("features/data/miles.yml"))[country]
|
|
28
|
+
|
|
29
|
+
if miles
|
|
30
|
+
text = "#{data['text'].first.gsub(/miles/,miles).gsub(/unit/,data['unit'][unit])} "
|
|
31
|
+
else
|
|
32
|
+
text = "#{data['text'].last.gsub(/unit/,data['unit'][unit])} "
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
cluster.link(:class,'frequent-flyer').text.downcase.strip.no_accents.should match(data[airline].last.gsub(/unit/,data["unit"][unit]).downcase.strip.no_accents)
|
|
36
|
+
cluster.link(:class,'frequent-flyer').click
|
|
37
|
+
Watir::Wait.until(timeout = 100){BROWSER.div(:id,'popup-frequent-flyer').present?}
|
|
38
|
+
if BROWSER.div(:id,'popup-frequent-flyer').present?
|
|
39
|
+
doc = Hpricot.parse(BROWSER.div(:id,'popup-frequent-flyer').html)
|
|
40
|
+
(doc/"div.popup-content").inner_text.gsub(/\n\n/," ").gsub(/\n/,"").downcase.no_accents.strip.should match(text.downcase + data[airline][0].downcase.strip)
|
|
41
|
+
BROWSER.div(:id,'popup-frequent-flyer').span(:class,'popup-close-button popup-close').click
|
|
42
|
+
else
|
|
43
|
+
#nil.should be_true
|
|
44
|
+
end
|
|
45
|
+
else
|
|
46
|
+
if type != "multipledestinations"
|
|
47
|
+
(!json['result']['data']['items'][i]['itinerariesBox']['frequentFlyerInfo']).should be_true
|
|
48
|
+
else
|
|
49
|
+
(!json['result']['data']['items'][i]['itinerary']['itineraryInfo']['frequentFlyerInfo']).should be_true
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def validate_cluster_ecoflights(json,type,cluster,i)
|
|
56
|
+
|
|
57
|
+
j=0
|
|
58
|
+
if type != "multipledestinations"
|
|
59
|
+
cluster.div(:class,'itineraries').div(:class,'sub-cluster outbound').ul(:class,'itineraries-group').lis(:class,'item itinerary itinerary-required').each do |route|
|
|
60
|
+
if route.li(:class,'ecological').span(:class,'main-sprite icon-eco-flight').present?
|
|
61
|
+
json['result']['data']['items'][i]['itinerariesBox']['outboundRoutes'][j]['carbonFootprintInfo']['mostEcological'].should be_true
|
|
62
|
+
else
|
|
63
|
+
json['result']['data']['items'][i]['itinerariesBox']['outboundRoutes'][j]['carbonFootprintInfo']['mostEcological'].should be_false
|
|
64
|
+
end
|
|
65
|
+
route.li(:class,'stops').a(:class,'text').click
|
|
66
|
+
Watir::Wait.until{BROWSER.div(:class,"flights-popup popup-detail").present?}
|
|
67
|
+
json['result']['data']['items'][i]['itinerariesBox']['outboundRoutes'].collect{|outbound| (outbound['carbonFootprintInfo']['relativeWeight'] * 100).to_i}.include?(BROWSER.div(:class,"flights-popup popup-detail").span(:class,'main-sprite icon-full-leaf').style.match(/(\d+)(\.|\%)/)[1].to_i).should be_true
|
|
68
|
+
j += 1
|
|
69
|
+
cerrar_popup
|
|
70
|
+
end
|
|
71
|
+
if type == "roundtrip"
|
|
72
|
+
k=0
|
|
73
|
+
cluster.div(:class,'itineraries').div(:class,'sub-cluster inbound').ul(:class,'itineraries-group').lis(:class,'item itinerary itinerary-required').each do |route|
|
|
74
|
+
if route.li(:class,'ecological').span(:class,'main-sprite icon-eco-flight').present?
|
|
75
|
+
json['result']['data']['items'][i]['itinerariesBox']['inboundRoutes'][k]['carbonFootprintInfo']['mostEcological'].should be_true
|
|
76
|
+
else
|
|
77
|
+
json['result']['data']['items'][i]['itinerariesBox']['inboundRoutes'][k]['carbonFootprintInfo']['mostEcological'].should be_false
|
|
78
|
+
end
|
|
79
|
+
route.li(:class,'stops').a(:class,'text').click
|
|
80
|
+
Watir::Wait.until{BROWSER.div(:class,"flights-popup popup-detail").present?}
|
|
81
|
+
json['result']['data']['items'][i]['itinerariesBox']['inboundRoutes'].collect{|inbound| (inbound['carbonFootprintInfo']['relativeWeight'] * 100).to_i}.include?(BROWSER.div(:class,"flights-popup popup-detail").span(:class,'main-sprite icon-full-leaf').style.match(/(\d+)(\.|\%)/)[1].to_i).should be_true
|
|
82
|
+
k += 1
|
|
83
|
+
cerrar_popup
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
else
|
|
87
|
+
cluster.div(:class,'itineraries').divs(:class,'sub-cluster multiple').each do |route|
|
|
88
|
+
if route.li(:class,'ecological').span(:class,'main-sprite icon-eco-flight').present?
|
|
89
|
+
json['result']['data']['items'][i]['itinerary']['routes'][j]['carbonFootprintInfo']['mostEcological'].should be_true
|
|
90
|
+
else
|
|
91
|
+
json['result']['data']['items'][i]['itinerary']['routes'][j]['carbonFootprintInfo']['mostEcological'].should be_false
|
|
92
|
+
end
|
|
93
|
+
route.li(:class,'stops').a(:class,'text').click
|
|
94
|
+
Watir::Wait.until{BROWSER.div(:class,"flights-popup popup-detail").present?}
|
|
95
|
+
json['result']['data']['items'][i]['itinerary']['routes'].collect{|aux|(aux['carbonFootprintInfo']['relativeWeight'] * 100).to_i}.include?(BROWSER.div(:class,"flights-popup popup-detail").span(:class,'main-sprite icon-full-leaf').style.match(/(\d+)(\.|\%)/)[1].to_i).should be_true
|
|
96
|
+
j += 1
|
|
97
|
+
cerrar_popup
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def validate_cluster_details(json,type,cluster,i,itinerary)
|
|
104
|
+
j=0
|
|
105
|
+
BROWSER.div(:class,'show-and-hide-clusters').link(:class,'toggle-clusters show-clusters').click if BROWSER.div(:class,'show-and-hide-clusters').link(:class,'toggle-clusters show-clusters').present?
|
|
106
|
+
if type != "multipledestinations"
|
|
107
|
+
cluster.div(:class,'itineraries').div(:class,'sub-cluster outbound').span(:class,'showMoreItineraries').click if cluster.div(:class,'itineraries').div(:class,'sub-cluster outbound').span(:class,'showMoreItineraries').present?
|
|
108
|
+
cluster.div(:class,'itineraries').div(:class,'sub-cluster outbound').ul(:class,'itineraries-group cluster-items-list').lis(:class,/item itinerary cluster-item/).each do |route|
|
|
109
|
+
recorrer_segmentos(route,itinerary.idas[j])
|
|
110
|
+
j += 1
|
|
111
|
+
cerrar_popup
|
|
112
|
+
end
|
|
113
|
+
if type == "roundtrip"
|
|
114
|
+
k=0
|
|
115
|
+
cluster.div(:class,'itineraries').div(:class,'sub-cluster inbound').span(:class,'showMoreItineraries').click if cluster.div(:class,'itineraries').div(:class,'sub-cluster inbound').span(:class,'showMoreItineraries').present?
|
|
116
|
+
cluster.div(:class,'itineraries').div(:class,'sub-cluster inbound').ul(:class,'itineraries-group cluster-items-list').lis(:class,/item itinerary cluster-item/).each do |route|
|
|
117
|
+
recorrer_segmentos(route,itinerary.vueltas[k])
|
|
118
|
+
k += 1
|
|
119
|
+
cerrar_popup
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
else
|
|
123
|
+
cluster.div(:class,'itineraries').divs(:class,'sub-cluster multiple').each do |route|
|
|
124
|
+
#recorrer_segmentos(route,(itinerary.idas+itinerary.vueltas)[j])
|
|
125
|
+
#j += 1
|
|
126
|
+
#cerrar_popup
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
def validate_itins_cluster_details(json,type,cluster,i)
|
|
132
|
+
if type != "multipledestinations"
|
|
133
|
+
outbound = cluster.div(:class,'itineraries').div(:class,'sub-cluster outbound').ul(:class,'item data')
|
|
134
|
+
(@search.city_from_1.airports.include?(outbound.lis(:class,'airport')[0].text)).should be_true
|
|
135
|
+
(@search.city_to_1.airports.include?(outbound.lis(:class,'airport')[1].text)).should be_true
|
|
136
|
+
outbound.li(:class,'city-departure').text.no_accents.downcase.gsub(",","").strip.should equal(@search.city_from_1.name($SITE).downcase) unless outbound.li(:class,'city-departure').text.downcase.no_accents.gsub(",","").strip.match("toluca|campinas")
|
|
137
|
+
outbound.li(:class,'city-arrival').text.no_accents.downcase.gsub(",","").strip.should equal(@search.city_to_1.name($SITE).downcase) unless outbound.li(:class,'city-arrival').text.downcase.no_accents.gsub(",","").strip.match("toluca|campinas")
|
|
138
|
+
if type == "roundtrip"
|
|
139
|
+
inbound = cluster.div(:class,'itineraries').div(:class,'sub-cluster inbound').ul(:class,'item data')
|
|
140
|
+
(@search.city_to_1.airports.include?(inbound.lis(:class,'airport')[0].text)).should be_true
|
|
141
|
+
(@search.city_from_1.airports.include?(inbound.lis(:class,'airport')[1].text)).should be_true
|
|
142
|
+
inbound.li(:class,'city-departure').text.no_accents.downcase.gsub(",","").strip.should equal(@search.city_to_1.name($SITE).downcase) unless inbound.li(:class,'city-departure').text.downcase.no_accents.gsub(",","").strip.match("toluca|campinas")
|
|
143
|
+
end
|
|
144
|
+
else
|
|
145
|
+
|
|
146
|
+
end
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
def recorrer_segmentos(route,cluster)
|
|
150
|
+
route.li(:class,'stops').a(:class,'text').click
|
|
151
|
+
Watir::Wait.until{BROWSER.div(:class,"flights-popup popup-detail").present?}
|
|
152
|
+
doc = Hpricot.parse(BROWSER.div(:class,"flights-popup popup-detail").html)
|
|
153
|
+
detail = DetailsCluster.new(doc)
|
|
154
|
+
detail.duracion.should match(/#{cluster.duracion}/)
|
|
155
|
+
detail.tramos.first['ciudad_origen'].should match(cluster.origen)
|
|
156
|
+
detail.tramos.last['ciudad_destino'].should match(cluster.destino)
|
|
157
|
+
cluster.fecha.should equal(detail.tramos.first['fecha_origen'])
|
|
158
|
+
cluster.hou_sal_ida.should equal(detail.tramos.first['hora_origen'])
|
|
159
|
+
#reglas_de_vuelo()
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
def reglas_de_vuelo()
|
|
163
|
+
popup = BROWSER.div(:class,"flights-popup popup-detail")
|
|
164
|
+
popup.div(:class,'top-box').a(:class,'show-rules').should visible
|
|
165
|
+
popup.div(:class,'detail').div(:class,'detail-footer').div(:class,'rules').should_not visible
|
|
166
|
+
popup.div(:class,'top-box').a(:class,'show-rules').click
|
|
167
|
+
popup.div(:class,'detail').div(:class,'detail-footer').div(:class,'rules').should visible
|
|
168
|
+
popup.div(:class,'detail').div(:class,'detail-footer').div(:class,'rules').div(:class,'text').text.strip.no_accents.should match(/El boleto que usted esta comprando est.{1,2} sujeto a reglas y restricciones impuestas por la aerol.{1,2}nea transportadora|No incluye impuestos, no reembolsable, aplica penalidad|Estos tickets No permiten cambios NI devoluciones parciales|O bilhete que voc.{1,2} est.{1,2} para adquirir est.{1,2} sujeito a regras e restri.{1,2}.{1,2}es impostas pela companhia a.{1,2}rea transportadora/)
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
def validate_cluster_with_headers(type,cluster,i)
|
|
172
|
+
cluster_html = Hpricot.parse(cluster.html)
|
|
173
|
+
(cluster_html/"li.itineraries-title ul li").collect{|li| li.inner_text.no_accents.downstrip if !li.inner_text.empty?}.compact.join('-').should match("sale-llega-duracion-escalas|sai-chega-duracao-paradas")
|
|
174
|
+
if type == "roundtrip"
|
|
175
|
+
((cluster_html/"li.itineraries-title").length == 2).should be_true
|
|
176
|
+
elsif type == "oneway"
|
|
177
|
+
((cluster_html/"li.itineraries-title").length == 1).should be_true
|
|
178
|
+
else
|
|
179
|
+
((cluster_html/"li.itineraries-title").length == 3).should be_true
|
|
180
|
+
end
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
def validate_cluster_ancillaries(json,type,cluster,i)
|
|
184
|
+
if $SITE=="US"
|
|
185
|
+
j=0
|
|
186
|
+
if type != "multipledestinations"
|
|
187
|
+
cluster.div(:class,'itineraries').div(:class,'sub-cluster outbound').ul(:class,'itineraries-group').lis(:class,'item itinerary cluster-item').each do |route|
|
|
188
|
+
json['result']['data']['items'][i]['itinerariesBox']['outboundRoutes'][j]['ancillaryTypes'].each do |amenity|
|
|
189
|
+
route.li(:class,'ancillaries').span(:class,"icon-ancillaries icon-ancillaries-#{amenity}").should visible
|
|
190
|
+
# (route.li(:class,'ancillaries').span(:class,"icon-ancillaries icon-ancillaries-#{amenity}")).click
|
|
191
|
+
# popup = Hpricot.parse(BROWSER.div(:class,'flights-popup popup-ancillary').html)
|
|
192
|
+
# if amenity == 'INTERNET_ACCESS'
|
|
193
|
+
# popup.div(:class,'popup-header').inner_text.no_accents.strip.should match(/WIFI/)
|
|
194
|
+
# else
|
|
195
|
+
# if amenity == 'MEALS'
|
|
196
|
+
# popup.div(:class,'popup-header').inner_text.no_accents.strip.should match(/Comidas/)
|
|
197
|
+
# else amenity == 'BAGGAGE'
|
|
198
|
+
# popup.div(:class,'popup-header').inner_text.no_accents.strip.should match(/Equipaje por pasajero/)
|
|
199
|
+
# end
|
|
200
|
+
# end
|
|
201
|
+
end
|
|
202
|
+
j += 1
|
|
203
|
+
# cerrar_popup
|
|
204
|
+
end
|
|
205
|
+
if type == "roundtrip"
|
|
206
|
+
cluster.div(:class,'itineraries').div(:class,'sub-cluster inbound').ul(:class,'itineraries-group').lis(:class,'item itinerary cluster-item').each do |route|
|
|
207
|
+
json['result']['data']['items'][i]['itinerariesBox']['inboundRoutes'][j]['ancillaryTypes'].each do |amenity|
|
|
208
|
+
route.li(:class,'ancillaries').span(:class,"icon-ancillaries icon-ancillaries-#{amenity}").should visible
|
|
209
|
+
end
|
|
210
|
+
j += 1
|
|
211
|
+
end
|
|
212
|
+
else
|
|
213
|
+
cluster.div(:class,'itineraries').div(:class,'sub-cluster multiple').ul(:class,'itineraries-group').lis(:class,'item itinerary cluster-item').each do |route|
|
|
214
|
+
json['result']['data']['items'][i]['itinerary']['routes'][j]['ancillaryTypes'].each do |amenity|
|
|
215
|
+
route.li(:class,'ancillaries').span(:class,"icon-ancillaries icon-ancillaries-#{amenity}").should visible
|
|
216
|
+
end
|
|
217
|
+
j += 1
|
|
218
|
+
end
|
|
219
|
+
end
|
|
220
|
+
end
|
|
221
|
+
end
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
def validate_cluster_payments(cluster)
|
|
225
|
+
if(cluster.div(:class,'actions').link(:class,'payments').present?)
|
|
226
|
+
cluster.div(:class,'actions').link(:class,'payments').click
|
|
227
|
+
Watir::Wait.until{BROWSER.div(:id,"popup-payments").present?}
|
|
228
|
+
popup = Hpricot.parse(BROWSER.div(:id,"popup-payments").html)
|
|
229
|
+
BROWSER.div(:id,"popup-payments").span(:class,'popup-close-button popup-close').click
|
|
230
|
+
Watir::Wait.until{!BROWSER.div(:id,"popup-payments").present?}
|
|
231
|
+
else
|
|
232
|
+
cluster.div(:class,'actions').text.should_not match("pagos|cuotas|installments|juros")
|
|
233
|
+
end
|
|
234
|
+
end
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
|
2
|
+
|
|
3
|
+
#resetear filtros a la busqueda de landing por default
|
|
4
|
+
def reset_filter()
|
|
5
|
+
BROWSER.div(:class,'ux-common-filters ux-flights-filters filterApplied').links[0].click if BROWSER.div(:class,'ux-common-filters ux-flights-filters filterApplied').present?
|
|
6
|
+
Watir::Wait.until{!BROWSER.div(:class,'ux-common-filters ux-flights-filters filterApplied').present?}
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def filter_panel()
|
|
10
|
+
return BROWSER.divs(:class,/ux-flights-filter-departures/)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
#muestra los filtros que estan ocultos
|
|
14
|
+
def see_filter(index)
|
|
15
|
+
begin
|
|
16
|
+
BROWSER.span(:class=>'ux-common-filter-toggle',:index=>index).click
|
|
17
|
+
rescue Watir::Wait::TimeoutError, Timeout::Error
|
|
18
|
+
stop_browser(BROWSER)
|
|
19
|
+
rescue Selenium::WebDriver::Error::UnknownError
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
#aplicar filtro
|
|
24
|
+
def apply_filter(filter)
|
|
25
|
+
value = (filter/'input').first.attributes['value']
|
|
26
|
+
if BROWSER.checkbox(:value,value).present?
|
|
27
|
+
begin
|
|
28
|
+
BROWSER.checkbox(:value,value).click
|
|
29
|
+
Watir::Wait.until(timeout = 120){!BROWSER.div(:id,'results-loader').present? and !BROWSER.div(:id,'results-update').present? and !BROWSER.div(:class,'results-update').present? and !BROWSER.div(:class,'update-message').present?}
|
|
30
|
+
if BROWSER.div(:class,'noResults').present? or BROWSER.span(:class,'commonSprite warningSymbol').present?
|
|
31
|
+
BROWSER.back
|
|
32
|
+
else
|
|
33
|
+
validate_filter(filter)
|
|
34
|
+
end
|
|
35
|
+
rescue Watir::Wait::TimeoutError, Timeout::Error
|
|
36
|
+
stop_browser(BROWSER)
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
return value
|
|
40
|
+
end
|
|
41
|
+
#validacion de filtros
|
|
42
|
+
def validate_filter(filter)
|
|
43
|
+
doc = Hpricot.parse(BROWSER.html)
|
|
44
|
+
clusters = load_clusters(doc)
|
|
45
|
+
text = (filter/"span.label").inner_text.no_accents
|
|
46
|
+
match = text.match(/\+/) ? text.match(/(\D+)(\d+)(\D+)/)[2] : text.match(/(\d+)(\D+)/)[1]
|
|
47
|
+
validate_price(Price.new((filter/"span.total span.price-currency").inner_text),clusters.first.tarifas['tarifa_adulto'] || clusters.first.tarifas['tarifa_adulto_dolar'])
|
|
48
|
+
validate_filter_text_applied(match,doc)
|
|
49
|
+
validate_stay_filter(clusters,match)
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
#############################VALIDACION FILTROS
|
|
53
|
+
#se valida que el filtro por fechas se aplique correctamente en los resultados mostrados
|
|
54
|
+
def validate_stay_filter(clusters,match)
|
|
55
|
+
clusters.each do |cluster|
|
|
56
|
+
cluster.idas.each do |ida|
|
|
57
|
+
departure = cluster.ida.fecha
|
|
58
|
+
filter_dates = BROWSER.url.match(/(.+)allowedDateRanges=(.+)_(.+)/)
|
|
59
|
+
(departure < Date.parse(filter_dates[2])) or (departure > Date.parse(filter_dates[3])).should_not be_true
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
#se valida que el filtro por dias se aplique correctamente en los resultados mostrados
|
|
64
|
+
def validate_day_filter(clusters,match,text)
|
|
65
|
+
clusters.each do |cluster|
|
|
66
|
+
departure,_return = cluster.ida.fecha,cluster.vuelta.fecha
|
|
67
|
+
if text.match(/\+/)
|
|
68
|
+
((_return-departure).abs < match.to_i).should_not be_true
|
|
69
|
+
else
|
|
70
|
+
(((_return-departure)-match.to_i).abs > 1).should_not be_true
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
#se valida que la leyenda del filtro aplicado sea correcta
|
|
76
|
+
def validate_filter_text_applied(match,doc)
|
|
77
|
+
(doc/"div.filterApplied span.label").inner_text.no_accents.strip.match(match.to_s)
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
#valida que el precio del filtro corresponda con el del primer cluster
|
|
81
|
+
def validate_price(filter_price,filter_cluster)
|
|
82
|
+
#$logger.info("#{filter_price} != #{filter_cluster}") if (filter_price != filter_cluster)
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def load_clusters(html,type = "roundtrip")
|
|
86
|
+
clusters = Array.new
|
|
87
|
+
doc = Hpricot.parse(BROWSER.div(:id,'clusters').html)
|
|
88
|
+
(doc/"div.cluster").each_with_index do |cluster,i|
|
|
89
|
+
clusters << LandingCluster.new(type,cluster)
|
|
90
|
+
end
|
|
91
|
+
return clusters
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def load_clusters_details(html)
|
|
95
|
+
clusters = Array.new
|
|
96
|
+
doc = Hpricot.parse(BROWSER.div(:id,'clusters').html)
|
|
97
|
+
(doc/"div.cluster").each_with_index do |cluster,i|
|
|
98
|
+
_cluster = {"idas"=>Array.new,"vueltas"=>Array.new}
|
|
99
|
+
(cluster/"div.outbound li.cluster-item").each_with_index do |item,j|
|
|
100
|
+
BROWSER.div(:class=>"cluster",:index=>i).div(:class,'sub-cluster outbound').span(:class,'showMoreItineraries').click if BROWSER.div(:class=>"cluster",:index=>i).div(:class,'sub-cluster outbound').span(:class,'showMoreItineraries').present?
|
|
101
|
+
BROWSER.div(:class=>"cluster",:index=>i).div(:class,"sub-cluster outbound").li(:class=>'item itinerary cluster-item',:index=>j).li(:class,'stops').link(:class,'text').click
|
|
102
|
+
_cluster["idas"] << DetailsCluster.new(Hpricot.parse(BROWSER.div(:id,"popup-detail").html))
|
|
103
|
+
BROWSER.div(:id,"popup-detail").span(:class,'popup-close-button popup-close').click
|
|
104
|
+
sleep(0.25)
|
|
105
|
+
end
|
|
106
|
+
(cluster/"div.inbound li.cluster-item").each_with_index do |item,j|
|
|
107
|
+
BROWSER.div(:class=>"cluster",:index=>i).div(:class,'sub-cluster inbound').span(:class,'showMoreItineraries').click if BROWSER.div(:class=>"cluster",:index=>i).div(:class,'sub-cluster inbound').span(:class,'showMoreItineraries').present?
|
|
108
|
+
BROWSER.div(:class=>"cluster",:index=>i).div(:class,"sub-cluster inbound").li(:class=>'item itinerary cluster-item',:index=>j).li(:class,'stops').link(:class,'text').click
|
|
109
|
+
_cluster["vueltas"] << DetailsCluster.new(Hpricot.parse(BROWSER.div(:id,"popup-detail").html))
|
|
110
|
+
BROWSER.div(:id,"popup-detail").span(:class,'popup-close-button popup-close').click
|
|
111
|
+
sleep(0.25)
|
|
112
|
+
end
|
|
113
|
+
clusters << _cluster
|
|
114
|
+
break if i > 2
|
|
115
|
+
end
|
|
116
|
+
return clusters
|
|
117
|
+
end
|