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.
Files changed (161) hide show
  1. data/Gemfile +3 -0
  2. data/features/data/home-offers-config.csv +883 -0
  3. data/features/data/host.yml +78 -0
  4. data/features/data/miles.yml +216 -0
  5. data/features/data/search.yml +27 -0
  6. data/features/data/sites.yml +49 -0
  7. data/features/data/sites.yml.orig +54 -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/cash_payment_steps.rb +70 -0
  11. data/features/step_definitions/checkout/chat_steps.rb +57 -0
  12. data/features/step_definitions/checkout/checkout_steps.rb +265 -0
  13. data/features/step_definitions/checkout/cupones_steps.rb +36 -0
  14. data/features/step_definitions/checkout/error_messages.rb +291 -0
  15. data/features/step_definitions/checkout/fast_checkout.rb +55 -0
  16. data/features/step_definitions/checkout/price_jump_steps.rb +70 -0
  17. data/features/step_definitions/checkout/seguros_steps.rb +79 -0
  18. data/features/step_definitions/checkout/thanks_steps.rb +81 -0
  19. data/features/step_definitions/content/contents_steps.rb +140 -0
  20. data/features/step_definitions/desambiguation/disambiguation_airports_steps.rb +82 -0
  21. data/features/step_definitions/desambiguation/disambiguation_city_steps.rb +53 -0
  22. data/features/step_definitions/filter/filters_airlines.rb +37 -0
  23. data/features/step_definitions/filter/filters_airports_steps.rb +31 -0
  24. data/features/step_definitions/filter/filters_price_steps.rb +91 -0
  25. data/features/step_definitions/filter/filters_stops_steps.rb +44 -0
  26. data/features/step_definitions/filter/filters_time_steps.rb +146 -0
  27. data/features/step_definitions/filter/matrix_steps.rb +276 -0
  28. data/features/step_definitions/landing/landing_checkout_steps.rb +49 -0
  29. data/features/step_definitions/landing/landing_filters_steps.rb +17 -0
  30. data/features/step_definitions/landing/landing_home_alerts_steps.rb +21 -0
  31. data/features/step_definitions/landing/landing_home_steps.rb +82 -0
  32. data/features/step_definitions/landing/landing_long_tail.rb +58 -0
  33. data/features/step_definitions/landing/landing_negative_steps.rb +128 -0
  34. data/features/step_definitions/landing/landing_passenger_review_steps.rb +8 -0
  35. data/features/step_definitions/landing/landing_steps.rb +348 -0
  36. data/features/step_definitions/orders/orders.rb +83 -0
  37. data/features/step_definitions/others/advancedgui_steps.rb +28 -0
  38. data/features/step_definitions/others/advancednogui_steps.rb +34 -0
  39. data/features/step_definitions/others/anticipatedsearch_steps.rb +13 -0
  40. data/features/step_definitions/others/cookies_steps.rb +40 -0
  41. data/features/step_definitions/others/flights_tracker_steps.rb +74 -0
  42. data/features/step_definitions/others/generic_steps.rb +33 -0
  43. data/features/step_definitions/others/newsletter_steps.rb +29 -0
  44. data/features/step_definitions/others/one_day_search.rb +58 -0
  45. data/features/step_definitions/others/print_steps.rb +26 -0
  46. data/features/step_definitions/others/querystringparameters_steps.rb +6 -0
  47. data/features/step_definitions/others/recommendation_steps.rb +78 -0
  48. data/features/step_definitions/others/render_steps.rb +70 -0
  49. data/features/step_definitions/others/tag_steps.rb +164 -0
  50. data/features/step_definitions/others/upgrade_bussines_steps.rb +27 -0
  51. data/features/step_definitions/results/devtools_steps.rb +10 -0
  52. data/features/step_definitions/results/itineraries_steps.rb +43 -0
  53. data/features/step_definitions/results/load_steps.rb +73 -0
  54. data/features/step_definitions/results/results_steps.rb +79 -0
  55. data/features/step_definitions/results/search_steps.rb +115 -0
  56. data/features/step_definitions/search/alerts_steps.rb +132 -0
  57. data/features/step_definitions/search/basefare_steps.rb +88 -0
  58. data/features/step_definitions/search/bestprices_steps.rb +70 -0
  59. data/features/step_definitions/search/cross_sell_row_hoteles.rb +52 -0
  60. data/features/step_definitions/search/cross_sell_steps.rb +15 -0
  61. data/features/step_definitions/search/delays_steps.rb +67 -0
  62. data/features/step_definitions/search/details_steps.rb +9 -0
  63. data/features/step_definitions/search/ecoflights_steps.rb +9 -0
  64. data/features/step_definitions/search/errors_steps.rb +24 -0
  65. data/features/step_definitions/search/fenix_steps.rb +99 -0
  66. data/features/step_definitions/search/flight_gui_steps.rb +376 -0
  67. data/features/step_definitions/search/miles_step.rb +13 -0
  68. data/features/step_definitions/search/pagination_steps.rb +29 -0
  69. data/features/step_definitions/search/reviews_step.rb +58 -0
  70. data/features/step_definitions/search/search_no_gui_steps.rb +185 -0
  71. data/features/step_definitions/search/wish_list_steps.rb +128 -0
  72. data/features/support/env.rb +86 -0
  73. data/features/support/lib/clusters.rb +6 -0
  74. data/features/support/lib/clusters/checkout_cluster.rb +111 -0
  75. data/features/support/lib/clusters/data/data.rb +33 -0
  76. data/features/support/lib/clusters/details/details_cluster.rb +36 -0
  77. data/features/support/lib/clusters/results/landing_cluster.rb +87 -0
  78. data/features/support/lib/clusters/results/render_cluster.rb +86 -0
  79. data/features/support/lib/clusters/results_cluster.rb +168 -0
  80. data/features/support/lib/helpers.rb +5 -0
  81. data/features/support/lib/helpers/browser.rb +235 -0
  82. data/features/support/lib/helpers/checkout.rb +29 -0
  83. data/features/support/lib/helpers/clusters.rb +166 -0
  84. data/features/support/lib/helpers/landing.rb +121 -0
  85. data/features/support/lib/helpers/render.rb +135 -0
  86. data/features/support/lib/price.rb +66 -0
  87. data/features/support/lib/process_manager.rb +104 -0
  88. data/features/support/lib/services.rb +4 -0
  89. data/features/support/lib/services/fenix.rb +14 -0
  90. data/features/support/lib/services/landing.rb +18 -0
  91. data/features/support/lib/services/results.rb +62 -0
  92. data/features/support/matchers.rb +120 -0
  93. data/features/support/redefinitions.rb +42 -0
  94. data/features/tests/checkout/agency.feature +27 -0
  95. data/features/tests/checkout/button_cac.feature +53 -0
  96. data/features/tests/checkout/cash_payment.feature +50 -0
  97. data/features/tests/checkout/compras_duplicadas.feature +95 -0
  98. data/features/tests/checkout/cupones.feature +34 -0
  99. data/features/tests/checkout/error_messages.feature +80 -0
  100. data/features/tests/checkout/fast_checkout.feature +82 -0
  101. data/features/tests/checkout/integration.feature +235 -0
  102. data/features/tests/checkout/low_cost.feature +62 -0
  103. data/features/tests/checkout/online_payment.feature +50 -0
  104. data/features/tests/checkout/price_jump.feature +103 -0
  105. data/features/tests/checkout/providers.feature +76 -0
  106. data/features/tests/checkout/seguros.feature +42 -0
  107. data/features/tests/contents/costs.feature +29 -0
  108. data/features/tests/contents/rules.feature +58 -0
  109. data/features/tests/contents/webcheckin.feature +26 -0
  110. data/features/tests/desambiguation/airports.feature +89 -0
  111. data/features/tests/desambiguation/airports_landing.feature +88 -0
  112. data/features/tests/desambiguation/city.feature +86 -0
  113. data/features/tests/filters/filters.feature +113 -0
  114. data/features/tests/fixes/advancedgui.feature +171 -0
  115. data/features/tests/fixes/advancednogui.feature +60 -0
  116. data/features/tests/fixes/book_no_gui.feature +21 -0
  117. data/features/tests/fixes/cross_sell_row_hoteles.feature +70 -0
  118. data/features/tests/fixes/facebook.feature +31 -0
  119. data/features/tests/fixes/landing_checkout.feature +286 -0
  120. data/features/tests/fixes/landing_home_alerts.feature +82 -0
  121. data/features/tests/fixes/matrix_stops.feature +104 -0
  122. data/features/tests/fixes/one_day_search.feature +63 -0
  123. data/features/tests/fixes/print.feature +87 -0
  124. data/features/tests/fixes/searches_no_gui.feature +85 -0
  125. data/features/tests/fixes/upgrade_bussines.feature +100 -0
  126. data/features/tests/landing/landing_alerts.feature +93 -0
  127. data/features/tests/landing/landing_filters.feature +171 -0
  128. data/features/tests/landing/landing_home.feature +68 -0
  129. data/features/tests/landing/landing_integration.feature +149 -0
  130. data/features/tests/landing/landing_long_tail.feature +169 -0
  131. data/features/tests/landing/landing_matrix.feature +152 -0
  132. data/features/tests/landing/landing_negative.feature +151 -0
  133. data/features/tests/landing/landing_orders.feature +79 -0
  134. data/features/tests/landing/landing_pagination.feature +141 -0
  135. data/features/tests/landing/landing_passenger_review.feature +135 -0
  136. data/features/tests/landing/landing_positive.feature +151 -0
  137. data/features/tests/landing/landing_reviews.feature +135 -0
  138. data/features/tests/landing/landing_sort.feature +140 -0
  139. data/features/tests/landing/landing_tags.feature +142 -0
  140. data/features/tests/matrix/matrix_airlines.feature +80 -0
  141. data/features/tests/matrix/matrix_fare_chart.feature +40 -0
  142. data/features/tests/matrix/matrix_price.feature +40 -0
  143. data/features/tests/others/alerts.feature +89 -0
  144. data/features/tests/others/anticipatedsearch.feature +82 -0
  145. data/features/tests/others/chat.feature +23 -0
  146. data/features/tests/others/flights_tracker.feature +94 -0
  147. data/features/tests/others/newsletter.feature +118 -0
  148. data/features/tests/others/querystringparameters.feature +82 -0
  149. data/features/tests/others/recommendation.feature +107 -0
  150. data/features/tests/others/semaphore.feature +206 -0
  151. data/features/tests/search/basefare.feature +89 -0
  152. data/features/tests/search/errors.feature +198 -0
  153. data/features/tests/search/itineraries.feature +92 -0
  154. data/features/tests/search/orders.feature +88 -0
  155. data/features/tests/search/pagination.feature +73 -0
  156. data/features/tests/search/reviews.feature +83 -0
  157. data/features/tests/search/searches.feature +214 -0
  158. data/features/tests/search/wish_list.feature +58 -0
  159. data/flights_gui_henry_tests.gemspec +32 -0
  160. data/henry-context.yml +17262 -0
  161. metadata +382 -0
@@ -0,0 +1,115 @@
1
+ # -*- encoding : utf-8 -*-
2
+ When /^Ingreso a la pagina de resultados de "(.*)" para una busqueda "(.*)"$/ do |site,type|
3
+ pending("No se inicializo el navegador") if @@error_navegador
4
+ set_site(site)
5
+ @search = Class.const_get("MockSearch#{type.capitalize}").new(site,$ENV,"nil")
6
+ BROWSER.goto(@search.generate_url_results_search)
7
+ set_language(site)
8
+ set_cookies(BROWSER)
9
+ end
10
+
11
+ When /^Ingreso a resultados que pase por "(.*)" en "(.*)" para una busqueda "(.*)" de tipo "(.*)"$/ do |site_url,site,type,cabotage|
12
+ pending("No se inicializo el navegador") if @@error_navegador
13
+ set_site(site)
14
+ @search = Class.const_get("MockSearch#{type.capitalize}").new(site,$ENV,cabotage)
15
+ BROWSER.goto(@search.generate_url_results_search("",site_url))
16
+ set_language(site)
17
+ set_cookies(BROWSER)
18
+ end
19
+
20
+ When /^Ingreso a la pagina de resultados en "(.*)" para una busqueda "(.*)" del tipo "(.*)"$/ do |site,type,cabotage|
21
+ pending("No se inicializo el navegador") if @@error_navegador
22
+ set_site(site)
23
+ @search = Class.const_get("MockSearch#{type.capitalize}").new(site,$ENV,cabotage)
24
+ begin
25
+ BROWSER.goto(@search.generate_url_results_search)
26
+ rescue Timeout::Error
27
+ stop_browser(BROWSER)
28
+ end
29
+ set_language(site)
30
+ set_cookies(BROWSER)
31
+ end
32
+
33
+ When /^Ingreso a la pagina de resultados en "(.*)" para una busqueda "(.*)" con origen "(.*)" y destino "(.*)" de tipo "(.*)"$/ do |site,type,from,to,cabotage|
34
+ pending("No se inicializo el navegador") if @@error_navegador
35
+ set_site(site)
36
+ @search = Class.const_get("MockSearch#{type.capitalize}").new(site,$ENV,cabotage,{"from"=>from.upcase,"to"=>to.upcase})
37
+ begin
38
+ BROWSER.goto(@search.generate_url_results_search)
39
+ rescue Timeout::Error
40
+ stop_browser(BROWSER)
41
+ end
42
+ set_language(site)
43
+ set_cookies(BROWSER)
44
+ end
45
+
46
+ When /^Ingreso a la pagina de resultados en "(.*)" para una busqueda "(.*)" con salida "(.*)", regreso "(.*)", origen "(.*)" y destino "(.*)" de tipo "(.*)"$/ do |site,type,date_from,date_to,from,to,cabotage|
47
+ pending("No se inicializo el navegador") if @@error_navegador
48
+ set_site(site)
49
+ @search = Class.const_get("MockSearch#{type.capitalize}").new(site,$ENV,cabotage,{"from"=>from.upcase,"to"=>to.upcase})
50
+ @search.set_new_date(Date.parse(date_from),Date.parse(date_to))
51
+ puts @search.generate_url_results_search
52
+ begin
53
+ BROWSER.goto(@search.generate_url_results_search)
54
+ rescue Timeout::Error
55
+ stop_browser(BROWSER)
56
+ end
57
+ set_language(site)
58
+ set_cookies(BROWSER)
59
+ end
60
+
61
+ When /^Ingreso a la pagina de resultados en "(.*)" para una busqueda "(.*)" que desambigue por "(.*)"$/ do |site,type,city|
62
+ pending("No se inicializo el navegador") if @@error_navegador
63
+ set_site(site)
64
+ @search = Class.const_get("MockSearch#{type.capitalize}").new(site,$ENV,"true")
65
+ puts @search.generate_url_disambiguation_airports(city)
66
+ BROWSER.goto(@search.generate_url_disambiguation_airports(city))
67
+ set_language(site)
68
+ set_cookies(BROWSER)
69
+ end
70
+
71
+ Cuando(/^Ingreso a la pagina de landing en "(.*?)" para una busqueda "(.*?)" que desambigue por "(.*?)"$/) do |site, type, city|
72
+ pending("No se inicializo el navegador") if @@error_navegador
73
+ set_site(site)
74
+ @search = Class.const_get("MockSearch#{type.capitalize}").new(site,$ENV,"true")
75
+ puts @search.generate_url_landing_disambiguation_airports(city)
76
+ BROWSER.goto(@search.generate_url_landing_disambiguation_airports(city))
77
+ set_language(site)
78
+ set_cookies(BROWSER)
79
+ end
80
+
81
+ When /^Ingreso a la pagina de resultados en "(.*)" para una busqueda "(.*)" del tipo "(.*)" sin gui$/ do |site,type,cabotage|
82
+ pending("No se inicializo el navegador") if @@error_navegador
83
+ set_site(site)
84
+ @search = Class.const_get("MockSearch#{type.capitalize}").new(site,$ENV,cabotage)
85
+ puts @search.generate_url_results_search
86
+ @get = HTTParty.get(@search.generate_url_results_search,:headers=>{"x-uow"=>"ROBOT"})
87
+ end
88
+
89
+ When /^Ingreso a la pagina de checkout de agencia en "(.*)" para una busqueda "(.*)" del tipo "(.*)"$/ do |site,type,cabotage|
90
+ pending("No se inicializo el navegador") if @@error_navegador
91
+ set_site(site)
92
+ @search = Class.const_get("MockSearch#{type.capitalize}").new(site,$ENV,cabotage)
93
+ begin
94
+ puts @search.generate_url_checkout + "?agency=AG14073"
95
+ BROWSER.goto(@search.generate_url_checkout + "?agency=AG14073")
96
+ rescue
97
+ pending("No se encontraron resultados para la busqueda #{@search.generate_url_results_search}")
98
+ end
99
+ set_language(site)
100
+ set_cookies(BROWSER)
101
+ end
102
+
103
+ When /^Ingreso a la pagina de checkout en "(.*)" para una busqueda "(.*)" del tipo "(.*)"$/ do |site,type,cabotage|
104
+ pending("No se inicializo el navegador") if @@error_navegador
105
+ set_site(site)
106
+ @search = Class.const_get("MockSearch#{type.capitalize}").new(site,$ENV,cabotage)
107
+ begin
108
+ puts @search.generate_url_checkout
109
+ BROWSER.goto(@search.generate_url_checkout)
110
+ rescue
111
+ pending("No se encontraron resultados para la busqueda #{@search.generate_url_results_search}")
112
+ end
113
+ set_language(site)
114
+ set_cookies(BROWSER)
115
+ end
@@ -0,0 +1,132 @@
1
+ # -*- encoding : utf-8 -*-
2
+ Then /^Verifico que exista el panel de alertas$/ do
3
+ Watir::Wait.until(timeout=30){BROWSER.div(:id,'flights-alerts').present?}
4
+ BROWSER.div(:id,'flights-alerts').should visible
5
+ end
6
+
7
+ When /^Abro el popup de alertas$/ do
8
+ sleep(1)
9
+ BROWSER.div(:id,'flights-alerts').click
10
+ end
11
+
12
+ Then /^Verifico que cargue correctamente el popup de alertas$/ do
13
+ begin
14
+ Watir::Wait.until{BROWSER.div(:class,"tooltip-container").present?}
15
+ rescue Watir::Wait::TimeoutError
16
+ BROWSER.refresh
17
+ Watir::Wait.until{BROWSER.div(:class,"tooltip-container").present?}
18
+ end
19
+ @popup = Hpricot.parse(BROWSER.div(:class,"tooltip-container").html)
20
+
21
+ end
22
+
23
+ Then /^Comparo el campo origen$/ do
24
+ (@popup/"div.place-default b").first.inner_text == @search.city_from_1.name
25
+ end
26
+
27
+ Then /^Comparo el campo destino$/ do
28
+ (@popup/"div.place-default b").last.inner_text == @search.city_to_1.name
29
+ end
30
+
31
+ When /^Hago click en guardar alerta$/ do
32
+ BROWSER.div(:class,"tooltip-container").link(:class,'mod-btn-alt send-alert').click
33
+ end
34
+
35
+ Then /^Validar que el campo origen sea obligatorio$/ do
36
+ (@popup/"div.place-default b").first.inner_text == @search.city_from_1.name
37
+ end
38
+
39
+ Then /^Validar que el campo destino sea obligatorio$/ do
40
+ (@popup/"div.place-default b").last.inner_text == @search.city_to_1.name
41
+ end
42
+
43
+ Then /^Validar que el campo precio maximo por adulto sea obligatorio$/ do
44
+ BROWSER.div(:class,"tooltip-container").div(:class,"error-msg error-price-invalid").should visible
45
+ end
46
+
47
+ Then /^Validar que el campo email sea obligatorio$/ do
48
+ BROWSER.div(:class,"tooltip-container").div(:class,"error-msg error-mail-invalid").should visible
49
+ end
50
+
51
+ When /^Completo el campo origen$/ do
52
+ sleep(0.5)
53
+ BROWSER.div(:class,'tooltip-container').text_field(:id,"pop-up-origin").set("#{@search.city_from_1.name($SITE)} (#{@search.city_from_1.code})")
54
+ sleep(0.5)
55
+ BROWSER.div(:class,'tooltip-container').text_field(:id,"pop-up-origin").send_keys :enter
56
+ end
57
+
58
+ When /^Completo el campo destino$/ do
59
+ sleep(0.5)
60
+ BROWSER.div(:class,'tooltip-container').text_field(:id,"pop-up-destine").set("#{@search.city_to_1.name($SITE)} (#{@search.city_to_1.name})")
61
+ sleep(0.5)
62
+ BROWSER.div(:class,'tooltip-container').text_field(:id,"pop-up-destine").send_keys :enter
63
+ end
64
+
65
+ When /^Edito el campo origen$/ do
66
+ BROWSER.div(:class,'tooltip-container').divs(:class,'place-default')[0].span(:class,'edit-city').click
67
+ end
68
+
69
+ When /^Edito el campo destino$/ do
70
+ BROWSER.div(:class,"tooltip-container").divs(:class,'place-default')[1].span(:class,"edit-city").click
71
+ end
72
+
73
+ When /^Selecciono Solo ida$/ do
74
+ BROWSER.div(:class,"tooltip-container").label(:class,"one-way basic-checkbox").click
75
+ BROWSER.div(:class,"tooltip-container").select(:class,"aprox-long").should_not enabled
76
+ end
77
+
78
+ When /^Selecciono Ida y vuelta$/ do
79
+ BROWSER.div(:class,"tooltip-container").label(:class,"one-way basic-checkbox").click
80
+ BROWSER.div(:class,"tooltip-container").select(:class,"aprox-long").should enabled
81
+ end
82
+
83
+ When /^Selecciono una fecha especifica$/ do
84
+ BROWSER.div(:class,"tooltip-container").input(:class,"date-preference").click
85
+ BROWSER.div(:class,"tooltip-container").input(:class,"month-select").should_not visible
86
+ BROWSER.div(:class,"tooltip-container").select(:class,"aprox-long").should_not visible
87
+ BROWSER.div(:class,"tooltip-container").input(:class,"check-in-calendar").should visible
88
+ BROWSER.div(:class,"tooltip-container").input(:class,"check-out-calendar").should visible
89
+ end
90
+
91
+ When /^Selecciono una fecha aproximada$/ do
92
+ BROWSER.div(:class,"tooltip-container").input(:class,"date-preference").click
93
+ BROWSER.div(:class,"tooltip-container").input(:class,"month-select").should visible
94
+ BROWSER.div(:class,"tooltip-container").select(:class,"aprox-long").should visible
95
+ BROWSER.div(:class,"tooltip-container").input(:class,"check-in-calendar").should_not visible
96
+ BROWSER.div(:class,"tooltip-container").input(:class,"check-out-calendar").should_not visible
97
+ end
98
+
99
+ When /^Completo el precio maximo por adulto "(.*)"$/ do |text|
100
+ BROWSER.text_field(:class,"medium-input min-price").set(text)
101
+ end
102
+
103
+ When /^Completo el email "(.*)"$/ do |text|
104
+ BROWSER.div(:class,"col4 mail-section").text_field(:type,"text").set(text)
105
+ @mail = text
106
+ end
107
+
108
+ Then /^Validar que el campo email tenga un email valido$/ do
109
+ BROWSER.div(:class,"tooltip-container").div(:class,"error-msg error-mail-invalid").should visible
110
+ end
111
+
112
+ Then /^Esperar que se muestre el mensaje de alerta$/ do
113
+ Watir::Wait.until(timeout=60){BROWSER.p(:class,"typo-paragraph").present?}
114
+ end
115
+
116
+ And /^Validar que el mensaje sea correcto$/ do
117
+ if BROWSER.div(:class,"tooltip-container").h5(:class,"typo-title-bg").text.strip =~ /Lo sentimos|Sentimos muito|We\'re sorry/
118
+ response = HTTParty.post(@search.generate_post_alert_url(),{:body=>"origin=#{@search.city_from_1.code}&destination=#{@search.city_to_1.code}&maxPrice=999-#{currency($SITE)}&email=testvuelos@despegar.com&addToNewsletter=false&country=#{$SITE}&stay=1-10"})
119
+ puts response
120
+ (response =~ /OK|La alerta que intenta agregar ya se encuentra cargada|O alerta está tentando adicionar já está carregado|The alert you are trying to create was already created/).should be_true
121
+ else
122
+ BROWSER.div(:class,"tooltip-container").p(:class,"typo-paragraph").text.no_accents.strip =~ (/A partir de este momento recibira en #{@mail} ofertas de vuelos para (.+) por menos de (.+).|A partir deste momento seu e-mail #{@mail} recebera ofertas de voos para (.+), por menos de (.+)|We will send you flights information to (.+), (.+), (.+) by email to #{@mail}./)
123
+ end
124
+ end
125
+
126
+ When /^Cierro el popup de alertas$/ do
127
+ BROWSER.div(:class,"commonSprite closeBlueIcon nibbler-close close-tooltip").click
128
+ end
129
+
130
+ Then /^Validar que se haya cerrado el popup de alertas$/ do
131
+ Watir::Wait.until(timeout=60){!BROWSER.div(:class,"tooltip-container").present?}
132
+ end
@@ -0,0 +1,88 @@
1
+ # -*- encoding : utf-8 -*-
2
+ When /^Elijo moneda local en "(.*)"$/ do |pais|
3
+ BROWSER.select_list(:id,'currency').select_value(currency(pais)) if BROWSER.select_list(:id,'currency').present?
4
+ sleep(1)
5
+ end
6
+
7
+ When /^Filtro por un itinerario en la matriz en "(.*)"$/ do |pais|
8
+ if BROWSER.div(:class,'flights-tab-header flights-tab-priceSuggestionMatrix flights-tab-header-active').present?
9
+ BROWSER.div(:class,/flights-tab-airlinePricesMatrix/).click
10
+ sleep(2)
11
+ end
12
+ BROWSER.div(:id,'matrix').span(:class,"price-currency #{currency(pais)}").click
13
+ end
14
+
15
+ Then /^Valido la base tarifaria en "(.*)"$/ do |pais|
16
+ Watir::Wait.until(timeout = 30){BROWSER.div(:class,'cluster').span(:class,'fare').span(:class,"price-currency #{currency(pais)} ").exists?}
17
+ map = {"adt"=>"MX,UY,PE,BR",
18
+ "abtesting"=>"AR,PA,US,CR,EC,VE,CL,CO"}
19
+ map.each_pair{|key,value| @basefare = key if value.match(/#{pais}/)}
20
+ price_cluster = Hash.new
21
+ doc = Hpricot.parse(BROWSER.html)
22
+ price_matrix = (doc/"div#matrix span[@class='price-currency #{currency(pais)} ']").first.inner_text.strip
23
+ price_cluster['adt'] = (doc/"div.cluster span.fare span[@class='price-currency #{currency(pais)} ']").first.inner_text.strip
24
+ if @basefare=="tot"
25
+ price_cluster['tot'] = (doc/"div.cluster ul.fare-detail li.fare-price span[@class='price-currency #{currency(pais)} ']").first.inner_text.strip
26
+ end
27
+ puts "#{price_cluster[@basefare]} != #{price_matrix}"
28
+ ((price_cluster[@basefare] == price_matrix) or @basefare=="abtesting").should be_true
29
+ end
30
+
31
+ Then /^Valido el breakdown en "(.*)"$/ do |pais|
32
+ (@basefare=="abtesting" or ((@basefare=="adt")^(BROWSER.div(:id,'clusters').div(:class,'fare-detail').lis.length > 0))).should be_true
33
+ end
34
+
35
+ Then /^Valido el sorting en "(.*)"$/ do |pais|
36
+ doc = Hpricot.parse(BROWSER.select_list(:id,'orderby').html)
37
+ options = (doc/"option").collect{|option| option.attributes['value']}
38
+ if pais=="BR"
39
+ BROWSER.select_list(:id,'orderby').value.should match("FARE_ASCENDING")
40
+ end
41
+ options.should include?("FARE_ASCENDING")
42
+ options.should include?("STOPSCOUNT_ASCENDING")
43
+ options.should include?("TOTALFARE_ASCENDING")
44
+ options.should include?("DURATION_ASCENDING")
45
+ options.should include?("PERSONAL_ASCENDING")
46
+ options.should_not include?("FLIGHTCLASS_ASCENDING")
47
+ options.should_not include?("FARE_DESCENDING")
48
+ options.should_not include?("STOPSCOUNT_DESCENDING")
49
+ options.should_not include?("TOTALFARE_DESCENDING")
50
+ end
51
+
52
+ Then /^Valido el sorting de landing en "(.*)"$/ do |pais|
53
+ doc = Hpricot.parse(BROWSER.select_list(:id,'orderby').html)
54
+ options = (doc/"option").collect{|option| option.attributes['value']}
55
+ if pais=="BR"
56
+ BROWSER.select_list(:id,'orderby').value.should match("FARE_ASCENDING")
57
+ elsif pais != "MX"
58
+ BROWSER.select_list(:id,'orderby').value.should match("TOTALFARE_ASCENDING")
59
+ end
60
+ options.should include?("FARE_ASCENDING")
61
+ options.should include?("STOPSCOUNT_ASCENDING")
62
+ options.should include?("TOTALFARE_ASCENDING")
63
+ options.should_not include?("PERSONAL_ASCENDING")
64
+ options.should_not include?("DURATION_ASCENDING")
65
+ options.should_not include?("FARE_DESCENDING")
66
+ options.should_not include?("STOPSCOUNT_DESCENDING")
67
+ options.should_not include?("TOTALFARE_DESCENDING")
68
+ end
69
+
70
+ Then /^Verifico que el texto en el combo de ordenamiento sea el correcto$/ do
71
+ order_text = case $SITE
72
+ when "US" then "Sort by"
73
+ when "BR" then "Ordenar"
74
+ else "Ordenar por"
75
+ end
76
+ BROWSER.li(:class,'orderby').spans[0].text.should equal(order_text)
77
+ end
78
+
79
+ Then /^Verifico los textos de las opciones del combo$/ do
80
+ combo_text = case $SITE
81
+ when "US" then "Recommended"
82
+ when "BR" then "Mais Escolhidos"
83
+ else "Mas Elegidos"
84
+ end
85
+ doc = Hpricot.parse(BROWSER.select_list(:id,'orderby').html)
86
+ options = (doc/"option").collect{|option| option.inner_text.no_accents.strip}
87
+ options.include?(combo_text).should be_true
88
+ end
@@ -0,0 +1,70 @@
1
+ # -*- encoding : utf-8 -*-
2
+ Then /^Verifico que existan mejores precios "(.*)"$/ do |type|
3
+ json = @search.get_results_search_service
4
+ if BROWSER.div(:class,'best-price-alert').present?
5
+ doc = Hpricot.parse(BROWSER.div(:id,'best-price-alert').html)
6
+ best_price = Price.new((doc/"span.price-currency").first.inner_text.strip)
7
+ dias = (BROWSER.spans(:class,'alert-text')[0].text.match(/(\d+)/)[1]).to_i
8
+ originalDepartureDate = Date.parse(BROWSER.url.match(/\/(\d{4}-\d{2}-\d{2})\//)[1])
9
+ newDepartureDate = Date.parse(BROWSER.a(:class,'flights-best-price-button').href.match(/\/(\d{4}-\d{2}-\d{2})\//)[1])
10
+ if BROWSER.spans(:class,'alert-text')[0].text.match(/(antes)/)
11
+ newDepartureDate == originalDepartureDate - dias
12
+ end
13
+ if BROWSER.spans(:class,'alert-text')[0].text.match(/(despu.{1,2}s)/)
14
+ newDepartureDate == originalDepartureDate + dias
15
+ end
16
+ if type == "roundtrip"
17
+ originalArrivalDate = Date.parse(BROWSER.url.match(/\/(\d{4}-\d{2}-\d{2})\/(\d{4}-\d{2}-\d{2})\//)[2])
18
+ newArrivalDate = Date.parse(BROWSER.link(:class,'flights-best-price-button').href.match(/\/(\d{4}-\d{2}-\d{2})\/(\d{4}-\d{2}-\d{2})\//)[2])
19
+ if BROWSER.spans(:class,'alert-text')[0].text.match(/(antes)/)
20
+ newArrivalDate == originalArrivalDate - dias
21
+ end
22
+ if BROWSER.spans(:class,'alert-text')[0].text.match(/(despu.{1,2}s)/)
23
+ newArrivalDate == originalArrivalDate + dias
24
+ end
25
+ end
26
+ price = json['result']['aditionalsSearchesSummary']['price'].first
27
+ url = json['result']['aditionalsSearchesSummary']['url']
28
+ best_price.should equal(Price.new("#{price['formatted']['mask']} #{price['formatted']['amount']}"))
29
+ "#{@search.host}#{url}".should equal(BROWSER.div(:id,'best-price-alert').link(:class,'flights-best-price-button').href)
30
+ else
31
+ (!json['result']['aditionalsSearchesSummary']).should be_true
32
+ end
33
+ end
34
+
35
+ Then /^Verifico que existan mejores precios en Brasil "(.*)"$/ do |type|
36
+ json = @search.get_results_search_service
37
+ if BROWSER.div(:class,'best-price-alert').present?
38
+ doc = Hpricot.parse(BROWSER.div(:id,'best-price-alert').html)
39
+ best_price = Price.new((doc/"span.price-currency").first.inner_text.strip)
40
+ dias = (BROWSER.spans(:id,'alert-text')[0].text.match(/(\d+)/)[1]).to_i
41
+ originalDepartureDate = Date.parse(BROWSER.url.match(/\/(\d{4}-\d{2}-\d{2})\//)[1])
42
+ newDepartureDate = Date.parse(BROWSER.a(:class,'flights-best-price-button').href.match(/\/(\d{4}-\d{2}-\d{2})\//)[1])
43
+ if BROWSER.spans(:class,'alert-text')[0].text.match(/(antes)/)
44
+ newDepartureDate == originalDepartureDate - dias
45
+ end
46
+ if BROWSER.spans(:class,'alert-text')[0].text.match(/(depois)/)
47
+ newDepartureDate == originalDepartureDate + dias
48
+ end
49
+ if type == "roundtrip"
50
+ originalArrivalDate = Date.parse(BROWSER.url.match(/\/(\d{4}-\d{2}-\d{2})\/(\d{4}-\d{2}-\d{2})\//)[2])
51
+ newArrivalDate = Date.parse(BROWSER.a(:class,'flights-best-price-button').href.match(/\/(\d{4}-\d{2}-\d{2})\/(\d{4}-\d{2}-\d{2})\//)[2])
52
+ if BROWSER.spans(:class,'alert-text')[0].text.match(/(antes)/)
53
+ newArrivalDate == originalArrivalDate - dias
54
+ end
55
+ if BROWSER.spans(:class,'alert-text')[0].text.match(/(depois)/)
56
+ newArrivalDate == originalArrivalDate + dias
57
+ end
58
+ end
59
+ price = json['result']['aditionalsSearchesSummary']['price'].first
60
+ url = json['result']['aditionalsSearchesSummary']['url']
61
+ best_price.should equal(Price.new("#{price['formatted']['mask']} #{price['formatted']['amount']}"))
62
+ "#{@search.host}#{url}".should equal(BROWSER.div(:id,'best-price-alert').link(:class,'flights-best-price-button').href)
63
+ else
64
+ (!json['result']['aditionalsSearchesSummary']).should be_true
65
+ end
66
+ end
67
+
68
+ And /^Ingreso al resultado con mejor precio$/ do
69
+ BROWSER.goto(BROWSER.div(:id,'best-price-alert').link(:class,'flights-best-price-button').href)
70
+ end
@@ -0,0 +1,52 @@
1
+ # -*- encoding : utf-8 -*-
2
+ Then /^aparece el popup de cross sell hoteles$/ do
3
+ if BROWSER.div(:id,'popup-cross-sell-row').present?
4
+ BROWSER.div(:id,'popup-cross-sell-row').should visible
5
+ else
6
+ pending("No se mostro el popup de cross sell row hoteles ABtesting: #{get_abtesting('crossSellingRow')}")
7
+ end
8
+ end
9
+
10
+ Then /^Verifico que se muestre correctamente el popup de cross sell hoteles$/ do
11
+ BROWSER.div(:id,'popup-cross-sell-row').link(:class,"cross-sell-button flights-button").should visible("boton ver hoteles")
12
+ BROWSER.div(:id,'popup-cross-sell-row').link(:class,"checkout-button").should visible("link no ver hoteles")
13
+ BROWSER.div(:id,'popup-cross-sell-row').span(:class,"popup-close-button popup-close").should visible("boton cerrar popup")
14
+ BROWSER.div(:id,'popup-cross-sell-row').link(:class,"cross-sell-button flights-button").text.should match('Ver vuelo \+ hotel')
15
+ BROWSER.div(:id,'popup-cross-sell-row').link(:class,"checkout-button").text.no_accents.should match("No gracias, solo quiero un vuelo")
16
+ BROWSER.div(:id,'popup-cross-sell-row').span(:class,"cross-sell-row-message").text.no_accents.should match("Super Promo")
17
+ BROWSER.div(:id,'popup-cross-sell-row').div(:class,"cross-sell-bell-boy cross-sell-bell-boy-#{$SITE.downcase}").should visible("imagen")
18
+ end
19
+
20
+ And /^Elijo ver hoteles en el popup de cross sell hoteles$/ do
21
+ BROWSER.div(:id,'popup-cross-sell-row').link(:class,"cross-sell-button flights-button").click
22
+ end
23
+
24
+ And /^Elijo la opcion de No gracias en el popup de cross sell hoteles$/ do
25
+ begin
26
+ BROWSER.div(:id,'popup-cross-sell-row').link(:class,"checkout-button").click
27
+ rescue Timeout::Error
28
+ puts "Timeout"
29
+ end
30
+ end
31
+
32
+ And /^Elijo la opcion cerrar popup en el popup de cross sell hoteles$/ do
33
+ BROWSER.div(:id,'popup-cross-sell-row').span(:class,"popup-close-button popup-close").click
34
+ end
35
+
36
+ And /^Verifico el popup de cross sell hoteles dirija a la pagina correcta$/ do
37
+ #BROWSER.url.should match("#{@search.host}/cp/shop/search/#{@search.path}")
38
+ end
39
+
40
+ And /^Verifico que se cree la marca de UPA$/ do
41
+ doc = Hpricot.parse(BROWSER.html)
42
+ tag_upa = (doc/"script[@type='text/javascript']").select{|script| script.inner_text.match(/pop-up-shown\|accepted_false\|/)}
43
+ tag_upa.should be_true
44
+ end
45
+
46
+ When /^Vuelvo a la pagina de resultados$/ do
47
+ BROWSER.back
48
+ end
49
+
50
+ And /^Verifico que no muestre el popup de cross sell hoteles$/ do
51
+ BROWSER.div(:id,'popup-cross-sell-row').should_not visible
52
+ end