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,53 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
When /^Ingreso un destino inexistente$/ do
|
3
|
+
puts @search.generate_url_disambiguation_city
|
4
|
+
BROWSER.goto(@search.generate_url_disambiguation_city)
|
5
|
+
BROWSER.url.should equal(@search.generate_url_disambiguation_city.gsub(/search/,'disambiguation/cities'))
|
6
|
+
end
|
7
|
+
|
8
|
+
Then /^Verifico que se muestre correctamente la pagina de desambiguacion$/ do
|
9
|
+
BROWSER.div(:class,'disambiguation-cities').should visible
|
10
|
+
end
|
11
|
+
|
12
|
+
When /^Elijo un nuevo destino desde desambiguacion de ciudades$/ do
|
13
|
+
countries = ["AR","BR","CL","CO","CR","PA","PE","MX","EC","UY","US","VE"]
|
14
|
+
@cities = []
|
15
|
+
BROWSER.div(:class,'location').select(:class,'flights-select country').select_value($SITE)
|
16
|
+
sleep(1)
|
17
|
+
@cities << MockCity.new($SITE).code
|
18
|
+
begin
|
19
|
+
BROWSER.div(:class,'location').select(:class,'flights-select city').select_value(@cities.last)
|
20
|
+
rescue Watir::Exception::NoValueFoundException
|
21
|
+
sleep(1)
|
22
|
+
BROWSER.div(:class,'location').select(:class,'flights-select city').select_value(@cities.last)
|
23
|
+
end
|
24
|
+
countries.delete($SITE)
|
25
|
+
BROWSER.divs(:class,'location').each_with_index do |option,i|
|
26
|
+
if i>0
|
27
|
+
country = countries[rand(countries.length)]
|
28
|
+
option.select(:class,'flights-select country').select_value(country)
|
29
|
+
sleep(1)
|
30
|
+
@cities << MockCity.new(country).code
|
31
|
+
begin
|
32
|
+
option.select(:class,'flights-select city').select_value(@cities.last)
|
33
|
+
rescue Watir::Exception::NoValueFoundException
|
34
|
+
sleep(1)
|
35
|
+
option.select(:class,'flights-select city').select_value(@cities.last)
|
36
|
+
end
|
37
|
+
countries.delete(country)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
When /^Realizo una nueva busqueda desde desambiguacion de ciudades$/ do
|
43
|
+
url = BROWSER.url
|
44
|
+
BROWSER.a(:class,'flights-search-button disambiguation-button').click
|
45
|
+
Watir::Wait.until(timeout = 60){url != BROWSER.url}
|
46
|
+
end
|
47
|
+
|
48
|
+
When /^Verifico que las ciudades elegidas sean las correctas$/ do
|
49
|
+
puts @cities
|
50
|
+
@cities.each do |city|
|
51
|
+
BROWSER.url.should match(city)
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
Then /^Elijo una aerolinea a aplicar$/ do
|
3
|
+
doc = Hpricot.parse(BROWSER.html)
|
4
|
+
options = (doc/"div.ux-flights-filter-airlines")[0]
|
5
|
+
options = (options/"ul.items label").reject{|option| option.attributes["class"].match(/selected|disabled|enabled/)}
|
6
|
+
@airline = options[rand(options.length)]
|
7
|
+
@total = (@airline/"span.total").inner_text.strip.to_i
|
8
|
+
end
|
9
|
+
|
10
|
+
When /^Filtro por aerolinea$/ do
|
11
|
+
BROWSER.checkbox(:id,(@airline/"input").first.attributes['id']).set
|
12
|
+
end
|
13
|
+
|
14
|
+
And /^Verifico que la primer pagina muestre correctamente los filtros de aerolineas$/ do
|
15
|
+
group_airlines = [["UA","CM","AM","US","AA","DL"],["LA","4M","XL","4C","JJ","PZ"],["AV","TA","LR"]]
|
16
|
+
doc = Hpricot.parse(BROWSER.html)
|
17
|
+
airlines = []
|
18
|
+
airline = (@airline/"img").first.attributes['src'].match(/\/(..)\.png/)[1].strip
|
19
|
+
(doc/"div#clusters div.cluster ul.itineraries-group").each do |itineraries|
|
20
|
+
airlines += (itineraries/"li.logo img").collect{|img| img.attributes['src'].match(/\/(..)\.png/)[1]}
|
21
|
+
airlines += (itineraries/"li.airlines img").collect{|img| img.attributes['src'].match(/\/(..)\.png/)[1]}
|
22
|
+
airlines += (itineraries/"li.airlinesShort img").collect{|img| img.attributes['src'].match(/\/(..)\.png/)[1]}
|
23
|
+
group_airlines.each{|airlines_tmp| airlines.concat(airlines_tmp) if airlines_tmp.include?(airline)}
|
24
|
+
end
|
25
|
+
airlines.should include?(airline)
|
26
|
+
end
|
27
|
+
|
28
|
+
Then /^Limpio el filtro de aerolineas$/ do
|
29
|
+
BROWSER.checkbox(:id,"airlines-all").set
|
30
|
+
end
|
31
|
+
|
32
|
+
Then /^Verifico que los contadores respecto a las aerolineas sean correctos$/ do
|
33
|
+
BROWSER.li(:class,"item time-outbound-all").strong(:class,"total") == @total
|
34
|
+
BROWSER.li(:class,"item airport-outbound-all").strong(:class,"total") == @total
|
35
|
+
BROWSER.li(:class,"item airport-inbound-all").strong(:class,"total") == @total
|
36
|
+
BROWSER.li(:class,"item stops-all").strong(:class,"total") == @total
|
37
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
Then /^Elijo un aeropuerto (outbound|inbound) a aplicar$/ do |_class|
|
3
|
+
doc = Hpricot.parse(BROWSER.html)
|
4
|
+
if _class == 'outbound'
|
5
|
+
_clase = 'origin'
|
6
|
+
else
|
7
|
+
_clase = 'destiny'
|
8
|
+
end
|
9
|
+
options = (doc/"div.ux-flights-filter-#{_clase}airports//label").reject{|option| option.attributes["class"].match(/selected|disabled/) or option.attributes["for"].match(/unique-airport/)}
|
10
|
+
@airport = options[rand(options.length)]
|
11
|
+
@total = (@airport/"span.total").inner_text.strip.to_i
|
12
|
+
end
|
13
|
+
|
14
|
+
When /^Filtro por aeropuerto$/ do
|
15
|
+
BROWSER.checkbox(:id,(@airport/"input").first.attributes['id']).set
|
16
|
+
end
|
17
|
+
|
18
|
+
And /^Verifico que la primer pagina muestre correctamente los filtros de aeropuertos (outbound|inbound)$/ do |_class|
|
19
|
+
doc = Hpricot.parse(BROWSER.html)
|
20
|
+
(@airport/"input").first.attributes["value"].strip.should equal((doc/"div#clusters div.cluster div.#{_class} span.airport a").first.inner_text.strip)
|
21
|
+
end
|
22
|
+
|
23
|
+
Then /^Limpio el filtro de aeropuertos (outbound|inbound)$/ do |_class|
|
24
|
+
BROWSER.checkbox(:id,"airport-#{_class}-all").set
|
25
|
+
end
|
26
|
+
|
27
|
+
Then /^Verifico que los contadores respecto al aeropuerto sean correctos$/ do
|
28
|
+
BROWSER.li(:class,"item time-outbound-all").strong(:class,"total") == @total
|
29
|
+
BROWSER.li(:class,"item airlines-all").strong(:class,"total") == @total
|
30
|
+
BROWSER.li(:class,"item stops-all").strong(:class,"total") == @total
|
31
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
When /^Verifico que el cambio de moneda no muestre limpiar filtros en "(.*)"$/ do |pais|
|
3
|
+
if BROWSER.radio(:value,currency(pais)).present?
|
4
|
+
BROWSER.radio(:value,currency(pais)).set
|
5
|
+
sleep(0.5)
|
6
|
+
BROWSER.radio(:value,"USD").set
|
7
|
+
sleep(0.5)
|
8
|
+
BROWSER.link(:class,'ux-common-filter-clear clean').should_not visible("boton de limpiar filtro")
|
9
|
+
end
|
10
|
+
BROWSER.link(:class,'ux-common-filter-apply apply').text.should match("Aplicar|Apply")
|
11
|
+
end
|
12
|
+
|
13
|
+
Then /^Filtro por precio mayor$/ do
|
14
|
+
if BROWSER.span(:class,'ux-common-filter-slider flights-filter-slider ui-slider ui-slider-horizontal ui-widget ui-widget-content ui-corner-all').present?
|
15
|
+
BROWSER.execute_script("javascript:void($('.price-max').val(''))")
|
16
|
+
BROWSER.div(:id,'ux-flights-filters').text_field(:class,'price-max').set(@price_up+3)
|
17
|
+
BROWSER.link(:class, 'ux-common-filter-apply apply').click
|
18
|
+
step "Espero que termine de cargar"
|
19
|
+
price=BROWSER.div(:id,'ux-flights-filters').text_field(:class,'price-max').value.to_i
|
20
|
+
while(price>@price_up)
|
21
|
+
BROWSER.div(:id,'ux-flights-filters').span(:class,'ux-common-filter-slider flights-filter-slider ui-slider ui-slider-horizontal ui-widget ui-widget-content ui-corner-all').link(:class,'ui-slider-handle ui-state-default ui-corner-all ui-slider-handle-max').send_keys :left
|
22
|
+
price=BROWSER.div(:id,'ux-flights-filters').text_field(:class,'price-max').value.to_i
|
23
|
+
end
|
24
|
+
@price_up=price
|
25
|
+
else
|
26
|
+
BROWSER.text_field(:class,'price-max').set(@price_up)
|
27
|
+
end
|
28
|
+
BROWSER.link(:class, 'ux-common-filter-apply apply').click
|
29
|
+
end
|
30
|
+
When /^Verifico que la pagina no rompa$/ do
|
31
|
+
errores_http(BROWSER)
|
32
|
+
end
|
33
|
+
And /^Verifico que la primer pagina muestre correctamente los filtros de precio$/ do
|
34
|
+
doc = Hpricot.parse(BROWSER.html)
|
35
|
+
(doc/"div#clusters div.cluster").each do |price|
|
36
|
+
itinerary = ResultsCluster.new(@search.description,price)
|
37
|
+
if $SITE.match("MX|UY|PE|BR|CR|PA")
|
38
|
+
(itinerary.tarifas['tarifa_adulto'].value >= @price_down).should be_true
|
39
|
+
(itinerary.tarifas['tarifa_adulto'].value <= @price_up).should be_true
|
40
|
+
else
|
41
|
+
(itinerary.tarifas['total'].value >= @price_down).should be_true
|
42
|
+
(itinerary.tarifas['total'].value <= @price_up).should be_true
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
Then /^Filtro por precio menor$/ do
|
48
|
+
if BROWSER.span(:class,'ux-common-filter-slider flights-filter-slider ui-slider ui-slider-horizontal ui-widget ui-widget-content ui-corner-all').present?
|
49
|
+
BROWSER.execute_script("javascript:void($('.price-min').val(''))")
|
50
|
+
BROWSER.div(:id,'ux-flights-filters').text_field(:class,'price-min').set(@price_down-2)
|
51
|
+
BROWSER.link(:class, 'ux-common-filter-apply apply').click
|
52
|
+
step "Espero que termine de cargar"
|
53
|
+
price=BROWSER.div(:id,'ux-flights-filters').text_field(:class,'price-min').value.to_i
|
54
|
+
while(price<@price_down)
|
55
|
+
BROWSER.div(:id,'ux-flights-filters').span(:class,'ux-common-filter-slider flights-filter-slider ui-slider ui-slider-horizontal ui-widget ui-widget-content ui-corner-all').link(:class,'ui-slider-handle ui-state-default ui-corner-all ui-slider-handle-min').send_keys :right
|
56
|
+
price=BROWSER.div(:id,'ux-flights-filters').text_field(:class,'price-min').value.to_i
|
57
|
+
end
|
58
|
+
@price_down=price
|
59
|
+
else
|
60
|
+
BROWSER.text_field(:class,'price-min').set(@price_down)
|
61
|
+
end
|
62
|
+
BROWSER.link(:class, 'ux-common-filter-apply apply').click
|
63
|
+
end
|
64
|
+
|
65
|
+
When /^Limpio el filtro de precio$/ do
|
66
|
+
if BROWSER.span(:class,'ux-common-filter-slider flights-filter-slider ui-slider ui-slider-horizontal ui-widget ui-widget-content ui-corner-all').present?
|
67
|
+
BROWSER.link(:id,'flights-price-filter-clean').click
|
68
|
+
else
|
69
|
+
BROWSER.link(:class,'ux-common-filter-clear clean').links[0].click
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
When /^Elijo moneda local como precio de filtrado$/ do
|
74
|
+
BROWSER.div(:id,'ux-flights-filters').radio(:value,currency($SITE.upcase)).click if BROWSER.div(:id,'ux-flights-filters').radio(:value,currency($SITE.upcase)).present?
|
75
|
+
sleep(2)
|
76
|
+
end
|
77
|
+
|
78
|
+
Then /^Recupero los precios limites de la lista$/ do
|
79
|
+
if $SITE.match("MX|PE|UY|BR|CR|PA")
|
80
|
+
@li_class = "span.fare"
|
81
|
+
BROWSER.select_list(:id,'orderby').select_value("FARE_ASCENDING")
|
82
|
+
Watir::Wait.until(timeout = 10){!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?}
|
83
|
+
else
|
84
|
+
@li_class = "li.fare-price"
|
85
|
+
end
|
86
|
+
doc = Hpricot.parse(BROWSER.html)
|
87
|
+
@price_down=Price.new((doc/"div#clusters div.cluster #{@li_class} span[@class='price-currency #{currency($SITE)} '] span.currency").first.inner_text + " " + (doc/"div#clusters div.cluster #{@li_class} span[@class='price-currency #{currency($SITE)} '] span.amount").first.inner_text).value
|
88
|
+
@price_up=Price.new((doc/"div#clusters div.cluster #{@li_class} span[@class='price-currency #{currency($SITE)} '] span.currency")[-2].inner_text + " " + (doc/"div#clusters div.cluster #{@li_class} span[@class='price-currency #{currency($SITE)} '] span.amount")[-2].inner_text).value
|
89
|
+
puts @price_down
|
90
|
+
puts @price_up
|
91
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
Then /^Elijo una escala a aplicar$/ do
|
3
|
+
doc = Hpricot.parse(BROWSER.html)
|
4
|
+
options = (doc/"div.ux-flights-filter-stops//label").reject{|option| option.attributes["class"].match(/selected|disabled/)}
|
5
|
+
@stop = options[rand(options.length)]
|
6
|
+
@cant = (@stop/"span.label").inner_text.gsub(/\D/,'').strip.to_i
|
7
|
+
@total = (@stop/"span.total").inner_text.strip.to_i
|
8
|
+
end
|
9
|
+
|
10
|
+
When /^Filtro por escala$/ do
|
11
|
+
BROWSER.checkbox(:id,(@stop/"input").first.attributes['id']).set
|
12
|
+
end
|
13
|
+
|
14
|
+
And /^Verifico que la primer pagina muestre correctamente los filtros de escalas$/ do
|
15
|
+
doc = Hpricot.parse(BROWSER.html)
|
16
|
+
(doc/"div#clusters div.cluster li.stops").each do |stop|
|
17
|
+
applied_stop = @cant
|
18
|
+
stop_displayed = stop.inner_text.gsub(/\D/,'').strip.to_i
|
19
|
+
if applied_stop == 2
|
20
|
+
(applied_stop<=>stop_displayed).should be_true
|
21
|
+
elsif applied_stop == 1
|
22
|
+
(applied_stop>=stop_displayed).should be_true
|
23
|
+
else
|
24
|
+
applied_stop.should equal(stop_displayed)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
And /^Verifico que la primer pagina muestre correctamente los filtros de escalas en matriz$/ do
|
30
|
+
doc = Hpricot.parse(BROWSER.html)
|
31
|
+
(doc/"div#clusters div.cluster li.stops").each do |stop|
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
Then /^Limpio el filtro de escalas$/ do
|
36
|
+
BROWSER.checkbox(:id,'stops-all').set
|
37
|
+
end
|
38
|
+
|
39
|
+
Then /^Verifico que los contadores respecto a las escalas sean correctos$/ do
|
40
|
+
BROWSER.li(:class,"item time-outbound-all").strong(:class,"total") == @total
|
41
|
+
BROWSER.li(:class,"item airport-outbound-all").strong(:class,"total") == @total
|
42
|
+
BROWSER.li(:class,"item airport-inbound-all").strong(:class,"total") == @total
|
43
|
+
BROWSER.li(:class,"item airlines-all").strong(:class,"total") == @total
|
44
|
+
end
|
@@ -0,0 +1,146 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
Then /^Elijo un horario (outbound|inbound) a aplicar$/ do |_class|
|
3
|
+
doc = Hpricot.parse(BROWSER.html)
|
4
|
+
if BROWSER.div(:class,"ux-common-filter-section ux-common-filter-slider ux-flights-filter-hours-slider ux-flights-filter-#{_class}hours-slider").present?
|
5
|
+
options = (doc/"div.ux-flights-filter-#{_class}hours-slider ul.ux-common-filter-options li")
|
6
|
+
@time = options[rand(options.length)]
|
7
|
+
else
|
8
|
+
options = (doc/"div.ux-flights-filter-#{_class}hours//label").reject{|option| option.attributes["class"].match(/selected|disabled/)}
|
9
|
+
@time = options[rand(options.length)]
|
10
|
+
@total = (@time/"span.total").inner_text.strip.to_i
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
When /^Filtro por horario (outbound|inbound)$/ do |_class|
|
15
|
+
if BROWSER.div(:class,"ux-common-filter-section ux-common-filter-slider ux-flights-filter-hours-slider ux-flights-filter-#{_class}hours-slider").present?
|
16
|
+
BROWSER.link(:text,@time.inner_text).click
|
17
|
+
box=BROWSER.div(:class,"ux-common-filter-section ux-common-filter-slider ux-flights-filter-hours-slider ux-flights-filter-#{_class}hours-slider")
|
18
|
+
box.link(:class,'ux-common-filter-apply').click
|
19
|
+
else
|
20
|
+
BROWSER.checkbox(:id,(@time/"input").first.attributes['id']).set
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
And /^Verifico que la primer pagina muestre correctamente los filtros de horario (outbound|inbound)$/ do |_class|
|
25
|
+
doc = Hpricot.parse(BROWSER.html)
|
26
|
+
if BROWSER.a(:class,'remove-last-action').present?
|
27
|
+
puts "Disculpe, no encontramos vuelos con el último criterio que ha seleccionado."
|
28
|
+
else
|
29
|
+
if BROWSER.div(:class,'ux-common-filter-section ux-common-filter-slider ux-flights-filter-hours-slider ux-flights-filter-outboundhours-slider ux-common-filter-change ux-common-filter-active').present?
|
30
|
+
case (@time/"a").inner_text.strip
|
31
|
+
when "Mañana"
|
32
|
+
maxx, min = Time.parse("12:00"), Time.parse("05:00")
|
33
|
+
when "Manhã"
|
34
|
+
maxx, min = Time.parse("12:00"), Time.parse("05:00")
|
35
|
+
when "Morning"
|
36
|
+
maxx, min = Time.parse("12:00"), Time.parse("05:00")
|
37
|
+
when "Tarde"
|
38
|
+
maxx, min = Time.parse("19:00"), Time.parse("12:00")
|
39
|
+
when "Afternoon"
|
40
|
+
maxx, min = Time.parse("19:00"), Time.parse("12:00")
|
41
|
+
when "Noche"
|
42
|
+
maxx, min = Time.parse("00:00")+(24*60*60),Time.parse("19:00")
|
43
|
+
when "Noite"
|
44
|
+
maxx, min = Time.parse("00:00")+(24*60*60),Time.parse("19:00")
|
45
|
+
when "Night"
|
46
|
+
maxx, min = Time.parse("00:00")+(24*60*60),Time.parse("19:00")
|
47
|
+
when "Madrugada"
|
48
|
+
maxx, min = Time.parse("05:00"),Time.parse("00:00")
|
49
|
+
when "Dawn"
|
50
|
+
maxx, min = Time.parse("05:00"),Time.parse("00:00")
|
51
|
+
end
|
52
|
+
else
|
53
|
+
case (@time/"input").first.attributes['value'].strip
|
54
|
+
when "MORNING"
|
55
|
+
maxx, min = Time.parse("12:00"), Time.parse("06:00")
|
56
|
+
when "AFTERNOON"
|
57
|
+
maxx, min = Time.parse("20:00"), Time.parse("12:00")
|
58
|
+
when "NIGHT"
|
59
|
+
maxx, min = Time.parse("00:00")+(24*60*60),Time.parse("20:00")
|
60
|
+
when "EARLY_MORNING"
|
61
|
+
maxx, min = Time.parse("06:00"),Time.parse("00:00")
|
62
|
+
end
|
63
|
+
end
|
64
|
+
(doc/"div#clusters div.cluster div.#{_class} ul.itineraries-group li.itinerary").each do |itineraries|
|
65
|
+
hour = Time.parse((itineraries/"li.leave span.hour").inner_text.strip)
|
66
|
+
(hour <= maxx and hour >= min).should be_true
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
Then /^Limpio el filtro de escalas (outbound|inbound)$/ do |_class|
|
72
|
+
BROWSER.checkbox(:id,"time-#{_class}-all").set
|
73
|
+
end
|
74
|
+
|
75
|
+
Then /^Verifico que los contadores respecto a los horarios sean correctos$/ do
|
76
|
+
BROWSER.li(:class,"item airlines-all").strong(:class,"total") == @total
|
77
|
+
BROWSER.li(:class,"item airport-outbound-all").strong(:class,"total") == @total
|
78
|
+
BROWSER.li(:class,"item airport-inbound-all").strong(:class,"total") == @total
|
79
|
+
BROWSER.li(:class,"item stops-all").strong(:class,"total") == @total
|
80
|
+
end
|
81
|
+
|
82
|
+
Then /^Elijo una duracion (outbound|inbound) a aplicar$/ do |_class|
|
83
|
+
unless((_class=="inbound")and(@search.description=="oneway"))
|
84
|
+
box=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")
|
85
|
+
@from_time=box.li(:class,'ux-common-filter-hour-min').spans.first.text
|
86
|
+
puts @from_time
|
87
|
+
@to_time=box.li(:class,'ux-common-filter-hour-max').spans.first.text
|
88
|
+
puts @to_time
|
89
|
+
diff="#{@to_time.split(':')[0].to_i-1}:#{@from_time.split(':')[1]}"
|
90
|
+
puts diff
|
91
|
+
while(@to_time!=diff and @to_time!=@from_time)
|
92
|
+
box.link(:class,'ui-slider-handle ui-state-default ui-corner-all ui-slider-handle-max').send_keys :left
|
93
|
+
@to_time=box.li(:class,'ux-common-filter-hour-max').spans.first.text
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
Then /^filtro por duracion (outbound|inbound)$/ do |_class|
|
99
|
+
unless((_class=="inbound")and(@search.description=="oneway"))
|
100
|
+
box=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")
|
101
|
+
box.link(:class,'ux-common-filter-apply').click
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
Then /^Verifico que la primer pagina muestre correctamente los filtros de duracion (outbound|inbound)$/ do |_class|
|
106
|
+
unless((_class=="inbound")and(@search.description=="oneway"))
|
107
|
+
doc = Hpricot.parse(BROWSER.html)
|
108
|
+
(doc/"div#clusters div.cluster div.#{_class} ul.itineraries-group li.itinerary").each do |itineraries|
|
109
|
+
time = (itineraries/"li.time span").inner_text.strip.split(' ')
|
110
|
+
if time.length==1
|
111
|
+
aux = time.first
|
112
|
+
if(aux.match(/h/))
|
113
|
+
time[0]=aux
|
114
|
+
time[1]="00m"
|
115
|
+
else
|
116
|
+
time[0]="00h"
|
117
|
+
time[1]=aux
|
118
|
+
end
|
119
|
+
end
|
120
|
+
(time[0].gsub(/\D/,'').to_i >= @from_time.split(':')[0].to_i).should be_true
|
121
|
+
(time[0].gsub(/\D/,'').to_i <= @to_time.split(':')[0].to_i).should be_true
|
122
|
+
if ((time[0].gsub(/\D/,'').to_i == @from_time.split(':')[0].to_i)and(time[1]))
|
123
|
+
(time[1].gsub(/\D/,'').to_i >= @from_time.split(':')[1].to_i).should be_true
|
124
|
+
end
|
125
|
+
if ((time[0].gsub(/\D/,'').to_i == @to_time.split(':')[0].to_i)and(time[1]))
|
126
|
+
(time[1].gsub(/\D/,'').to_i <= @to_time.split(':')[1].to_i).should be_true
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
Then /^Limpio el filtro de duracion (outbound|inbound)$/ do |_class|
|
133
|
+
unless((_class=="inbound")and(@search.description=="oneway"))
|
134
|
+
box=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")
|
135
|
+
box.link(:class,'ux-common-filter-reset').click
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
Then /^Limpio el filtro de horario (outbound|inbound)$/ do |_class|
|
140
|
+
if BROWSER.div(:class,"ux-common-filter-section ux-common-filter-slider ux-flights-filter-hours-slider ux-flights-filter-#{_class}hours-slider").present?
|
141
|
+
box=BROWSER.div(:class,"ux-common-filter-section ux-common-filter-slider ux-flights-filter-hours-slider ux-flights-filter-#{_class}hours-slider")
|
142
|
+
box.link(:class,'ux-common-filter-reset').click
|
143
|
+
else
|
144
|
+
BROWSER.checkbox(:id,'time-outbound-all').set
|
145
|
+
end
|
146
|
+
end
|
@@ -0,0 +1,276 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
When /^Elijo en la matriz una aerolinea a aplicar$/ do
|
3
|
+
doc = Hpricot.parse(BROWSER.html)
|
4
|
+
@airline = (doc/"div.matrix-airlines div.airline-description")[rand((doc/"div.matrix-airlines div.airline-description").length)]
|
5
|
+
end
|
6
|
+
|
7
|
+
When /^Elijo en la matriz una escala a aplicar$/ do
|
8
|
+
doc = Hpricot.parse(BROWSER.html)
|
9
|
+
@stop = (doc/"ul.matrix-scales li.scale")[rand((doc/"ul.matrix-scales li.scale").length)]
|
10
|
+
@cant = @stop.inner_text.gsub(/\D/,'').strip.to_i
|
11
|
+
end
|
12
|
+
|
13
|
+
Then /^Filtro por matriz una escala$/ do
|
14
|
+
BROWSER.ul(:class,'matrix-scales').li(:text, @stop.inner_text.strip).click
|
15
|
+
end
|
16
|
+
|
17
|
+
Then /^Filtro por matriz una aerolinea$/ do
|
18
|
+
BROWSER.div(:class,'flights-tab-header flights-tab-airlinePricesMatrix').click if !BROWSER.div(:class,/matrix-airlines matrix/).present?
|
19
|
+
BROWSER.span(:class,'matrix-next').click while !BROWSER.div(:class,'matrix-airlines-container').img(:src, (@airline/"img").first.attributes['src']).present?
|
20
|
+
BROWSER.div(:class,'matrix-airlines-container').img(:src, (@airline/"img").first.attributes['src']).click
|
21
|
+
end
|
22
|
+
|
23
|
+
And /^Valido mensaje del filtro por escala$/ do
|
24
|
+
puts BROWSER.div(:class,'matrix-filter').span.text.no_accents.downcase.strip
|
25
|
+
scale = case $SITE
|
26
|
+
when "BR" then {"1 escala"=>"com uma escala","direto"=>"diretos","2 escalas ou mais"=>"com duas ou mais escalas"}
|
27
|
+
when "US" then {"1 stop"=>"with 1 stop","non-stop"=>"Non-stop","2 stops or more"=>"with two or more stops"}
|
28
|
+
else {"1 escala"=>"con una escala","directo"=>"directos","2 escalas o mas"=>"con dos o mas escalas"}
|
29
|
+
end
|
30
|
+
BROWSER.div(:class,'matrix-filter').span.text.no_accents.strip.should match("Currently viewing: #{scale[@stop.inner_text.no_accents.downcase.strip]} flights|Currently viewing: Flights #{scale[@stop.inner_text.no_accents.downcase.strip]}|Actualmente visualizando: Vuelos #{scale[@stop.inner_text.no_accents.downcase.strip]}|Atualmente visualizando: Voos #{scale[@stop.inner_text.no_accents.downcase.strip]}")
|
31
|
+
end
|
32
|
+
|
33
|
+
And /^Valido mensaje del filtro por aerolinea$/ do
|
34
|
+
BROWSER.div(:class,'matrix-filter').span.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}")
|
35
|
+
end
|
36
|
+
|
37
|
+
And /^Limpio la matriz$/ do
|
38
|
+
BROWSER.a(:class,'matrix-reset').click
|
39
|
+
end
|
40
|
+
|
41
|
+
And /^no se muestra la matriz de precios$/ do
|
42
|
+
(!BROWSER.div(:class,'flights-tab-header flights-tab-priceSuggestionMatrix ').present? and !BROWSER.div(:id,'ux-common-message ux-common-message-success price-suggestion-matrix-alert').present?).should be_true
|
43
|
+
end
|
44
|
+
|
45
|
+
And /^Modifico la cookie "(.*)" con el valor "(.*)"$/ do |name,value|
|
46
|
+
cookie = get_cookie(name)
|
47
|
+
delete_cookie(name)
|
48
|
+
add_cookie(name,value,{:expires => cookie[:expires],:domain=>cookie[:domain]})
|
49
|
+
end
|
50
|
+
|
51
|
+
And /^Realizo las busquedas para recargar la matriz$/ do
|
52
|
+
date = @search.date_to_1
|
53
|
+
[0,1,2,3].each do |x|
|
54
|
+
[0,1,2,3].each do |y|
|
55
|
+
@search.set_new_date(@search.date_from_1,@search.date_to_1+1)
|
56
|
+
begin
|
57
|
+
HTTParty.get(@search.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" => @search.generate_url_results_search})
|
58
|
+
rescue Errno::ECONNRESET,Timeout::Error
|
59
|
+
HTTParty.get(@search.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" => @search.generate_url_results_search})
|
60
|
+
end
|
61
|
+
end
|
62
|
+
@search.set_new_date(@search.date_from_1+1,date)
|
63
|
+
end
|
64
|
+
@search.set_new_date(@search.date_from_1-3,@search.date_to_1+3)
|
65
|
+
BROWSER.goto(@search.generate_url_results_search)
|
66
|
+
end
|
67
|
+
|
68
|
+
Then /^Verifico que se muestre la matriz de precios$/ do
|
69
|
+
value = get_abtesting("priceSuggestionMatrixAlertType")
|
70
|
+
if BROWSER.div(:class,'ux-common-overlay ux-common-overlay-top-center ux-common-overlay-popover popup-price-suggestion-matrix-alert').present?
|
71
|
+
BROWSER.div(:class,'ux-common-overlay ux-common-overlay-top-center ux-common-overlay-popover popup-price-suggestion-matrix-alert').click
|
72
|
+
sleep(2)
|
73
|
+
end
|
74
|
+
if BROWSER.div(:class,'flights-tab-header flights-tab-priceSuggestionMatrix ').present?
|
75
|
+
BROWSER.div(:class,'flights-tab-header flights-tab-priceSuggestionMatrix ').click
|
76
|
+
sleep(2)
|
77
|
+
end
|
78
|
+
BROWSER.div(:id,'price-suggestion-matrix').should visible
|
79
|
+
end
|
80
|
+
|
81
|
+
#se verifica que en la matriz de precios mostrada se encuentren las cantidad de fechas correctas
|
82
|
+
And /^Verifico la correcta disposicion de la matriz de precios$/ do
|
83
|
+
doc = Hpricot.parse(BROWSER.div(:id,'price-suggestion-matrix').html)
|
84
|
+
#filas
|
85
|
+
(doc/"ul.price-suggestion-matrix-date").first.should be_true
|
86
|
+
(doc/"ul.price-suggestion-matrix-date li.price-suggestion-matrix-cell").length.should equal(8)
|
87
|
+
(doc/"ul.price-suggestion-matrix-date li.price-suggestion-matrix-first-cell").length.should equal(1)
|
88
|
+
(doc/"ul.price-suggestion-matrix-date li.price-suggestion-matrix-inbound").length.should equal(7)
|
89
|
+
#columnas
|
90
|
+
(doc/"div.price-suggestion-matrix-responsive").first.should be_true
|
91
|
+
(doc/"div.price-suggestion-matrix-responsive ul.price-suggestion-matrix-column").length.should equal(7)
|
92
|
+
end
|
93
|
+
|
94
|
+
#verifico que las fechas mostradas sean las correctas
|
95
|
+
And /^Verifico las fechas de la matriz de precios$/ do
|
96
|
+
doc = Hpricot.parse(BROWSER.div(:id,'price-suggestion-matrix').html)
|
97
|
+
#levanto las fechas mostradas en la matriz
|
98
|
+
#idas
|
99
|
+
@outbounds = (doc/"div.price-suggestion-matrix-responsive li.price-suggestion-matrix-outbound").collect{|li| Date.parse(li.attributes['data-outbounddate'])}
|
100
|
+
#vueltas
|
101
|
+
@inbounds = (doc/"ul.price-suggestion-matrix-date li.price-suggestion-matrix-inbound").collect{|li| Date.parse(li.attributes['data-inbounddate'])}
|
102
|
+
#verifico que las fechas sean continuas +/- 2 dias a las fechas buscadas
|
103
|
+
[-2,-1,0,1,2].each do |days|
|
104
|
+
@outbounds.include?(@search.date_from_1+days)
|
105
|
+
@inbounds.include?(@search.date_to_1+days)
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
#Se verifica que las fechas que se usaron en la busqueda sea la opcion central en la matriz de precios
|
110
|
+
And /^Verifico que la fechas buscadas sea la central en la matriz de precios$/ do
|
111
|
+
doc = Hpricot.parse(BROWSER.div(:id,'price-suggestion-matrix').html)
|
112
|
+
@search.date_from_1.should equal(Date.parse((doc/"li.price-suggestion-matrix-price-CURRENT").first.attributes["data-outbounddate"]))
|
113
|
+
@search.date_to_1.should equal(Date.parse((doc/"li.price-suggestion-matrix-price-CURRENT").first.attributes["data-inbounddate"]))
|
114
|
+
end
|
115
|
+
|
116
|
+
#Se verifica la existencia de otra fecha con precio y se levantan las fechas
|
117
|
+
And /^Verifico que exista otra fecha con precio en la matriz de precios$/ do
|
118
|
+
doc = Hpricot.parse(BROWSER.div(:id,'price-suggestion-matrix').html)
|
119
|
+
if (doc/"li.price-suggestion-matrix-price-CHEAPEST").first
|
120
|
+
option="price-suggestion-matrix-price-CHEAPEST"
|
121
|
+
else
|
122
|
+
option="price-suggestion-matrix-price-EXPENSIVE"
|
123
|
+
end
|
124
|
+
(doc/"li.#{option}").first.should be_true
|
125
|
+
@new_outbound = Date.parse((doc/"li.#{option}").first.attributes["data-outbounddate"])
|
126
|
+
@new_inbound = Date.parse((doc/"li.#{option}").first.attributes["data-inbounddate"])
|
127
|
+
@price = Price.new((doc/"li.#{option} span[@class='price-currency #{currency($SITE)} '] span.currency").first.inner_text+" "+(doc/"li.#{option} span[@class='price-currency #{currency($SITE)} '] span.amount").first.inner_text)
|
128
|
+
BROWSER.div(:id,'price-suggestion-matrix').li(:class,"price-suggestion-matrix-cell price-suggestion-matrix-price price-suggestion-matrix-price-VALID #{option}").click
|
129
|
+
@search.set_new_date(@new_outbound,@new_inbound)
|
130
|
+
end
|
131
|
+
|
132
|
+
#Se verifica que el precio de la opcion de fecha elegida sea mostrado primero en la lista de itinerarios
|
133
|
+
And /^Verifico que el precio mostrado en la matriz sea el primero en los itinerarios$/ do
|
134
|
+
doc = Hpricot.parse(BROWSER.div(:id,'price-suggestion-matrix').html)
|
135
|
+
@actual_price = Price.new((doc/"li.price-suggestion-matrix-price-CURRENT span[@class='price-currency #{currency($SITE)} '] span.currency").first.inner_text+" "+(doc/"li.price-suggestion-matrix-price-CURRENT span[@class='price-currency #{currency($SITE)} '] span.amount").first.inner_text)
|
136
|
+
puts "#{@price}==#{@actual_price}"
|
137
|
+
end
|
138
|
+
|
139
|
+
#Se verifica la opcion de elejir una opcion sin precio
|
140
|
+
And /^Elijo una opcion sin precio en la matriz de precios$/ do
|
141
|
+
doc = Hpricot.parse(BROWSER.div(:id,'price-suggestion-matrix').html)
|
142
|
+
i = ((doc/"li.price-suggestion-matrix-price-").length/2).to_i
|
143
|
+
suggestion = (doc/"li.price-suggestion-matrix-price-EMPTY")[i]
|
144
|
+
@new_outbound = Date.parse(suggestion.attributes["data-outbounddate"])
|
145
|
+
@new_inbound = Date.parse(suggestion.attributes["data-inbounddate"])
|
146
|
+
BROWSER.div(:id,'price-suggestion-matrix').li(:class=>"price-suggestion-matrix-cell price-suggestion-matrix-price price-suggestion-matrix-price-EMPTY", :index=>i).click
|
147
|
+
@search.set_new_date(@new_outbound,@new_inbound)
|
148
|
+
end
|
149
|
+
|
150
|
+
And /^Espero que la matriz de precios termine de cargar$/ do
|
151
|
+
Watir::Wait.until(timeout=60){!BROWSER.div(:id,'price-suggestion-matrix').div(:class,'price-suggestion-matrix-overlay').present?}
|
152
|
+
end
|
153
|
+
|
154
|
+
When /^Fuerzo el abztesting de showFareChart al "(.*)"$/ do |value|
|
155
|
+
cookie = BROWSER.cookies.to_a.select{|cookie| cookie[:name]=="abzTestingId"}.first
|
156
|
+
new_value = cookie[:value].gsub(/#{get_abtesting('showFareChart')}/,value)
|
157
|
+
delete_cookie("abzTestingId")
|
158
|
+
add_cookie("abzTestingId",new_value,{:expires => cookie[:expires],:domain=>cookie[:domain]})
|
159
|
+
end
|
160
|
+
|
161
|
+
And /^Ingreso a la matriz de tendencia de precios$/ do
|
162
|
+
BROWSER.div(:class,'flights-tabs').div(:class,'flights-tab-header flights-tab-fareChart').should visible("matriz de evolucion de tarifas")
|
163
|
+
BROWSER.div(:class,'flights-tabs').div(:class,'flights-tab-header flights-tab-fareChart').click
|
164
|
+
Watir::Wait.until(timeout=20){BROWSER.div(:id,'fare-chart').div(:class,'fare-chart-content').present?}
|
165
|
+
end
|
166
|
+
|
167
|
+
And /^Verifico el l\&f de la matriz de tendencia de precios$/ do
|
168
|
+
doc = Hpricot.parse(BROWSER.div(:id,'fare-chart').html)
|
169
|
+
#content
|
170
|
+
(doc/"div.fare-chart-content").empty?.should be_false
|
171
|
+
#main
|
172
|
+
(doc/"div.fare-chart-content div.fare-chart-main").empty?.should be_false
|
173
|
+
(doc/"div.fare-chart-content div.fare-chart-main div.fare-chart-values-container").empty?.should be_false
|
174
|
+
(doc/"div.fare-chart-content div.fare-chart-main div.fare-chart-values-container").empty?.should be_false
|
175
|
+
(doc/"div.fare-chart-content div.fare-chart-main div.fare-chart-big-viewport").empty?.should be_false
|
176
|
+
(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
|
177
|
+
(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)
|
178
|
+
#secondary
|
179
|
+
(doc/"div.fare-chart-content div.fare-chart-secondary").empty?.should be_false
|
180
|
+
(doc/"div.fare-chart-content div.fare-chart-secondary div[@class='fare-chart-bars-container fare-chart-small']").empty?.should be_false
|
181
|
+
(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)
|
182
|
+
(doc/"div.fare-chart-content div.fare-chart-secondary div[@class='fare-char-small-selector ui-draggable']").empty?.should be_false
|
183
|
+
#script
|
184
|
+
BROWSER.script(:id,'popup-fare-chart-template').exists?.should be_true
|
185
|
+
end
|
186
|
+
|
187
|
+
And /^Verifico que la matriz cumpla con el rango de fechas de la busqueda$/ do
|
188
|
+
doc = Hpricot.parse(BROWSER.div(:id,'fare-chart').html)
|
189
|
+
#main
|
190
|
+
visible_months = BROWSER.div(:class,'fare-chart-main').divs(:class,'fare-chart-bars-text').select{|d| d.present?}.collect{|m| m.text}
|
191
|
+
#visible_months.should include?(@search.date_from_1.mes.capitalize) #verifico que se muestre el mes elegido
|
192
|
+
today = Date.today
|
193
|
+
months = []
|
194
|
+
count = 0
|
195
|
+
while(today.month != (@search.date_from_1.month+1)) do
|
196
|
+
months << today.mes.capitalize
|
197
|
+
today = today + 1
|
198
|
+
count = count + 1
|
199
|
+
break if count > 13
|
200
|
+
end
|
201
|
+
months.uniq!
|
202
|
+
visible_months.delete(visible_months.last) if (visible_months.length!=months.length)
|
203
|
+
#months.sort.should equal(visible_months.sort) #verifico que se muestren todos los meses hasta la fecha de salida
|
204
|
+
#(doc/"div.fare-chart-main div.fare-chart-current-price div").first.attributes['data-month-index'].to_i.should equal(@search.date_from_1.month - 1) #verifico que el mes del precio mostrado sea el correcto
|
205
|
+
(doc/"div.fare-chart-main div.fare-chart-current-price div").first.attributes['data-suggestion-index'].to_i.should equal(@search.date_from_1.day - 1) #verifico que el mes del precio mostrado sea el correcto
|
206
|
+
|
207
|
+
#secondary
|
208
|
+
visible_months_abbr = BROWSER.div(:class,'fare-chart-secondary').divs(:class,'fare-chart-bars-text').collect{|m| m.text}
|
209
|
+
#visible_months_abbr.should include?(@search.date_from_1.mes_abrr.capitalize)
|
210
|
+
#(doc/"div.fare-chart-secondary div.fare-chart-current-price div").first.attributes['data-month-index'].to_i.should equal(@search.date_from_1.month - 1) #verifico que el mes del precio mostrado sea el correcto
|
211
|
+
(doc/"div.fare-chart-secondary div.fare-chart-current-price div").first.attributes['data-suggestion-index'].to_i.should equal(@search.date_from_1.day - 1) #verifico que el mes del precio mostrado sea el correcto
|
212
|
+
end
|
213
|
+
|
214
|
+
And /^Verificar que los datos mostrados en la matriz sean correctos$/ do
|
215
|
+
doc = Hpricot.parse(BROWSER.div(:id,'fare-chart').html)
|
216
|
+
first_value = ResultsCluster.new(@search.description, Hpricot.parse(BROWSER.div(:id,'clusters').div(:class,'cluster').html))
|
217
|
+
max_value = (doc/"div.fare-chart-content div.fare-chart-main div.fare-chart-values-container div.fare-chart-value span.#{currency($SITE)} span.amount")[0]
|
218
|
+
(first_value.tarifas['tarifa_adulto'].value <= max_value.inner_text.gsub(/\./,"").to_i).should be_true
|
219
|
+
#para usar despues
|
220
|
+
@min_value = (doc/"div.fare-chart-content div.fare-chart-main div.fare-chart-values-container div.fare-chart-value span.#{currency($SITE)} span.amount")[1]
|
221
|
+
end
|
222
|
+
|
223
|
+
And /^Verificar que filtre por una celda de la matriz$/ do
|
224
|
+
i=0
|
225
|
+
BROWSER.div(:class,'fare-chart-secondary').div(:class,'fare-chart-bars-container fare-chart-small').div(:class=>'fare-chart-bars',:index=>0).click
|
226
|
+
while(!BROWSER.div(:class,'fare-chart-bar fare-chart-min-price').present?) do
|
227
|
+
i=i+1
|
228
|
+
BROWSER.div(:class,'fare-chart-secondary').div(:class,'fare-chart-bars-container fare-chart-small').div(:class=>'fare-chart-bars',:index=>i).divs(:class,'fare-chart-bar ')[-1].click if BROWSER.div(:class,'fare-chart-secondary').div(:class,'fare-chart-bars-container fare-chart-small').div(:class=>'fare-chart-bars',:index=>i).present?
|
229
|
+
end
|
230
|
+
doc = Hpricot.parse(BROWSER.div(:id,'fare-chart').html)
|
231
|
+
month_bar = (doc/"div.fare-chart-main div.fare-chart-bars div.fare-chart-min-price")
|
232
|
+
puts "#{(month_bar/'div').first.attributes['data-suggestion-index'].to_i+1}"+"/"+"#{(month_bar/'div').first.attributes['data-month-index'].to_i+1}"+"/"+"2014"
|
233
|
+
@search.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"))
|
234
|
+
BROWSER.div(:class,'fare-chart-main').div(:class,'fare-chart-bar fare-chart-min-price').div(:class,'fare-chart-bar-content').click
|
235
|
+
step "Espero que termine de cargar"
|
236
|
+
step "Ingreso a la matriz de tendencia de precios"
|
237
|
+
step "Verifico el l&f de la matriz de tendencia de precios"
|
238
|
+
step "Verifico que la matriz cumpla con el rango de fechas de la busqueda"
|
239
|
+
end
|
240
|
+
|
241
|
+
And /^Verifico el mensaje de aclaracion de precio de matriz de precios$/ do
|
242
|
+
text = case $SITE
|
243
|
+
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."
|
244
|
+
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."
|
245
|
+
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."
|
246
|
+
end
|
247
|
+
BROWSER.div(:id,'price-suggestion-matrix').span(:class,'price-suggestion-description-text').text.strip.no_accents.should equal(text.strip.no_accents)
|
248
|
+
end
|
249
|
+
|
250
|
+
And /^Verifico el mensaje de aclaracion de precio de matriz de tendencia de precios$/ do
|
251
|
+
text = case $SITE
|
252
|
+
when "US" then 'Prices per adult(.*). The displayed prices are the best found by users in the last days and they could be outdated.'
|
253
|
+
when "BR" then 'Precos por adulto(.*). Os valores exibidos sao referentes aos encontrados por nossos usuarios nos ultimos dias e podem estar desatualizados.'
|
254
|
+
else 'Precios por adulto(.*). Los precios visualizados son los mejores encontrados por los usuarios en los ultimos dias y podrian no estar actualizados.'
|
255
|
+
end
|
256
|
+
BROWSER.div(:id,'fare-chart').span(:class,'fare-chart-description-text').text.strip.no_accents.should match(text.strip.no_accents)
|
257
|
+
end
|
258
|
+
# And /^Verificar que filtre por una celda de la matriz$/ do
|
259
|
+
# i=0
|
260
|
+
# BROWSER.div(:class,'fare-chart-secondary').div(:class,'fare-chart-bars-container fare-chart-small').div(:class,'fare-chart-bars').click
|
261
|
+
# i=i+1
|
262
|
+
# BROWSER.div(:class,'fare-chart-secondary').div(:class,'fare-chart-bars-container fare-chart-small').div(:class=>'fare-chart-bars',:index=>i).divs(:class,'fare-chart-bar ')[-1].click if BROWSER.div(:class,'fare-chart-secondary').div(:class,'fare-chart-bars-container fare-chart-small').div(:class=>'fare-chart-bars',:index=>i).present?
|
263
|
+
# while(!BROWSER.div(:class,'fare-chart-bar fare-chart-weekend-bar').present?) do
|
264
|
+
# i=i+1
|
265
|
+
# BROWSER.div(:class,'fare-chart-secondary').div(:class,'fare-chart-bars-container fare-chart-small').div(:class=>'fare-chart-bars',:index=>i).divs(:class,'fare-chart-bar ')[-1].click if BROWSER.div(:class,'fare-chart-secondary').div(:class,'fare-chart-bars-container fare-chart-small').div(:class=>'fare-chart-bars',:index=>i).present?
|
266
|
+
# end
|
267
|
+
# month_bar = Hpricot.parse(BROWSER.div(:id,'fare-chart').div(:class,'fare-chart-bar fare-chart-weekend-bar').html)
|
268
|
+
# puts (month_bar/'div div').first.attributes
|
269
|
+
# @search.set_from_date(Date.parse("#{(month_bar/'div').first.attributes['data-suggestion-index'].to_i+1}"+"/"+"#{(month_bar/'div').first.attributes['data-month-index']}"+"/"+"2014"))
|
270
|
+
# BROWSER.div(:class,'fare-chart-bar fare-chart-weekend-bar').click
|
271
|
+
# step "Espero que termine de cargar"
|
272
|
+
# step "Ingreso a la matriz de tendencia de precios"
|
273
|
+
# step "Verifico el l&f de la matriz de tendencia de precios"
|
274
|
+
# step "Verifico que la matriz cumpla con el rango de fechas de la busqueda"
|
275
|
+
# end
|
276
|
+
|