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,23 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
Cuando(/^ingreso bebes de mas$/) do
|
|
3
|
+
url = @page.url.gsub(/\/\d\/\d\/\d/,"/1/0/4")
|
|
4
|
+
@page.buscar url
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
Then(/^ingreso una fecha pasada$/) do
|
|
8
|
+
date = Date.today -1
|
|
9
|
+
@page.nueva_fecha_ida date
|
|
10
|
+
@page.buscar
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
Then(/^Verifico mensaje de error "(.*)"$/) do |text|
|
|
14
|
+
step "verifico que la pagina no rompa"
|
|
15
|
+
@page.resultados_error_element.should visible("Mensaje de error")
|
|
16
|
+
@page.resultados_error_element.text.no_accents.downcase.should match(text)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
Then(/^ingreso una fecha del dia de hoy$/) do
|
|
20
|
+
date = Date.today
|
|
21
|
+
@page.nueva_fecha_ida date
|
|
22
|
+
@page.buscar
|
|
23
|
+
end
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
Cuando(/^verifico que el cambio de moneda no muestre limpiar filtros$/) do
|
|
3
|
+
if @page.moneda_local_element.present?
|
|
4
|
+
@page.moneda_local_element.set
|
|
5
|
+
sleep(0.5)
|
|
6
|
+
@page.moneda_dolar_element.set
|
|
7
|
+
sleep(0.5)
|
|
8
|
+
@page.limpiar_filtro_precio_element.should_not visible("boton de limpiar filtro")
|
|
9
|
+
end
|
|
10
|
+
@page.aplicar_filtro_precio_element.text.should match("Aplicar|Apply")
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
Cuando(/^elijo una aerolinea a aplicar$/) do
|
|
14
|
+
doc = Hpricot.parse(@page.html)
|
|
15
|
+
options = (doc/"div.ux-flights-filter-airlines")[0]
|
|
16
|
+
options = (options/"ul.items label").reject{|option| option.attributes["class"].match(/selected|disabled|enabled/)}
|
|
17
|
+
@airline = options[rand(options.length)]
|
|
18
|
+
@total = (@airline/"span.total").inner_text.strip.to_i
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
Entonces(/^filtro por aerolinea$/) do
|
|
22
|
+
@page.browser.checkbox(:id,(@airline/"input").first.attributes['id']).set
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
Entonces(/^verifico que los contadores respecto a las aerolineas sean correctos$/) do
|
|
26
|
+
@page.cantidad_items_aeropuerto_salida_element.text.to_i.should equal(@total)
|
|
27
|
+
@page.cantidad_items_aeropuerto_llegada_element.text.to_i.should equal(@total) if @page.cantidad_items_aeropuerto_llegada_element.present?
|
|
28
|
+
@page.cantidad_items_paradas_element.text.to_i.should equal(@total)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
Entonces(/^verifico que la primer pagina muestre correctamente los filtros de aerolineas$/) do
|
|
32
|
+
group_airlines = [["UA","CM","AM","US","AA","DL"],["LA","4M","XL","4C","JJ","PZ"],["AV","TA","LR"]]
|
|
33
|
+
doc = Hpricot.parse(@page.html)
|
|
34
|
+
airlines = []
|
|
35
|
+
airline = (@airline/"img").first.attributes['src'].match(/\/(..)\.png/)[1].strip
|
|
36
|
+
(doc/"div#clusters div.cluster ul.itineraries-group").each do |itineraries|
|
|
37
|
+
airlines += (itineraries/"li.logo img").collect{|img| img.attributes['src'].match(/\/(..)\.png/)[1]}
|
|
38
|
+
airlines += (itineraries/"li.airlines img").collect{|img| img.attributes['src'].match(/\/(..)\.png/)[1]}
|
|
39
|
+
airlines += (itineraries/"li.airlinesShort img").collect{|img| img.attributes['src'].match(/\/(..)\.png/)[1]}
|
|
40
|
+
group_airlines.each{|airlines_tmp| airlines.concat(airlines_tmp) if airlines_tmp.include?(airline)}
|
|
41
|
+
end
|
|
42
|
+
airlines.should include?(airline)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
Cuando(/^limpio el filtro de aerolineas$/) do
|
|
46
|
+
@page.limpiar_filtro_aerolinea_element.set
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
Cuando(/^elijo un aeropuerto (outbound|inbound) a aplicar$/) do |_class|
|
|
50
|
+
doc = Hpricot.parse(@page.html)
|
|
51
|
+
if _class == 'outbound'
|
|
52
|
+
_clase = 'origin'
|
|
53
|
+
else
|
|
54
|
+
_clase = 'destiny'
|
|
55
|
+
end
|
|
56
|
+
options = (doc/"div.ux-flights-filter-#{_clase}airports//label").reject{|option| option.attributes["class"].match(/selected|disabled/) or option.attributes["for"].match(/unique-airport/)}
|
|
57
|
+
@airport = options[rand(options.length)]
|
|
58
|
+
@total = (@airport/"span.total").inner_text.strip.to_i
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
Entonces(/^filtro por aeropuerto$/) do
|
|
62
|
+
@page.browser.checkbox(:id,(@airport/"input").first.attributes['id']).set
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
Entonces(/^verifico que los contadores respecto al aeropuerto sean correctos$/) do
|
|
66
|
+
@page.cantidad_items_paradas_element.text.to_i.should equal(@total)
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
Entonces(/^verifico que la primer pagina muestre correctamente los filtros de aeropuertos (outbound|inbound)$/) do |_class|
|
|
70
|
+
doc = Hpricot.parse(@page.html)
|
|
71
|
+
(@airport/"input").first.attributes["value"].strip.should equal((doc/"div#clusters div.cluster div.#{_class} span.airport a").first.inner_text.strip)
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
Cuando(/^limpio el filtro de aeropuertos de salida$/) do
|
|
75
|
+
@page.limpiar_filtro_aeropuerto_salida_element.set
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
Cuando(/^limpio el filtro de aeropuertos de llegada$/) do
|
|
79
|
+
@page.limpiar_filtro_aeropuerto_llegada_element.set
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
Cuando(/^elijo una escala a aplicar$/) do
|
|
83
|
+
doc = Hpricot.parse(@page.html)
|
|
84
|
+
options = (doc/"div.ux-flights-filter-stops//label").reject{|option| option.attributes["class"].match(/selected|disabled/)}
|
|
85
|
+
@stop = options[rand(options.length)]
|
|
86
|
+
@cant = (@stop/"span.label").inner_text.gsub(/\D/,'').strip.to_i
|
|
87
|
+
@total = (@stop/"span.total").inner_text.strip.to_i
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
Entonces(/^filtro por escala$/) do
|
|
91
|
+
@page.browser.checkbox(:id,(@stop/"input").first.attributes['id']).set
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
Entonces(/^verifico que los contadores respecto a las escalas sean correctos$/) do
|
|
95
|
+
@page.cantidad_items_aeropuerto_salida_element.text.to_i.should equal(@total)
|
|
96
|
+
@page.cantidad_items_aeropuerto_llegada_element.text.to_i.should equal(@total) if @page.cantidad_items_aeropuerto_llegada_element.present?
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
Entonces(/^verifico que la primer pagina muestre correctamente los filtros de escalas$/) do
|
|
100
|
+
doc = Hpricot.parse(@page.html)
|
|
101
|
+
(doc/"div#clusters div.cluster li.stops").each do |stop|
|
|
102
|
+
applied_stop = @cant
|
|
103
|
+
stop_displayed = stop.inner_text.gsub(/\D/,'').strip.to_i
|
|
104
|
+
if applied_stop == 2
|
|
105
|
+
(applied_stop<=>stop_displayed).should be_true
|
|
106
|
+
elsif applied_stop == 1
|
|
107
|
+
(applied_stop>=stop_displayed).should be_true
|
|
108
|
+
else
|
|
109
|
+
applied_stop.should equal(stop_displayed)
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
Cuando(/^limpio el filtro de escalas$/) do
|
|
115
|
+
@page.limpiar_filtro_escalas_element.set
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
Cuando(/^elijo un horario (outbound|inbound) a aplicar$/) do |_class|
|
|
119
|
+
doc = Hpricot.parse(@page.html)
|
|
120
|
+
options = (doc/"div.ux-flights-filter-#{_class}hours-slider ul.ux-common-filter-options li")
|
|
121
|
+
@time = options[rand(options.length)]
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
Entonces(/^filtro por horario (outbound|inbound)$/) do |_class|
|
|
125
|
+
@page.browser.link(:text,@time.inner_text).click
|
|
126
|
+
box=@page.browser.div(:class,"ux-common-filter-section ux-common-filter-slider ux-flights-filter-hours-slider ux-flights-filter-#{_class}hours-slider")
|
|
127
|
+
box.link(:class,'ux-common-filter-apply').click
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
Entonces(/^verifico que la primer pagina muestre correctamente los filtros de horario (outbound|inbound)$/) do |_class|
|
|
131
|
+
doc = Hpricot.parse(@page.html)
|
|
132
|
+
if @page.remover_ultima_accion_element.present?
|
|
133
|
+
puts "Disculpe, no encontramos vuelos con el último criterio que ha seleccionado."
|
|
134
|
+
else
|
|
135
|
+
if @page.slider_horario_salida_element.present?
|
|
136
|
+
case (@time/"a").inner_text.strip
|
|
137
|
+
when "Mañana"
|
|
138
|
+
maxx, min = Time.parse("12:00"), Time.parse("05:00")
|
|
139
|
+
when "Manhã"
|
|
140
|
+
maxx, min = Time.parse("12:00"), Time.parse("05:00")
|
|
141
|
+
when "Morning"
|
|
142
|
+
maxx, min = Time.parse("12:00"), Time.parse("05:00")
|
|
143
|
+
when "Tarde"
|
|
144
|
+
maxx, min = Time.parse("19:00"), Time.parse("12:00")
|
|
145
|
+
when "Afternoon"
|
|
146
|
+
maxx, min = Time.parse("19:00"), Time.parse("12:00")
|
|
147
|
+
when "Noche"
|
|
148
|
+
maxx, min = Time.parse("00:00")+(24*60*60),Time.parse("19:00")
|
|
149
|
+
when "Noite"
|
|
150
|
+
maxx, min = Time.parse("00:00")+(24*60*60),Time.parse("19:00")
|
|
151
|
+
when "Night"
|
|
152
|
+
maxx, min = Time.parse("00:00")+(24*60*60),Time.parse("19:00")
|
|
153
|
+
when "Madrugada"
|
|
154
|
+
maxx, min = Time.parse("05:00"),Time.parse("00:00")
|
|
155
|
+
when "Dawn"
|
|
156
|
+
maxx, min = Time.parse("05:00"),Time.parse("00:00")
|
|
157
|
+
end
|
|
158
|
+
else
|
|
159
|
+
case (@time/"input").first.attributes['value'].strip
|
|
160
|
+
when "MORNING"
|
|
161
|
+
maxx, min = Time.parse("12:00"), Time.parse("06:00")
|
|
162
|
+
when "AFTERNOON"
|
|
163
|
+
maxx, min = Time.parse("20:00"), Time.parse("12:00")
|
|
164
|
+
when "NIGHT"
|
|
165
|
+
maxx, min = Time.parse("00:00")+(24*60*60),Time.parse("20:00")
|
|
166
|
+
when "EARLY_MORNING"
|
|
167
|
+
maxx, min = Time.parse("06:00"),Time.parse("00:00")
|
|
168
|
+
end
|
|
169
|
+
end
|
|
170
|
+
(doc/"div#clusters div.cluster div.#{_class} ul.itineraries-group li.itinerary").each do |itineraries|
|
|
171
|
+
hour = Time.parse((itineraries/"li.leave span.hour").inner_text.strip)
|
|
172
|
+
(hour <= maxx and hour >= min).should be_true
|
|
173
|
+
end
|
|
174
|
+
end
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
Cuando(/^limpio el filtro de horario (outbound|inbound)$/) do |_class|
|
|
178
|
+
box=@page.browser.div(:class,"ux-common-filter-section ux-common-filter-slider ux-flights-filter-hours-slider ux-flights-filter-#{_class}hours-slider")
|
|
179
|
+
box.link(:class,'ux-common-filter-reset').click
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
Cuando(/^elijo una duracion (outbound|inbound) a aplicar$/) do |_class|
|
|
183
|
+
unless((_class=="inbound")and(@page.tipo_de_busqueda=="oneway"))
|
|
184
|
+
box=@page.browser.div(:class,"ux-common-filter-section ux-common-filter-slider ux-flights-filter-hours-slider ux-flights-filter-duration-slider ux-flights-filter-#{_class}duration-slider")
|
|
185
|
+
@from_time=box.li(:class,'ux-common-filter-hour-min').spans.first.text
|
|
186
|
+
puts @from_time
|
|
187
|
+
@to_time=box.li(:class,'ux-common-filter-hour-max').spans.first.text
|
|
188
|
+
puts @to_time
|
|
189
|
+
diff="#{@to_time.split(':')[0].to_i-1}:#{@from_time.split(':')[1]}"
|
|
190
|
+
puts diff
|
|
191
|
+
while(@to_time!=diff and @to_time!=@from_time)
|
|
192
|
+
box.link(:class,'ui-slider-handle ui-state-default ui-corner-all ui-slider-handle-max').send_keys :left
|
|
193
|
+
@to_time=box.li(:class,'ux-common-filter-hour-max').spans.first.text
|
|
194
|
+
end
|
|
195
|
+
end
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
Entonces(/^filtro por duracion (outbound|inbound)$/) do |_class|
|
|
199
|
+
unless((_class=="inbound")and(@page.tipo_de_busqueda=="oneway"))
|
|
200
|
+
box=@page.browser.div(:class,"ux-common-filter-section ux-common-filter-slider ux-flights-filter-hours-slider ux-flights-filter-duration-slider ux-flights-filter-#{_class}duration-slider")
|
|
201
|
+
box.link(:class,'ux-common-filter-apply').click
|
|
202
|
+
end
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
Entonces(/^verifico que la primer pagina muestre correctamente los filtros de duracion (outbound|inbound)$/) do |_class|
|
|
206
|
+
unless((_class=="inbound")and(@page.tipo_de_busqueda=="oneway"))
|
|
207
|
+
doc = Hpricot.parse(@page.html)
|
|
208
|
+
(doc/"div#clusters div.cluster div.#{_class} ul.itineraries-group li.itinerary").each do |itineraries|
|
|
209
|
+
time = (itineraries/"li.time span").inner_text.strip.split(' ')
|
|
210
|
+
if time.length==1
|
|
211
|
+
aux = time.first
|
|
212
|
+
if(aux.match(/h/))
|
|
213
|
+
time[0]=aux
|
|
214
|
+
time[1]="00m"
|
|
215
|
+
else
|
|
216
|
+
time[0]="00h"
|
|
217
|
+
time[1]=aux
|
|
218
|
+
end
|
|
219
|
+
end
|
|
220
|
+
(time[0].gsub(/\D/,'').to_i >= @from_time.split(':')[0].to_i).should be_true
|
|
221
|
+
(time[0].gsub(/\D/,'').to_i <= @to_time.split(':')[0].to_i).should be_true
|
|
222
|
+
if ((time[0].gsub(/\D/,'').to_i == @from_time.split(':')[0].to_i)and(time[1]))
|
|
223
|
+
(time[1].gsub(/\D/,'').to_i >= @from_time.split(':')[1].to_i).should be_true
|
|
224
|
+
end
|
|
225
|
+
if ((time[0].gsub(/\D/,'').to_i == @to_time.split(':')[0].to_i)and(time[1]))
|
|
226
|
+
(time[1].gsub(/\D/,'').to_i <= @to_time.split(':')[1].to_i).should be_true
|
|
227
|
+
end
|
|
228
|
+
end
|
|
229
|
+
end
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
Entonces(/^limpio el filtro de duracion (outbound|inbound)$/) do |_class|
|
|
233
|
+
unless((_class=="inbound")and(@page.tipo_de_busqueda=="oneway"))
|
|
234
|
+
box=@page.browser.div(:class,"ux-common-filter-section ux-common-filter-slider ux-flights-filter-hours-slider ux-flights-filter-duration-slider ux-flights-filter-#{_class}duration-slider")
|
|
235
|
+
box.link(:class,'ux-common-filter-reset').click
|
|
236
|
+
end
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
Cuando(/^Recupero los precios limites de la lista$/) do
|
|
240
|
+
if AllPages.site.match("MX|PE|UY|BR|CR|PA")
|
|
241
|
+
@li_class = "span.fare"
|
|
242
|
+
@page.orden_element.select_value("FARE_ASCENDING")
|
|
243
|
+
step "espero que termine de cargar la pagina de resultados"
|
|
244
|
+
else
|
|
245
|
+
@li_class = "li.fare-price"
|
|
246
|
+
end
|
|
247
|
+
doc = Hpricot.parse(@page.html)
|
|
248
|
+
@price_down=Price.new((doc/"div#clusters div.cluster #{@li_class} span[@class='price-currency #{Helpers.currency(AllPages.site.upcase)} '] span.currency").first.inner_text + " " + (doc/"div#clusters div.cluster #{@li_class} span[@class='price-currency #{Helpers.currency(AllPages.site.upcase)} '] span.amount").first.inner_text).value
|
|
249
|
+
@price_up=Price.new((doc/"div#clusters div.cluster #{@li_class} span[@class='price-currency #{Helpers.currency(AllPages.site.upcase)} '] span.currency")[-2].inner_text + " " + (doc/"div#clusters div.cluster #{@li_class} span[@class='price-currency #{Helpers.currency(AllPages.site.upcase)} '] span.amount")[-2].inner_text).value
|
|
250
|
+
puts @price_down
|
|
251
|
+
puts @price_up
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
Entonces(/^filtro por precio mayor$/) do
|
|
255
|
+
@page.execute_script("javascript:void($('.price-max').val(''))")
|
|
256
|
+
@page.filtro_precio_mayor_element.set(@price_up+3)
|
|
257
|
+
@page.aplicar_filtro_precio_element.click
|
|
258
|
+
step "espero que termine de cargar la pagina de resultados"
|
|
259
|
+
price=@page.filtro_precio_mayor_element.value.to_i
|
|
260
|
+
while(price>@price_up)
|
|
261
|
+
@page.slider_precio_mayor_element.send_keys :left
|
|
262
|
+
price=@page.filtro_precio_mayor_element.value.to_i
|
|
263
|
+
end
|
|
264
|
+
@price_up=price
|
|
265
|
+
end
|
|
266
|
+
|
|
267
|
+
Entonces(/^verifico que la primer pagina muestre correctamente los filtros de precio$/) do
|
|
268
|
+
doc = Hpricot.parse(@page.html)
|
|
269
|
+
@page.cargar_itinerarios
|
|
270
|
+
@page.datos_de_itinerarios.each do |itinerario|
|
|
271
|
+
if AllPages.site.match("MX|UY|PE|BR|CR|PA")
|
|
272
|
+
(itinerario.tarifas['tarifa_adulto'].value >= @price_down).should be_true
|
|
273
|
+
(itinerario.tarifas['tarifa_adulto'].value <= @price_up).should be_true
|
|
274
|
+
else
|
|
275
|
+
(itinerario.tarifas['total'].value >= @price_down).should be_true
|
|
276
|
+
(itinerario.tarifas['total'].value <= @price_up).should be_true
|
|
277
|
+
end
|
|
278
|
+
end
|
|
279
|
+
end
|
|
280
|
+
|
|
281
|
+
Entonces(/^filtro por precio menor$/) do
|
|
282
|
+
@page.execute_script("javascript:void($('.price-min').val(''))")
|
|
283
|
+
@page.filtro_precio_menor_element.set(@price_down-2)
|
|
284
|
+
@page.aplicar_filtro_precio_element.click
|
|
285
|
+
step "espero que termine de cargar la pagina de resultados"
|
|
286
|
+
price=@page.filtro_precio_menor_element.value.to_i
|
|
287
|
+
while(price<@price_down)
|
|
288
|
+
@page.slider_precio_menor_element.send_keys :right
|
|
289
|
+
price=@page.filtro_precio_menor_element.value.to_i
|
|
290
|
+
end
|
|
291
|
+
@price_down=price
|
|
292
|
+
end
|
|
293
|
+
|
|
294
|
+
Cuando(/^limpio el filtro de precio$/) do
|
|
295
|
+
@page.limpiar_filtro_precio_element.click
|
|
296
|
+
end
|
|
297
|
+
|
|
298
|
+
Cuando(/^elijo moneda local como precio de filtrado$/) do
|
|
299
|
+
@page.filtros_precio_element.radio(:value,Helpers.currency(AllPages.site.upcase)).click if @page.filtros_precio_element.radio(:value,Helpers.currency(AllPages.site.upcase)).present?
|
|
300
|
+
sleep(2)
|
|
301
|
+
end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
|
2
|
+
Dado(/^una pagina de resultados en "(.*)" para una busqueda "(.*)" del tipo "(.*)"$/) do |pais,tipo,cabotaje|
|
|
3
|
+
Helpers.set_date_language(pais)
|
|
4
|
+
@page = Results::SearchPage.new($browser)
|
|
5
|
+
@page.load_page(tipo,pais,$ENV,cabotaje)
|
|
6
|
+
@page.set_cookies
|
|
7
|
+
@page.elegir_idioma
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
Cuando(/^espero que termine de cargar la pagina de resultados$/) do
|
|
11
|
+
@page.carga_element.when_not_visible(timeout=60)
|
|
12
|
+
@page.actualizar_filtro_element.when_not_visible(timeout=60)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
Entonces(/^(?:verifico|valido) que (?:traiga|vengan|tenga) resultados$/) do
|
|
16
|
+
unless @page.con_resultados?
|
|
17
|
+
json = @page.get_results_search_service
|
|
18
|
+
if json["result"]["data"]["metadata"]["status"]["code"].match("NO_RESULTS|SUCCEEDED")
|
|
19
|
+
pending("No se encontraron resultados")
|
|
20
|
+
else
|
|
21
|
+
json["result"]["data"]["metadata"]["status"]["code"].should equal("NO_RESULTS")
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
Entonces(/^verifico el nuevo loader$/) do
|
|
28
|
+
if @page.carga_element.present? and !@page.tipo_de_busqueda.match(/multipledestinations/)
|
|
29
|
+
begin
|
|
30
|
+
Watir::Wait.until(timeout=25){@page.carga_element.span(:class,'nibbler-iterated-text-description').exists? and !@page.carga_element.span(:class,'nibbler-iterated-text-description').text.empty?}
|
|
31
|
+
text = @page.carga_element.span(:class,'nibbler-iterated-text-description').text
|
|
32
|
+
unless text.empty?
|
|
33
|
+
unless text.no_accents.downcase.match("searching flights to #{@page.manage_data.city_to_1.name(AllPages.site).downcase} by|buscando vuelos hacia #{@page.manage_data.city_to_1.name(AllPages.site).downcase} por|procurando voos a #{@page.manage_data.city_to_1.name(AllPages.site).downcase} por")
|
|
34
|
+
airlines=@page.manage_data.get_indec_airlines($ENV)
|
|
35
|
+
airlines.should is_empty
|
|
36
|
+
end
|
|
37
|
+
else
|
|
38
|
+
puts "Fallo la validacion en el loader con el texto de aerolineas"
|
|
39
|
+
end
|
|
40
|
+
text_hotels = @page.carga_element.div(:class,'nibbler-second-text').text
|
|
41
|
+
unless text_hotels.empty?
|
|
42
|
+
text_hotels.no_accents.downcase.should match("hoteles en #{@page.manage_data.city_to_1.name(AllPages.site).downcase}|hotels in #{@page.manage_data.city_to_1.name(AllPages.site).downcase} , best price guaranteed|hoteles en #{@page.manage_data.city_to_1.name(AllPages.site).downcase} con el mejor precio garantizado|hoteis em #{@page.manage_data.city_to_1.name(AllPages.site).downcase} com o melhor preco garantido")
|
|
43
|
+
hotels_count = @page.carga_element.text.gsub(/\D/,'')
|
|
44
|
+
hotels_count.to_i.should es_mayor_que(0)
|
|
45
|
+
else
|
|
46
|
+
puts "Fallo la validacion en el loader con el texto de hoteles"
|
|
47
|
+
end
|
|
48
|
+
rescue Watir::Wait::TimeoutError
|
|
49
|
+
puts "Timeout loader!"
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
|
2
|
+
Cuando(/^elijo en la matriz una aerolinea a aplicar$/) do
|
|
3
|
+
doc = Hpricot.parse(@page.html)
|
|
4
|
+
@airline = (doc/"div.matrix-airlines div.airline-description")[rand((doc/"div.matrix-airlines div.airline-description").length)]
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
Entonces(/^filtro por matriz una aerolinea$/) do
|
|
8
|
+
@page.activar_aerolineas_en_matriz
|
|
9
|
+
@page.siguiente_aerolinea_element.click while !@page.elegir_aerolinea((@airline/"img").first.attributes['src']).present?
|
|
10
|
+
@page.elegir_aerolinea((@airline/"img").first.attributes['src']).click
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
Entonces(/^verifico el mensaje del filtro por aerolinea$/) do
|
|
14
|
+
@page.filtro_matriz_element.text.no_accents.strip.should match("Currently viewing: Flights by #{@airline.inner_text.no_accents.strip}|Actualmente visualizando: Vuelos por #{@airline.inner_text.no_accents.strip}|Atualmente visualizando: Voos por #{@airline.inner_text.no_accents.strip}")
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
Cuando(/^limpio la matriz de aerolineas$/) do
|
|
18
|
+
@page.limpiar_matriz_aerolinea_element.click
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
Cuando(/^ingreso a la matriz de tendencia de precios$/) do
|
|
22
|
+
@page.tab_matriz_tendencia_precio_element.should visible("matriz de evolucion de tarifas")
|
|
23
|
+
@page.tab_matriz_tendencia_precio_element.click
|
|
24
|
+
@page.matriz_fare_chart_element.when_visible(timeout=30)
|
|
25
|
+
@page.mensaje_fare_chart_element.when_visible(timeout=30)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
Cuando(/^verifico el mensaje de aclaracion de precio de matriz de tendencia de precios$/) do
|
|
29
|
+
text = case AllPages.site
|
|
30
|
+
when "US" then 'Prices per adult(.*). The displayed prices are the best found by users in the last days and they could be outdated.'
|
|
31
|
+
when "BR" then 'Precos por adulto(.*). Os valores exibidos sao referentes aos encontrados por nossos usuarios nos ultimos dias e podem estar desatualizados.'
|
|
32
|
+
else 'Precios por adulto(.*). Los precios visualizados son los mejores encontrados por los usuarios en los ultimos dias y podrian no estar actualizados.'
|
|
33
|
+
end
|
|
34
|
+
@page.mensaje_fare_chart_element.text.strip.no_accents.should match(text.strip.no_accents)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
Cuando(/^verifico el l&f de la matriz de tendencia de precios$/) do
|
|
38
|
+
doc = Hpricot.parse(@page.matriz_fare_chart_element.html)
|
|
39
|
+
#content
|
|
40
|
+
(doc/"div.fare-chart-content").empty?.should be_false
|
|
41
|
+
#main
|
|
42
|
+
(doc/"div.fare-chart-content div.fare-chart-main").empty?.should be_false
|
|
43
|
+
(doc/"div.fare-chart-content div.fare-chart-main div.fare-chart-values-container").empty?.should be_false
|
|
44
|
+
(doc/"div.fare-chart-content div.fare-chart-main div.fare-chart-values-container").empty?.should be_false
|
|
45
|
+
(doc/"div.fare-chart-content div.fare-chart-main div.fare-chart-big-viewport").empty?.should be_false
|
|
46
|
+
(doc/"div.fare-chart-content div.fare-chart-main div.fare-chart-big-viewport div[@class='fare-chart-bars-container fare-chart-big ui-draggable']").empty?.should be_false
|
|
47
|
+
(doc/"div.fare-chart-content div.fare-chart-main div.fare-chart-big-viewport div[@class='fare-chart-bars-container fare-chart-big ui-draggable'] div.fare-chart-bars").length.should equal(11)
|
|
48
|
+
#secondary
|
|
49
|
+
(doc/"div.fare-chart-content div.fare-chart-secondary").empty?.should be_false
|
|
50
|
+
(doc/"div.fare-chart-content div.fare-chart-secondary div[@class='fare-chart-bars-container fare-chart-small']").empty?.should be_false
|
|
51
|
+
(doc/"div.fare-chart-content div.fare-chart-secondary div[@class='fare-chart-bars-container fare-chart-small'] div.fare-chart-bars").length.should equal(11)
|
|
52
|
+
(doc/"div.fare-chart-content div.fare-chart-secondary div[@class='fare-char-small-selector ui-draggable']").empty?.should be_false
|
|
53
|
+
#script
|
|
54
|
+
@page.script_matriz_fare_chart_element.exists?.should be_true
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
Cuando(/^verifico que la matriz cumpla con el rango de fechas de la busqueda$/) do
|
|
58
|
+
doc = Hpricot.parse(@page.matriz_fare_chart_element.html)
|
|
59
|
+
#main
|
|
60
|
+
visible_months = @page.fare_chart_principal_element.divs(:class,'fare-chart-bars-text').select{|d| d.present?}.collect{|m| m.text}
|
|
61
|
+
today = Date.today
|
|
62
|
+
months = []
|
|
63
|
+
count = 0
|
|
64
|
+
while(today.month != (@page.manage_data.date_from_1.month+1)) do
|
|
65
|
+
months << today.mes.capitalize
|
|
66
|
+
today = today + 1
|
|
67
|
+
count = count + 1
|
|
68
|
+
break if count > 13
|
|
69
|
+
end
|
|
70
|
+
months.uniq!
|
|
71
|
+
visible_months.delete(visible_months.last) if (visible_months.length!=months.length)
|
|
72
|
+
(doc/"div.fare-chart-main div.fare-chart-current-price div").first.attributes['data-suggestion-index'].to_i.should equal(@page.manage_data.date_from_1.day - 1) #verifico que el mes del precio mostrado sea el correcto
|
|
73
|
+
|
|
74
|
+
#secondary
|
|
75
|
+
visible_months_abbr = @page.fare_chart_secundario_element.divs(:class,'fare-chart-bars-text').collect{|m| m.text}
|
|
76
|
+
(doc/"div.fare-chart-secondary div.fare-chart-current-price div").first.attributes['data-suggestion-index'].to_i.should equal(@page.manage_data.date_from_1.day - 1) #verifico que el mes del precio mostrado sea el correcto
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
Cuando(/^verificar que los datos mostrados en la matriz sean correctos$/) do
|
|
80
|
+
doc = Hpricot.parse(@page.matriz_fare_chart_element.html)
|
|
81
|
+
first_value = ResultsCluster.new(@page.tipo_de_busqueda, Hpricot.parse(@page.itinerarios_elements.first.html))
|
|
82
|
+
max_value = (doc/"div.fare-chart-content div.fare-chart-main div.fare-chart-values-container div.fare-chart-value span.#{Helpers.currency(AllPages.site)} span.amount")[0]
|
|
83
|
+
(first_value.tarifas['tarifa_adulto'].value <= max_value.inner_text.gsub(/\./,"").to_i).should be_true
|
|
84
|
+
#para usar despues
|
|
85
|
+
@min_value = (doc/"div.fare-chart-content div.fare-chart-main div.fare-chart-values-container div.fare-chart-value span.#{Helpers.currency(AllPages.site)} span.amount")[1]
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
Cuando(/^verificar que filtre por una celda de la matriz$/) do
|
|
89
|
+
i=0
|
|
90
|
+
@page.barras_fare_chart_secundario_element.div(:class=>'fare-chart-bars',:index=>0).click
|
|
91
|
+
while(!@page.barra_precio_minimo_element.present?) do
|
|
92
|
+
i=i+1
|
|
93
|
+
@page.barras_fare_chart_secundario_element.div(:class=>'fare-chart-bars',:index=>i).divs(:class,'fare-chart-bar ')[-1].click if @page.barras_fare_chart_secundario_element.div(:class=>'fare-chart-bars',:index=>i).present?
|
|
94
|
+
end
|
|
95
|
+
doc = Hpricot.parse(@page.matriz_fare_chart_element.html)
|
|
96
|
+
month_bar = (doc/"div.fare-chart-main div.fare-chart-bars div.fare-chart-min-price")
|
|
97
|
+
puts "#{(month_bar/'div').first.attributes['data-suggestion-index'].to_i+1}"+"/"+"#{(month_bar/'div').first.attributes['data-month-index'].to_i+1}"+"/"+"2014"
|
|
98
|
+
@page.manage_data.set_from_date(Date.parse("#{(month_bar/'div').first.attributes['data-suggestion-index'].to_i+1}"+"/"+"#{(month_bar/'div').first.attributes['data-month-index'].to_i+1}"+"/"+"2014"))
|
|
99
|
+
@page.barra_precio_minimo_element.div(:class,'fare-chart-bar-content').click
|
|
100
|
+
step "espero que termine de cargar la pagina de resultados"
|
|
101
|
+
step "ingreso a la matriz de tendencia de precios"
|
|
102
|
+
step "verifico el l&f de la matriz de tendencia de precios"
|
|
103
|
+
step "verifico que la matriz cumpla con el rango de fechas de la busqueda"
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
Entonces(/^no se muestra la matriz de precios$/) do
|
|
107
|
+
(!@page.tab_matriz_precio_element.present? and !@page.alerta_matriz_precio.present?).should be_true
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
Entonces(/^verifico que se muestre la matriz de precios$/) do
|
|
111
|
+
if @page.popup_matriz_precio_element.present?
|
|
112
|
+
@page.popup_matriz_precio_element.click
|
|
113
|
+
sleep(2)
|
|
114
|
+
end
|
|
115
|
+
if @page.tab_matriz_precio_element.present?
|
|
116
|
+
@page.tab_matriz_precio_element.click
|
|
117
|
+
sleep(2)
|
|
118
|
+
end
|
|
119
|
+
@page.matriz_precio_element.should visible
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
Entonces(/^verifico el mensaje de aclaracion de precio de matriz de precios$/) do
|
|
123
|
+
text = case AllPages.site
|
|
124
|
+
when "US" then "Roundtrip fare per passenger. The displayed prices are the best found by users in the last days and they could be outdated."
|
|
125
|
+
when "BR" then "Preco da passagem ida e volta por pessoa. Os valores exibidos sao referentes aos encontrados por nossos usuarios nos ultimos dias e podem estar desatualizados."
|
|
126
|
+
else "Precio del pasaje ida y vuelta por persona. Los precios visualizados son los mejores encontrados por los usuarios en los ultimos días y podrian no estar actualizados."
|
|
127
|
+
end
|
|
128
|
+
@page.mensaje_precio_element.text.strip.no_accents.should equal(text.strip.no_accents)
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
Entonces(/^verifico la correcta disposicion de la matriz de precios$/) do
|
|
132
|
+
doc = Hpricot.parse(@page.matriz_precio_element.html)
|
|
133
|
+
#filas
|
|
134
|
+
(doc/"ul.price-suggestion-matrix-date").first.should be_true
|
|
135
|
+
(doc/"ul.price-suggestion-matrix-date li.price-suggestion-matrix-cell").length.should equal(8)
|
|
136
|
+
(doc/"ul.price-suggestion-matrix-date li.price-suggestion-matrix-first-cell").length.should equal(1)
|
|
137
|
+
(doc/"ul.price-suggestion-matrix-date li.price-suggestion-matrix-inbound").length.should equal(7)
|
|
138
|
+
#columnas
|
|
139
|
+
(doc/"div.price-suggestion-matrix-responsive").first.should be_true
|
|
140
|
+
(doc/"div.price-suggestion-matrix-responsive ul.price-suggestion-matrix-column").length.should equal(7)
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
Entonces(/^verifico las fechas de la matriz de precios$/) do
|
|
144
|
+
doc = Hpricot.parse(@page.matriz_precio_element.html)
|
|
145
|
+
#levanto las fechas mostradas en la matriz
|
|
146
|
+
#idas
|
|
147
|
+
@outbounds = (doc/"div.price-suggestion-matrix-responsive li.price-suggestion-matrix-outbound").collect{|li| Date.parse(li.attributes['data-outbounddate'])}
|
|
148
|
+
#vueltas
|
|
149
|
+
@inbounds = (doc/"ul.price-suggestion-matrix-date li.price-suggestion-matrix-inbound").collect{|li| Date.parse(li.attributes['data-inbounddate'])}
|
|
150
|
+
#verifico que las fechas sean continuas +/- 2 dias a las fechas buscadas
|
|
151
|
+
[-2,-1,0,1,2].each do |days|
|
|
152
|
+
@outbounds.include?(@page.manage_data.date_from_1+days)
|
|
153
|
+
@inbounds.include?(@page.manage_data.date_to_1+days)
|
|
154
|
+
end
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
Entonces(/^verifico que la fechas buscadas sea la central en la matriz de precios$/) do
|
|
158
|
+
doc = Hpricot.parse(@page.matriz_precio_element.html)
|
|
159
|
+
@page.manage_data.date_from_1.should equal(Date.parse((doc/"li.price-suggestion-matrix-price-CURRENT").first.attributes["data-outbounddate"]))
|
|
160
|
+
@page.manage_data.date_to_1.should equal(Date.parse((doc/"li.price-suggestion-matrix-price-CURRENT").first.attributes["data-inbounddate"]))
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
Entonces(/^verifico que exista otra fecha con precio en la matriz de precios$/) do
|
|
164
|
+
doc = Hpricot.parse(@page.matriz_precio_element.html)
|
|
165
|
+
if (doc/"li.price-suggestion-matrix-price-CHEAPEST").first
|
|
166
|
+
option="price-suggestion-matrix-price-CHEAPEST"
|
|
167
|
+
else
|
|
168
|
+
option="price-suggestion-matrix-price-EXPENSIVE"
|
|
169
|
+
end
|
|
170
|
+
(doc/"li.#{option}").first.should be_true
|
|
171
|
+
@new_outbound = Date.parse((doc/"li.#{option}").first.attributes["data-outbounddate"])
|
|
172
|
+
@new_inbound = Date.parse((doc/"li.#{option}").first.attributes["data-inbounddate"])
|
|
173
|
+
@price = Price.new((doc/"li.#{option} span[@class='price-currency #{Helpers.currency(AllPages.site)} '] span.currency").first.inner_text+" "+(doc/"li.#{option} span[@class='price-currency #{Helpers.currency(AllPages.site)} '] span.amount").first.inner_text)
|
|
174
|
+
@page.matriz_precio_element.li(:class,"price-suggestion-matrix-cell price-suggestion-matrix-price price-suggestion-matrix-price-VALID #{option}").click
|
|
175
|
+
@page.manage_data.set_new_date(@new_outbound,@new_inbound)
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
Entonces(/^verifico que el precio mostrado en la matriz sea el primero en los itinerarios$/) do
|
|
179
|
+
doc = Hpricot.parse(@page.matriz_precio_element.html)
|
|
180
|
+
@actual_price = Price.new((doc/"li.price-suggestion-matrix-price-CURRENT span[@class='price-currency #{Helpers.currency(AllPages.site)} '] span.currency").first.inner_text+" "+(doc/"li.price-suggestion-matrix-price-CURRENT span[@class='price-currency #{Helpers.currency(AllPages.site)} '] span.amount").first.inner_text)
|
|
181
|
+
puts "#{@price}==#{@actual_price}"
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
Entonces(/^elijo una opcion sin precio en la matriz de precios$/) do
|
|
185
|
+
doc = Hpricot.parse(@page.matriz_precio_element.html)
|
|
186
|
+
i = ((doc/"li.price-suggestion-matrix-price-").length/2).to_i
|
|
187
|
+
suggestion = (doc/"li.price-suggestion-matrix-price-EMPTY")[i]
|
|
188
|
+
@new_outbound = Date.parse(suggestion.attributes["data-outbounddate"])
|
|
189
|
+
@new_inbound = Date.parse(suggestion.attributes["data-inbounddate"])
|
|
190
|
+
@page.matriz_precio_element.li(:class=>"price-suggestion-matrix-cell price-suggestion-matrix-price price-suggestion-matrix-price-EMPTY", :index=>i).click
|
|
191
|
+
@page.manage_data.set_new_date(@new_outbound,@new_inbound)
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
Entonces(/^espero que la matriz de precios termine de cargar$/) do
|
|
195
|
+
@page.matriz_precio_overlay_element.when_not_visible(timeout=60)
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
Entonces(/^realizo las busquedas para recargar la matriz$/) do
|
|
199
|
+
date = @page.manage_data.date_to_1
|
|
200
|
+
[0,1,2,3].each do |x|
|
|
201
|
+
[0,1,2,3].each do |y|
|
|
202
|
+
@page.manage_data.set_new_date(@page.manage_data.date_from_1,@page.manage_data.date_to_1+1)
|
|
203
|
+
begin
|
|
204
|
+
HTTParty.get(@page.manage_data.generate_url_results_search.gsub(/results/,"data/search") + "/TOTALFARE/ASCENDING/NA/NA/NA/NA/NA?hashForData=#{Digest::MD5.hexdigest(@search.generate_url_results_search+'despegar')}",:headers => {"referer" => @page.manage_data.generate_url_results_search})
|
|
205
|
+
rescue Errno::ECONNRESET,Timeout::Error
|
|
206
|
+
HTTParty.get(@page.manage_data.generate_url_results_search.gsub(/results/,"data/search") + "/TOTALFARE/ASCENDING/NA/NA/NA/NA/NA?hashForData=#{Digest::MD5.hexdigest(@search.generate_url_results_search+'despegar')}",:headers => {"referer" => @page.manage_data.generate_url_results_search})
|
|
207
|
+
end
|
|
208
|
+
end
|
|
209
|
+
@page.manage_data.set_new_date(@page.manage_data.date_from_1+1,date)
|
|
210
|
+
end
|
|
211
|
+
@page.manage_data.set_new_date(@page.manage_data.date_from_1-3,@page.manage_data.date_to_1+3)
|
|
212
|
+
@page.browser.goto(@page.manage_data.generate_url_results_search)
|
|
213
|
+
end
|