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,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,64 @@
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-header 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)} ").present?}
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').ul(: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
+ (options.include?("TOTALFARE_ASCENDING") and options.include?("TOTALFARE_DESCENDING")).should be_true
39
+ if pais=="BR"
40
+ BROWSER.select_list(:id,'orderby').value.should match("FARE_ASCENDING")
41
+ elsif pais != "MX"
42
+ BROWSER.select_list(:id,'orderby').value.should match("TOTALFARE_ASCENDING")
43
+ end
44
+ end
45
+
46
+ Then /^Verifico que el texto en el combo de ordenamiento sea el correcto$/ do
47
+ order_text = case $SITE
48
+ when "US" then "Sort by"
49
+ when "BR" then "Ordenar"
50
+ else "Ordenar por"
51
+ end
52
+ BROWSER.li(:class,'orderby').spans[0].text.should equal(order_text)
53
+ end
54
+
55
+ Then /^Verifico los textos de las opciones del combo$/ do
56
+ combo_text = case $SITE
57
+ when "US" then "More Selected"
58
+ when "BR" then "Mais Escolhidos"
59
+ else "Mas Elegidos"
60
+ end
61
+ doc = Hpricot.parse(BROWSER.select_list(:id,'orderby').html)
62
+ options = (doc/"option").collect{|option| option.inner_text.no_accents}
63
+ options.include?(combo_text).should be_true
64
+ 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,78 @@
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 que se cree la cookie "(.+)" con valor "(.+)"$/ do |name,value|
37
+ cookie = get_cookie(name)
38
+ cookie.should be_true
39
+ cookie[:value].should equal(value)
40
+ end
41
+
42
+ And /^Verifico el popup de cross sell hoteles dirija a la pagina correcta$/ do
43
+ #BROWSER.url.should match("#{@search.host}/cp/shop/search/#{@search.path}")
44
+ end
45
+
46
+ And /^Verifico que se cree la marca de UPA$/ do
47
+ doc = Hpricot.parse(BROWSER.html)
48
+ tag_upa = (doc/"script[@type='text/javascript']").select{|script| script.inner_text.match(/pop-up-shown\|accepted_false\|/)}
49
+ tag_upa.should be_true
50
+ end
51
+
52
+ When /^Vuelvo a la pagina de resultados$/ do
53
+ BROWSER.back
54
+ end
55
+
56
+ And /^Verifico que no muestre el popup de cross sell hoteles$/ do
57
+ BROWSER.div(:id,'popup-cross-sell-row').should_not visible
58
+ end
59
+
60
+ And /^Elimino la cookie de cross sell row hoteles$/ do
61
+ if get_cookie("crossSellRow")
62
+ delete_cookie("crossSellRow")
63
+ end
64
+ end
65
+
66
+ And /^seteo el abztesting de crossSellingRow$/ do
67
+ value = BROWSER.cookies.to_a.select{|cookie| cookie[:name]=="abzTestingId"}.first
68
+ new_value = value[:value].gsub(/#{get_abtesting('crossSellingRow')}/,'15')
69
+ delete_cookie("abzTestingId")
70
+ add_cookie("abzTestingId",new_value,{:expires => value[:expires],:domain=>value[:domain]})
71
+ end
72
+
73
+ And /^seteo el abztesting de showCrossSellHotels$/ do
74
+ value = BROWSER.cookies.to_a.select{|cookie| cookie[:name]=="abzTestingId"}.first
75
+ new_value = value[:value].gsub(/#{get_abtesting('showCrossSellHotels')}/,'15')
76
+ delete_cookie("abzTestingId")
77
+ add_cookie("abzTestingId",new_value,{:expires => value[:expires],:domain=>value[:domain]})
78
+ end
@@ -0,0 +1,15 @@
1
+ # -*- encoding : utf-8 -*-
2
+ And /^Verifico que se muestre la caja de cross sell$/ do
3
+ BROWSER.div(:id,'cross-sell').should visible
4
+ end
5
+
6
+ And /^Verifico que la caja de cross sell tenga los datos correctos$/ do
7
+ text = BROWSER.div(:id,'cross-sell').div(:class,'cross-sell-text').text.strip.no_accents.downcase
8
+ text.should match("(.*)tenemos (\\d+) hoteles en #{@search.to_city_description.downcase}(.*)|(.*)temos (\\d+) hoteis em #{@search.to_city_description.downcase} (.*)")
9
+ end
10
+
11
+ And /^Verifico que la caja de cross sell dirija a resultados de hoteles correcto$/ do
12
+ link = BROWSER.div(:id,'cross-sell').link(:class,'cross-sell-button flights-search-button').href
13
+ puts "#{@search.host}/cp/shop/search/cross/flight/#{@search.path}"
14
+ link.should match("#{@search.host}/cp/shop/search/cross/flight/#{@search.path}")
15
+ end
@@ -0,0 +1,67 @@
1
+ # -*- encoding : utf-8 -*-
2
+ Then /^Verifico que haya retrasos$/ do
3
+ doc = Hpricot.parse(BROWSER.html)
4
+ (!(doc/"li.delays span.main-sprite").empty?).should be_true
5
+ BROWSER.div(:id,'clusters').divs(:class,'cluster').each{|cluster| @cluster = cluster if cluster.li(:class,'delays').span(:class,/main-sprite/).present?}
6
+ end
7
+
8
+ When /^Abro el popup de retrasos$/ do
9
+ if @cluster.li(:class,'delays').span(:class, "main-sprite icon-clock-LOW").present?
10
+ @cluster.li(:class,'delays').span(:class, "main-sprite icon-clock-LOW").click
11
+ else
12
+ if @cluster.li(:class,'delays').span(:class, "main-sprite icon-clock-MEDIUM").present?
13
+ @cluster.li(:class,'delays').span(:class, "main-sprite icon-clock-MEDIUM").click
14
+ else
15
+ if @cluster.li(:class,'delays').span(:class, "main-sprite icon-clock-HIGH").present?
16
+ @cluster.li(:class,'delays').span(:class, "main-sprite icon-clock-HIGH").click
17
+ end
18
+ end
19
+ end
20
+ end
21
+
22
+ Then /^Verifico que se muestre el popup de retrasos$/ do
23
+ BROWSER.div(:id,'popup-delays').should visible
24
+ end
25
+
26
+ Then /^Comparo ciudades de destino$/ do
27
+ BROWSER.div(:id,'popup-delays').span(:class,'description-flight').text.strip.should match("#{@from_city} - #{@to_city}")
28
+ end
29
+
30
+ Then /^Comparo ciudades de destino en multidestinos$/ do |ciudad|
31
+ BROWSER.div(:id,'popup-delays').span(:class,'description-flight').text.strip.should match("#{@from_city} - #{@to_city}")
32
+ end
33
+
34
+ #Then /^Verifico aerolineas en el popup de retrasos$/ do
35
+ # ticket.idas.first.aerolinea.incluye?((popup/"ul//li.even")[0].inner_text.strip)
36
+ # if !(popup/"ul//li.odd").empty?
37
+ # ticket.idas.first.aerolinea.incluye?((popup/"ul//li.odd")[0].inner_text)
38
+ # end
39
+ #end
40
+
41
+ When /^Cierro el popup de retrasos$/ do
42
+ BROWSER.div(:id,'popup-delays').span(:class,'popup-close-button popup-close').click
43
+ end
44
+
45
+ Then /^Verifico que se cierre el popup de retrasos$/ do
46
+ BROWSER.div(:id,'popup-delays').present?
47
+ end
48
+
49
+ Then /^Verifico los textos de la fuente "(.*)"$/ do |pais|
50
+ browser = BROWSER.div(:id,'popup-delays')
51
+ popup = Hpricot.parse(browser.html)
52
+ if pais.match(/AR/)
53
+ (popup/"a.show-ANAC-info").inner_text.should match("Fuente: ANAC")
54
+ browser.div(:id,'popup-delays').div(:class,'popup-container').div(:class,'popup-content').link(:class,"show-ANAC-info").click
55
+ browser.div(:id,'popup-delays').div(:class,'popup-container').div(:class,'popup-content').p(:class,'information-ANAC').should visible
56
+ (popup/"p.information-ANAC").inner_text.should match("La informaci.{1,2}n proporcionada sobre el % de retrasos y cancelaciones")
57
+ (popup/"p.information-ANAC a[@target='_blank']").inner_text.should match("http:\/\/www2.anac.gov.br\/percentuaisdeatraso")
58
+ elsif pais.match(/BR/)
59
+ (popup/"a.show-ANAC-info").inner_text.should match("Fonte: ANAC")
60
+ browser.div(:id,'popup-delays').div(:class,'popup-container').div(:class,'popup-content').link(:class,"show-ANAC-info").click
61
+ browser.div(:id,'popup-delays').div(:class,'popup-container').div(:class,'popup-content').p(:class,'information-ANAC').should visible
62
+ (popup/"p.information-ANAC").inner_text.should match("IMPORTANTE")
63
+ (!(popup/"p.information-ANAC br").empty?).should be_true
64
+ else
65
+ (popup/"div.ANAC-info-container").inner_text.should match("Fuente: ANAC")
66
+ end
67
+ end
@@ -0,0 +1,9 @@
1
+ # -*- encoding : utf-8 -*-
2
+ Then /^Verifico los detalles en cada cluster "(.*)"$/ do |type|
3
+ json = @search.get_results_search_service
4
+ i=0
5
+ BROWSER.div(:id,'clusters').divs(:class,'cluster').each do |cluster|
6
+ validate_cluster_details(json,type,cluster,i)
7
+ i += 1
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ # -*- encoding : utf-8 -*-
2
+ Then /^Verifico los vuelos en cada cluster "(.*)"$/ do |type|
3
+ json = @search.get_results_search_service
4
+ i=0
5
+ BROWSER.div(:id,'clusters').divs(:class,'cluster').each do |cluster|
6
+ validate_cluster_ecoflights(json,type,cluster,i)
7
+ i += 1
8
+ end
9
+ end
@@ -0,0 +1,119 @@
1
+ # -*- encoding : utf-8 -*-
2
+ And /^cumple para pruebas en fenix$/ do
3
+ @search.description.should_not equal("multipledestinations")
4
+ $ENV.upcase.should equal("RC")
5
+ end
6
+
7
+ And /^Levanto los datos del vuelo$/ do
8
+ @cluster_json = @search.get_results_search_service
9
+ BROWSER.div(:id,'ticket').link(:class,'ux-shared-checkout-thanks-more').should visible("Link para popup de detalle de vuelo")
10
+ BROWSER.div(:id,'ticket').link(:class,'ux-shared-checkout-thanks-more').click
11
+ Watir::Wait.until(timeout = 20){BROWSER.div(:id,'popup-booking-details').present?}
12
+ popup_detalle_vuelo = Hpricot.parse(BROWSER.div(:id,'popup-booking-details').html)
13
+ popup_detalle_vuelo.inner_text.empty?.should_not be_true
14
+ @monto_total=(popup_detalle_vuelo/"span#total-price span.amount").inner_text.gsub(/\.|\,/,'').to_i
15
+ BROWSER.div(:id,'popup-booking-details').links(:class,'number').each do |a|
16
+ a.click
17
+ Watir::Wait.until(timeout=20){BROWSER.div(:class,"flights-popup popup-detail").present?}
18
+ doc = Hpricot.parse(BROWSER.div(:class,"flights-popup popup-detail").html)
19
+ detail = DetailsCluster.new(doc)
20
+ BROWSER.div(:class,"flights-popup popup-detail").span(:class,'popup-close-button popup-close').click
21
+ Watir::Wait.until(timeout=20){!BROWSER.div(:class,"flights-popup popup-detail").present?}
22
+ sleep(1)
23
+ end
24
+ BROWSER.div(:id,'popup-booking-details').span(:class,'popup-close-button popup-close').click
25
+ end
26
+
27
+ Then /^Inicializo las pruebas en fenix$/ do
28
+ puts BROWSER.url
29
+ data_cluster = @item_json
30
+ plus_name=["A","B","C","D","E","F","G","H","I","J","k"]
31
+ index = 0
32
+ pax = []
33
+ @search.adt.times do |adulto|
34
+ adt = {
35
+ "apellido" => "Diez" + plus_name[index],
36
+ "documento" => {
37
+ "numero" => "3245673#{index}",
38
+ "tipo" => "PASSPORT"
39
+ },
40
+ "nombre"=> "Martin QA" + plus_name[index],
41
+ "tipo"=> "ADULT"
42
+ }
43
+ pax << adt
44
+ index += 1
45
+ end
46
+ @search.cnn.times do |adulto|
47
+ cnn = {
48
+ "apellido"=> "Romero jr" + plus_name[index],
49
+ "documento"=> {
50
+ "numero"=> "3012343#{index}",
51
+ "tipo"=> "PASSPORT"
52
+ },
53
+ "nombre"=> "Diego qa" + plus_name[index],
54
+ "tipo"=> "CHILD"
55
+ }
56
+ pax << cnn
57
+ index += 1
58
+ end
59
+ @search.inf.times do |adulto|
60
+ inf = {
61
+ "apellido"=> "Dias Herrera jrb" + plus_name[index],
62
+ "documento"=> {
63
+ "numero"=> "4569734#{index}",
64
+ "tipo"=> "PASSPORT"
65
+ },
66
+ "nombre"=> "Maribel qa" + plus_name[index],
67
+ "tipo"=> "INFANT"
68
+ }
69
+ pax << inf
70
+ index += 1
71
+ end
72
+ if @search.description=="roundtrip"
73
+ dest = data_cluster['itinerariesBox']['inboundRoutes'][0]['segments'].first
74
+ vuelta = {
75
+ "aeropuerto_destino"=> dest['arrival']['location']['airport']['code'],
76
+ "aeropuerto_origen"=> dest['departure']['location']['airport']['code'],
77
+ "fecha_salida"=> data_cluster['itinerariesBox']['inboundRoutes'][0]['departureDateTime']['raw']/1000
78
+ }
79
+ else
80
+ vuelta = nil
81
+ end
82
+ hash = {
83
+ "itinerario"=> {
84
+ "ida"=> {
85
+ "aeropuerto_destino"=> data_cluster['itinerariesBox']['outboundRoutes'][0]['segments'][0]['arrival']['location']['airport']['code'],
86
+ "aeropuerto_origen"=> data_cluster['itinerariesBox']['outboundRoutes'][0]['segments'][0]['departure']['location']['airport']['code'],
87
+ "fecha_salida"=> data_cluster['itinerariesBox']['outboundRoutes'][0]['departureDateTime']['raw']/1000
88
+ },
89
+ "vuelta"=> vuelta
90
+ },
91
+ "pasajeros"=> pax,
92
+ "proveedor"=> data_cluster['provider'],
93
+ "tarjeta"=> {
94
+ "bin"=> "4242424242424242",
95
+ "tipo"=> "VI"
96
+ },
97
+ "total_a_cobrar"=> {
98
+ "cuotas"=> 1,
99
+ "interes"=> 0,
100
+ "moneda"=> currency($SITE),
101
+ "monto"=> @monto_total
102
+ }
103
+ }
104
+ puts hash
105
+ @json = HTTParty.post("http://fenix-tools.despegar.it/fenix-tools/start-tests/8#{@id_cro}",:body=>hash.to_json,:headers => { 'Accept' => 'application/json', 'Content-type' => "application/json\;charset=utf-8"})
106
+ end
107
+
108
+ When /^Verifico que las pruebas en fenix esten correctas$/ do
109
+ unless @search.description=="multipledestinations"
110
+ sleep(5)
111
+ respond = HTTParty.get("http://fenix-tools.despegar.it/fenix-tools/check-test-status/#{@json['test_id']}")
112
+ while respond['status']!="FINISHED"
113
+ respond = HTTParty.get("http://fenix-tools.despegar.it/fenix-tools/check-test-status/#{@json['test_id']}")
114
+ sleep(1)
115
+ end
116
+ puts respond
117
+ respond['result'].should equal("OK")
118
+ end
119
+ end