ds-gui-automation 0.1.13 → 0.1.14

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.
@@ -0,0 +1,9 @@
1
+ Feature: Destination Services Results
2
+ As a user,
3
+ I want to be able to see the search results by provider
4
+
5
+ @results
6
+ Scenario: Search results for tickets
7
+ Given I perform a search from seo URL
8
+ Then I should see the result clusters for the specified provider
9
+
@@ -0,0 +1,12 @@
1
+ Given(/^I perform a search from seo URL$/) do
2
+ DestinationServicesGUI::Search.perform_search_from_seo_url
3
+ Watir::Wait.until(timeout = 300){@browser.div(:class, 'ux-destination-services-cluster').present?}
4
+ end
5
+
6
+ Then(/^I should see the result clusters for the specified provider$/) do
7
+ DestinationServicesGUI::Results.show_results_tracking_id
8
+
9
+ (DestinationServicesGUI::Results.get_clusters_by_provider_code(PROVIDER_ID).size > 0).should be_true
10
+
11
+ end
12
+
@@ -1,5 +1,5 @@
1
1
  Given(/^I'm on the Activities's home search box$/) do
2
- DestinationServicesGUI::Search.go_home
2
+ DestinationServicesGUI::Search.go_activities_home
3
3
  end
4
4
 
5
5
  Given(/^I'm on the Result's page$/) do
@@ -28,7 +28,12 @@ COUNTRY = params['country']
28
28
  BROWSER = params['browser'] || 'chrome'
29
29
  WAIT_TIMEOUT = params['timeout'] || 150
30
30
  BOT_UOW = params['botuow'] || 'DS-GUI-BOT'
31
- TO_CITY = params['to_city'] || %W{BUE ORL CUN MIA NYC LAS}.shuffle.first
31
+ ## To handle correctly whether the destination city comes as a string or as an array
32
+ if !params['destination'].is_a? String
33
+ params['destination'] = params['destination'].nil? ? params['destination'] : params['destination'].to_a.shuffle.first
34
+ end
35
+
36
+ TO_CITY = params['destination'] || %W{BUE ORL CUN MIA NYC LAS}.shuffle.first
32
37
  # FROM_CITY = params['from_city'] || get_origin_based_on_environment(ENVIRONMENT)
33
38
  ON_MONTH = params['search_month'] || (Time.now + 2629743).strftime('%Y-%m')
34
39
  WITH_DISTRIBUTION = params['distribution'] || rand(1..3).to_s
@@ -39,6 +44,7 @@ BETA_COOKIES = params['cookies'] || 'settings'
39
44
  DRY_RUN = params['dry_run'] || true
40
45
  MAX_RETRIES = params['max_retries'] || 3
41
46
  TRACKING_ID = params['environment']['trackingId']
47
+ PROVIDER_ID = params['environment']['providerId']
42
48
  ## END OF SET-UP FROM HENRY
43
49
 
44
50
  client = Selenium::WebDriver::Remote::Http::Default.new
data/henry-context.yml CHANGED
@@ -13,6 +13,15 @@ tasks:
13
13
  options:
14
14
  tags:
15
15
  - detail_disney
16
+ reports:
17
+ - format: html
18
+ name: ${DATE}_${TASK_NAME}.html
19
+
20
+ - name: Destination Services Results
21
+ class_name: Henry::Task::CucumberTask
22
+ options:
23
+ tags:
24
+ - results
16
25
  reports:
17
26
  - format: html
18
27
  name: ${DATE}_${TASK_NAME}.html
data/lib/ds/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module DestinationServicesGUI
2
- VERSION = "0.1.13"
2
+ VERSION = "0.1.14"
3
3
  end
@@ -10,6 +10,7 @@ require_relative './navigation.rb'
10
10
  require_relative './modules/initialize.rb'
11
11
  require_relative './modules/navigation.rb'
12
12
  require_relative './search.rb'
13
+ require_relative './results.rb'
13
14
  require_relative './detail.rb'
14
15
 
15
16
  module DestinationServicesGUI
@@ -6,5 +6,19 @@ module Commons
6
6
  city_name = geo_response['data']['geoAreaDescriptions'].reject{|key| key if !key['languageCode'].eql?("ES")}[0]['name']
7
7
  end
8
8
 
9
+ def show_results_tracking_id
10
+ results_script = %Q(javascript: ( function(){var providers = $(".providers"); providers.filter(":visible").length > 0 ? providers.hide() : providers.show()})();)
11
+
12
+ browser.execute_script(results_script)
13
+ end
14
+
15
+ def get_provider_code(cluster)
16
+
17
+ cluster = cluster.li(:class, 'providers').text.slice(13..14)
18
+
19
+ cluster
20
+
21
+ end
22
+
9
23
 
10
24
  end
@@ -49,4 +49,16 @@ module Navigation
49
49
  url
50
50
  end
51
51
 
52
+ def next_page
53
+ browser.li(:class, 'next').click
54
+ end
55
+
56
+ def next_page?
57
+ !browser.li(:class, 'next disabled').present?
58
+ end
59
+
60
+ def prev_page
61
+ browser.li(:class, 'prev').click unless @browser.li(:class, 'prev disabled').present?
62
+ end
63
+
52
64
  end
@@ -0,0 +1,43 @@
1
+ require_relative './commons.rb'
2
+
3
+ module Results
4
+
5
+
6
+ def get_clusters_by_provider_code(providerCode)
7
+
8
+ clusters = get_clusters(providerCode)
9
+
10
+ while clusters.empty? and next_page?
11
+
12
+ next_page
13
+
14
+ while browser.div(:class, 'modal').visible?
15
+ sleep 3
16
+ end
17
+
18
+ Watir::Wait.until(timeout = 300){browser.div(:class, 'ux-destination-services-cluster').present?}
19
+
20
+ show_results_tracking_id
21
+
22
+ clusters = get_clusters(providerCode)
23
+
24
+ end
25
+
26
+ clusters
27
+
28
+ end
29
+
30
+ def get_clusters(providerCode)
31
+
32
+ clusters = browser.divs(:class, 'ux-destination-services-cluster').to_a
33
+
34
+ clusters = clusters.select { | cluster | get_provider_code(cluster).eql?(providerCode) }
35
+
36
+ clusters
37
+
38
+ end
39
+
40
+
41
+
42
+
43
+ end
@@ -2,6 +2,15 @@ require_relative './commons.rb'
2
2
 
3
3
  module Search
4
4
 
5
+ def perform_search_from_seo_url
6
+
7
+ url = get_domain_by_country + TO_CITY
8
+
9
+ browser.goto(url)
10
+
11
+ end
12
+
13
+
5
14
  def perform_search(destination = nil, date = nil)
6
15
 
7
16
  search_box = browser.div(:class, 'pdt-activities')
@@ -0,0 +1,11 @@
1
+ require_relative './modules/results.rb'
2
+ require_relative './modules/initialize.rb'
3
+ require_relative './modules/navigation.rb'
4
+ require_relative './modules/commons.rb'
5
+
6
+ module DestinationServicesGUI::Results
7
+ extend Initialize
8
+ extend Navigation
9
+ extend Results
10
+ extend Commons
11
+ end
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.13
4
+ version: 0.1.14
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-08-14 00:00:00.000000000 Z
12
+ date: 2014-08-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: henry-container
@@ -102,14 +102,18 @@ files:
102
102
  - Gemfile
103
103
  - features/step_definitions/detail_steps.rb
104
104
  - features/step_definitions/search_steps.rb
105
+ - features/step_definitions/results_steps.rb
105
106
  - features/support/env.rb
106
107
  - features/detail.feature
107
108
  - features/search.feature
109
+ - features/results.feature
108
110
  - henry-context.yml
109
111
  - lib/ds-gui-automation.rb
112
+ - lib/page_objects/results.rb
110
113
  - lib/page_objects/search.rb
111
114
  - lib/page_objects/ds_flow.rb
112
115
  - lib/page_objects/modules/disney_detail.rb
116
+ - lib/page_objects/modules/results.rb
113
117
  - lib/page_objects/modules/search.rb
114
118
  - lib/page_objects/modules/initialize.rb
115
119
  - lib/page_objects/modules/commons.rb