flights_gui_henry_tests 1.8.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +15 -0
- data/Gemfile +3 -0
- data/features/data/home-offers-config.csv +883 -0
- data/features/data/host.yml +72 -0
- data/features/data/miles.yml +216 -0
- data/features/data/search.yml +27 -0
- data/features/data/sites.yml +39 -0
- data/features/data/tag_microsoft.yml +68 -0
- data/features/step_definitions/checkout/agencia_steps.rb +6 -0
- data/features/step_definitions/checkout/chat_steps.rb +43 -0
- data/features/step_definitions/checkout/checkout_steps.rb +144 -0
- data/features/step_definitions/checkout/cupones_steps.rb +26 -0
- data/features/step_definitions/checkout/error_messages.rb +251 -0
- data/features/step_definitions/checkout/seguros_steps.rb +78 -0
- data/features/step_definitions/checkout/thanks_steps.rb +75 -0
- data/features/step_definitions/content/contents_steps.rb +140 -0
- data/features/step_definitions/desambiguation/disambiguation_airports_steps.rb +73 -0
- data/features/step_definitions/desambiguation/disambiguation_city_steps.rb +43 -0
- data/features/step_definitions/filter/filters_airlines.rb +38 -0
- data/features/step_definitions/filter/filters_airports_steps.rb +31 -0
- data/features/step_definitions/filter/filters_price_steps.rb +87 -0
- data/features/step_definitions/filter/filters_stops_steps.rb +44 -0
- data/features/step_definitions/filter/filters_time_steps.rb +143 -0
- data/features/step_definitions/filter/matrix_steps.rb +249 -0
- data/features/step_definitions/landing/landing_checkout_steps.rb +45 -0
- data/features/step_definitions/landing/landing_filters_steps.rb +17 -0
- data/features/step_definitions/landing/landing_home_alerts_steps.rb +21 -0
- data/features/step_definitions/landing/landing_home_steps.rb +82 -0
- data/features/step_definitions/landing/landing_long_tail.rb +58 -0
- data/features/step_definitions/landing/landing_negative_steps.rb +127 -0
- data/features/step_definitions/landing/landing_passenger_review_steps.rb +8 -0
- data/features/step_definitions/landing/landing_steps.rb +325 -0
- data/features/step_definitions/orders/orders.rb +67 -0
- data/features/step_definitions/others/advancedgui_steps.rb +28 -0
- data/features/step_definitions/others/advancednogui_steps.rb +34 -0
- data/features/step_definitions/others/anticipatedsearch_steps.rb +13 -0
- data/features/step_definitions/others/flights_tracker_steps.rb +73 -0
- data/features/step_definitions/others/generic_steps.rb +35 -0
- data/features/step_definitions/others/newsletter_steps.rb +50 -0
- data/features/step_definitions/others/one_day_search.rb +58 -0
- data/features/step_definitions/others/print_steps.rb +26 -0
- data/features/step_definitions/others/querystringparameters_steps.rb +6 -0
- data/features/step_definitions/others/recommendation_steps.rb +80 -0
- data/features/step_definitions/others/render_steps.rb +70 -0
- data/features/step_definitions/others/tag_steps.rb +157 -0
- data/features/step_definitions/others/upgrade_bussines_steps.rb +27 -0
- data/features/step_definitions/results/load_steps.rb +69 -0
- data/features/step_definitions/results/results_steps.rb +21 -0
- data/features/step_definitions/results/search_steps.rb +82 -0
- data/features/step_definitions/search/alerts_steps.rb +132 -0
- data/features/step_definitions/search/basefare_steps.rb +64 -0
- data/features/step_definitions/search/bestprices_steps.rb +70 -0
- data/features/step_definitions/search/cross_sell_row_hoteles.rb +78 -0
- data/features/step_definitions/search/cross_sell_steps.rb +15 -0
- data/features/step_definitions/search/delays_steps.rb +67 -0
- data/features/step_definitions/search/details_steps.rb +9 -0
- data/features/step_definitions/search/ecoflights_steps.rb +9 -0
- data/features/step_definitions/search/fenix_steps.rb +119 -0
- data/features/step_definitions/search/flight_gui_steps.rb +312 -0
- data/features/step_definitions/search/miles_step.rb +13 -0
- data/features/step_definitions/search/pagination_steps.rb +41 -0
- data/features/step_definitions/search/reviews_step.rb +56 -0
- data/features/step_definitions/search/search_no_gui_steps.rb +185 -0
- data/features/step_definitions/search/wish_list_steps.rb +123 -0
- data/features/support/env.rb +61 -0
- data/features/support/lib/clusters/data/datos_new.rb +33 -0
- data/features/support/lib/clusters/details/details_cluster.rb +30 -0
- data/features/support/lib/clusters/results/landing_cluster.rb +29 -0
- data/features/support/lib/clusters/results/render_cluster.rb +43 -0
- data/features/support/lib/clusters/results_cluster.rb +140 -0
- data/features/support/lib/clusters.rb +5 -0
- data/features/support/lib/helpers/browser.rb +212 -0
- data/features/support/lib/helpers/checkout.rb +31 -0
- data/features/support/lib/helpers/clusters.rb +234 -0
- data/features/support/lib/helpers/landing.rb +117 -0
- data/features/support/lib/helpers/render.rb +135 -0
- data/features/support/lib/helpers.rb +5 -0
- data/features/support/lib/price.rb +66 -0
- data/features/support/lib/services/fenix.rb +14 -0
- data/features/support/lib/services/landing.rb +18 -0
- data/features/support/lib/services/results.rb +62 -0
- data/features/support/lib/services.rb +4 -0
- data/features/support/matchers.rb +120 -0
- data/features/support/redefinitions.rb +42 -0
- data/features/tests/checkout/agency.feature +33 -0
- data/features/tests/checkout/button_cac.feature +52 -0
- data/features/tests/checkout/chat.feature +20 -0
- data/features/tests/checkout/cupones.feature +54 -0
- data/features/tests/checkout/error_messages.feature +64 -0
- data/features/tests/checkout/integration.feature +215 -0
- data/features/tests/checkout/low_cost.feature +55 -0
- data/features/tests/checkout/seguros.feature +37 -0
- data/features/tests/contents/costs.feature +29 -0
- data/features/tests/contents/rules.feature +58 -0
- data/features/tests/contents/webcheckin.feature +26 -0
- data/features/tests/desambiguation/airports.feature +89 -0
- data/features/tests/desambiguation/city.feature +86 -0
- data/features/tests/filters/filters.feature +160 -0
- data/features/tests/fixes/advancedgui.feature +171 -0
- data/features/tests/fixes/advancednogui.feature +60 -0
- data/features/tests/fixes/book_no_gui.feature +21 -0
- data/features/tests/fixes/cross_sell_row_hoteles.feature +70 -0
- data/features/tests/fixes/facebook.feature +31 -0
- data/features/tests/fixes/landing_home_alerts.feature +82 -0
- data/features/tests/fixes/matrix_stops.feature +104 -0
- data/features/tests/fixes/one_day_search.feature +63 -0
- data/features/tests/fixes/print.feature +87 -0
- data/features/tests/fixes/searches_no_gui.feature +85 -0
- data/features/tests/landing/landing_alerts.feature +93 -0
- data/features/tests/landing/landing_checkout.feature +286 -0
- data/features/tests/landing/landing_filters.feature +176 -0
- data/features/tests/landing/landing_home.feature +68 -0
- data/features/tests/landing/landing_integration.feature +153 -0
- data/features/tests/landing/landing_long_tail.feature +162 -0
- data/features/tests/landing/landing_matrix.feature +156 -0
- data/features/tests/landing/landing_negative.feature +157 -0
- data/features/tests/landing/landing_orders.feature +107 -0
- data/features/tests/landing/landing_pagination.feature +142 -0
- data/features/tests/landing/landing_passenger_review.feature +139 -0
- data/features/tests/landing/landing_positive.feature +155 -0
- data/features/tests/landing/landing_reviews.feature +139 -0
- data/features/tests/landing/landing_tags.feature +148 -0
- data/features/tests/matrix/matrix_airlines.feature +104 -0
- data/features/tests/matrix/matrix_fare_chart.feature +24 -0
- data/features/tests/matrix/matrix_price.feature +35 -0
- data/features/tests/others/alerts.feature +89 -0
- data/features/tests/others/anticipatedsearch.feature +82 -0
- data/features/tests/others/flights_tracker.feature +94 -0
- data/features/tests/others/newsletter.feature +131 -0
- data/features/tests/others/querystringparameters.feature +82 -0
- data/features/tests/others/recommendation.feature +170 -0
- data/features/tests/others/semaphore.feature +206 -0
- data/features/tests/others/upgrade_bussines.feature +100 -0
- data/features/tests/search/basefare.feature +88 -0
- data/features/tests/search/itineraries.feature +85 -0
- data/features/tests/search/orders.feature +100 -0
- data/features/tests/search/pagination.feature +70 -0
- data/features/tests/search/reviews.feature +84 -0
- data/features/tests/search/searches.feature +197 -0
- data/features/tests/search/wish_list.feature +102 -0
- data/flights_gui_henry_tests.gemspec +32 -0
- data/henry-context.yml +14733 -0
- metadata +324 -0
|
@@ -0,0 +1,43 @@
|
|
|
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
|
+
BROWSER.div(:class,'location').select(:class,'flights-select city').select_value(@cities.last)
|
|
19
|
+
countries.delete($SITE)
|
|
20
|
+
BROWSER.divs(:class,'location').each_with_index do |option,i|
|
|
21
|
+
if i>0
|
|
22
|
+
country = countries[rand(countries.length)]
|
|
23
|
+
option.select(:class,'flights-select country').select_value(country)
|
|
24
|
+
sleep(1)
|
|
25
|
+
@cities << MockCity.new(country).code
|
|
26
|
+
option.select(:class,'flights-select city').select_value(@cities.last)
|
|
27
|
+
countries.delete(country)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
When /^Realizo una nueva busqueda desde desambiguacion de ciudades$/ do
|
|
33
|
+
url = BROWSER.url
|
|
34
|
+
BROWSER.a(:class,'flights-search-button disambiguation-button').click
|
|
35
|
+
Watir::Wait.until(timeout = 60){url != BROWSER.url}
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
When /^Verifico que las ciudades elegidas sean las correctas$/ do
|
|
39
|
+
puts @cities
|
|
40
|
+
@cities.each do |city|
|
|
41
|
+
BROWSER.url.should match(city)
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
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/)}
|
|
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
|
+
puts (@airline/"input").first.attributes['id']
|
|
12
|
+
BROWSER.checkbox(:id,(@airline/"input").first.attributes['id']).set
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
And /^Verifico que la primer pagina muestre correctamente los filtros de aerolineas$/ do
|
|
16
|
+
group_airlines = [["UA","CM","AM","US","AA","DL"],["LA","4M","XL","4C","JJ","PZ"],["AV","TA","LR"]]
|
|
17
|
+
doc = Hpricot.parse(BROWSER.html)
|
|
18
|
+
airlines = []
|
|
19
|
+
airline = (@airline/"img").first.attributes['src'].match(/\/(..)\.png/)[1].strip
|
|
20
|
+
(doc/"div#clusters div.cluster ul.itineraries-group").each do |itineraries|
|
|
21
|
+
airlines += (itineraries/"li.logo img").collect{|img| img.attributes['src'].match(/\/(..)\.png/)[1]}
|
|
22
|
+
airlines += (itineraries/"li.airlines img").collect{|img| img.attributes['src'].match(/\/(..)\.png/)[1]}
|
|
23
|
+
airlines += (itineraries/"li.airlinesShort img").collect{|img| img.attributes['src'].match(/\/(..)\.png/)[1]}
|
|
24
|
+
group_airlines.each{|airlines_tmp| airlines.concat(airlines_tmp) if airlines_tmp.include?(airline)}
|
|
25
|
+
end
|
|
26
|
+
airlines.should include?(airline)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
Then /^Limpio el filtro de aerolineas$/ do
|
|
30
|
+
BROWSER.checkbox(:id,"airlines-all").set
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
Then /^Verifico que los contadores respecto a las aerolineas sean correctos$/ do
|
|
34
|
+
BROWSER.li(:class,"item time-outbound-all").strong(:class,"total") == @total
|
|
35
|
+
BROWSER.li(:class,"item airport-outbound-all").strong(:class,"total") == @total
|
|
36
|
+
BROWSER.li(:class,"item airport-inbound-all").strong(:class,"total") == @total
|
|
37
|
+
BROWSER.li(:class,"item stops-all").strong(:class,"total") == @total
|
|
38
|
+
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/)}
|
|
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} li.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,87 @@
|
|
|
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.div(:id,'ux-flights-filters').text_field(:class,'price-max').set(nil)
|
|
16
|
+
BROWSER.div(:id,'ux-flights-filters').text_field(:class,'price-max').set(@price_up+3)
|
|
17
|
+
price=BROWSER.div(:id,'ux-flights-filters').text_field(:class,'price-max').value.to_i
|
|
18
|
+
while(price>@price_up)
|
|
19
|
+
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
|
|
20
|
+
price=BROWSER.div(:id,'ux-flights-filters').text_field(:class,'price-max').value.to_i
|
|
21
|
+
end
|
|
22
|
+
@price_up=price
|
|
23
|
+
else
|
|
24
|
+
BROWSER.text_field(:class,'price-max').set(@price_up)
|
|
25
|
+
end
|
|
26
|
+
BROWSER.link(:class, 'ux-common-filter-apply apply').click
|
|
27
|
+
end
|
|
28
|
+
When /^Verifico que la pagina no rompa$/ do
|
|
29
|
+
errores_http(BROWSER)
|
|
30
|
+
end
|
|
31
|
+
And /^Verifico que la primer pagina muestre correctamente los filtros de precio$/ do
|
|
32
|
+
doc = Hpricot.parse(BROWSER.html)
|
|
33
|
+
(doc/"div#clusters div.cluster").each do |price|
|
|
34
|
+
itinerary = ResultsCluster.new(@search.description,price)
|
|
35
|
+
if $SITE.match("MX|UY|PE|BR|CR|PA")
|
|
36
|
+
(itinerary.tarifas['tarifa_adulto'].value >= @price_down).should be_true
|
|
37
|
+
(itinerary.tarifas['tarifa_adulto'].value <= @price_up).should be_true
|
|
38
|
+
else
|
|
39
|
+
(itinerary.tarifas['total'].value >= @price_down).should be_true
|
|
40
|
+
(itinerary.tarifas['total'].value <= @price_up).should be_true
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
Then /^Filtro por precio menor$/ do
|
|
46
|
+
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?
|
|
47
|
+
BROWSER.div(:id,'ux-flights-filters').text_field(:class,'price-min').set(nil)
|
|
48
|
+
BROWSER.div(:id,'ux-flights-filters').text_field(:class,'price-min').set(@price_down-2)
|
|
49
|
+
price=BROWSER.div(:id,'ux-flights-filters').text_field(:class,'price-min').value.to_i
|
|
50
|
+
while(price<@price_down)
|
|
51
|
+
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
|
|
52
|
+
price=BROWSER.div(:id,'ux-flights-filters').text_field(:class,'price-min').value.to_i
|
|
53
|
+
end
|
|
54
|
+
@price_down=price
|
|
55
|
+
else
|
|
56
|
+
BROWSER.text_field(:class,'price-min').set(@price_down)
|
|
57
|
+
end
|
|
58
|
+
BROWSER.link(:class, 'ux-common-filter-apply apply').click
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
When /^Limpio el filtro de precio$/ do
|
|
62
|
+
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?
|
|
63
|
+
BROWSER.link(:id,'flights-price-filter-clean').click
|
|
64
|
+
else
|
|
65
|
+
BROWSER.link(:class,'ux-common-filter-clear clean').links[0].click
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
When /^Elijo moneda local como precio de filtrado$/ do
|
|
70
|
+
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?
|
|
71
|
+
sleep(2)
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
Then /^Recupero los precios limites de la lista$/ do
|
|
75
|
+
if $SITE.match("MX|PE|UY|BR|CR|PA")
|
|
76
|
+
@li_class = "span.fare"
|
|
77
|
+
BROWSER.select_list(:id,'orderby').select_value("FARE_ASCENDING")
|
|
78
|
+
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?}
|
|
79
|
+
else
|
|
80
|
+
@li_class = "li.fare-price"
|
|
81
|
+
end
|
|
82
|
+
doc = Hpricot.parse(BROWSER.html)
|
|
83
|
+
@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
|
|
84
|
+
@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
|
|
85
|
+
puts @price_down
|
|
86
|
+
puts @price_up
|
|
87
|
+
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,143 @@
|
|
|
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 strong").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
|
+
@to_time=box.li(:class,'ux-common-filter-hour-max').spans.first.text
|
|
87
|
+
diff="#{@to_time.split(':')[0].to_i-@from_time.split(':')[0].to_i}:#{@from_time.split(':')[1]}"
|
|
88
|
+
while(@to_time!=diff and @to_time!=@from_time)
|
|
89
|
+
box.link(:class,'ui-slider-handle ui-state-default ui-corner-all ui-slider-handle-max').send_keys :left
|
|
90
|
+
@to_time=box.li(:class,'ux-common-filter-hour-max').spans.first.text
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
Then /^filtro por duracion (outbound|inbound)$/ do |_class|
|
|
96
|
+
unless((_class=="inbound")and(@search.description=="oneway"))
|
|
97
|
+
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")
|
|
98
|
+
box.link(:class,'ux-common-filter-apply').click
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
Then /^Verifico que la primer pagina muestre correctamente los filtros de duracion (outbound|inbound)$/ do |_class|
|
|
103
|
+
unless((_class=="inbound")and(@search.description=="oneway"))
|
|
104
|
+
doc = Hpricot.parse(BROWSER.html)
|
|
105
|
+
(doc/"div#clusters div.cluster div.#{_class} ul.itineraries-group li.itinerary").each do |itineraries|
|
|
106
|
+
time = (itineraries/"li.time span").inner_text.strip.split(' ')
|
|
107
|
+
if time.length==1
|
|
108
|
+
aux = time.first
|
|
109
|
+
if(aux.match(/h/))
|
|
110
|
+
time[0]=aux
|
|
111
|
+
time[1]="00m"
|
|
112
|
+
else
|
|
113
|
+
time[0]="00h"
|
|
114
|
+
time[1]=aux
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
(time[0].gsub(/\D/,'').to_i >= @from_time.split(':')[0].to_i).should be_true
|
|
118
|
+
(time[0].gsub(/\D/,'').to_i <= @to_time.split(':')[0].to_i).should be_true
|
|
119
|
+
if ((time[0].gsub(/\D/,'').to_i == @from_time.split(':')[0].to_i)and(time[1]))
|
|
120
|
+
(time[1].gsub(/\D/,'').to_i >= @from_time.split(':')[1].to_i).should be_true
|
|
121
|
+
end
|
|
122
|
+
if ((time[0].gsub(/\D/,'').to_i == @to_time.split(':')[0].to_i)and(time[1]))
|
|
123
|
+
(time[1].gsub(/\D/,'').to_i <= @to_time.split(':')[1].to_i).should be_true
|
|
124
|
+
end
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
Then /^Limpio el filtro de duracion (outbound|inbound)$/ do |_class|
|
|
130
|
+
unless((_class=="inbound")and(@search.description=="oneway"))
|
|
131
|
+
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")
|
|
132
|
+
box.link(:class,'ux-common-filter-reset').click
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
Then /^Limpio el filtro de horario (outbound|inbound)$/ do |_class|
|
|
137
|
+
if BROWSER.div(:class,"ux-common-filter-section ux-common-filter-slider ux-flights-filter-hours-slider ux-flights-filter-#{_class}hours-slider").present?
|
|
138
|
+
box=BROWSER.div(:class,"ux-common-filter-section ux-common-filter-slider ux-flights-filter-hours-slider ux-flights-filter-#{_class}hours-slider")
|
|
139
|
+
box.link(:class,'ux-common-filter-reset').click
|
|
140
|
+
else
|
|
141
|
+
BROWSER.checkbox(:id,'time-outbound-all').set
|
|
142
|
+
end
|
|
143
|
+
end
|
|
@@ -0,0 +1,249 @@
|
|
|
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 ').should_not visible
|
|
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
|
+
puts "#{@search.date_from_1}/#{@search.date_to_1}"
|
|
56
|
+
@search.set_new_date(@search.date_from_1,@search.date_to_1+1)
|
|
57
|
+
begin
|
|
58
|
+
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})
|
|
59
|
+
rescue Errno::ECONNRESET,Timeout::Error
|
|
60
|
+
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})
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
@search.set_new_date(@search.date_from_1+1,date)
|
|
64
|
+
end
|
|
65
|
+
@search.set_new_date(@search.date_from_1-3,@search.date_to_1+3)
|
|
66
|
+
puts @search.generate_url_results_search
|
|
67
|
+
BROWSER.goto(@search.generate_url_results_search)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
Then /^Verifico que se muestre la matriz de precios$/ do
|
|
71
|
+
if BROWSER.div(:class,'flights-tab-header flights-tab-priceSuggestionMatrix ').present?
|
|
72
|
+
BROWSER.div(:class,'flights-tab-header flights-tab-priceSuggestionMatrix ').click
|
|
73
|
+
sleep(2)
|
|
74
|
+
end
|
|
75
|
+
BROWSER.div(:id,'price-suggestion-matrix').should visible
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
#se verifica que en la matriz de precios mostrada se encuentren las cantidad de fechas correctas
|
|
79
|
+
And /^Verifico la correcta disposicion de la matriz de precios$/ do
|
|
80
|
+
doc = Hpricot.parse(BROWSER.div(:id,'price-suggestion-matrix').html)
|
|
81
|
+
#filas
|
|
82
|
+
(doc/"ul.price-suggestion-matrix-date").first.should be_true
|
|
83
|
+
(doc/"ul.price-suggestion-matrix-date li.price-suggestion-matrix-cell").length.should equal(8)
|
|
84
|
+
(doc/"ul.price-suggestion-matrix-date li.price-suggestion-matrix-first-cell").length.should equal(1)
|
|
85
|
+
(doc/"ul.price-suggestion-matrix-date li.price-suggestion-matrix-inbound").length.should equal(7)
|
|
86
|
+
#columnas
|
|
87
|
+
(doc/"div.price-suggestion-matrix-responsive").first.should be_true
|
|
88
|
+
(doc/"div.price-suggestion-matrix-responsive ul.price-suggestion-matrix-column").length.should equal(7)
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
#verifico que las fechas mostradas sean las correctas
|
|
92
|
+
And /^Verifico las fechas de la matriz de precios$/ do
|
|
93
|
+
doc = Hpricot.parse(BROWSER.div(:id,'price-suggestion-matrix').html)
|
|
94
|
+
#levanto las fechas mostradas en la matriz
|
|
95
|
+
#idas
|
|
96
|
+
@outbounds = (doc/"div.price-suggestion-matrix-responsive li.price-suggestion-matrix-outbound").collect{|li| Date.parse(li.attributes['data-outbounddate'])}
|
|
97
|
+
#vueltas
|
|
98
|
+
@inbounds = (doc/"ul.price-suggestion-matrix-date li.price-suggestion-matrix-inbound").collect{|li| Date.parse(li.attributes['data-inbounddate'])}
|
|
99
|
+
#verifico que las fechas sean continuas +/- 2 dias a las fechas buscadas
|
|
100
|
+
[-2,-1,0,1,2].each do |days|
|
|
101
|
+
@outbounds.include?(@search.date_from_1+days)
|
|
102
|
+
@inbounds.include?(@search.date_to_1+days)
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
#Se verifica que las fechas que se usaron en la busqueda sea la opcion central en la matriz de precios
|
|
107
|
+
And /^Verifico que la fechas buscadas sea la central en la matriz de precios$/ do
|
|
108
|
+
doc = Hpricot.parse(BROWSER.div(:id,'price-suggestion-matrix').html)
|
|
109
|
+
@search.date_from_1.should equal(Date.parse((doc/"li.price-suggestion-matrix-price-CURRENT").first.attributes["data-outbounddate"]))
|
|
110
|
+
@search.date_to_1.should equal(Date.parse((doc/"li.price-suggestion-matrix-price-CURRENT").first.attributes["data-inbounddate"]))
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
#Se verifica la existencia de otra fecha con precio y se levantan las fechas
|
|
114
|
+
And /^Verifico que exista otra fecha con precio en la matriz de precios$/ do
|
|
115
|
+
doc = Hpricot.parse(BROWSER.div(:id,'price-suggestion-matrix').html)
|
|
116
|
+
if (doc/"li.price-suggestion-matrix-price-CHEAPEST").first
|
|
117
|
+
option="price-suggestion-matrix-price-CHEAPEST"
|
|
118
|
+
else
|
|
119
|
+
option="price-suggestion-matrix-price-EXPENSIVE"
|
|
120
|
+
end
|
|
121
|
+
(doc/"li.#{option}").first.should be_true
|
|
122
|
+
@new_outbound = Date.parse((doc/"li.#{option}").first.attributes["data-outbounddate"])
|
|
123
|
+
@new_inbound = Date.parse((doc/"li.#{option}").first.attributes["data-inbounddate"])
|
|
124
|
+
@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)
|
|
125
|
+
BROWSER.div(:id,'price-suggestion-matrix').li(:class,"price-suggestion-matrix-cell price-suggestion-matrix-price #{option}").click
|
|
126
|
+
@search.set_new_date(@new_outbound,@new_inbound)
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
#Se verifica que el precio de la opcion de fecha elegida sea mostrado primero en la lista de itinerarios
|
|
130
|
+
And /^Verifico que el precio mostrado en la matriz sea el primero en los itinerarios$/ do
|
|
131
|
+
doc = Hpricot.parse(BROWSER.div(:id,'price-suggestion-matrix').html)
|
|
132
|
+
@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)
|
|
133
|
+
puts "#{@price}==#{@actual_price}"
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
#Se verifica la opcion de elejir una opcion sin precio
|
|
137
|
+
And /^Elijo una opcion sin precio en la matriz de precios$/ do
|
|
138
|
+
doc = Hpricot.parse(BROWSER.div(:id,'price-suggestion-matrix').html)
|
|
139
|
+
i = ((doc/"li.price-suggestion-matrix-price-").length/2).to_i
|
|
140
|
+
suggestion = (doc/"li.price-suggestion-matrix-price-")[i]
|
|
141
|
+
@new_outbound = Date.parse(suggestion.attributes["data-outbounddate"])
|
|
142
|
+
@new_inbound = Date.parse(suggestion.attributes["data-inbounddate"])
|
|
143
|
+
BROWSER.div(:id,'price-suggestion-matrix').li(:class=>"price-suggestion-matrix-cell price-suggestion-matrix-price price-suggestion-matrix-price-", :index=>i).click
|
|
144
|
+
@search.set_new_date(@new_outbound,@new_inbound)
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
When /^Fuerzo el abztesting de showFareChart al "(.*)"$/ do |value|
|
|
148
|
+
cookie = BROWSER.cookies.to_a.select{|cookie| cookie[:name]=="abzTestingId"}.first
|
|
149
|
+
new_value = cookie[:value].gsub(/#{get_abtesting('showFareChart')}/,value)
|
|
150
|
+
delete_cookie("abzTestingId")
|
|
151
|
+
add_cookie("abzTestingId",new_value,{:expires => cookie[:expires],:domain=>cookie[:domain]})
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
And /^Ingreso a la matriz de tendencia de precios$/ do
|
|
155
|
+
BROWSER.div(:class,'flights-tabs').div(:class,'flights-tab-header flights-tab-fareChart').should visible("matriz de evolucion de tarifas")
|
|
156
|
+
BROWSER.div(:class,'flights-tabs').div(:class,'flights-tab-header flights-tab-fareChart').click
|
|
157
|
+
Watir::Wait.until(timeout=20){BROWSER.div(:id,'fare-chart').div(:class,'fare-chart-content').present?}
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
And /^Verifico el l\&f de la matriz de tendencia de precios$/ do
|
|
161
|
+
doc = Hpricot.parse(BROWSER.div(:id,'fare-chart').html)
|
|
162
|
+
#content
|
|
163
|
+
(doc/"div.fare-chart-content").empty?.should be_false
|
|
164
|
+
(doc/"div.fare-chart-content span.fare-chart-description-text").inner_text.strip.should equal("Precio aproximado por adulto")
|
|
165
|
+
#main
|
|
166
|
+
(doc/"div.fare-chart-content div.fare-chart-main").empty?.should be_false
|
|
167
|
+
(doc/"div.fare-chart-content div.fare-chart-main div.fare-chart-values-container").empty?.should be_false
|
|
168
|
+
(doc/"div.fare-chart-content div.fare-chart-main div.fare-chart-values-container").empty?.should be_false
|
|
169
|
+
(doc/"div.fare-chart-content div.fare-chart-main div.fare-chart-big-viewport").empty?.should be_false
|
|
170
|
+
(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
|
|
171
|
+
(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(12)
|
|
172
|
+
#secondary
|
|
173
|
+
(doc/"div.fare-chart-content div.fare-chart-secondary").empty?.should be_false
|
|
174
|
+
(doc/"div.fare-chart-content div.fare-chart-secondary div[@class='fare-chart-bars-container fare-chart-small']").empty?.should be_false
|
|
175
|
+
(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(12)
|
|
176
|
+
(doc/"div.fare-chart-content div.fare-chart-secondary div[@class='fare-char-small-selector ui-draggable']").empty?.should be_false
|
|
177
|
+
#script
|
|
178
|
+
BROWSER.script(:id,'popup-fare-chart-template').exists?.should be_true
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
And /^Verifico que la matriz cumpla con el rango de fechas de la busqueda$/ do
|
|
182
|
+
doc = Hpricot.parse(BROWSER.div(:id,'fare-chart').html)
|
|
183
|
+
#main
|
|
184
|
+
visible_months = BROWSER.div(:class,'fare-chart-main').divs(:class,'fare-chart-bars-text').select{|d| d.present?}.collect{|m| m.text}
|
|
185
|
+
visible_months.should include?(@search.date_from_1.mes.capitalize) #verifico que se muestre el mes elegido
|
|
186
|
+
today = Date.today
|
|
187
|
+
months = []
|
|
188
|
+
while(today.month != (@search.date_from_1.month+1)) do
|
|
189
|
+
months << today.mes.capitalize
|
|
190
|
+
today = today +1
|
|
191
|
+
end
|
|
192
|
+
months.uniq!
|
|
193
|
+
visible_months.delete(visible_months.last) if (visible_months.length!=months.length)
|
|
194
|
+
months.sort.should equal(visible_months.sort) #verifico que se muestren todos los meses hasta la fecha de salida
|
|
195
|
+
(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) #verifico que el mes del precio mostrado sea el correcto
|
|
196
|
+
(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
|
|
197
|
+
|
|
198
|
+
#secondary
|
|
199
|
+
visible_months_abbr = BROWSER.div(:class,'fare-chart-secondary').divs(:class,'fare-chart-bars-text').collect{|m| m.text}
|
|
200
|
+
visible_months_abbr.should include?(@search.date_from_1.mes_abrr.capitalize)
|
|
201
|
+
(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) #verifico que el mes del precio mostrado sea el correcto
|
|
202
|
+
(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
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
And /^Verificar que los datos mostrados en la matriz sean correctos$/ do
|
|
206
|
+
doc = Hpricot.parse(BROWSER.div(:id,'fare-chart').html)
|
|
207
|
+
first_value = ResultsCluster.new(@search.description, Hpricot.parse(BROWSER.div(:id,'clusters').div(:class,'cluster').html))
|
|
208
|
+
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]
|
|
209
|
+
(first_value.tarifas['tarifa_adulto'].value <= max_value.inner_text.gsub(/\./,"").to_i).should be_true
|
|
210
|
+
#para usar despues
|
|
211
|
+
@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]
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
And /^Verificar que filtre por una celda de la matriz$/ do
|
|
215
|
+
i=0
|
|
216
|
+
BROWSER.div(:class,'fare-chart-secondary').div(:class,'fare-chart-bars-container fare-chart-small').div(:class=>'fare-chart-bars',:index=>1).click
|
|
217
|
+
while(!BROWSER.div(:class,'fare-chart-bar fare-chart-min-price').present?) do
|
|
218
|
+
i=i+1
|
|
219
|
+
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?
|
|
220
|
+
end
|
|
221
|
+
doc = Hpricot.parse(BROWSER.div(:id,'fare-chart').html)
|
|
222
|
+
month_bar = (doc/"div.fare-chart-main div.fare-chart-bars div.fare-chart-min-price")
|
|
223
|
+
@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"))
|
|
224
|
+
BROWSER.div(:class,'fare-chart-main').div(:class,'fare-chart-bar fare-chart-min-price').div(:class,'fare-chart-bar-content').click
|
|
225
|
+
step "Espero que termine de cargar"
|
|
226
|
+
step "Ingreso a la matriz de tendencia de precios"
|
|
227
|
+
step "Verifico el l&f de la matriz de tendencia de precios"
|
|
228
|
+
step "Verifico que la matriz cumpla con el rango de fechas de la busqueda"
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
# And /^Verificar que filtre por una celda de la matriz$/ do
|
|
232
|
+
# i=0
|
|
233
|
+
# BROWSER.div(:class,'fare-chart-secondary').div(:class,'fare-chart-bars-container fare-chart-small').div(:class,'fare-chart-bars').click
|
|
234
|
+
# i=i+1
|
|
235
|
+
# 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?
|
|
236
|
+
# while(!BROWSER.div(:class,'fare-chart-bar fare-chart-weekend-bar').present?) do
|
|
237
|
+
# i=i+1
|
|
238
|
+
# 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?
|
|
239
|
+
# end
|
|
240
|
+
# month_bar = Hpricot.parse(BROWSER.div(:id,'fare-chart').div(:class,'fare-chart-bar fare-chart-weekend-bar').html)
|
|
241
|
+
# puts (month_bar/'div div').first.attributes
|
|
242
|
+
# @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"))
|
|
243
|
+
# BROWSER.div(:class,'fare-chart-bar fare-chart-weekend-bar').click
|
|
244
|
+
# step "Espero que termine de cargar"
|
|
245
|
+
# step "Ingreso a la matriz de tendencia de precios"
|
|
246
|
+
# step "Verifico el l&f de la matriz de tendencia de precios"
|
|
247
|
+
# step "Verifico que la matriz cumpla con el rango de fechas de la busqueda"
|
|
248
|
+
# end
|
|
249
|
+
|