flights_gui_henry_tests 1.8.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/Gemfile +3 -0
- data/features/data/home-offers-config.csv +883 -0
- data/features/data/host.yml +72 -0
- data/features/data/miles.yml +216 -0
- data/features/data/search.yml +27 -0
- data/features/data/sites.yml +39 -0
- data/features/data/tag_microsoft.yml +68 -0
- data/features/step_definitions/checkout/agencia_steps.rb +6 -0
- data/features/step_definitions/checkout/chat_steps.rb +43 -0
- data/features/step_definitions/checkout/checkout_steps.rb +144 -0
- data/features/step_definitions/checkout/cupones_steps.rb +26 -0
- data/features/step_definitions/checkout/error_messages.rb +251 -0
- data/features/step_definitions/checkout/seguros_steps.rb +78 -0
- data/features/step_definitions/checkout/thanks_steps.rb +75 -0
- data/features/step_definitions/content/contents_steps.rb +140 -0
- data/features/step_definitions/desambiguation/disambiguation_airports_steps.rb +73 -0
- data/features/step_definitions/desambiguation/disambiguation_city_steps.rb +43 -0
- data/features/step_definitions/filter/filters_airlines.rb +38 -0
- data/features/step_definitions/filter/filters_airports_steps.rb +31 -0
- data/features/step_definitions/filter/filters_price_steps.rb +87 -0
- data/features/step_definitions/filter/filters_stops_steps.rb +44 -0
- data/features/step_definitions/filter/filters_time_steps.rb +143 -0
- data/features/step_definitions/filter/matrix_steps.rb +249 -0
- data/features/step_definitions/landing/landing_checkout_steps.rb +45 -0
- data/features/step_definitions/landing/landing_filters_steps.rb +17 -0
- data/features/step_definitions/landing/landing_home_alerts_steps.rb +21 -0
- data/features/step_definitions/landing/landing_home_steps.rb +82 -0
- data/features/step_definitions/landing/landing_long_tail.rb +58 -0
- data/features/step_definitions/landing/landing_negative_steps.rb +127 -0
- data/features/step_definitions/landing/landing_passenger_review_steps.rb +8 -0
- data/features/step_definitions/landing/landing_steps.rb +325 -0
- data/features/step_definitions/orders/orders.rb +67 -0
- data/features/step_definitions/others/advancedgui_steps.rb +28 -0
- data/features/step_definitions/others/advancednogui_steps.rb +34 -0
- data/features/step_definitions/others/anticipatedsearch_steps.rb +13 -0
- data/features/step_definitions/others/flights_tracker_steps.rb +73 -0
- data/features/step_definitions/others/generic_steps.rb +35 -0
- data/features/step_definitions/others/newsletter_steps.rb +50 -0
- data/features/step_definitions/others/one_day_search.rb +58 -0
- data/features/step_definitions/others/print_steps.rb +26 -0
- data/features/step_definitions/others/querystringparameters_steps.rb +6 -0
- data/features/step_definitions/others/recommendation_steps.rb +80 -0
- data/features/step_definitions/others/render_steps.rb +70 -0
- data/features/step_definitions/others/tag_steps.rb +157 -0
- data/features/step_definitions/others/upgrade_bussines_steps.rb +27 -0
- data/features/step_definitions/results/load_steps.rb +69 -0
- data/features/step_definitions/results/results_steps.rb +21 -0
- data/features/step_definitions/results/search_steps.rb +82 -0
- data/features/step_definitions/search/alerts_steps.rb +132 -0
- data/features/step_definitions/search/basefare_steps.rb +64 -0
- data/features/step_definitions/search/bestprices_steps.rb +70 -0
- data/features/step_definitions/search/cross_sell_row_hoteles.rb +78 -0
- data/features/step_definitions/search/cross_sell_steps.rb +15 -0
- data/features/step_definitions/search/delays_steps.rb +67 -0
- data/features/step_definitions/search/details_steps.rb +9 -0
- data/features/step_definitions/search/ecoflights_steps.rb +9 -0
- data/features/step_definitions/search/fenix_steps.rb +119 -0
- data/features/step_definitions/search/flight_gui_steps.rb +312 -0
- data/features/step_definitions/search/miles_step.rb +13 -0
- data/features/step_definitions/search/pagination_steps.rb +41 -0
- data/features/step_definitions/search/reviews_step.rb +56 -0
- data/features/step_definitions/search/search_no_gui_steps.rb +185 -0
- data/features/step_definitions/search/wish_list_steps.rb +123 -0
- data/features/support/env.rb +61 -0
- data/features/support/lib/clusters/data/datos_new.rb +33 -0
- data/features/support/lib/clusters/details/details_cluster.rb +30 -0
- data/features/support/lib/clusters/results/landing_cluster.rb +29 -0
- data/features/support/lib/clusters/results/render_cluster.rb +43 -0
- data/features/support/lib/clusters/results_cluster.rb +140 -0
- data/features/support/lib/clusters.rb +5 -0
- data/features/support/lib/helpers/browser.rb +212 -0
- data/features/support/lib/helpers/checkout.rb +31 -0
- data/features/support/lib/helpers/clusters.rb +234 -0
- data/features/support/lib/helpers/landing.rb +117 -0
- data/features/support/lib/helpers/render.rb +135 -0
- data/features/support/lib/helpers.rb +5 -0
- data/features/support/lib/price.rb +66 -0
- data/features/support/lib/services/fenix.rb +14 -0
- data/features/support/lib/services/landing.rb +18 -0
- data/features/support/lib/services/results.rb +62 -0
- data/features/support/lib/services.rb +4 -0
- data/features/support/matchers.rb +120 -0
- data/features/support/redefinitions.rb +42 -0
- data/features/tests/checkout/agency.feature +33 -0
- data/features/tests/checkout/button_cac.feature +52 -0
- data/features/tests/checkout/chat.feature +20 -0
- data/features/tests/checkout/cupones.feature +54 -0
- data/features/tests/checkout/error_messages.feature +64 -0
- data/features/tests/checkout/integration.feature +215 -0
- data/features/tests/checkout/low_cost.feature +55 -0
- data/features/tests/checkout/seguros.feature +37 -0
- data/features/tests/contents/costs.feature +29 -0
- data/features/tests/contents/rules.feature +58 -0
- data/features/tests/contents/webcheckin.feature +26 -0
- data/features/tests/desambiguation/airports.feature +89 -0
- data/features/tests/desambiguation/city.feature +86 -0
- data/features/tests/filters/filters.feature +160 -0
- data/features/tests/fixes/advancedgui.feature +171 -0
- data/features/tests/fixes/advancednogui.feature +60 -0
- data/features/tests/fixes/book_no_gui.feature +21 -0
- data/features/tests/fixes/cross_sell_row_hoteles.feature +70 -0
- data/features/tests/fixes/facebook.feature +31 -0
- data/features/tests/fixes/landing_home_alerts.feature +82 -0
- data/features/tests/fixes/matrix_stops.feature +104 -0
- data/features/tests/fixes/one_day_search.feature +63 -0
- data/features/tests/fixes/print.feature +87 -0
- data/features/tests/fixes/searches_no_gui.feature +85 -0
- data/features/tests/landing/landing_alerts.feature +93 -0
- data/features/tests/landing/landing_checkout.feature +286 -0
- data/features/tests/landing/landing_filters.feature +176 -0
- data/features/tests/landing/landing_home.feature +68 -0
- data/features/tests/landing/landing_integration.feature +153 -0
- data/features/tests/landing/landing_long_tail.feature +162 -0
- data/features/tests/landing/landing_matrix.feature +156 -0
- data/features/tests/landing/landing_negative.feature +157 -0
- data/features/tests/landing/landing_orders.feature +107 -0
- data/features/tests/landing/landing_pagination.feature +142 -0
- data/features/tests/landing/landing_passenger_review.feature +139 -0
- data/features/tests/landing/landing_positive.feature +155 -0
- data/features/tests/landing/landing_reviews.feature +139 -0
- data/features/tests/landing/landing_tags.feature +148 -0
- data/features/tests/matrix/matrix_airlines.feature +104 -0
- data/features/tests/matrix/matrix_fare_chart.feature +24 -0
- data/features/tests/matrix/matrix_price.feature +35 -0
- data/features/tests/others/alerts.feature +89 -0
- data/features/tests/others/anticipatedsearch.feature +82 -0
- data/features/tests/others/flights_tracker.feature +94 -0
- data/features/tests/others/newsletter.feature +131 -0
- data/features/tests/others/querystringparameters.feature +82 -0
- data/features/tests/others/recommendation.feature +170 -0
- data/features/tests/others/semaphore.feature +206 -0
- data/features/tests/others/upgrade_bussines.feature +100 -0
- data/features/tests/search/basefare.feature +88 -0
- data/features/tests/search/itineraries.feature +85 -0
- data/features/tests/search/orders.feature +100 -0
- data/features/tests/search/pagination.feature +70 -0
- data/features/tests/search/reviews.feature +84 -0
- data/features/tests/search/searches.feature +197 -0
- data/features/tests/search/wish_list.feature +102 -0
- data/flights_gui_henry_tests.gemspec +32 -0
- data/henry-context.yml +14733 -0
- metadata +324 -0
@@ -0,0 +1,135 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
#validaciones js and css de shop flights
|
3
|
+
def get_render(url,type)
|
4
|
+
begin
|
5
|
+
get = HTTParty.get("#{url}#{type}")
|
6
|
+
rescue
|
7
|
+
true.should be_true
|
8
|
+
end
|
9
|
+
return get
|
10
|
+
end
|
11
|
+
def validate_render(url,type)
|
12
|
+
data = get_render(url,type)
|
13
|
+
if data.code == 200
|
14
|
+
respond = Hpricot.parse(data.body)
|
15
|
+
respond.inner_text.should_not match("FreeMarker template error!")
|
16
|
+
else
|
17
|
+
true.should be_true
|
18
|
+
end
|
19
|
+
end
|
20
|
+
def escala_to_i(escala)
|
21
|
+
return 0 if escala.to_s =~ /(solo vuelo directo)|(Sin escalas)|(Sem escalas)|(Soamente v.o directo)|(Vuelo Directo)/i
|
22
|
+
return escala.to_s.gsub(/\D/,'').to_i
|
23
|
+
end
|
24
|
+
def validar_fechas(ticket,search)
|
25
|
+
if search.type.downcase !~ /multiple/
|
26
|
+
(ticket.ida.fecha == search.date_from).should be_true
|
27
|
+
if search.type.downcase =~ /roundtrip/
|
28
|
+
(ticket.vuelta.fecha == search.date_to).should be_true
|
29
|
+
end
|
30
|
+
else
|
31
|
+
(search.dates.split(',').include?(ticket.ida.fecha.to_s)).should be_true
|
32
|
+
(search.dates.split(',').include?(ticket.vuelta.fecha.to_s)).should be_true
|
33
|
+
end
|
34
|
+
end
|
35
|
+
#redefinicion del metodo que valida las ciudades en cada cluster
|
36
|
+
#se agrega la validacion del nombre de las ciudades origen/destino
|
37
|
+
def validar_destinos(ticket,search,html)
|
38
|
+
if search.type !~ /multipledestinations/
|
39
|
+
((!search.from_city.airports.include?(ticket.ida.origen_iata))and(!search.to_city.airports.include?(ticket.ida.destino_iata))).should_not be_true
|
40
|
+
if search.type == 'roundtrip'
|
41
|
+
((!search.to_city.airports.include?(ticket.vuelta.origen_iata))and(!search.from_city.airports.include?(ticket.vuelta.destino_iata))).should_not be_true
|
42
|
+
end
|
43
|
+
else
|
44
|
+
i = 0
|
45
|
+
(html/"div.sub-cluster.multiple").each do |tramo|
|
46
|
+
#(tramo/"li.city-departure").inner_text.gsub(/,/,'').strip.downcase.no_accents.downcase.should match("#{@search.from_cities[i].name}")
|
47
|
+
i += 1
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
#validar que el boton de seleccionar sea correcto
|
52
|
+
def validar_button(doc)
|
53
|
+
((doc/"a[@class='buy btn-buy flights-button']/span").empty? or !(doc/"a[@class='buy btn-buy flights-button']/span").inner_text.strip.downcase.match(/seleccionar|selecionar/)).should_not be_true
|
54
|
+
end
|
55
|
+
def other_page(page)
|
56
|
+
if BROWSER.li(:class => "page", :index => page).present? or BROWSER.li(:class,'next enabled').present?
|
57
|
+
if BROWSER.li(:class,'next enabled').present?
|
58
|
+
BROWSER.li(:class,'next enabled').click
|
59
|
+
else
|
60
|
+
BROWSER.li(:class => "page", :index => page).click
|
61
|
+
end
|
62
|
+
wait_action()
|
63
|
+
return nil
|
64
|
+
else
|
65
|
+
BROWSER.li(:class => "page", :index => 0).click if BROWSER.li(:class => "page", :index => 0).present?
|
66
|
+
wait_action()
|
67
|
+
return true
|
68
|
+
end
|
69
|
+
end
|
70
|
+
def wait_action()
|
71
|
+
Watir::Wait.until(timeout = 120){(!BROWSER.div(:class => "results-update").present?)}
|
72
|
+
end
|
73
|
+
#validar que se muestren correctamente los precios si la sesion expiro
|
74
|
+
def validate_prices_session_expired(ticket)
|
75
|
+
!ticket.tarifas['adicional'].nil?
|
76
|
+
end
|
77
|
+
#validar que se muestren correctamente los precios si la sesion no expiro
|
78
|
+
def validate_prices_without_session_expired(ticket)
|
79
|
+
ticket.tarifas['adicional'].nil?
|
80
|
+
end
|
81
|
+
#validaciones del popup de mas detalles
|
82
|
+
def mostrar_mas_detalles_nr(search)
|
83
|
+
#TODO que cargue el pop up
|
84
|
+
if search.type !~ /multipledestinations/
|
85
|
+
BROWSER.div(:class=>'cluster',:index=>0).div(:class,"sub-cluster outbound").li(:class=>'stops',:index=> 0).links[0].click
|
86
|
+
Watir::Wait.until(timeout = 120){BROWSER.div(:id,'popup-detail').present?}
|
87
|
+
if BROWSER.div(:id,'popup-detail').present?
|
88
|
+
link_reglas_y_restricciones_nr(BROWSER.div(:id,'popup-detail'))
|
89
|
+
html_ida = BROWSER.div(:id,'popup-detail').html
|
90
|
+
BROWSER.div(:id,'popup-detail').span(:class,'popup-close-button popup-close').click
|
91
|
+
if search.type =~ /ida y vuelta/
|
92
|
+
BROWSER.div(:class=>'cluster',:index=>0).div(:class,"sub-cluster inbound").li(:class=>'stops',:index=> 0).links[0].click
|
93
|
+
Watir::Wait.until(timeout = 120){BROWSER.div(:id,'popup-detail').present?}
|
94
|
+
if BROWSER.div(:id,'popup-detail').present?
|
95
|
+
link_reglas_y_restricciones_nr(BROWSER.div(:id,'popup-detail'))
|
96
|
+
validar_mas_detalle_nr(html_ida,BROWSER.div(:id,'popup-detail').html)
|
97
|
+
BROWSER.div(:id,'popup-detail').span(:class,'popup-close-button popup-close').click
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
else
|
102
|
+
BROWSER.div(:class=>'cluster',:index=>0).li(:class=>'stops',:index=> 0).links[0].click
|
103
|
+
Watir::Wait.until(timeout = 120){BROWSER.div(:id,'popup-detail').present?}
|
104
|
+
if BROWSER.div(:id,'popup-detail').present?
|
105
|
+
link_reglas_y_restricciones_nr(BROWSER.div(:id,'popup-detail'))
|
106
|
+
validar_mas_detalle_nr(BROWSER.html)
|
107
|
+
BROWSER.div(:id,'popup-detail').span(:class,'popup-close-button popup-close').click
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
def link_reglas_y_restricciones_nr(elemento)
|
112
|
+
elemento.link(:class,'show-rules').click
|
113
|
+
sleep(1)
|
114
|
+
elemento.div(:class,'rules').should visible
|
115
|
+
end
|
116
|
+
def validar_mas_detalle_nr(html_ida,html_vuelta = nil)
|
117
|
+
ida = Hpricot.parse(html_ida)
|
118
|
+
vuelta = Hpricot.parse(html_vuelta) if html_vuelta
|
119
|
+
(ida/"div.segment li.itinerary span.date").select{|li| li.inner_text.empty?}.should is_empty
|
120
|
+
(ida/"div.rules/div.text").inner_text.empty?.should_not be_true
|
121
|
+
if html_vuelta
|
122
|
+
(vuelta/"div.segment li.itinerary span.date").select{|li| li.inner_text.empty?}.should is_empty
|
123
|
+
(vuelta/"div.rules/div.text").inner_text.empty?.should_not be_true
|
124
|
+
end
|
125
|
+
begin
|
126
|
+
((ida/"span.location").first.inner_text.match(/(.+)\((...)\)/)[2] == search.from_city.code).should be_true
|
127
|
+
((ida/"span.location").last.inner_text.match(/(.+)\((...)\)/)[2] == search.to_city.code).should be_true
|
128
|
+
if html_vuelta
|
129
|
+
((vuelta/"span.location").first.inner_text.match(/(.+)\((...)\)/)[2] == search.to_city.code).should be_true
|
130
|
+
((vuelta/"span.location").last.inner_text.match(/(.+)\((...)\)/)[2] == search.from_city.code).should be_true
|
131
|
+
end
|
132
|
+
rescue
|
133
|
+
true.should be_true
|
134
|
+
end
|
135
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
#clase que representa un precio, con su moneda y valor correspondiente
|
3
|
+
#se le pasa una string que contiene al precio(moneda y valor juntos)
|
4
|
+
class Price
|
5
|
+
|
6
|
+
include Comparable
|
7
|
+
|
8
|
+
attr_accessor :value, :currency
|
9
|
+
|
10
|
+
def initialize(precio, costos=nil, item=nil)
|
11
|
+
@currency = (precio.empty?) ? '$' : (precio.gsub(/\-|\.|\d/,'').upstrip == 'BSF' ? "Bs.F." : precio.gsub(/\-|\.|\d| /,'').upstrip )
|
12
|
+
@value = (precio.empty?) ? 0 : precio.match(/([^\s]+)\s+([^\s]+)/i)[2].strip.gsub(/\./,'').to_i
|
13
|
+
end
|
14
|
+
|
15
|
+
def moneda
|
16
|
+
self.currency
|
17
|
+
end
|
18
|
+
|
19
|
+
def valor
|
20
|
+
self.value
|
21
|
+
end
|
22
|
+
|
23
|
+
def set_valor(value)
|
24
|
+
@value = value
|
25
|
+
end
|
26
|
+
|
27
|
+
#metodo que pregunta si el precio es en dolares
|
28
|
+
def dolar?
|
29
|
+
self.currency =~ /(U\$S)|(U\$D)|(USD)|(US\$)|(\$US)/
|
30
|
+
end
|
31
|
+
|
32
|
+
#metodos de comparacion
|
33
|
+
def <=>(other)
|
34
|
+
( (self.dolar? and other.dolar?) or self.same_moneda?(other) ) ? ( self.value <=> other.value ) : ( self.to_dolar.value <=> other.to_dolar.value)
|
35
|
+
end
|
36
|
+
|
37
|
+
#informa si la diferencia es mayor a un rango determinado
|
38
|
+
def diff(other,range)
|
39
|
+
( (self.dolar? and other.dolar?) or self.same_moneda?(other) ) ? ( self.value <=> other.value ) : ( self.to_dolar.value <=> other.to_dolar.value )
|
40
|
+
end
|
41
|
+
|
42
|
+
#devuelve un string del precio
|
43
|
+
def to_s
|
44
|
+
"#{self.currency}#{self.value}"
|
45
|
+
end
|
46
|
+
|
47
|
+
def +(other)
|
48
|
+
( self.same_moneda?(other) )? ( Precio.new("#{self.currency} #{self.value + other.value}",true) ) : ( Precio.new("U$S #{self.to_dolar.value + other.to_dolar.value}",true) )
|
49
|
+
end
|
50
|
+
def -(other)
|
51
|
+
( self.same_moneda?(other) )? ( Precio.new("#{self.currency} #{self.value - other.value}","change") ) : ( Precio.new("U$S #{self.to_dolar.value - other.to_dolar.value}","change") )
|
52
|
+
end
|
53
|
+
|
54
|
+
def same_moneda?(other)
|
55
|
+
self.currency == other.currency or ver_moneda_en_base(other.currency) or (MainData.site =~ /ECUADOR/)
|
56
|
+
end
|
57
|
+
|
58
|
+
def zero?
|
59
|
+
self.value == 0
|
60
|
+
end
|
61
|
+
|
62
|
+
def empty?
|
63
|
+
self.zero?
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
module Services
|
3
|
+
class Fenix
|
4
|
+
def self.start_test(id,body={},headers={})
|
5
|
+
respond = HTTParty.post("http://fenix-tools.despegar.it/fenix-tools/start-tests/#{id}",:body=>body,:headers=>headers)
|
6
|
+
puts respond
|
7
|
+
return respond
|
8
|
+
end
|
9
|
+
def self.test_status(id)
|
10
|
+
respond = JSON.parse(HTTParty.get "http://fenix-tools.despegar.it/fenix-tools/tests-status/#{id}")
|
11
|
+
return respond
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
module Services
|
3
|
+
|
4
|
+
class Landing
|
5
|
+
|
6
|
+
attr_accessor :json
|
7
|
+
|
8
|
+
def initialize(html)
|
9
|
+
@json = JSON.parse(get_json(html))
|
10
|
+
end
|
11
|
+
|
12
|
+
def get_json(html)
|
13
|
+
script=(html/"script").select{|script| script.inner_text.match('jsonData')}.first
|
14
|
+
return script.inner_text.match(/^\"jsonData\" \: (.*),$/)[1]
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
require 'digest/md5'
|
3
|
+
module Services
|
4
|
+
|
5
|
+
class Results
|
6
|
+
|
7
|
+
attr_accessor :json, :json_no_referer
|
8
|
+
|
9
|
+
def initialize(browser,type)
|
10
|
+
@json = eval "get_json_#{type}(browser)"
|
11
|
+
@json_no_referer = eval "get_json_#{type}_no_referer(browser)"
|
12
|
+
end
|
13
|
+
|
14
|
+
def get_json_roundtrip(url)
|
15
|
+
begin
|
16
|
+
HTTParty.get(url.gsub(/results/,"data/search") + "/TOTALFARE/ASCENDING/NA/NA/NA/NA/NA?hashForData=#{digest_md5(url)}",:headers => {"referer" => url})
|
17
|
+
rescue Errno::ECONNRESET,Timeout::Error
|
18
|
+
HTTParty.get(url.gsub(/results/,"data/search") + "/TOTALFARE/ASCENDING/NA/NA/NA/NA/NA?hashForData=#{digest_md5(url)}",:headers => {"referer" => url})
|
19
|
+
end
|
20
|
+
end
|
21
|
+
def get_json_oneway(url)
|
22
|
+
begin
|
23
|
+
HTTParty.get(url.gsub(/results/,"data/search") + "/TOTALFARE/ASCENDING/NA/NA/NA/NA?hashForData=#{digest_md5(url)}",:headers => {"referer" => url})
|
24
|
+
rescue Errno::ECONNRESET,Timeout::Error
|
25
|
+
HTTParty.get(url.gsub(/results/,"data/search") + "/TOTALFARE/ASCENDING/NA/NA/NA/NA?hashForData=#{digest_md5(url)}",:headers => {"referer" => url})
|
26
|
+
end
|
27
|
+
end
|
28
|
+
def get_json_multipledestinations(url)
|
29
|
+
begin
|
30
|
+
HTTParty.get(url.gsub(/results/,"data/search") + "/TOTALFARE/ASCENDING?hashForData=#{digest_md5(url)}",:headers => {"referer" => url})
|
31
|
+
rescue Errno::ECONNRESET,Timeout::Error
|
32
|
+
HTTParty.get(url.gsub(/results/,"data/search") + "/TOTALFARE/ASCENDING?hashForData=#{digest_md5(url)}",:headers => {"referer" => url})
|
33
|
+
end
|
34
|
+
end
|
35
|
+
def get_json_roundtrip_no_referer(url)
|
36
|
+
begin
|
37
|
+
HTTParty.get(url.gsub(/results/,"data/search") + "/TOTALFARE/ASCENDING/NA/NA/NA/NA/NA")
|
38
|
+
rescue Errno::ECONNRESET,Timeout::Error
|
39
|
+
HTTParty.get(url.gsub(/results/,"data/search") + "/TOTALFARE/ASCENDING/NA/NA/NA/NA/NA")
|
40
|
+
end
|
41
|
+
end
|
42
|
+
def get_json_oneway_no_referer(url)
|
43
|
+
begin
|
44
|
+
HTTParty.get(url.gsub(/results/,"data/search") + "/TOTALFARE/ASCENDING/NA/NA/NA/NA")
|
45
|
+
rescue Errno::ECONNRESET,Timeout::Error
|
46
|
+
HTTParty.get(url.gsub(/results/,"data/search") + "/TOTALFARE/ASCENDING/NA/NA/NA/NA")
|
47
|
+
end
|
48
|
+
end
|
49
|
+
def get_json_multipledestinations_no_referer(url)
|
50
|
+
begin
|
51
|
+
HTTParty.get(url.gsub(/results/,"data/search") + "/TOTALFARE/ASCENDING")
|
52
|
+
rescue Errno::ECONNRESET,Timeout::Error
|
53
|
+
HTTParty.get(url.gsub(/results/,"data/search") + "/TOTALFARE/ASCENDING")
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def digest_md5(url)
|
58
|
+
return Digest::MD5.hexdigest(url+"despegar")
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,120 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
RSpec::Matchers.define :is_greater_than do |min|
|
3
|
+
match do |actual|
|
4
|
+
actual.to_i > min
|
5
|
+
end
|
6
|
+
failure_message_for_should do |actual|
|
7
|
+
"se esperaba que el valor #{actual} sea mayor a #{min}"
|
8
|
+
end
|
9
|
+
failure_message_for_should_not do |actual|
|
10
|
+
"se esperaba que el valor #{actual} no sea mayor a #{min}"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
RSpec::Matchers.define :is_greater_equal_than do |min|
|
15
|
+
match do |actual|
|
16
|
+
actual.to_i >= min
|
17
|
+
end
|
18
|
+
failure_message_for_should do |actual|
|
19
|
+
"se esperaba que el valor #{actual} sea mayor o igual a #{min}"
|
20
|
+
end
|
21
|
+
failure_message_for_should_not do |actual|
|
22
|
+
"se esperaba que el valor #{actual} no sea mayor o igual a #{min}"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
RSpec::Matchers.define :visible do
|
27
|
+
match do |actual|
|
28
|
+
actual.present?
|
29
|
+
end
|
30
|
+
failure_message_for_should do |actual|
|
31
|
+
"se esperaba que el elemento #{actual} sea visible"
|
32
|
+
end
|
33
|
+
failure_message_for_should_not do |actual|
|
34
|
+
"se esperaba que el elemento #{actual} no sea visible"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
RSpec::Matchers.define :enabled do
|
39
|
+
match do |actual|
|
40
|
+
actual.enabled?
|
41
|
+
end
|
42
|
+
failure_message_for_should do |actual|
|
43
|
+
"se esperaba que el elemento #{actual} estuviera habilitado"
|
44
|
+
end
|
45
|
+
failure_message_for_should_not do |actual|
|
46
|
+
"se esperaba que el elemento #{actual} estuviera deshabilitado"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
RSpec::Matchers.define :visible do |text|
|
51
|
+
match do |actual|
|
52
|
+
actual.present?
|
53
|
+
end
|
54
|
+
failure_message_for_should do |actual|
|
55
|
+
"se esperaba que el elemento #{text} sea visible"
|
56
|
+
end
|
57
|
+
failure_message_for_should_not do |actual|
|
58
|
+
"se esperaba que el elemento #{text} no sea visible"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
RSpec::Matchers.define :match do |text_for_match|
|
63
|
+
match do |actual|
|
64
|
+
actual.match(/#{text_for_match}/)
|
65
|
+
end
|
66
|
+
failure_message_for_should do |actual|
|
67
|
+
"se esperaba que el texto #{actual} contenga a #{text_for_match}"
|
68
|
+
end
|
69
|
+
failure_message_for_should_not do |actual|
|
70
|
+
"se esperaba que el texto #{actual} no contenga a #{text_for_match}"
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
RSpec::Matchers.define :match_sensitive do |text_for_match|
|
75
|
+
match do |actual|
|
76
|
+
actual.match(/#{text_for_match}/i)
|
77
|
+
end
|
78
|
+
failure_message_for_should do |actual|
|
79
|
+
"se esperaba que el texto #{actual} contenga a #{text_for_match}"
|
80
|
+
end
|
81
|
+
failure_message_for_should_not do |actual|
|
82
|
+
"se esperaba que el texto #{actual} no contenga a #{text_for_match}"
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
RSpec::Matchers.define :equal do |text|
|
87
|
+
match do |actual|
|
88
|
+
actual == text
|
89
|
+
end
|
90
|
+
failure_message_for_should do |actual|
|
91
|
+
"se esperaba que el texto #{actual} sea igual a #{text}"
|
92
|
+
end
|
93
|
+
failure_message_for_should_not do |actual|
|
94
|
+
"se esperaba que el texto #{actual} no sea igual a #{text}"
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
RSpec::Matchers.define :include? do |text|
|
99
|
+
match do |actual|
|
100
|
+
actual.include?(text)
|
101
|
+
end
|
102
|
+
failure_message_for_should do |actual|
|
103
|
+
"se esperaba que la coleccion [#{actual.join('-')}] contenga a #{text}"
|
104
|
+
end
|
105
|
+
failure_message_for_should_not do |actual|
|
106
|
+
"se esperaba que la coleccion [#{actual.join('-')}] no contenga a #{text}"
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
RSpec::Matchers.define :is_empty do
|
111
|
+
match do |actual|
|
112
|
+
actual.empty?
|
113
|
+
end
|
114
|
+
failure_message_for_should do |actual|
|
115
|
+
"Se esperaba que la coleccion #{actual.join('-')} sea vacia"
|
116
|
+
end
|
117
|
+
failure_message_for_should_not do |actual|
|
118
|
+
"Se esperaba que la coleccion #{actual.join('-')} no sea vacia"
|
119
|
+
end
|
120
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
class String
|
3
|
+
|
4
|
+
def no_accents
|
5
|
+
return self.force_encoding("UTF-8").unaccent
|
6
|
+
end
|
7
|
+
|
8
|
+
def downstrip
|
9
|
+
return self.downcase.strip.gsub(/\n\r/,'')
|
10
|
+
end
|
11
|
+
|
12
|
+
def upstrip
|
13
|
+
return self.upcase.strip
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
class Date
|
19
|
+
def self.parse_new_result(string)
|
20
|
+
aux = string.gsub(/\.|\,/,'').match(/(\D.+) (\d{1,2}) (\D.+)(,|) (\d{4})/)
|
21
|
+
fecha = "#{aux[5]}/#{MONTHNAMES.index(aux[3].capitalize) ? MONTHNAMES.index(aux[3].capitalize) : ABBR_MONTHNAMES.index(aux[3].downcase)}/#{aux[2]}"
|
22
|
+
self.parse(fecha)
|
23
|
+
end
|
24
|
+
def self.parse_details(string)
|
25
|
+
aux = string.match(/(\d{1,2}) (\D.+) (\d{4}) (\d{2}):(\d{2})/)
|
26
|
+
fecha = "#{aux[3]}/#{ABBR_MONTHNAMES.index(aux[2].downcase)}/#{aux[1]}"
|
27
|
+
self.parse(fecha)
|
28
|
+
end
|
29
|
+
def self.parse_new_details(string)
|
30
|
+
aux = string.match(/(\D.+) (\d{1,2}) (\D.+)/)
|
31
|
+
fecha = "#{aux[2]}/#{ABBR_MONTHNAMES.index(aux[3].downcase)}/#{Date.today.year}"
|
32
|
+
date = self.parse(fecha)
|
33
|
+
date = date.next_year if date < Date.today
|
34
|
+
return date
|
35
|
+
end
|
36
|
+
def mes
|
37
|
+
return MONTHNAMES[self.month]
|
38
|
+
end
|
39
|
+
def mes_abrr
|
40
|
+
return ABBR_MONTHNAMES[self.month]
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
#language: es
|
2
|
+
@checkout
|
3
|
+
Característica: checkout.agency
|
4
|
+
IF000*
|
5
|
+
|
6
|
+
@agency
|
7
|
+
Esquema del escenario: Se ingresa al checkout con ciertos parametros de entrada, se llenan los campos y se compra el vuelo verificando que se realize la compra correctamente
|
8
|
+
Cuando Ingreso a la pagina de checkout de agencia en "<pais>" para una busqueda "<tipo>" del tipo "<cabotage>"
|
9
|
+
Cuando Verifico que ingrese al checkout
|
10
|
+
Y Si existe la opcion de cobertura, Elijo "no_chequear" si quiero cobertura
|
11
|
+
Y Verifico los datos de agencia afiliada
|
12
|
+
Y Verifico el pixel de Efrontier
|
13
|
+
Entonces Completo el formulario de pasajeros
|
14
|
+
Y Completo el formulario de tarjeta
|
15
|
+
Y Completo los datos de contacto
|
16
|
+
Y Realizo la compra
|
17
|
+
Entonces Verifico que dirija a la pagina de gracias
|
18
|
+
Entonces Si el checkout me pide mas datos de tarjeta, lleno los datos de tarjeta adicionales
|
19
|
+
Entonces Si se muestra el popup de no disponibilidad, elijo otro vuelo
|
20
|
+
Entonces Si debo completar de vuelta el formulario, completo el formulario
|
21
|
+
Y Verifico que genere id cro
|
22
|
+
|
23
|
+
@br
|
24
|
+
Ejemplos:
|
25
|
+
|pais|cabotage|tipo|
|
26
|
+
|BR|nil|roundtrip|
|
27
|
+
|BR|nil|oneway|
|
28
|
+
@us
|
29
|
+
Ejemplos:
|
30
|
+
|pais|cabotage|tipo|
|
31
|
+
|US|nil|roundtrip|
|
32
|
+
|US|nil|oneway|
|
33
|
+
|US|nil|multipledestinations|
|
@@ -0,0 +1,52 @@
|
|
1
|
+
#language: es
|
2
|
+
@checkout
|
3
|
+
Característica: checkout.button_cac
|
4
|
+
IF000*
|
5
|
+
|
6
|
+
@button_cac
|
7
|
+
Esquema del escenario: Se ingresa al checkout con ciertos parametros de entrada, se elije la opcion de reserva CAC y se realiza la compra
|
8
|
+
Cuando Ingreso a la pagina de resultados en "<pais>" para una busqueda "<tipo>" del tipo "<cabotage>"
|
9
|
+
Cuando Espero que termine de cargar
|
10
|
+
Entonces Verifico que traiga resultados
|
11
|
+
Cuando Elijo un itinerario y paso a checkout
|
12
|
+
Cuando Verifico que ingrese al checkout
|
13
|
+
Entonces Completo el formulario de pasajeros
|
14
|
+
Y Completo los datos para reservas CAC
|
15
|
+
Y Completo los datos de contacto
|
16
|
+
Y Realizo la compra
|
17
|
+
Entonces Verifico que dirija a la pagina de gracias
|
18
|
+
Entonces Si el checkout me pide mas datos de tarjeta, lleno los datos de tarjeta adicionales
|
19
|
+
Entonces Si se muestra el popup de no disponibilidad, elijo otro vuelo
|
20
|
+
Entonces Si debo completar de vuelta el formulario, completo el formulario para reservas CAC
|
21
|
+
Y Verifico que genere id cro
|
22
|
+
|
23
|
+
@ar
|
24
|
+
@roundtrip
|
25
|
+
Ejemplos:
|
26
|
+
|pais|tipo|cabotage|
|
27
|
+
|AR |roundtrip|nil|
|
28
|
+
@ar
|
29
|
+
@oneway
|
30
|
+
Ejemplos:
|
31
|
+
|pais|tipo|cabotage|
|
32
|
+
|AR |oneway|nil|
|
33
|
+
@ar
|
34
|
+
@multipledestinations
|
35
|
+
Ejemplos:
|
36
|
+
|pais|tipo|cabotage|
|
37
|
+
|AR |multipledestinations|nil|
|
38
|
+
@br
|
39
|
+
@roundtrip
|
40
|
+
Ejemplos:
|
41
|
+
|pais|tipo|cabotage|
|
42
|
+
|BR |roundtrip|true|
|
43
|
+
@br
|
44
|
+
@oneway
|
45
|
+
Ejemplos:
|
46
|
+
|pais|tipo|cabotage|
|
47
|
+
|BR |oneway|true|
|
48
|
+
@br
|
49
|
+
@roundtrip
|
50
|
+
Ejemplos:
|
51
|
+
|pais|tipo|cabotage|
|
52
|
+
|BR |roundtrip|true|
|
@@ -0,0 +1,20 @@
|
|
1
|
+
#language: es
|
2
|
+
@checkout
|
3
|
+
Característica: checkout.chat
|
4
|
+
|
5
|
+
@chat
|
6
|
+
Esquema del escenario: Se ingresa al checkout con ciertos parametros de entrada, se activa el chat y se loguea un user de prueba
|
7
|
+
Cuando Ingreso a la pagina de checkout en "<pais>" para una busqueda "<tipo>" del tipo "<cabotage>"
|
8
|
+
Cuando Verifico que ingrese al checkout
|
9
|
+
Cuando aplico el js del chat
|
10
|
+
Cuando espero que se muestre la caja del chat
|
11
|
+
Entonces me logueo al chat
|
12
|
+
Entonces verifico que se muestre todo correctamente
|
13
|
+
Y Cierro el chat
|
14
|
+
|
15
|
+
@ar
|
16
|
+
Ejemplos:
|
17
|
+
|pais|cabotage|tipo|
|
18
|
+
|AR|nil|roundtrip|
|
19
|
+
|AR|true|oneway|
|
20
|
+
|AR|nil|multipledestinations|
|
@@ -0,0 +1,54 @@
|
|
1
|
+
#language: es
|
2
|
+
@checkout
|
3
|
+
Característica: checkout.cupones
|
4
|
+
IF000*
|
5
|
+
|
6
|
+
@cupones
|
7
|
+
Esquema del escenario: Se ingresa al checkout con ciertos parametros de entrada, se llenan los campos y se compra el vuelo verificando que se realize la compra correctamente con un cupon de descuento
|
8
|
+
Cuando Ingreso a la pagina de resultados en "<pais>" para una busqueda "<tipo>" del tipo "<cabotage>"
|
9
|
+
Cuando Espero que termine de cargar
|
10
|
+
Entonces Verifico que traiga resultados
|
11
|
+
Cuando Elijo un itinerario y paso a checkout
|
12
|
+
Cuando Verifico que ingrese al checkout
|
13
|
+
Entonces Completo el formulario de pasajeros
|
14
|
+
Y Completo el formulario de tarjeta
|
15
|
+
Y Completo los datos de resolucion AFIP
|
16
|
+
Y Completo los datos de contacto
|
17
|
+
Y Si pide factura fiscal, Completo los campos de factura fiscal
|
18
|
+
Y Si permite cupon de descuento, Completo con un cupon de descuento invalido
|
19
|
+
Y Realizo la compra
|
20
|
+
Entonces Verifico que de error de cupon invalido
|
21
|
+
|
22
|
+
@ar
|
23
|
+
Ejemplos:
|
24
|
+
|pais|tipo|cabotage|
|
25
|
+
|AR |roundtrip|nil|
|
26
|
+
|AR |oneway|nil|
|
27
|
+
|AR |multipledestinations|nil|
|
28
|
+
|
29
|
+
@cupones
|
30
|
+
Esquema del escenario: Se ingresa al checkout con ciertos parametros de entrada, se llenan los campos y se compra el vuelo verificando que se realize la compra correctamente con un cupon de descuento
|
31
|
+
Cuando Ingreso a la pagina de resultados en "<pais>" para una busqueda "<tipo>" del tipo "<cabotage>"
|
32
|
+
Cuando Espero que termine de cargar
|
33
|
+
Entonces Verifico que traiga resultados
|
34
|
+
Cuando Elijo un itinerario y paso a checkout
|
35
|
+
Cuando Verifico que ingrese al checkout
|
36
|
+
Entonces Completo el formulario de pasajeros
|
37
|
+
Y Completo el formulario de tarjeta
|
38
|
+
Y Completo los datos de resolucion AFIP
|
39
|
+
Y Completo los datos de contacto
|
40
|
+
Y Si pide factura fiscal, Completo los campos de factura fiscal
|
41
|
+
Y Si permite cupon de descuento, Completo con un cupon de descuento valido
|
42
|
+
Y Realizo la compra
|
43
|
+
Entonces Verifico que dirija a la pagina de gracias
|
44
|
+
Entonces Si el checkout me pide mas datos de tarjeta, lleno los datos de tarjeta adicionales
|
45
|
+
Entonces Si se muestra el popup de no disponibilidad, elijo otro vuelo
|
46
|
+
Entonces Si debo completar de vuelta el formulario, completo el formulario
|
47
|
+
Y Verifico que genere id cro
|
48
|
+
|
49
|
+
@ar
|
50
|
+
Ejemplos:
|
51
|
+
|pais|tipo|cabotage|
|
52
|
+
|AR |roundtrip|nil|
|
53
|
+
|AR |oneway|nil|
|
54
|
+
|AR |multipledestinations|nil|
|