flights_gui_henry_tests_ds 0.0.16
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +3 -0
- data/features/data/home-offers-config.csv +883 -0
- data/features/data/host.yml +78 -0
- data/features/data/miles.yml +216 -0
- data/features/data/search.yml +27 -0
- data/features/data/sites.yml +49 -0
- data/features/data/sites.yml.orig +54 -0
- data/features/data/tag_microsoft.yml +68 -0
- data/features/step_definitions/checkout/agencia_steps.rb +6 -0
- data/features/step_definitions/checkout/cash_payment_steps.rb +70 -0
- data/features/step_definitions/checkout/chat_steps.rb +57 -0
- data/features/step_definitions/checkout/checkout_steps.rb +265 -0
- data/features/step_definitions/checkout/cupones_steps.rb +36 -0
- data/features/step_definitions/checkout/error_messages.rb +291 -0
- data/features/step_definitions/checkout/fast_checkout.rb +55 -0
- data/features/step_definitions/checkout/price_jump_steps.rb +70 -0
- data/features/step_definitions/checkout/seguros_steps.rb +79 -0
- data/features/step_definitions/checkout/thanks_steps.rb +81 -0
- data/features/step_definitions/content/contents_steps.rb +140 -0
- data/features/step_definitions/desambiguation/disambiguation_airports_steps.rb +82 -0
- data/features/step_definitions/desambiguation/disambiguation_city_steps.rb +53 -0
- data/features/step_definitions/filter/filters_airlines.rb +37 -0
- data/features/step_definitions/filter/filters_airports_steps.rb +31 -0
- data/features/step_definitions/filter/filters_price_steps.rb +91 -0
- data/features/step_definitions/filter/filters_stops_steps.rb +44 -0
- data/features/step_definitions/filter/filters_time_steps.rb +146 -0
- data/features/step_definitions/filter/matrix_steps.rb +276 -0
- data/features/step_definitions/landing/landing_checkout_steps.rb +49 -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 +128 -0
- data/features/step_definitions/landing/landing_passenger_review_steps.rb +8 -0
- data/features/step_definitions/landing/landing_steps.rb +348 -0
- data/features/step_definitions/orders/orders.rb +83 -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/cookies_steps.rb +40 -0
- data/features/step_definitions/others/flights_tracker_steps.rb +74 -0
- data/features/step_definitions/others/generic_steps.rb +33 -0
- data/features/step_definitions/others/newsletter_steps.rb +29 -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 +78 -0
- data/features/step_definitions/others/render_steps.rb +70 -0
- data/features/step_definitions/others/tag_steps.rb +164 -0
- data/features/step_definitions/others/upgrade_bussines_steps.rb +27 -0
- data/features/step_definitions/results/devtools_steps.rb +10 -0
- data/features/step_definitions/results/itineraries_steps.rb +43 -0
- data/features/step_definitions/results/load_steps.rb +73 -0
- data/features/step_definitions/results/results_steps.rb +79 -0
- data/features/step_definitions/results/search_steps.rb +115 -0
- data/features/step_definitions/search/alerts_steps.rb +132 -0
- data/features/step_definitions/search/basefare_steps.rb +88 -0
- data/features/step_definitions/search/bestprices_steps.rb +70 -0
- data/features/step_definitions/search/cross_sell_row_hoteles.rb +52 -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/errors_steps.rb +24 -0
- data/features/step_definitions/search/fenix_steps.rb +99 -0
- data/features/step_definitions/search/flight_gui_steps.rb +376 -0
- data/features/step_definitions/search/miles_step.rb +13 -0
- data/features/step_definitions/search/pagination_steps.rb +29 -0
- data/features/step_definitions/search/reviews_step.rb +58 -0
- data/features/step_definitions/search/search_no_gui_steps.rb +185 -0
- data/features/step_definitions/search/wish_list_steps.rb +128 -0
- data/features/support/env.rb +86 -0
- data/features/support/lib/clusters.rb +6 -0
- data/features/support/lib/clusters/checkout_cluster.rb +111 -0
- data/features/support/lib/clusters/data/data.rb +33 -0
- data/features/support/lib/clusters/details/details_cluster.rb +36 -0
- data/features/support/lib/clusters/results/landing_cluster.rb +87 -0
- data/features/support/lib/clusters/results/render_cluster.rb +86 -0
- data/features/support/lib/clusters/results_cluster.rb +168 -0
- data/features/support/lib/helpers.rb +5 -0
- data/features/support/lib/helpers/browser.rb +235 -0
- data/features/support/lib/helpers/checkout.rb +29 -0
- data/features/support/lib/helpers/clusters.rb +166 -0
- data/features/support/lib/helpers/landing.rb +121 -0
- data/features/support/lib/helpers/render.rb +135 -0
- data/features/support/lib/price.rb +66 -0
- data/features/support/lib/process_manager.rb +104 -0
- data/features/support/lib/services.rb +4 -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/matchers.rb +120 -0
- data/features/support/redefinitions.rb +42 -0
- data/features/tests/checkout/agency.feature +27 -0
- data/features/tests/checkout/button_cac.feature +53 -0
- data/features/tests/checkout/cash_payment.feature +50 -0
- data/features/tests/checkout/compras_duplicadas.feature +95 -0
- data/features/tests/checkout/cupones.feature +34 -0
- data/features/tests/checkout/error_messages.feature +80 -0
- data/features/tests/checkout/fast_checkout.feature +82 -0
- data/features/tests/checkout/integration.feature +235 -0
- data/features/tests/checkout/low_cost.feature +62 -0
- data/features/tests/checkout/online_payment.feature +50 -0
- data/features/tests/checkout/price_jump.feature +103 -0
- data/features/tests/checkout/providers.feature +76 -0
- data/features/tests/checkout/seguros.feature +42 -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/airports_landing.feature +88 -0
- data/features/tests/desambiguation/city.feature +86 -0
- data/features/tests/filters/filters.feature +113 -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_checkout.feature +286 -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/fixes/upgrade_bussines.feature +100 -0
- data/features/tests/landing/landing_alerts.feature +93 -0
- data/features/tests/landing/landing_filters.feature +171 -0
- data/features/tests/landing/landing_home.feature +68 -0
- data/features/tests/landing/landing_integration.feature +149 -0
- data/features/tests/landing/landing_long_tail.feature +169 -0
- data/features/tests/landing/landing_matrix.feature +152 -0
- data/features/tests/landing/landing_negative.feature +151 -0
- data/features/tests/landing/landing_orders.feature +79 -0
- data/features/tests/landing/landing_pagination.feature +141 -0
- data/features/tests/landing/landing_passenger_review.feature +135 -0
- data/features/tests/landing/landing_positive.feature +151 -0
- data/features/tests/landing/landing_reviews.feature +135 -0
- data/features/tests/landing/landing_sort.feature +140 -0
- data/features/tests/landing/landing_tags.feature +142 -0
- data/features/tests/matrix/matrix_airlines.feature +80 -0
- data/features/tests/matrix/matrix_fare_chart.feature +40 -0
- data/features/tests/matrix/matrix_price.feature +40 -0
- data/features/tests/others/alerts.feature +89 -0
- data/features/tests/others/anticipatedsearch.feature +82 -0
- data/features/tests/others/chat.feature +23 -0
- data/features/tests/others/flights_tracker.feature +94 -0
- data/features/tests/others/newsletter.feature +118 -0
- data/features/tests/others/querystringparameters.feature +82 -0
- data/features/tests/others/recommendation.feature +107 -0
- data/features/tests/others/semaphore.feature +206 -0
- data/features/tests/search/basefare.feature +89 -0
- data/features/tests/search/errors.feature +198 -0
- data/features/tests/search/itineraries.feature +92 -0
- data/features/tests/search/orders.feature +88 -0
- data/features/tests/search/pagination.feature +73 -0
- data/features/tests/search/reviews.feature +83 -0
- data/features/tests/search/searches.feature +214 -0
- data/features/tests/search/wish_list.feature +58 -0
- data/flights_gui_henry_tests.gemspec +32 -0
- data/henry-context.yml +17262 -0
- metadata +382 -0
@@ -0,0 +1,235 @@
|
|
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
|
+
uow = "ROBOT-DS-#{Socket.gethostname}-#{rand(1000)}"
|
17
|
+
puts uow
|
18
|
+
browser.execute_script("javascript:void(document.cookie = 'X-UOW-CUSTOM=#{uow}; Path=/')")
|
19
|
+
#add_cookie("X-UOW-CUSTOM","ROBOTFGUI-#{Socket.gethostname}-#{rand(1000)}",{:path=>"/"})
|
20
|
+
if $ENV.upcase=="BETA" #or PROVIDER
|
21
|
+
#add_cookie("X-Version-Override",COOKIE,{:path=>"/"})
|
22
|
+
# if PROVIDER
|
23
|
+
# browser.execute_script("javascript:void(document.cookie='XDESP-FDBS-PROVIDER=#{PROVIDER};path=/');")
|
24
|
+
# end
|
25
|
+
if $ENV.upcase=="BETA"
|
26
|
+
browser.execute_script("javascript:void(document.cookie='X-Version-Override=#{COOKIE};domain=#{dominio};path=/');")
|
27
|
+
end
|
28
|
+
browser.refresh
|
29
|
+
end
|
30
|
+
rescue Timeout::Error
|
31
|
+
stop_browser(browser)
|
32
|
+
end
|
33
|
+
|
34
|
+
sleep(2)
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
def get_abtesting(abtesting)
|
39
|
+
begin
|
40
|
+
return BROWSER.cookies.to_a.select{|cookie| cookie[:name]=="abzTestingId"}.first[:value].split(',').select{|option| option.match(/#{abtesting}/)}.first.gsub(/\D/,'').to_i
|
41
|
+
rescue NoMethodError
|
42
|
+
return 0
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def get_cookie(name)
|
47
|
+
return BROWSER.cookies.to_a.select{|cookie| cookie[:name]==name}.first
|
48
|
+
end
|
49
|
+
|
50
|
+
def delete_cookie(name)
|
51
|
+
BROWSER.cookies.delete name
|
52
|
+
end
|
53
|
+
|
54
|
+
def add_cookie(name,value,opts = {})
|
55
|
+
begin
|
56
|
+
BROWSER.cookies.add(name,value,opts)
|
57
|
+
rescue Selenium::WebDriver::Error::InvalidCookieDomainError
|
58
|
+
puts "No se pudo setear la cookie #{name}"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def stop_browser(browser)
|
63
|
+
begin
|
64
|
+
browser.send_keys(:escape)#browser.refresh
|
65
|
+
rescue Timeout::Error
|
66
|
+
begin
|
67
|
+
browser.send_keys(:escape)
|
68
|
+
rescue Timeout::Error
|
69
|
+
end
|
70
|
+
rescue Selenium::WebDriver::Error::UnknownError
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def currency(site)
|
75
|
+
currency = { 'CL' => 'CLP',
|
76
|
+
'AR' => 'ARS',
|
77
|
+
'BR' => 'BRL',
|
78
|
+
'MX' => 'MXN',
|
79
|
+
'PE' => 'PEN',
|
80
|
+
'VE' => 'VEF',
|
81
|
+
'CO' => 'COP',
|
82
|
+
'CR' => 'CRC',
|
83
|
+
'PA' => 'USD',
|
84
|
+
'UY' => 'USD',
|
85
|
+
'EC' => 'USD',
|
86
|
+
'US' => 'USD'
|
87
|
+
}[site.upcase]
|
88
|
+
end
|
89
|
+
|
90
|
+
def cerrar_popup
|
91
|
+
BROWSER.div(:class,"flights-popup popup-detail").span(:class,'popup-close-button popup-close').click
|
92
|
+
sleep(0.5)
|
93
|
+
BROWSER.div(:class,"flights-popup popup-detail").present?.should be_false
|
94
|
+
end
|
95
|
+
|
96
|
+
def cargar_brasil
|
97
|
+
|
98
|
+
Time.const_set("RFC2822_DAY_NAME" , %w(dom seg ter qua qui sex s�b))
|
99
|
+
Time.const_set("RFC2822_MONTH_NAME" , [nil] + %w(jan fev mar abr mai jun jul ago set out nov dez))
|
100
|
+
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 })
|
101
|
+
Date.const_set("MONTHNAMES" , [nil] + %w(Janeiro Fevereiro Marco Abril Maio Junho Julho Agosto Setembro Outubro Novembro Dezembro))
|
102
|
+
Date.const_set("ABBR_MONTHNAMES", [nil] + %w(jan fev mar abr mai jun jul ago set out nov dez))
|
103
|
+
Date.const_set("DAYNAMES", ["Domingo", "segunda-feira", "terca-feira", "quarta-feira", "quinta-feira", "sexta-feira", "S�bado"])
|
104
|
+
Date.const_set("ABBR_DAYNAMES", %w(dom seg ter qua qui sex s�b))
|
105
|
+
|
106
|
+
end
|
107
|
+
|
108
|
+
def cargar_latino
|
109
|
+
|
110
|
+
Time.const_set("RFC2822_DAY_NAME", %w(dom lun mar mi� jue vie s�b))
|
111
|
+
Time.const_set("RFC2822_MONTH_NAME",[nil] + %w(ene feb mar abr may jun jul ago sep oct nov dic))
|
112
|
+
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 })
|
113
|
+
Date.const_set("MONTHNAMES", [nil] + %w(Enero Febrero Marzo Abril Mayo Junio Julio Agosto Septiembre Octubre Noviembre Diciembre))
|
114
|
+
Date.const_set("ABBR_MONTHNAMES", [nil] + %w(ene feb mar abr may jun jul ago sep oct nov dic))
|
115
|
+
Date.const_set("DAYNAMES" , %w(Domingo Lunes Martes Mi�rcoles Jueves Viernes S�bado))
|
116
|
+
Date.const_set("ABBR_DAYNAMES" , %w(dom lun mar mi� jue vie s�b))
|
117
|
+
|
118
|
+
end
|
119
|
+
|
120
|
+
def cargar_usa
|
121
|
+
|
122
|
+
Time.const_set("RFC2822_DAY_NAME", %w(sun mon tue wed thu fri sat))
|
123
|
+
Time.const_set("RFC2822_MONTH_NAME",[nil] + %w(jan feb mar apr may jun jul aug sep oct nov dec))
|
124
|
+
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 })
|
125
|
+
Date.const_set("MONTHNAMES", [nil] + %w(January February March April May June July August September October November December))
|
126
|
+
Date.const_set("ABBR_MONTHNAMES", [nil] + %w(jan feb mar apr may jun jul aug sep oct nov dec))
|
127
|
+
Date.const_set("DAYNAMES" , %w(Sunday Monday Tuesday Wednesday Thursday Friday Saturday))
|
128
|
+
Date.const_set("ABBR_DAYNAMES" , %w(sun mon tue wed thu fri sat))
|
129
|
+
|
130
|
+
end
|
131
|
+
|
132
|
+
def set_site(site)
|
133
|
+
$SITE = site
|
134
|
+
case site
|
135
|
+
when "BR" then cargar_brasil
|
136
|
+
when "US" then cargar_usa
|
137
|
+
else cargar_latino
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
def set_language(site)
|
142
|
+
begin
|
143
|
+
if site=="US"
|
144
|
+
if BROWSER.li(:class,'nibbler-common-header-language nibbler-user').image(:src,/es.png/).present?
|
145
|
+
BROWSER.li(:class,'nibbler-common-header-language nibbler-user').links[0].click
|
146
|
+
BROWSER.execute_script("javascript:void($(\".popup-languages img\").click());")
|
147
|
+
end
|
148
|
+
if BROWSER.li(:class,'nibbler-common-header-language').image(:src,/es.png/).present?
|
149
|
+
BROWSER.li(:class,'nibbler-common-header-language').links[0].click
|
150
|
+
BROWSER.execute_script("javascript:void($(\".nibbler-common-header-language-popup a\").click());")
|
151
|
+
end
|
152
|
+
end
|
153
|
+
rescue Selenium::WebDriver::Error::UnknownError
|
154
|
+
if site=="US"
|
155
|
+
if BROWSER.li(:class,'nibbler-common-header-language nibbler-user').image(:src,/es.png/).present?
|
156
|
+
BROWSER.li(:class,'nibbler-common-header-language nibbler-user').links[0].click
|
157
|
+
BROWSER.execute_script("javascript:void($(\".popup-languages a\").click());")
|
158
|
+
end
|
159
|
+
if BROWSER.li(:class,'nibbler-common-header-language').image(:src,/es.png/).present?
|
160
|
+
BROWSER.li(:class,'nibbler-common-header-language').links[0].click
|
161
|
+
BROWSER.execute_script("javascript:void($(\".nibbler-common-header-language-popup img\").click());")
|
162
|
+
end
|
163
|
+
end
|
164
|
+
rescue Timeout::Error
|
165
|
+
stop_browser(BROWSER)
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
def errores_http(browser,data="")
|
170
|
+
|
171
|
+
begin
|
172
|
+
|
173
|
+
begin
|
174
|
+
pagina = Hpricot.parse(browser.html)
|
175
|
+
rescue Hpricot::ParseError
|
176
|
+
return false
|
177
|
+
end
|
178
|
+
|
179
|
+
if (pagina/"div#errorInfo").length>0
|
180
|
+
raise((pagina/"div#errorInfo").inner_html)
|
181
|
+
end
|
182
|
+
|
183
|
+
if (pagina/"div.errorPageContenido h2#disculpaLangES").inner_text.match(/Estamos trabajando/i)
|
184
|
+
true.should be_true
|
185
|
+
end
|
186
|
+
|
187
|
+
browser_text = Sanitize.clean(browser.html)
|
188
|
+
|
189
|
+
(browser.div(:class,"errorPageContenido").present?).should_not be_true
|
190
|
+
|
191
|
+
(browser_text =~ /Server Error/i or browser_text == nil).should_not be_true
|
192
|
+
|
193
|
+
(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
|
194
|
+
|
195
|
+
(browser.title =~ /Server Error in \'\/\' Application./i).should_not be_true
|
196
|
+
|
197
|
+
(browser_text =~ /Bienvenido a la agencia/i).should_not be_true
|
198
|
+
|
199
|
+
(browser.title =~ /ERROR: The requested URL could not be retrieved/i).should_not be_true
|
200
|
+
|
201
|
+
rescue Timeout::Error
|
202
|
+
puts "Rompio errores http"
|
203
|
+
rescue DRb::DRbConnError
|
204
|
+
puts "DRb::DRbConnError"
|
205
|
+
end
|
206
|
+
|
207
|
+
end
|
208
|
+
|
209
|
+
def brought_results?(browser)
|
210
|
+
begin
|
211
|
+
if browser.div(:id,'filters-error').present? or BROWSER.div(:id,'results-error').present?
|
212
|
+
return nil
|
213
|
+
else
|
214
|
+
doc = Hpricot.parse(browser.html)
|
215
|
+
return !(doc/"div#clusters/div.cluster").empty?
|
216
|
+
end
|
217
|
+
rescue Timeout::Error
|
218
|
+
stop_browser(browser)
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
def attach_browser(browser, how, url, timeout=10)
|
223
|
+
visible = nil
|
224
|
+
times = 0
|
225
|
+
while((!visible)and(times < timeout))
|
226
|
+
begin
|
227
|
+
browser.driver.switch_to.window(browser.driver.window_handles[0])
|
228
|
+
browser.window(how, /#{url}/).use
|
229
|
+
visible = true
|
230
|
+
rescue Watir::Exception::NoMatchingWindowFoundException
|
231
|
+
sleep(1)
|
232
|
+
times += 1
|
233
|
+
end
|
234
|
+
end
|
235
|
+
end
|
@@ -0,0 +1,29 @@
|
|
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/).div(:class,"installments-price").present?
|
7
|
+
doc = Hpricot.parse(BROWSER.fieldset(:class,'payment').li(:class,/selected/).div(: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
|
+
(inicial + (cant_restantes * valor_restantes)).should be_within(3).of(total_2)
|
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
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,166 @@
|
|
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_details(json,type,cluster,i,itinerary)
|
56
|
+
j=0
|
57
|
+
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?
|
58
|
+
if type != "multipledestinations"
|
59
|
+
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?
|
60
|
+
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|
|
61
|
+
cluster_detail = recorrer_segmentos(route,itinerary.idas[j])
|
62
|
+
j += 1
|
63
|
+
cerrar_popup
|
64
|
+
validar_clase(cluster_detail,route)
|
65
|
+
end
|
66
|
+
if type == "roundtrip"
|
67
|
+
k=0
|
68
|
+
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?
|
69
|
+
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|
|
70
|
+
cluster_detail = recorrer_segmentos(route,itinerary.vueltas[k])
|
71
|
+
k += 1
|
72
|
+
cerrar_popup
|
73
|
+
validar_clase(cluster_detail,route)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
else
|
77
|
+
cluster.div(:class,'itineraries').divs(:class,'sub-cluster multiple').each do |route|
|
78
|
+
#recorrer_segmentos(route,(itinerary.idas+itinerary.vueltas)[j])
|
79
|
+
#j += 1
|
80
|
+
#cerrar_popup
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def validate_itins_cluster_details(json,type,cluster,i)
|
86
|
+
if type != "multipledestinations"
|
87
|
+
outbound = cluster.div(:class,'itineraries').div(:class,'sub-cluster outbound').div(:class,'item data')
|
88
|
+
(@search.city_from_1.airports.include?(outbound.spans(:class,'airport')[0].text)).should be_true
|
89
|
+
(@search.city_to_1.airports.include?(outbound.spans(:class,'airport')[1].text)).should be_true
|
90
|
+
outbound.span(:class,'city-departure').text.no_accents.downcase.gsub(",","").strip.should equal(@search.city_from_1.name($SITE).downcase) unless outbound.span(:class,'city-departure').text.downcase.no_accents.gsub(",","").strip.match("toluca|campinas")
|
91
|
+
outbound.span(:class,'city-arrival').text.no_accents.downcase.gsub(",","").strip.should equal(@search.city_to_1.name($SITE).downcase) unless outbound.span(:class,'city-arrival').text.downcase.no_accents.gsub(",","").strip.match("toluca|campinas")
|
92
|
+
if type == "roundtrip"
|
93
|
+
inbound = cluster.div(:class,'itineraries').div(:class,'sub-cluster inbound').div(:class,'item data')
|
94
|
+
(@search.city_to_1.airports.include?(inbound.spans(:class,'airport')[0].text)).should be_true
|
95
|
+
(@search.city_from_1.airports.include?(inbound.spans(:class,'airport')[1].text)).should be_true
|
96
|
+
inbound.span(:class,'city-departure').text.no_accents.downcase.gsub(",","").strip.should equal(@search.city_to_1.name($SITE).downcase) unless inbound.span(:class,'city-departure').text.downcase.no_accents.gsub(",","").strip.match("toluca|campinas")
|
97
|
+
end
|
98
|
+
else
|
99
|
+
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
def validar_clase(cluster,route)
|
104
|
+
if cluster.tramos.select{|tramo| tramo['bussines'] }.empty?
|
105
|
+
route.span(:class,'ux-common-icon-rate-star').should_not visible("icono de bussines")
|
106
|
+
else
|
107
|
+
route.span(:class,'ux-common-icon-rate-star').should visible("icono de bussines")
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
def validate_cluster_bussines(cluster)
|
112
|
+
if cluster.div(:class,'not-economy-cluster-alert').present?
|
113
|
+
cluster.span(:class,'ux-common-icon-rate-star').should visible("icono de bussines")
|
114
|
+
else
|
115
|
+
cluster.span(:class,'ux-common-icon-rate-star').should_not visible("icono de bussines")
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
def recorrer_segmentos(route,cluster)
|
120
|
+
route.li(:class,'stops').a(:class,'text').click
|
121
|
+
Watir::Wait.until{BROWSER.div(:class,"flights-popup popup-detail").present?}
|
122
|
+
doc = Hpricot.parse(BROWSER.div(:class,"flights-popup popup-detail").html)
|
123
|
+
detail = DetailsCluster.new(doc)
|
124
|
+
detail.duracion.should match(/#{cluster.duracion}/)
|
125
|
+
detail.tramos.first['ciudad_origen'].should match(cluster.origen)
|
126
|
+
detail.tramos.last['ciudad_destino'].should match(cluster.destino)
|
127
|
+
cluster.fecha.should equal(detail.tramos.first['fecha_origen'])
|
128
|
+
cluster.hou_sal_ida.should equal(detail.tramos.first['hora_origen'])
|
129
|
+
reglas_de_vuelo()
|
130
|
+
return detail
|
131
|
+
end
|
132
|
+
|
133
|
+
def reglas_de_vuelo()
|
134
|
+
popup = BROWSER.div(:class,"flights-popup popup-detail")
|
135
|
+
popup.div(:class,'top-box').a(:class,'show-rules').should visible
|
136
|
+
popup.div(:class,'detail').div(:class,'detail-footer').div(:class,'rules').should_not visible
|
137
|
+
popup.div(:class,'top-box').a(:class,'show-rules').click
|
138
|
+
popup.div(:class,'detail').div(:class,'detail-footer').div(:class,'rules').should visible
|
139
|
+
popup.div(:class,'detail').div(:class,'detail-footer').div(:class,'rules').div(:class,'text').text.strip.no_accents.should match(/The ticket you are booking is subject to the airline rules and restrictions|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/)
|
140
|
+
end
|
141
|
+
|
142
|
+
def validate_cluster_with_headers(type,cluster,i)
|
143
|
+
cluster_html = Hpricot.parse(cluster.html)
|
144
|
+
(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")
|
145
|
+
if type == "roundtrip"
|
146
|
+
((cluster_html/"li.itineraries-title").length == 2).should be_true
|
147
|
+
elsif type == "oneway"
|
148
|
+
((cluster_html/"li.itineraries-title").length == 1).should be_true
|
149
|
+
else
|
150
|
+
((cluster_html/"li.itineraries-title").length == 3).should be_true
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
def validate_cluster_payments(cluster)
|
155
|
+
if(cluster.div(:class,'actions').link(:class,'payments').present?)
|
156
|
+
cluster.radio(:id,/outbound/).click if cluster.radio(:id,/outbound/).present?
|
157
|
+
cluster.radio(:id,/inbound/).click if cluster.radio(:id,/inbound/).present?
|
158
|
+
cluster.div(:class,'actions').link(:class,'payments').click
|
159
|
+
Watir::Wait.until{BROWSER.div(:id,"popup-payments").present?}
|
160
|
+
popup = Hpricot.parse(BROWSER.div(:id,"popup-payments").html)
|
161
|
+
BROWSER.div(:id,"popup-payments").span(:class,'popup-close-button popup-close').click
|
162
|
+
Watir::Wait.until{!BROWSER.div(:id,"popup-payments").present?}
|
163
|
+
else
|
164
|
+
cluster.div(:class,'actions').text.should_not match("pagos|cuotas|installments|juros")
|
165
|
+
end
|
166
|
+
end
|
@@ -0,0 +1,121 @@
|
|
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
|
+
begin
|
88
|
+
doc = Hpricot.parse(BROWSER.div(:id,'clusters').html)
|
89
|
+
rescue Selenium::WebDriver::Error::UnknownError
|
90
|
+
doc = Hpricot.parse(BROWSER.div(:id,'clusters').html)
|
91
|
+
end
|
92
|
+
(doc/"div.cluster").each_with_index do |cluster,i|
|
93
|
+
clusters << LandingCluster.new(type,cluster)
|
94
|
+
end
|
95
|
+
return clusters
|
96
|
+
end
|
97
|
+
|
98
|
+
def load_clusters_details(html)
|
99
|
+
clusters = Array.new
|
100
|
+
doc = Hpricot.parse(BROWSER.div(:id,'clusters').html)
|
101
|
+
(doc/"div.cluster").each_with_index do |cluster,i|
|
102
|
+
_cluster = {"idas"=>Array.new,"vueltas"=>Array.new}
|
103
|
+
(cluster/"div.outbound li.cluster-item").each_with_index do |item,j|
|
104
|
+
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?
|
105
|
+
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
|
106
|
+
_cluster["idas"] << DetailsCluster.new(Hpricot.parse(BROWSER.div(:id,"popup-detail").html))
|
107
|
+
BROWSER.div(:id,"popup-detail").span(:class,'popup-close-button popup-close').click
|
108
|
+
sleep(0.25)
|
109
|
+
end
|
110
|
+
(cluster/"div.inbound li.cluster-item").each_with_index do |item,j|
|
111
|
+
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?
|
112
|
+
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
|
113
|
+
_cluster["vueltas"] << DetailsCluster.new(Hpricot.parse(BROWSER.div(:id,"popup-detail").html))
|
114
|
+
BROWSER.div(:id,"popup-detail").span(:class,'popup-close-button popup-close').click
|
115
|
+
sleep(0.25)
|
116
|
+
end
|
117
|
+
clusters << _cluster
|
118
|
+
break if i > 2
|
119
|
+
end
|
120
|
+
return clusters
|
121
|
+
end
|