ds-gui-automation 0.1.16 → 0.1.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,13 +1,15 @@
1
1
  Given(/^I perform a search from seo URL$/) do
2
2
  DestinationServicesGUI::Search.perform_search_from_seo_url
3
- Watir::Wait.until(timeout = 300){@browser.div(:class, 'ux-destination-services-cluster').present?}
3
+
4
+ DestinationServicesGUI::Results.wait_for_results
5
+
4
6
  puts @browser.url
5
7
  end
6
8
 
7
9
  Then(/^I should see the result clusters for the specified provider$/) do
8
10
  DestinationServicesGUI::Results.show_results_tracking_id
9
11
 
10
- (DestinationServicesGUI::Results.get_clusters_by_provider_code(PROVIDER_ID).size > 0).should be_true
12
+ (DestinationServicesGUI::Results.get_results_by_provider_code(PROVIDER_ID, IS_MODULAR).size > 0).should be_true
11
13
 
12
14
  puts @browser.url
13
15
  end
@@ -23,6 +23,7 @@ require 'henry/config'
23
23
  DOMAIN = {}
24
24
  params = Henry::Environment.params
25
25
 
26
+ IS_MODULAR = params['isModular'] || true
26
27
  DOMAIN = params['environment']['site'] || %W{www.despegar.com.bo www.despegar.com.uy www.despegar.com.sv www.despegar.com.sv www.despegar.com.gt www.despegar.com.hn www.despegar.com.ni www.despegar.com.pa www.despegar.com.py www.despegar.com.do www.us.despegar.com www.despegar.com.ve}.shuffle.first
27
28
  COUNTRY = params['country']
28
29
  BROWSER = params['browser'] || 'chrome'
@@ -1,3 +1,3 @@
1
1
  module DestinationServicesGUI
2
- VERSION = "0.1.16"
2
+ VERSION = "0.1.17"
3
3
  end
@@ -20,5 +20,22 @@ module Commons
20
20
 
21
21
  end
22
22
 
23
+ def wait_for_results
24
+
25
+ grid_results = browser.div(:class, 'ux-destination-services-cluster-grid')
26
+
27
+ cluster_results = browser.div(:class, 'ux-destination-services-cluster')
28
+
29
+ timeout = 0
30
+
31
+
32
+
33
+ while !grid_results.present? and !cluster_results.present? and timeout < 60
34
+ sleep 3
35
+ timeout += 3
36
+ end
37
+
38
+ end
39
+
23
40
 
24
41
  end
@@ -3,23 +3,34 @@ require_relative './commons.rb'
3
3
  module Results
4
4
 
5
5
 
6
- def get_clusters_by_provider_code(providerCode)
6
+ def get_results_by_provider_code(providerCode, isModular = false)
7
7
 
8
- clusters = get_clusters(providerCode)
8
+ ## Se selecciona el tipo de vista
9
+
10
+ cluster_view = browser.span(:class, 'ux-common-icon-cluster-view')
11
+
12
+ modular_view = browser.span(:class, 'ux-common-icon-modular-view')
13
+
14
+ isModular ? modular_view.click : cluster_view.click
15
+
16
+ clusters = get_results(providerCode, isModular)
9
17
 
10
18
  while clusters.empty? and next_page?
11
19
 
20
+ timeout = 0
21
+
12
22
  next_page
13
23
 
14
- while browser.div(:class, 'modal').visible?
24
+ while browser.div(:class, 'modal').visible? and timeout < 40
15
25
  sleep 3
26
+ timeout += 3
16
27
  end
17
28
 
18
- Watir::Wait.until(timeout = 300){browser.div(:class, 'ux-destination-services-cluster').present?}
29
+ wait_for_results
19
30
 
20
31
  show_results_tracking_id
21
32
 
22
- clusters = get_clusters(providerCode)
33
+ clusters = get_results(providerCode, isModular)
23
34
 
24
35
  end
25
36
 
@@ -27,17 +38,19 @@ module Results
27
38
 
28
39
  end
29
40
 
30
- def get_clusters(providerCode)
41
+ def get_results(providerCode, isModular = false)
31
42
 
32
- clusters = browser.divs(:class, 'ux-destination-services-cluster').to_a
33
-
34
- clusters = clusters.select { | cluster | get_provider_code(cluster).eql?(providerCode) }
43
+ if isModular
44
+ clusters = browser.divs(:class, 'ux-destination-services-cluster-grid').to_a
45
+ clusters = clusters.select { | cluster | get_provider_code(cluster).eql?(providerCode) }
46
+ else
47
+ clusters = browser.divs(:class, 'ux-destination-services-cluster').to_a
48
+ clusters = clusters.select { | cluster | get_provider_code(cluster).eql?(providerCode) }
49
+ end
35
50
 
36
51
  clusters
37
52
 
38
53
  end
39
54
 
40
55
 
41
-
42
-
43
56
  end
@@ -35,7 +35,7 @@ module Search
35
35
  destination_field = browser.text_field(:id, 'sb-destination-activities')
36
36
  destination_field.set(destination)
37
37
  sleep(8) # implementar wait para el servicio de autocomplete
38
- binding.pry
38
+
39
39
  search_box.div(:class,'com-city-hotels destination').uls.first.li(:class, 'first').click
40
40
 
41
41
  date_select.select(date)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ds-gui-automation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.16
4
+ version: 0.1.17
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-09-11 00:00:00.000000000 Z
12
+ date: 2014-09-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: henry-container