flights_gui_tests 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +3 -0
  3. data/features/data/host.yml +78 -0
  4. data/features/data/miles.yml +216 -0
  5. data/features/data/sites.yml +44 -0
  6. data/features/data/tag_microsoft.yml +68 -0
  7. data/features/step_definitions/checkout/checkout_steps.rb +24 -0
  8. data/features/step_definitions/checkout/form_steps.rb +20 -0
  9. data/features/step_definitions/checkout/load_steps.rb +36 -0
  10. data/features/step_definitions/conditional_steps.rb +12 -0
  11. data/features/step_definitions/cookies_steps.rb +8 -0
  12. data/features/step_definitions/flights_tracker/flights_tracker_steps.rb +30 -0
  13. data/features/step_definitions/landing/itineraries_steps.rb +75 -0
  14. data/features/step_definitions/landing/landing_steps.rb +59 -0
  15. data/features/step_definitions/landing/load_steps.rb +30 -0
  16. data/features/step_definitions/page_steps.rb +18 -0
  17. data/features/step_definitions/results/basefare_steps.rb +65 -0
  18. data/features/step_definitions/results/desambiguation_steps.rb +144 -0
  19. data/features/step_definitions/results/errors_steps.rb +23 -0
  20. data/features/step_definitions/results/filters_steps.rb +301 -0
  21. data/features/step_definitions/results/load_steps.rb +52 -0
  22. data/features/step_definitions/results/matrix_steps.rb +213 -0
  23. data/features/step_definitions/results/order_steps.rb +49 -0
  24. data/features/step_definitions/results/pagination_steps.rb +29 -0
  25. data/features/step_definitions/results/recommendation_steps.rb +75 -0
  26. data/features/step_definitions/results/results_steps.rb +40 -0
  27. data/features/step_definitions/results/reviews_steps.rb +16 -0
  28. data/features/step_definitions/results/tags_steps.rb +102 -0
  29. data/features/step_definitions/results/wish_list_steps.rb +114 -0
  30. data/features/step_definitions/thanks/load_steps.rb +10 -0
  31. data/features/step_definitions/thanks/thanks_steps.rb +12 -0
  32. data/features/support/classes/clusters/checkout_cluster.rb +117 -0
  33. data/features/support/classes/clusters/data/data.rb +33 -0
  34. data/features/support/classes/clusters/results/details_cluster.rb +36 -0
  35. data/features/support/classes/clusters/results/landing_cluster.rb +29 -0
  36. data/features/support/classes/clusters/results/render_cluster.rb +83 -0
  37. data/features/support/classes/clusters/results_cluster.rb +171 -0
  38. data/features/support/classes/date.rb +26 -0
  39. data/features/support/classes/element.rb +23 -0
  40. data/features/support/classes/price.rb +66 -0
  41. data/features/support/classes/process_manager.rb +104 -0
  42. data/features/support/classes/string.rb +16 -0
  43. data/features/support/env.rb +94 -0
  44. data/features/support/hooks.rb +20 -0
  45. data/features/support/matchers.rb +108 -0
  46. data/features/support/modules/accessor.rb +26 -0
  47. data/features/support/modules/browser.rb +80 -0
  48. data/features/support/modules/checkout/datos_de_facturacion.rb +64 -0
  49. data/features/support/modules/checkout/informacion_de_contacto.rb +30 -0
  50. data/features/support/modules/checkout/pasajeros.rb +71 -0
  51. data/features/support/modules/checkout/tarjeta.rb +71 -0
  52. data/features/support/modules/element.rb +12 -0
  53. data/features/support/modules/helpers.rb +64 -0
  54. data/features/support/modules/pages/cookies.rb +33 -0
  55. data/features/support/modules/pages/tags.rb +27 -0
  56. data/features/support/modules/results/filters.rb +37 -0
  57. data/features/support/modules/results/itineraries/bussines.rb +17 -0
  58. data/features/support/modules/results/itineraries/data.rb +25 -0
  59. data/features/support/modules/results/itineraries/details.rb +80 -0
  60. data/features/support/modules/results/itineraries/miles.rb +64 -0
  61. data/features/support/modules/results/itineraries/payments.rb +27 -0
  62. data/features/support/modules/results/matrix/matrix_airline.rb +52 -0
  63. data/features/support/modules/results/matrix/matrix_fare_chart.rb +21 -0
  64. data/features/support/modules/results/matrix/matrix_price.rb +18 -0
  65. data/features/support/modules/results/recommendation.rb +29 -0
  66. data/features/support/modules/results/search_params.rb +21 -0
  67. data/features/support/modules/results/wish_list.rb +33 -0
  68. data/features/support/pages/all_pages.rb +95 -0
  69. data/features/support/pages/checkout/checkout_page.rb +45 -0
  70. data/features/support/pages/checkout/popup_results_page.rb +39 -0
  71. data/features/support/pages/flights_tracker/search_page.rb +54 -0
  72. data/features/support/pages/landing/search_page.rb +94 -0
  73. data/features/support/pages/results/desambiguation_airports_page.rb +16 -0
  74. data/features/support/pages/results/desambiguation_city_page.rb +20 -0
  75. data/features/support/pages/results/search_page.rb +101 -0
  76. data/features/support/pages/thanks/thanks_page.rb +7 -0
  77. data/features/tests/checkout/book_ok.feature +209 -0
  78. data/features/tests/flights_tracker/search.feature +65 -0
  79. data/features/tests/landing/search.feature +152 -0
  80. data/features/tests/results/basefare.feature +90 -0
  81. data/features/tests/results/desambiguation/airports.feature +89 -0
  82. data/features/tests/results/desambiguation/city.feature +87 -0
  83. data/features/tests/results/errors.feature +198 -0
  84. data/features/tests/results/filters.feature +113 -0
  85. data/features/tests/results/itineraries.feature +93 -0
  86. data/features/tests/results/matrix/matrix_airlines.feature +46 -0
  87. data/features/tests/results/matrix/matrix_fare_chart.feature +41 -0
  88. data/features/tests/results/matrix/matrix_price.feature +41 -0
  89. data/features/tests/results/orders.feature +89 -0
  90. data/features/tests/results/pagination.feature +74 -0
  91. data/features/tests/results/recommendation.feature +111 -0
  92. data/features/tests/results/reviews_airlines.feature +84 -0
  93. data/features/tests/results/search.feature +209 -0
  94. data/features/tests/results/wish_list.feature +55 -0
  95. data/flights_gui_tests.gemspec +34 -0
  96. data/henry-context.yml +4938 -0
  97. metadata +306 -0
@@ -0,0 +1,26 @@
1
+ # encoding: utf-8
2
+ module PageObject
3
+ module Accessors
4
+ def select_list(name, identifier={:index => 0}, &block)
5
+ define_method(name) do
6
+ return platform.select_list_value_for identifier.clone unless block_given?
7
+ self.send("#{name}_element").value
8
+ end
9
+ define_method("#{name}=") do |value|
10
+ return platform.select_list_value_set(identifier.clone, value) unless block_given?
11
+ self.send("#{name}_element").select(value)
12
+ end
13
+ define_method("#{name}_value=") do |value|
14
+ return platform.select_list_value_set(identifier.clone, value) unless block_given?
15
+ self.send("#{name}_element").select_value(value)
16
+ end
17
+ define_method("#{name}_options") do
18
+ element = self.send("#{name}_element")
19
+ (element && element.options) ? element.options.collect(&:text) : []
20
+ end
21
+
22
+ standard_methods(name, identifier, 'select_list_for', &block)
23
+
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,80 @@
1
+ # -*- encoding : utf-8 -*-
2
+ module Browser
3
+
4
+ def self.iniciar(browser)
5
+ browser = Watir::Browser.new opcion(browser)
6
+ maximizar(browser)
7
+ return browser
8
+ end
9
+
10
+ def self.opcion(type)
11
+ case type.upcase
12
+ when 'IE' then
13
+ :ie
14
+ when 'FIREFOX' then
15
+ :firefox
16
+ when 'CHROME' then
17
+ :chrome
18
+ else
19
+ :chrome
20
+ end
21
+ end
22
+
23
+ def self.maximizar(browser)
24
+ screen_width = browser.execute_script("return screen.width;")
25
+ screen_height = browser.execute_script("return screen.height;")
26
+ browser.window.resize_to(screen_width, screen_height)
27
+ end
28
+
29
+ def self.error_http?(browser)
30
+
31
+ begin
32
+
33
+ begin
34
+ pagina = Hpricot.parse(browser.html)
35
+ rescue Hpricot::ParseError
36
+ return false
37
+ end
38
+
39
+ if (pagina/"div#errorInfo").length>0
40
+ raise((pagina/"div#errorInfo").inner_html)
41
+ end
42
+
43
+ if (pagina/"div.errorPageContenido h2#disculpaLangES").inner_text.match(/Estamos trabajando/i)
44
+ return true
45
+ end
46
+
47
+ browser_text = Sanitize.clean(browser.html)
48
+
49
+ if browser.div(:class,"errorPageContenido").present?
50
+ return true
51
+ end
52
+
53
+ if (browser_text =~ /Server Error/i or browser_text == nil)
54
+ return true
55
+ end
56
+
57
+ if (browser_text =~ /(HTTP error 404)|(Internet Explorer no puede mostrar la)|(Problema al cargar la)|(HTTP 403)|(El URL solicitado no se ha podido conseguir)|Service Unavailable|Bad Request|Servidor no encontrado|Proxy Error/i)
58
+ return true
59
+ end
60
+
61
+ if (browser_text =~ /Bienvenido a la agencia/i)
62
+ return true
63
+ end
64
+
65
+ if (browser.title =~ /ERROR: The requested URL could not be retrieved/i)
66
+ return true
67
+ end
68
+
69
+ return false
70
+
71
+ rescue Timeout::Error
72
+ puts "Rompio errores http"
73
+ return false
74
+ rescue DRb::DRbConnError
75
+ puts "DRb::DRbConnError"
76
+ return false
77
+ end
78
+ end
79
+
80
+ end
@@ -0,0 +1,64 @@
1
+ # encoding: utf-8
2
+ module Checkout
3
+ module DatosDeFacturacion
4
+ include PageObject
5
+
6
+ select_list(:situacion_fiscal,:id=>"invoice-fiscal-status")
7
+ select_list(:provincia_facturacion,:id=>"invoice-state")
8
+
9
+ element(:formulario_facturacion,:fieldset,:id=>"invoice")
10
+
11
+ text_field(:cuil,:id=>"invoice-fiscal-id")
12
+ text_field(:domicilio_facturacion,:id=>"invoice-address")
13
+ text_field(:nombre_facturacion,:id=>"invoice-card-holder-name")
14
+ text_field(:ciudad_facturacion_custom,:id=>"invoice-city-custom")
15
+ text_field(:ciudad_facturacion,:id=>"invoice-city")
16
+ text_field(:calle_facturacion,:id=>"invoice-street")
17
+ text_field(:numero_facturacion,:id=>"invoice-address-number")
18
+ text_field(:piso_facturacion,:id=>"invoice-address-floor")
19
+ text_field(:departamento_facturacion,:id=>"invoice-address-deparment")
20
+ text_field(:codigo_postal_facturacion,:id=>"invoice-postal-code")
21
+ text_field(:otro_estado_facturacion,:id=>"invoice-other-state")
22
+
23
+ checkbox(:invoice_check,:id=>"invoice-check")
24
+
25
+ li(:opcion_cac,:id=>"cac-installment")
26
+
27
+ def cargar_datos_facturacion
28
+ if AllPages.site=="AR"
29
+ option = ["FINAL","INSCR","EXENT","MONOTRIBUTO"][rand(3)]
30
+ situacion_fiscal_element.select_value(option)
31
+ if option=="FINAL"
32
+ cuil_element.set("20-32456324-6")
33
+ domicilio_facturacion_element.set("corrientes 123")
34
+ else
35
+ #lleno los campos requeridos
36
+ cuil_element.set("30643063936")
37
+ nombre_facturacion_element.set("diego qa romero")
38
+ provincia_facturacion_element.select_value("C")
39
+ set_autocomplete("ciudad_facturacion_custom","buenos aires")
40
+ calle_facturacion_element.set("corrientes")
41
+ codigo_postal_facturacion_element.set("7111")
42
+ numero_facturacion_element.set("123")
43
+ piso_facturacion_element.set("1")
44
+ departamento_facturacion_element.set("1")
45
+ end
46
+ else
47
+ check_invoice_check if invoice_check?
48
+ cuil_element.set("3334445556")
49
+ nombre_facturacion_element.set("diego qa romero")
50
+ provincia_facturacion_element.select(provincia_facturacion_options[2])
51
+ ciudad_facturacion_element.set("Rosario")
52
+ calle_facturacion_element.set("corrientes")
53
+ if AllPages.site=="MX"
54
+ otro_estado_facturacion_element.set("Chiapas") if otro_estado_facturacion_element.present?
55
+ codigo_postal_facturacion_element.set("7111")
56
+ numero_facturacion_element.set("123")
57
+ piso_facturacion_element.set("1")
58
+ departamento_facturacion_element.set("1")
59
+ end
60
+ end
61
+ end
62
+
63
+ end
64
+ end
@@ -0,0 +1,30 @@
1
+ # encoding: utf-8
2
+ module Checkout
3
+ module InformacionDeContacto
4
+ include PageObject
5
+
6
+ text_field(:mail_contacto,:id=>"contact-email")
7
+ text_field(:mail_contacto_confimacion,:id=>"contact-email-repeat")
8
+ text_field(:pais_contacto,:id=>"country-code-0")
9
+ text_field(:area_contacto,:id=>"area-code-0")
10
+ text_field(:numero_contacto,:id=>"phone-number-0")
11
+
12
+ select_list(:telefono_contacto,:id=>"phone-type-0")
13
+
14
+ checkbox(:opcion_ofertas,:id=>"offers")
15
+
16
+ elements(:bandera_argentina,:span,:class=>"flagIcon flag-ar")
17
+
18
+ def cargar_datos_de_contacto
19
+ uncheck_opcion_ofertas
20
+ mail_contacto_element.set "bookingvuelos@despegar.com"
21
+ mail_contacto_confimacion_element.set "bookingvuelos@despegar.com"
22
+ telefono_contacto_element.select_value("HOME")
23
+ pais_contacto_element.set "Argentina (54)"
24
+ sleep 0.5
25
+ area_contacto_element.set "055"
26
+ numero_contacto_element.set "123456"
27
+ end
28
+
29
+ end
30
+ end
@@ -0,0 +1,71 @@
1
+ #encoding: utf-8
2
+ module Checkout
3
+ module Pasajeros
4
+ include PageObject
5
+
6
+ elements(:nombre,:text_field,:css=>"#passengers .input-passenger-first-name")
7
+ elements(:apellido,:text_field,:css=>"#passengers .input-passenger-last-name")
8
+ elements(:documento,:text_field,:css=>"#passengers .input-document-number")
9
+ elements(:nacionalidad,:select_list,:css=>"#passengers .select-nationality")
10
+ elements(:tipo_documento,:select_list,:css=>"#passengers .select-document-type")
11
+ elements(:sexo,:select_list,:css=>"#passengers .select-passenger-gender")
12
+ elements(:dia_nacimiento,:select_list,:css=>"#passengers .select-day")
13
+ elements(:mes_nacimiento,:select_list,:css=>"#passengers .select-month")
14
+ elements(:ano_nacimiento,:select_list,:css=>"#passengers .select-year")
15
+
16
+ div(:edades_adultos,:id=>"birthday-group-0")
17
+
18
+ PLUS_NAME = ["A","B","C","D","E","F","G","H","I","J","k"]
19
+
20
+ def cargar_adultos
21
+ @index = 0
22
+ @index_menores = 0
23
+ self.manage_data.adt.times do |adulto|
24
+ nombre_elements[@index].set "Diego QA#{PLUS_NAME[@index]}"
25
+ apellido_elements[@index].set "Romero#{PLUS_NAME[@index]}"
26
+ documento_elements[@index].set "3245673#{@index}" if documento_elements[@index]
27
+ nacionalidad_elements[@index].select_value(AllPages.site) if nacionalidad_elements[@index]
28
+ tipo_documento_elements[@index].select_value(AllPages.site.match("AR") ? "LOCAL" : "PASSPORT") if tipo_documento_elements[@index]
29
+ sexo_elements[@index].select_value("MALE") if sexo_elements[@index]
30
+ if edades_adultos?
31
+ dia_nacimiento_elements[@index_menores].select(@index+1)
32
+ mes_nacimiento_elements[@index_menores].select(3)
33
+ ano_nacimiento_elements[@index_menores].select_value("197#{@index}")
34
+ @index_menores += 1
35
+ end
36
+ @index += 1
37
+ end
38
+ end
39
+ def cargar_ninos
40
+ self.manage_data.cnn.times do |nino|
41
+ nombre_elements[@index].set "Martin QA#{PLUS_NAME[@index]}"
42
+ apellido_elements[@index].set "Diez jr#{PLUS_NAME[@index]}"
43
+ documento_elements[@index].set "4245663#{@index}" if documento_elements[@index]
44
+ nacionalidad_elements[@index].select_value(AllPages.site) if nacionalidad_elements[@index]
45
+ tipo_documento_elements[@index].select_value(AllPages.site.match("AR") ? "LOCAL" : "PASSPORT") if tipo_documento_elements[@index]
46
+ sexo_elements[@index].select_value("MALE") if sexo_elements[@index]
47
+ dia_nacimiento_elements[@index_menores].select(@index+1)
48
+ mes_nacimiento_elements[@index_menores].select(3)
49
+ ano_nacimiento_elements[@index_menores].select_value("2009")
50
+ @index += 1
51
+ @index_menores += 1
52
+ end
53
+ end
54
+ def cargar_bebes
55
+ self.manage_data.inf.times do |bebe|
56
+ nombre_elements[@index].set "Maribel QA#{PLUS_NAME[@index]}"
57
+ apellido_elements[@index].set "Dias Herr jrb#{PLUS_NAME[@index]}"
58
+ documento_elements[@index].set "4249966#{@index}" if documento_elements[@index]
59
+ nacionalidad_elements[@index].select_value(AllPages.site) if nacionalidad_elements[@index]
60
+ tipo_documento_elements[@index].select_value(AllPages.site.match("AR") ? "LOCAL" : "PASSPORT") if tipo_documento_elements[@index]
61
+ sexo_elements[@index].select_value("MALE") if sexo_elements[@index]
62
+ dia_nacimiento_elements[@index_menores].select(@index+1)
63
+ mes_nacimiento_elements[@index_menores].select(3)
64
+ ano_nacimiento_elements[@index_menores].select_value("2013")
65
+ @index += 1
66
+ @index_menores += 1
67
+ end
68
+ end
69
+
70
+ end
71
+ end
@@ -0,0 +1,71 @@
1
+ #encoding: utf-8
2
+ module Checkout
3
+ module Tarjeta
4
+ include PageObject
5
+
6
+ select_list(:tarjeta,:id=>"card-brand")
7
+ select_list(:mes_vencimiento_tarjeta,:id=>"card-expiration-month")
8
+ select_list(:ano_vencimiento_tarjeta,:id=>"card-expiration-year")
9
+ select_list(:tipo_titular_tarjeta,:id=>"owner-type")
10
+ select_list(:sexo_titular_tarjeta,:id=>"owner-gender")
11
+ select_list(:estado_entrega_tarjeta,:id=>"billing-address-state")
12
+
13
+ text_field(:cp_entrega_tarjeta,:id=>"billing-address-postal-code")
14
+ text_field(:piso_entrega_tarjeta,:id=>"billing-address-floor")
15
+ text_field(:depto_entrega_tarjeta,:id=>"billing-address-deparment")
16
+ text_field(:numero_entrega_tarjeta,:id=>"billing-address-number")
17
+ text_field(:ciudad_entrega_tarjeta,:id=>"billing-address-city")
18
+ text_field(:calle_entrega_tarjeta,:id=>"billing-address-street")
19
+ text_field(:numero_tarjeta,:id=>"card-number")
20
+ text_field(:codigo_seguridad_tarjeta,:id=>"security-code")
21
+ text_field(:nombre_titular_tarjeta,:id=>"owner-name")
22
+ text_field(:documento_titular_tarjeta,:id=>"owner-document-number")
23
+ text_field(:banco_emisor,:id=>"other-bank-name")
24
+
25
+ div(:debito,:class=>"installment-info")
26
+
27
+ radio_button(:un_pago,:id=>"installment-0")
28
+ radio_button(:un_pago_argentina,:class=>"radio main-radio ")
29
+ radio_button(:un_pago_debito,:id=>"installment-1")
30
+
31
+ elements(:tipos_de_pago,:radio,:css=>"#paymentDefinition input.radio")
32
+
33
+ def cargar_datos_tarjeta
34
+ if AllPages.site=="AR"
35
+ select_un_pago_argentina
36
+ else
37
+ if debito.downcase.no_accents.match(/debito/)
38
+ select_un_pago_debito
39
+ else
40
+ select_un_pago
41
+ end
42
+ end
43
+ tarjeta_element.select "Visa"
44
+ numero_tarjeta_element.set "4242424242424242"
45
+ mes_vencimiento_tarjeta_element.select 5
46
+ banco_emisor_element.set "galicia" if banco_emisor_element.present?
47
+ ano_vencimiento_tarjeta_element.select 2017
48
+ codigo_seguridad_tarjeta_element.set "123"
49
+ tipo_titular_tarjeta_value = "PERSON" if tipo_titular_tarjeta_element.present?
50
+ nombre_titular_tarjeta_element.set "Martin qa diez"
51
+ if documento_titular_tarjeta_element.present?
52
+ number = case AllPages.site
53
+ when "CL" then "7028168-6"
54
+ when "BR" then "22233366638"
55
+ else "32456324"
56
+ end
57
+ documento_titular_tarjeta_element.set number
58
+ end
59
+ sexo_titular_tarjeta_element.select_value "MALE" if sexo_titular_tarjeta_element.present?
60
+ #datos extras de tarjeta
61
+ estado_entrega_tarjeta_element.select(estado_entrega_tarjeta_options[3]) if estado_entrega_tarjeta_element.present?
62
+ ciudad_entrega_tarjeta_element.set "capital" if ciudad_entrega_tarjeta_element.present?
63
+ calle_entrega_tarjeta_element.set "corrientes" if calle_entrega_tarjeta_element.present?
64
+ numero_entrega_tarjeta_element.set "1234" if numero_entrega_tarjeta_element.present?
65
+ piso_entrega_tarjeta_element.set "3" if piso_entrega_tarjeta_element.present?
66
+ depto_entrega_tarjeta_element.set "A" if depto_entrega_tarjeta_element.present?
67
+ cp_entrega_tarjeta_element.set "1182" if cp_entrega_tarjeta_element.present?
68
+ end
69
+
70
+ end
71
+ end
@@ -0,0 +1,12 @@
1
+ # -*- encoding : utf-8 -*-
2
+ module PageObject
3
+ module Platforms
4
+ module WatirWebDriver
5
+ module Element
6
+ def present?
7
+ element.exists? and element.visible?
8
+ end
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,64 @@
1
+ # encoding: utf-8
2
+ module Helpers
3
+
4
+ def self.cargar_brasil
5
+
6
+ Time.const_set("RFC2822_DAY_NAME" , %w(dom seg ter qua qui sex s�b))
7
+ Time.const_set("RFC2822_MONTH_NAME" , [nil] + %w(jan fev mar abr mai jun jul ago set out nov dez))
8
+ Time.const_set("MonthValue",{ 'JAN' => 1, 'FEV' => 2, 'MAR' => 3, 'ABR' => 4, 'MAI' => 5, 'JUN' => 6,'JUL' => 7, 'AGO' => 8, 'SET' => 9, 'OUT' => 10, 'NOV' => 11, 'DEZ' => 12 })
9
+ Date.const_set("MONTHNAMES" , [nil] + %w(Janeiro Fevereiro Marco Abril Maio Junho Julho Agosto Setembro Outubro Novembro Dezembro))
10
+ Date.const_set("ABBR_MONTHNAMES", [nil] + %w(jan fev mar abr mai jun jul ago set out nov dez))
11
+ Date.const_set("DAYNAMES", ["Domingo", "segunda-feira", "terca-feira", "quarta-feira", "quinta-feira", "sexta-feira", "S�bado"])
12
+ Date.const_set("ABBR_DAYNAMES", %w(dom seg ter qua qui sex s�b))
13
+
14
+ end
15
+
16
+ def self.cargar_latino
17
+
18
+ Time.const_set("RFC2822_DAY_NAME", %w(dom lun mar mi� jue vie s�b))
19
+ Time.const_set("RFC2822_MONTH_NAME",[nil] + %w(ene feb mar abr may jun jul ago sep oct nov dic))
20
+ Time.const_set("MonthValue", { 'ENE' => 1, 'FEB' => 2, 'MAR' => 3, 'ABR' => 4, 'MAY' => 5, 'JUN' => 6,'JUL' => 7, 'AGO' => 8, 'SEP' => 9, 'OCT' => 10, 'NOV' => 11, 'DIC' => 12 })
21
+ Date.const_set("MONTHNAMES", [nil] + %w(Enero Febrero Marzo Abril Mayo Junio Julio Agosto Septiembre Octubre Noviembre Diciembre))
22
+ Date.const_set("ABBR_MONTHNAMES", [nil] + %w(ene feb mar abr may jun jul ago sep oct nov dic))
23
+ Date.const_set("DAYNAMES" , %w(Domingo Lunes Martes Mi�rcoles Jueves Viernes S�bado))
24
+ Date.const_set("ABBR_DAYNAMES" , %w(dom lun mar mi� jue vie s�b))
25
+
26
+ end
27
+
28
+ def self.cargar_usa
29
+
30
+ Time.const_set("RFC2822_DAY_NAME", %w(sun mon tue wed thu fri sat))
31
+ Time.const_set("RFC2822_MONTH_NAME",[nil] + %w(jan feb mar apr may jun jul aug sep oct nov dec))
32
+ Time.const_set("MonthValue", { 'JAN' => 1, 'FEB' => 2, 'MAR' => 3, 'APR' => 4, 'MAY' => 5, 'JUN' => 6,'JUL' => 7, 'AUG' => 8, 'SEP' => 9, 'OCT' => 10, 'NOV' => 11, 'DEC' => 12 })
33
+ Date.const_set("MONTHNAMES", [nil] + %w(January February March April May June July August September October November December))
34
+ Date.const_set("ABBR_MONTHNAMES", [nil] + %w(jan feb mar apr may jun jul aug sep oct nov dec))
35
+ Date.const_set("DAYNAMES" , %w(Sunday Monday Tuesday Wednesday Thursday Friday Saturday))
36
+ Date.const_set("ABBR_DAYNAMES" , %w(sun mon tue wed thu fri sat))
37
+
38
+ end
39
+
40
+ def self.set_date_language(site)
41
+ case site
42
+ when "BR" then cargar_brasil
43
+ when "US" then cargar_usa
44
+ else cargar_latino
45
+ end
46
+ end
47
+
48
+ def self.currency(site)
49
+ currency = { 'CL' => 'CLP',
50
+ 'AR' => 'ARS',
51
+ 'BR' => 'BRL',
52
+ 'MX' => 'MXN',
53
+ 'PE' => 'PEN',
54
+ 'VE' => 'VEF',
55
+ 'CO' => 'COP',
56
+ 'CR' => 'CRC',
57
+ 'PA' => 'USD',
58
+ 'UY' => 'USD',
59
+ 'EC' => 'USD',
60
+ 'US' => 'USD'
61
+ }[site.upcase]
62
+ end
63
+
64
+ end
@@ -0,0 +1,33 @@
1
+ # encoding: utf-8
2
+ module Pages
3
+ module Cookies
4
+ #modifico el valor del abtesting requerido
5
+ def modificar_abtesting(nombre,valor)
6
+ cookie = self.recuperar_cookie("abzTestingId")
7
+ nuevo_valor = cookie[:value].gsub(/#{self.recuperar_valor_abtesting(nombre)}/,valor.to_s)
8
+ self.eliminar_cookie("abzTestingId")
9
+ self.agregar_cookie("abzTestingId",nuevo_valor,{:expires => cookie[:expires],:domain=>cookie[:domain]})
10
+ self.recuperar_cookie("abzTestingId")
11
+ end
12
+ #recupero una cookie
13
+ def recuperar_cookie(nombre)
14
+ return @browser.cookies.to_a.select{|cookie| cookie[:name]==nombre}.first
15
+ end
16
+ #elimino una cookie
17
+ def eliminar_cookie(nombre)
18
+ @browser.cookies.delete nombre
19
+ end
20
+ #agrego una cookie
21
+ def agregar_cookie(nombre,valor,opciones)
22
+ @browser.cookies.add(nombre,valor,opciones)
23
+ end
24
+ #recupero el valor de un abtesting
25
+ def recuperar_valor_abtesting(nombre)
26
+ begin
27
+ return self.recuperar_cookie("abzTestingId")[:value].split(',').select{|option| option.match(/#{nombre}/)}.first.gsub(/\D/,'').to_i
28
+ rescue NoMethodError
29
+ return 0
30
+ end
31
+ end
32
+ end
33
+ end