flights_gui_henry_tests 1.8.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (143) hide show
  1. checksums.yaml +15 -0
  2. data/Gemfile +3 -0
  3. data/features/data/home-offers-config.csv +883 -0
  4. data/features/data/host.yml +72 -0
  5. data/features/data/miles.yml +216 -0
  6. data/features/data/search.yml +27 -0
  7. data/features/data/sites.yml +39 -0
  8. data/features/data/tag_microsoft.yml +68 -0
  9. data/features/step_definitions/checkout/agencia_steps.rb +6 -0
  10. data/features/step_definitions/checkout/chat_steps.rb +43 -0
  11. data/features/step_definitions/checkout/checkout_steps.rb +144 -0
  12. data/features/step_definitions/checkout/cupones_steps.rb +26 -0
  13. data/features/step_definitions/checkout/error_messages.rb +251 -0
  14. data/features/step_definitions/checkout/seguros_steps.rb +78 -0
  15. data/features/step_definitions/checkout/thanks_steps.rb +75 -0
  16. data/features/step_definitions/content/contents_steps.rb +140 -0
  17. data/features/step_definitions/desambiguation/disambiguation_airports_steps.rb +73 -0
  18. data/features/step_definitions/desambiguation/disambiguation_city_steps.rb +43 -0
  19. data/features/step_definitions/filter/filters_airlines.rb +38 -0
  20. data/features/step_definitions/filter/filters_airports_steps.rb +31 -0
  21. data/features/step_definitions/filter/filters_price_steps.rb +87 -0
  22. data/features/step_definitions/filter/filters_stops_steps.rb +44 -0
  23. data/features/step_definitions/filter/filters_time_steps.rb +143 -0
  24. data/features/step_definitions/filter/matrix_steps.rb +249 -0
  25. data/features/step_definitions/landing/landing_checkout_steps.rb +45 -0
  26. data/features/step_definitions/landing/landing_filters_steps.rb +17 -0
  27. data/features/step_definitions/landing/landing_home_alerts_steps.rb +21 -0
  28. data/features/step_definitions/landing/landing_home_steps.rb +82 -0
  29. data/features/step_definitions/landing/landing_long_tail.rb +58 -0
  30. data/features/step_definitions/landing/landing_negative_steps.rb +127 -0
  31. data/features/step_definitions/landing/landing_passenger_review_steps.rb +8 -0
  32. data/features/step_definitions/landing/landing_steps.rb +325 -0
  33. data/features/step_definitions/orders/orders.rb +67 -0
  34. data/features/step_definitions/others/advancedgui_steps.rb +28 -0
  35. data/features/step_definitions/others/advancednogui_steps.rb +34 -0
  36. data/features/step_definitions/others/anticipatedsearch_steps.rb +13 -0
  37. data/features/step_definitions/others/flights_tracker_steps.rb +73 -0
  38. data/features/step_definitions/others/generic_steps.rb +35 -0
  39. data/features/step_definitions/others/newsletter_steps.rb +50 -0
  40. data/features/step_definitions/others/one_day_search.rb +58 -0
  41. data/features/step_definitions/others/print_steps.rb +26 -0
  42. data/features/step_definitions/others/querystringparameters_steps.rb +6 -0
  43. data/features/step_definitions/others/recommendation_steps.rb +80 -0
  44. data/features/step_definitions/others/render_steps.rb +70 -0
  45. data/features/step_definitions/others/tag_steps.rb +157 -0
  46. data/features/step_definitions/others/upgrade_bussines_steps.rb +27 -0
  47. data/features/step_definitions/results/load_steps.rb +69 -0
  48. data/features/step_definitions/results/results_steps.rb +21 -0
  49. data/features/step_definitions/results/search_steps.rb +82 -0
  50. data/features/step_definitions/search/alerts_steps.rb +132 -0
  51. data/features/step_definitions/search/basefare_steps.rb +64 -0
  52. data/features/step_definitions/search/bestprices_steps.rb +70 -0
  53. data/features/step_definitions/search/cross_sell_row_hoteles.rb +78 -0
  54. data/features/step_definitions/search/cross_sell_steps.rb +15 -0
  55. data/features/step_definitions/search/delays_steps.rb +67 -0
  56. data/features/step_definitions/search/details_steps.rb +9 -0
  57. data/features/step_definitions/search/ecoflights_steps.rb +9 -0
  58. data/features/step_definitions/search/fenix_steps.rb +119 -0
  59. data/features/step_definitions/search/flight_gui_steps.rb +312 -0
  60. data/features/step_definitions/search/miles_step.rb +13 -0
  61. data/features/step_definitions/search/pagination_steps.rb +41 -0
  62. data/features/step_definitions/search/reviews_step.rb +56 -0
  63. data/features/step_definitions/search/search_no_gui_steps.rb +185 -0
  64. data/features/step_definitions/search/wish_list_steps.rb +123 -0
  65. data/features/support/env.rb +61 -0
  66. data/features/support/lib/clusters/data/datos_new.rb +33 -0
  67. data/features/support/lib/clusters/details/details_cluster.rb +30 -0
  68. data/features/support/lib/clusters/results/landing_cluster.rb +29 -0
  69. data/features/support/lib/clusters/results/render_cluster.rb +43 -0
  70. data/features/support/lib/clusters/results_cluster.rb +140 -0
  71. data/features/support/lib/clusters.rb +5 -0
  72. data/features/support/lib/helpers/browser.rb +212 -0
  73. data/features/support/lib/helpers/checkout.rb +31 -0
  74. data/features/support/lib/helpers/clusters.rb +234 -0
  75. data/features/support/lib/helpers/landing.rb +117 -0
  76. data/features/support/lib/helpers/render.rb +135 -0
  77. data/features/support/lib/helpers.rb +5 -0
  78. data/features/support/lib/price.rb +66 -0
  79. data/features/support/lib/services/fenix.rb +14 -0
  80. data/features/support/lib/services/landing.rb +18 -0
  81. data/features/support/lib/services/results.rb +62 -0
  82. data/features/support/lib/services.rb +4 -0
  83. data/features/support/matchers.rb +120 -0
  84. data/features/support/redefinitions.rb +42 -0
  85. data/features/tests/checkout/agency.feature +33 -0
  86. data/features/tests/checkout/button_cac.feature +52 -0
  87. data/features/tests/checkout/chat.feature +20 -0
  88. data/features/tests/checkout/cupones.feature +54 -0
  89. data/features/tests/checkout/error_messages.feature +64 -0
  90. data/features/tests/checkout/integration.feature +215 -0
  91. data/features/tests/checkout/low_cost.feature +55 -0
  92. data/features/tests/checkout/seguros.feature +37 -0
  93. data/features/tests/contents/costs.feature +29 -0
  94. data/features/tests/contents/rules.feature +58 -0
  95. data/features/tests/contents/webcheckin.feature +26 -0
  96. data/features/tests/desambiguation/airports.feature +89 -0
  97. data/features/tests/desambiguation/city.feature +86 -0
  98. data/features/tests/filters/filters.feature +160 -0
  99. data/features/tests/fixes/advancedgui.feature +171 -0
  100. data/features/tests/fixes/advancednogui.feature +60 -0
  101. data/features/tests/fixes/book_no_gui.feature +21 -0
  102. data/features/tests/fixes/cross_sell_row_hoteles.feature +70 -0
  103. data/features/tests/fixes/facebook.feature +31 -0
  104. data/features/tests/fixes/landing_home_alerts.feature +82 -0
  105. data/features/tests/fixes/matrix_stops.feature +104 -0
  106. data/features/tests/fixes/one_day_search.feature +63 -0
  107. data/features/tests/fixes/print.feature +87 -0
  108. data/features/tests/fixes/searches_no_gui.feature +85 -0
  109. data/features/tests/landing/landing_alerts.feature +93 -0
  110. data/features/tests/landing/landing_checkout.feature +286 -0
  111. data/features/tests/landing/landing_filters.feature +176 -0
  112. data/features/tests/landing/landing_home.feature +68 -0
  113. data/features/tests/landing/landing_integration.feature +153 -0
  114. data/features/tests/landing/landing_long_tail.feature +162 -0
  115. data/features/tests/landing/landing_matrix.feature +156 -0
  116. data/features/tests/landing/landing_negative.feature +157 -0
  117. data/features/tests/landing/landing_orders.feature +107 -0
  118. data/features/tests/landing/landing_pagination.feature +142 -0
  119. data/features/tests/landing/landing_passenger_review.feature +139 -0
  120. data/features/tests/landing/landing_positive.feature +155 -0
  121. data/features/tests/landing/landing_reviews.feature +139 -0
  122. data/features/tests/landing/landing_tags.feature +148 -0
  123. data/features/tests/matrix/matrix_airlines.feature +104 -0
  124. data/features/tests/matrix/matrix_fare_chart.feature +24 -0
  125. data/features/tests/matrix/matrix_price.feature +35 -0
  126. data/features/tests/others/alerts.feature +89 -0
  127. data/features/tests/others/anticipatedsearch.feature +82 -0
  128. data/features/tests/others/flights_tracker.feature +94 -0
  129. data/features/tests/others/newsletter.feature +131 -0
  130. data/features/tests/others/querystringparameters.feature +82 -0
  131. data/features/tests/others/recommendation.feature +170 -0
  132. data/features/tests/others/semaphore.feature +206 -0
  133. data/features/tests/others/upgrade_bussines.feature +100 -0
  134. data/features/tests/search/basefare.feature +88 -0
  135. data/features/tests/search/itineraries.feature +85 -0
  136. data/features/tests/search/orders.feature +100 -0
  137. data/features/tests/search/pagination.feature +70 -0
  138. data/features/tests/search/reviews.feature +84 -0
  139. data/features/tests/search/searches.feature +197 -0
  140. data/features/tests/search/wish_list.feature +102 -0
  141. data/flights_gui_henry_tests.gemspec +32 -0
  142. data/henry-context.yml +14733 -0
  143. metadata +324 -0
@@ -0,0 +1,45 @@
1
+ # -*- encoding : utf-8 -*-
2
+ And /^Seteo AbzTesting redirect al "(.*)"$/ do |perc|
3
+ value = BROWSER.cookies.to_a.select{|cookie| cookie[:name]=="abzTestingId"}.first
4
+ revalue = value[:value].gsub(/#{get_abtesting('currency')}/,perc).gsub(/currency/,"redirect")
5
+ delete_cookie("abzTestingId")
6
+ add_cookie("abzTestingId",revalue,{:expires => value[:expires],:domain=>value[:domain]})
7
+ end
8
+
9
+ And /^recargo la pagina$/ do
10
+ BROWSER.goto(BROWSER.url)
11
+ puts BROWSER.cookies.to_a
12
+ end
13
+
14
+ And /^Verifico que se cree la cookie landingTestPrice con menos "(.*)" por ciento$/ do |perc|
15
+ value = @clusters.first.tarifas['tarifa_adulto'].value.round - ((@clusters.first.tarifas['tarifa_adulto'].value.round*perc.to_i)/100).round
16
+ add_cookie("landingTestPrice",value.to_s)
17
+ end
18
+
19
+ And /^Verifico que se cree la cookie landingTestPrice con mas "(.*)" por ciento$/ do |perc|
20
+ value = @clusters.first.tarifas['tarifa_adulto'].value.round + ((@clusters.first.tarifas['tarifa_adulto'].value.round*perc.to_i)/100).round
21
+ add_cookie("landingTestPrice",value.to_s)
22
+ end
23
+
24
+ And /^Verifico la pagina donde ingresa$/ do
25
+ begin
26
+ puts " URL: #{BROWSER.url} "
27
+ Watir::Wait.until(timeout = 120){(!BROWSER.div(:id,'results-loader').present? and !BROWSER.div(:id,'results-update').present? and !BROWSER.div(:class,'results-update').present? and !BROWSER.div(:class,'update-message').present?) or (BROWSER.fieldset(:id,'passengers').div(:class,'passenger background').present? or BROWSER.div(:class,'notification-box warn-box').present?)}
28
+ rescue Timeout::Error, Watir::Wait::TimeoutError
29
+ puts "Timeout de resultados"
30
+ end
31
+ if BROWSER.fieldset(:id,'passengers').div(:class,'passenger background').present? or BROWSER.div(:class,'notification-box warn-box').present?
32
+ @page = "checkout"
33
+ else
34
+ @page = "results"
35
+ end
36
+ sleep(1)
37
+ end
38
+
39
+ And /^ingreso checkout$/ do
40
+ @page.should equal("checkout")
41
+ end
42
+
43
+ And /^ingreso resultados$/ do
44
+ @page.should equal("results")
45
+ end
@@ -0,0 +1,17 @@
1
+ # -*- encoding : utf-8 -*-
2
+ And /^Verifico los filtros de estadia$/ do
3
+ doc = Hpricot.parse(BROWSER.html)
4
+ index = 0
5
+ (doc/"div.ux-flights-filter-departures").each do |div|
6
+ BROWSER.span(:class=>'ux-common-filter-toggle',:index => index).click unless BROWSER.ul(:class=>'ux-common-filter-options items accordion-content',:index=>index).present?
7
+ value = apply_filter((div/"li.item").first)
8
+ begin
9
+ BROWSER.checkbox(:value,value).click
10
+ rescue Selenium::WebDriver::Error::ElementNotVisibleError
11
+ end
12
+ Watir::Wait.until(timeout = 120){!BROWSER.div(:id,'results-loader').present? and !BROWSER.div(:id,'results-update').present? and !BROWSER.div(:class,'results-update').present? and !BROWSER.div(:class,'update-message').present?}
13
+ index += 1
14
+ puts index
15
+ break if index > 1
16
+ end
17
+ end
@@ -0,0 +1,21 @@
1
+ # -*- encoding : utf-8 -*-
2
+
3
+ Then /^Verifico que exista el panel de alertas de home de vuelos$/ do
4
+ Watir::Wait.until(timeout=30){BROWSER.div(:class,'alerts-home').present?}
5
+ BROWSER.div(:class,'alerts-home').should visible
6
+ end
7
+
8
+ When /^Abro el popup de alertas de home de vuelos$/ do
9
+ BROWSER.div(:id,'alert-home-subscribe').click
10
+ end
11
+
12
+ Then /^Comparo el campo origen en alertas de home de vuelos$/ do
13
+ BROWSER.text_field(:class,"alerts-destination").text == (@search.city_to_1.name + " (" + @search.city_to_1.code + ")")
14
+ end
15
+
16
+ When /^Completo el campo destino con "(.*)"$/ do |city|
17
+ sleep(0.5)
18
+ BROWSER.text_field(:class,"alerts-destination").set("#{city}")
19
+ sleep(0.5)
20
+ BROWSER.text_field(:class,"alerts-destination").send_keys :enter
21
+ end
@@ -0,0 +1,82 @@
1
+ When /^Verifico que se muestre la caja de busqueda$/ do
2
+ BROWSER.form(:class,'searchbox flights').should visible
3
+ end
4
+
5
+ When /^que se muestre la caja de ofertas$/ do
6
+ BROWSER.div(:class,'alerts-home').should visible
7
+ end
8
+
9
+ When /^que se muestren los links de pasajes aereos internacionales$/ do
10
+ @img_110 = []
11
+ @img_259 = []
12
+ BROWSER.div(:class,'destiny-offers').should visible
13
+ doc = Hpricot.parse(BROWSER.div(:class,'destiny-offers').html)
14
+ (doc/"li").each do |li|
15
+ img = (li/"img").first
16
+ puts img.attributes['src']
17
+ @img_110 << img.attributes['alt'] if img.attributes['src'].match(/no\-disponible/)
18
+ #respond_img = HTTParty.get(img.attributes['src'])
19
+ #respond_img.code.should equal(200)
20
+ (!(li/"a").empty?).should be_true
21
+ (!(li/"div.first-col").inner_text.empty?).should be_true
22
+ (!(li/"div.sec-col").inner_text.empty?).should be_true
23
+ end
24
+ end
25
+
26
+ When /^que se muestren correctamente los destinos mas buscados$/ do
27
+ BROWSER.div(:class,'most-searched').should visible
28
+ doc = Hpricot.parse(BROWSER.div(:class,'most-searched').html)
29
+ (doc/"ul li").each do |li|
30
+ img = (li/"img").first
31
+ puts img.attributes['src']
32
+ @img_259 << img.attributes['alt'] if img.attributes['src'].match(/no\-disponible/)
33
+ #respond_img = HTTParty.get(img.attributes['src'])
34
+ #respond_img.code.should equal(200)
35
+ (!(li/"a").empty?).should be_true
36
+ (!(li/"div.info-city").inner_text.empty?).should be_true
37
+ (!(li/"div.product-info").inner_text.empty?).should be_true
38
+ (!(li/"div.price-container").inner_text.empty?).should be_true
39
+ end
40
+ end
41
+
42
+ And /^verifico si alguna imagen no esta disponible$/ do
43
+ puts "Ciudades sin imagenes 110X110: #{@img_110.join(', ')}"
44
+ puts "Ciudades sin imagenes 259X90: #{@img_259.join(', ')}"
45
+ end
46
+
47
+ When /^que se muestre las descripciones de beneficios despegar$/ do
48
+ BROWSER.div(:class,'benefits').should visible
49
+ doc = Hpricot.parse(BROWSER.div(:class,'benefits').html)
50
+ (doc/"div.benefit").each do |li|
51
+ li.inner_text.no_accents.should match("More than 20,000 verified reviews|Take advantage of the comments from other travelers in Despegar.com|Online booking management|Easily manage your bookings from My Despegar, for free!|Pay in installments|Finance your purchase in installments|Safe shopping|We use secure connections to protect your information|Attention 24 hours a day|Our agents are always at your disposal|Best Price Guaranteed|Best Price Guaranteed or we'll refund the difference|Mejor precio garantizado|Aproveche nuestra amplia disponibilidad de vuelos para los mejores destinos|Ofertas importantes en Despegar.com|Melhor preco garantido|El mejor precio garantizado o le devolvemos la diferencia|O melhor preco ou lhe devolvemos a diferenca|Garantia de mejor precio|Melhor preco garantido|Atencion las 24 hs|Atendimento 24 hs|Nuestros agentes se encuentran siempre a su disposicion|Nossos atendentes estao sempre a sua disposicao|Compra protegida|Compra protegida|Utilizamos conexiones seguras para proteger su informacion|Utilizamos conexoes seguras para proteger a sua informacao|Pague en cuotas|Pague em parcelas|Financie su compra en varios pagos|Financie sua compra em varias parcelas|Gestion de reservas online|Gestao de reservas on-line|Administre facilmente sus reservas desde Mi Despegar, .{1,2}gratis.{1,2}|Administre facilmente suas reservas desde Meu Decolar, gratis.{1,2}|Mas de (\d+) opiniones verificadas|Mais de (\d+) opinioes verificadas.|Aproveche los comentarios de otros viajeros de Despegar.com|Veja os comentarios de outros viajantes do Decolar.com")
52
+ end
53
+ end
54
+
55
+ When /^que se muestre la descripcion de vuelos mas baratos$/ do
56
+ BROWSER.div(:class,'cheapest-flights').should visible
57
+ BROWSER.div(:class,'cheapest-flights').h3(:class,'main-title').text.no_accents.downcase.should match("vuelos mas baratos en despegar.com|cheapest flights in despegar.com|vuelos economicos en despegar.com|garanta suas passagens aereas no decolar.com")
58
+ BROWSER.div(:class,'cheapest-flights').text.no_accents.should match("Welcome to Despegar.com|Seja bem-vindo ao Decolar.com|Bienvenidos a Despegar.com")
59
+ end
60
+
61
+ When /^que se muestren las opiniones de pasajeros$/ do
62
+ BROWSER.div(:class,'reviews').should visible
63
+ BROWSER.div(:class,'reviews').div(:class,'main-title').text.downcase.no_accents.should match("traveler reviews|opinioes de viajantes|opiniones de viajeros")
64
+ doc = Hpricot.parse(BROWSER.div(:class,'reviews').html)
65
+ (!(doc/"div.ux-common-comment").empty?).should be_true
66
+ end
67
+
68
+ When /^Seteo las ciudades de la busqueda de resultados de landing$/ do
69
+ @search = MockSearchRoundtrip.new($SITE,$ENV,true)
70
+ @search.set_from_city(BROWSER.url.match(/\/(...)\//)[1].upcase)
71
+ @search.set_to_city(BROWSER.url.match(/\/(...)\/(...)\//)[2].upcase)
72
+ end
73
+
74
+ When /^que se muestre los links vuelo a destino SEO$/ do
75
+ BROWSER.div(:id,'seo-links').should visible("links vuelo a destino SEO")
76
+ BROWSER.div(:id,'seo-links').ul(:class,'list destination').should visible("links vuelo a destino SEO destinos")
77
+ BROWSER.div(:id,'seo-links').ul(:class,'list destination').links.length.should equal(5)
78
+ BROWSER.div(:id,'seo-links').ul(:class,'list airlines').should visible("links vuelo a destino SEO aerolineas")
79
+ BROWSER.div(:id,'seo-links').ul(:class,'list airlines').links.length.should equal(5)
80
+ BROWSER.div(:id,'seo-links').ul(:class,'list continent').should visible("links vuelo a destino SEO continentes")
81
+ BROWSER.div(:id,'seo-links').ul(:class,'list continent').links.length.should equal(4)
82
+ end
@@ -0,0 +1,58 @@
1
+ # -*- encoding : utf-8 -*-
2
+ And /^Verifico las nuevas urls de vuelos a destino por aerolinea$/ 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
+ code = (@airline/"img").first.attributes['src'].match(/\/(..)\.png/)[1].strip
8
+ @arrival = BROWSER.url.match(/#{@search.host()}\/(vuelos|passagens-aereas|flights)\/(\D{3})\/(\D{3})\/(vuelos|passagens-aereas)-(a|para)-(.+)-(desde|saindo-de)-(.+)/)[3]
9
+ BROWSER.goto(@search.generate_url_landing_airline(code,@arrival))
10
+ end
11
+
12
+ And /^Verifico que aparezcan los links propuestos de vuelos a destino por aerolinea$/ do
13
+ doc = Hpricot.parse(BROWSER.html)
14
+ if (doc/"div#seo-links div.category h4.category-title").inner_text.match(/Vuelos a destino por aerolinea|Passagens para destino com Cia A.{1,2}rea|Flights to destination on airline/)
15
+ links = (doc/"div#seo-links ul.list li.item a").select{|a| a.attributes['href'].match(/#{@search.host()}\/(vuelos|passagens-aereas|fligths)\/(aerolinea|companhiasaerea)\/(\D{3})\/(..)\/(vuelos|passagens-aereas)-(a|da)-(.+)-(por|para)-(.+)/)}
16
+ links.should_not is_empty
17
+ end
18
+ end
19
+
20
+ And /^Verifico las nuevas urls de vuelos a destino por aeropuerto de llegada$/ do
21
+ doc = Hpricot.parse(BROWSER.html)
22
+ options = (doc/"div.ux-flights-filter-destinyairports label").reject{|option| option.attributes["class"].match(/selected|disabled/)}
23
+ @airport = options[rand(options.length)]
24
+ BROWSER.goto(@search.generate_url_landing_arrival_airport((@airport/"input").first.attributes['value']))
25
+ end
26
+
27
+ And /^Verifico que aparezcan los links propuestos de vuelos a destino por aeropuerto de llegada$/ do
28
+ doc = Hpricot.parse(BROWSER.html)
29
+ if (doc/"div#seo-links div.category h4.category-title").inner_text.match(/Vuelos a aeropuertos|Passagens para o Aeroporto|Flights to airport/)
30
+ (doc/"div#seo-links ul.list li.item a").each do |a|
31
+ puts a.attributes['href']
32
+ end
33
+ links = (doc/"div#seo-links ul.list li.item a").select{|a| a.attributes['href'].match(/#{@search.host()}\/(vuelos|passagens-aereas|fligths)\/(aeropuerto|aeroporto|airport)\/(\D{3})\/(voos-para-aeroporto|vuelos-a)(.+)/)}
34
+ links.should_not is_empty
35
+ end
36
+ end
37
+
38
+ And /^Verifico las nuevas urls de vuelos a destino por aeropuerto de salida$/ do
39
+ doc = Hpricot.parse(BROWSER.html)
40
+ options = (doc/"div.ux-flights-filter-originairports label").reject{|option| option.attributes["class"].match(/selected|disabled/)}
41
+ @airport = options[rand(options.length)]
42
+ BROWSER.goto(@search.generate_url_landing_origin_airport((@airport/"input").first.attributes['value'],@arrival))
43
+ end
44
+
45
+ And /^Verifico que aparezcan los links propuestos de vuelos a destino por aeropuerto de salida$/ do
46
+ doc = Hpricot.parse(BROWSER.html)
47
+ if (doc/"div#seo-links div.category h4.category-title").inner_text.match(/Vuelos a destino desde aeropuerto origen|Passagens para destino saindo do Aeroporto de Origem|Flights to destination from departure airport/)
48
+ (doc/"div#seo-links ul.list li.item a").each do |a|
49
+ puts a.attributes['href']
50
+ end
51
+ links = (doc/"div#seo-links ul.list li.item a").select{|a| a.attributes['href'].match(/#{@search.host()}\/(vuelos|passagens-aereas|fligths)\/(aeropuerto|aeroporto|airport)\/(\D{3})\/(\D{3})\/(passagens-aereas-para|vuelos-a|flights-to)-(.+)-(desde|from|saindo-de)-(.+)/)}
52
+ links.should_not is_empty
53
+ end
54
+ end
55
+
56
+ And /^es ida y vuelta$/ do
57
+ @search.description.downcase.match("roundtrip")
58
+ end
@@ -0,0 +1,127 @@
1
+ # -*- encoding : utf-8 -*-
2
+ And /^Verifico que ciudades iguales de error$/ do
3
+ @path_landing = BROWSER.url.match(/(.+)(vuelos-a|passagens\-aereas\-para)(.+)/)
4
+ BROWSER.goto(@path_landing[1].gsub(/\/...\/...\//,"/bue/bue/"))
5
+ Watir::Wait.until(timeout = 10){BROWSER.div(:class,'messages').span(:class,'commonSprite warningSymbol').present?}
6
+ BROWSER.div(:class,'messages').text.should match("The destination city is the same as the city of origin|La ciudad de destino es la misma que la ciudad de origen|A cidade de destino .{1,2} a mesma que a cidade de origem")
7
+ end
8
+
9
+ And /^Verifico que fechas iguales no de error$/ do
10
+ BROWSER.goto(@path_landing[1] + "1/2014-03-05/2014-03-05/" + @path_landing[2] + @path_landing[3])
11
+ Watir::Wait.until(timeout = 10){BROWSER.div(:class,'messages').span(:class,'commonSprite warningSymbol').present?}
12
+ BROWSER.div(:class,'messages').text.should match("No flights were found for your search|No encontramos vuelos para su b.{1,2}squeda|N.{1,2}o foi possivel encontrar assentos disponiveis nos v.{1,2}os buscados")
13
+ end
14
+
15
+ And /^Verifico que paginado negativo de error$/ do
16
+ BROWSER.goto(@path_landing[1] + "-1/" + @path_landing[2] + @path_landing[3])
17
+ Watir::Wait.until(timeout = 10){BROWSER.div(:class,'messages').span(:class,'commonSprite warningSymbol').present?}
18
+ BROWSER.div(:class,'messages').text.should match("The page you requested is not valid|La pagina solicitada no es valida|A p.{1,2}gina que voc.{1,2} solicitou n.{1,2}o .{1,2} v.{1,2}lido")
19
+ end
20
+
21
+ And /^Verifico que la ciudad "(.*)" de error$/ do |text|
22
+ BROWSER.goto(@path_landing[1].gsub(/\/...\/...\//,"/bue/xxx/"))
23
+ Watir::Wait.until(timeout = 10){BROWSER.div(:class,'messages').span(:class,'commonSprite warningSymbol').present?}
24
+ BROWSER.div(:class,'messages').text.should match("We could not understand the city you want to fly|No hemos podido interpretar la ciudad a la que quiere volar|N.{1,2}o encontramos a cidade solicitada")
25
+ end
26
+
27
+ And /^Verifico que dias de permanencia negativo de error$/ do
28
+ BROWSER.goto(@path_landing[1] + "1/-1/" + @path_landing[2] + @path_landing[3])
29
+ Watir::Wait.until(timeout = 10){BROWSER.div(:class,'messages').span(:class,'commonSprite warningSymbol').present?}
30
+ BROWSER.div(:class,'messages').text.should match("Los dias de permanencia no son validos|Os dias de estadia n.{1,2}o s.{1,2}o v.{1,2}lidos")
31
+ end
32
+
33
+ And /^Verifico que si la fecha de ida ingresada es posterior a la fecha de vuelta de error$/ do
34
+ BROWSER.goto(@path_landing[1] + "1/2014-03-05/2014-03-04/" + @path_landing[2] + @path_landing[3])
35
+ Watir::Wait.until(timeout = 10){BROWSER.div(:class,'messages').span(:class,'commonSprite warningSymbol').present?}
36
+ BROWSER.div(:class,'messages').text.should match("The departure date entered is later than the return date|La fecha de ida ingresada es posterior a la fecha de vuelta|A data de partida digitada .{1,2} posterior a data de retorno")
37
+ end
38
+
39
+ And /^Verifico que si la url no tiene el seoPath, se redirige a la pagina que si lo tiene$/ do
40
+ BROWSER.goto(@path_landing[1])
41
+
42
+ sleep(0.5)
43
+ BROWSER.url.strip.should equal(@path_landing.to_s.gsub(/\?(.+)/,'').strip)
44
+ end
45
+
46
+ And /^Verifico que si el seoPath esta mal escrito, se redirige a la pagina con el seoPath correcto$/ do
47
+ BROWSER.goto(@path_landing[1]+"qwerty")
48
+ sleep(0.5)
49
+ BROWSER.url.strip.should equal(@path_landing.to_s.strip.to_s.gsub(/\?(.+)/,'').strip)
50
+ end
51
+
52
+ And /^Verifico que si se pone un codigo de aeropuerto en vez de uno de cuidad, se redirige a la ciudad del aeropuerto$/ do
53
+ BROWSER.goto(@path_landing[1].gsub(/\/...\/...\//,"/ccs/eze/"))
54
+ sleep(0.5)
55
+ if $SITE=="BR"
56
+ BROWSER.url.strip.should equal(@path_landing[1].to_s.gsub(/\/...\/...\//,"/ccs/bue/")+@path_landing[2]+"-buenos+aires-saindo-de-caracas")
57
+ else
58
+ BROWSER.url.strip.should equal(@path_landing[1].to_s.gsub(/\/...\/...\//,"/ccs/bue/")+@path_landing[2]+"-buenos+aires-desde-caracas")
59
+ end
60
+ end
61
+
62
+ And /^Verifico que si se pone algun caracter en mayuscula, se redirige a todo minuscula$/ do
63
+ BROWSER.goto(@path_landing[1] + @path_landing[2].upcase + @path_landing[3])
64
+ sleep(0.5)
65
+ BROWSER.url.strip.should equal(@path_landing.to_s.strip)
66
+ end
67
+
68
+ And /^Verifico que si la url tiene parametros, se deben conservar en la redireccion$/ do
69
+ BROWSER.goto(@path_landing[1] + "qwerty?param=value")
70
+ sleep(0.5)
71
+ BROWSER.url.strip.should equal("#{@path_landing.to_s.strip.to_s.gsub(/\?(.+)/,'').strip}?param=value")
72
+ end
73
+
74
+
75
+ And /^Verifico que la url para sem funcione correctamente con un ciudad con resultados$/ do
76
+ match = @path_landing[1].match(/(.+)(vuelos|passagens-aereas)\/(...)\/(...)\//)
77
+ BROWSER.goto("#{match[1]}#{match[2]}/handler/#{match[3]}/#{match[4]}/#{@path_landing[2]}#{@path_landing[3]}")
78
+ sleep(0.5)
79
+ BROWSER.url.strip.should equal(@path_landing.to_s.strip)
80
+ end
81
+
82
+ And /^Verifico que la url para sem funcione correctamente con un ciudad sin resultados$/ do
83
+ match = @path_landing[1].match(/(.+)(vuelos|passagens-aereas)\/(...)\/(...)\//)
84
+ BROWSER.goto("#{match[1]}#{match[2]}/handler/#{match[3]}/KLP/#{@path_landing[2]}#{@path_landing[3]}")
85
+ sleep(0.5)
86
+ BROWSER.url.strip.should equal("#{match[1]}#{match[2]}/")
87
+ end
88
+
89
+ And /^Verifico que la url para sem funcione correctamente con un ciudad con resultados sin seoPath$/ do
90
+ match = @path_landing[1].match(/(.+)(vuelos|passagens-aereas)\/(...)\/(...)\//)
91
+ BROWSER.goto("#{match[1]}#{match[2]}/handler/#{match[3]}/#{match[4]}")
92
+ sleep(0.5)
93
+ BROWSER.url.strip.should equal(@path_landing.to_s.strip.gsub(/\?(.+)/,''))
94
+ end
95
+
96
+ And /^Verifico que la url para sem funcione correctamente con un ciudad sin resultados sin seoPath$/ do
97
+ match = @path_landing[1].match(/(.+)(vuelos|passagens-aereas)\/(...)\/(...)\//)
98
+ BROWSER.goto("#{match[1]}#{match[2]}/handler/#{match[3]}/KLP")
99
+ sleep(0.5)
100
+ BROWSER.url.strip.should equal("#{match[1]}#{match[2].to_s.gsub(/\?(.+)/,'').strip}/")
101
+ end
102
+
103
+ And /^Verifico que el paginado con "(.+)" paginas redireccione a la primer pagina$/ do |limit_pages|
104
+ BROWSER.goto(@path_landing[1] + "#{limit_pages.to_i + 1}/" + @path_landing[2] + @path_landing[3])
105
+ sleep(0.5)
106
+ BROWSER.url.strip.should equal(@path_landing.to_s.strip)
107
+ end
108
+
109
+ And /^Verifico que la url de landing para el destino "(.*)" no rompa$/ do |to_city|
110
+ match = @path_landing[1].match(/(.+)(vuelos|passagens-aereas)\/(...)\/(...)\//)
111
+ puts "#{match[1]}#{match[2]}/css/#{to_city}"
112
+ respond = HTTParty.get("#{match[1]}#{match[2]}/css/#{to_city}")
113
+ respond.code.to_s.should match("200|404")
114
+ end
115
+
116
+ And /^Verifico que redirija a la home de vuelos si no hay oficinas en la ciudad de origen$/ do
117
+ BROWSER.goto(@search.generate_url_landing_home + "/tyo")
118
+ BROWSER.url.should equal(@search.generate_url_landing_home + "/")
119
+ BROWSER.goto(@search.generate_url_landing_home + "/#{@search.city_from_1.code}")
120
+ BROWSER.url.should equal(@search.generate_url_landing_home + "/#{@search.city_from_1.code.downcase}")
121
+ end
122
+
123
+ And /^Verifico que si paso tres ciudades en la url de error$/ do
124
+ BROWSER.goto(@path_landing[1] + "#{@search.city_to_1.code.downcase}/" + @path_landing[2] + @path_landing[3])
125
+ Watir::Wait.until(timeout = 10){BROWSER.div(:class,'messages').span(:class,'commonSprite warningSymbol').present?}
126
+ BROWSER.div(:class,'messages').text.no_accents.should match("La pagina solicitada no es valida|A pagina que voce solicitou nao e valido|The page you requested is not valid")
127
+ end
@@ -0,0 +1,8 @@
1
+ Then /^Verifico que se muestre correctamente la review de pasajero$/ do
2
+ pending("No se muestra la review de pasajeros") unless BROWSER.div(:class,'flights-comments').present?
3
+ BROWSER.div(:class,'flights-comments').should visible
4
+ BROWSER.div(:class,'flights-comments').h3(:class,'ux-common-results-title').text.no_accents.should match("Puntuacion general de vuelos a #{@ciudad_elegida}|Pontuacao geral de voos #{@ciudad_elegida}|Overall rating for flights to #{@ciudad_elegida}")
5
+ if $SITE != "US"
6
+ BROWSER.div(:class,'flights-comments').h2(:class,'ux-common-results-title').text.no_accents.should match("Ya compraron vuelos a #{@ciudad_elegida}|Ja compraram voos a #{@ciudad_elegida}|")
7
+ end
8
+ end