testcentricity_web 4.0.0 → 4.0.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: df556101ef2de8b85dae896e6d943d621e220a452101257a8c36aa4f32a6db51
4
- data.tar.gz: 324e34cc74ccd75892e7cbba3f11ab6e4ada25699c94b8a5c9d49dda411866a7
3
+ metadata.gz: ab40b67743553e06540746f3cc20b3dbef79aaf8f70f1be584dd54150a252e71
4
+ data.tar.gz: 638bb4707bb184a59fa6bf5645f8107891e569e8eb7f218ac92ef1259c21b9ec
5
5
  SHA512:
6
- metadata.gz: 88a64d973f5dc89fee73245eb888c41c3d8fc673b83548e11798f5d4bc80679176a2abe0a5cde655e8d5c67a1d1887fa9963ecef92eeb2521e8dc6367d8bc3e6
7
- data.tar.gz: 2f7a3967eadac906420d7175a0d8c0d915b6f70240aaee0a333bf332f6ed5b08a376464af7a7cc6a472f46540000e7e607dd4ac99b000c3f81e53c43488956d7
6
+ metadata.gz: 8de993273139d817ea101761ae99fbf5eb3a3737d57b7d3e537e9885dff49dcb842bef51448b88c72993768bb4e4f59f24299ed2ebd104a552d89ecd4f6bc9d7
7
+ data.tar.gz: 891917e94e04880a609a32c7a53adc5bfb125a1dd4c570fdf712d4164948b3e3748c0131ed5fc56b95ab6096c0570c0144a5eba974c926b0a7a860a35e1235ae
data/CHANGELOG.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # CHANGELOG
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
- ## [4.0.0] - 25-MAR-2021
4
+ ## [4.0.0] - 18-APR-2021
5
5
 
6
6
  ### Changed
7
7
  * `WebDriverConnect.initialize_web_driver` method now accepts an `options` hash as an optional parameter, which can be used to
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- testcentricity_web (4.0.0.a1)
4
+ testcentricity_web (4.0.1)
5
5
  appium_lib
6
6
  browserstack-local
7
7
  capybara (>= 3.1, < 4)
@@ -61,9 +61,7 @@ GEM
61
61
  concurrent-ruby (~> 1.0)
62
62
  ice_nine (0.11.2)
63
63
  mini_mime (1.1.0)
64
- mini_portile2 (2.5.0)
65
- nokogiri (1.11.3)
66
- mini_portile2 (~> 2.5.0)
64
+ nokogiri (1.11.3-x86_64-darwin)
67
65
  racc (~> 1.4)
68
66
  os (1.1.1)
69
67
  power_assert (2.0.0)
data/README.md CHANGED
@@ -670,24 +670,25 @@ In the above example, the step definitions associated with the 3 steps might be
670
670
  end
671
671
 
672
672
  # this method takes a page name as a parameter and returns an instance of the associated Page Object
673
- def page_dispatcher(page_name)
674
- case page_name
675
- when 'Registration'
676
- page = registration_page
677
- when 'My Account'
678
- page = my_account_page
679
- when 'Terms & Conditions'
680
- page = terms_conditions_page
681
- when 'Privacy Policy'
682
- page = privacy_policy_page
683
- when 'Contact Us'
684
- page = contact_us_page
685
- when 'FAQs'
686
- page = faqs_page
673
+ def page_dispatcher(page_name)
674
+ page = case page_name
675
+ when 'Registration'
676
+ registration_page
677
+ when 'My Account'
678
+ my_account_page
679
+ when 'Terms & Conditions'
680
+ terms_conditions_page
681
+ when 'Privacy Policy'
682
+ privacy_policy_page
683
+ when 'Contact Us'
684
+ contact_us_page
685
+ when 'FAQs'
686
+ faqs_page
687
+ end
688
+ raise "No page object defined for page named '#{page_name}'" unless page
689
+ page
687
690
  end
688
- raise "No page object defined for page named '#{page_name}'" unless page
689
- page
690
- end
691
+
691
692
 
692
693
 
693
694
  While this approach may be effective for small web applications with only a few pages (and hence few **Page Objects**), it quickly becomes
@@ -1,12 +1,18 @@
1
1
  require 'yaml'
2
2
  require 'json'
3
3
  require 'virtus'
4
+ require 'time'
5
+ require 'chronic'
6
+ require 'faker'
4
7
 
5
8
 
6
9
  module TestCentricity
7
10
 
8
11
  PRIMARY_DATA_PATH ||= 'features/test_data/'
9
- XL_PRIMARY_DATA_FILE ||= "#{PRIMARY_DATA_PATH}data.xls"
12
+ PRIMARY_DATA_FILE ||= "#{PRIMARY_DATA_PATH}data."
13
+ XL_PRIMARY_DATA_FILE ||= "#{PRIMARY_DATA_FILE}xls"
14
+ YML_PRIMARY_DATA_FILE ||= "#{PRIMARY_DATA_FILE}yml"
15
+ JSON_PRIMARY_DATA_FILE ||= "#{PRIMARY_DATA_FILE}json"
10
16
 
11
17
 
12
18
  class DataObject
@@ -106,6 +112,28 @@ module TestCentricity
106
112
  data[node_name] = node_data
107
113
  File.write(@file_path, data.to_json)
108
114
  end
115
+
116
+ private
117
+
118
+ def self.calculate_dynamic_value(value)
119
+ test_value = value.split('!', 2)
120
+ parameter = test_value[1].split('.', 2)
121
+ case parameter[0]
122
+ when 'Date'
123
+ result = eval("Chronic.parse('#{parameter[1]}')")
124
+ when 'FormattedDate', 'FormatDate'
125
+ date_time_params = parameter[1].split(' format! ', 2)
126
+ date_time = eval("Chronic.parse('#{date_time_params[0].strip}')")
127
+ result = date_time.to_s.format_date_time("#{date_time_params[1].strip}")
128
+ else
129
+ result = if Faker.constants.include?(parameter[0].to_sym)
130
+ eval("Faker::#{parameter[0]}.#{parameter[1]}")
131
+ else
132
+ eval(test_value[1])
133
+ end
134
+ end
135
+ result.to_s
136
+ end
109
137
  end
110
138
 
111
139
 
@@ -147,3 +175,4 @@ module TestCentricity
147
175
  end
148
176
  end
149
177
  end
178
+
@@ -1,21 +1,45 @@
1
1
  module TestCentricity
2
2
  class EnvironData < TestCentricity::ExcelDataSource
3
3
  attr_accessor :current
4
+ attr_accessor :generic_data
5
+ attr_accessor :environ_specific_data
4
6
 
5
- WKS_ENVIRONS ||= 'Environments'
6
-
7
- def find_environ(environ_name, source_type = :excel)
7
+ def self.find_environ(environ_name, source_type = :excel)
8
8
  data = case source_type
9
9
  when :excel
10
- ExcelData.read_row_data(XL_PRIMARY_DATA_FILE, WKS_ENVIRONS, environ_name)
10
+ ExcelData.read_row_data(XL_PRIMARY_DATA_FILE, 'Environments', environ_name)
11
11
  when :yaml
12
- read_yaml_node_data('environments.yml', environ_name)
12
+ # read generic test data from data.yml file
13
+ @generic_data ||= YAML.load_file(YML_PRIMARY_DATA_FILE)
14
+ # read environment specific test data
15
+ data_file = "#{PRIMARY_DATA_PATH}#{environ_name}_data.yml"
16
+ @environ_specific_data ||= YAML.load_file(data_file)
17
+
18
+ read('Environments', environ_name)
13
19
  when :json
14
20
  read_json_node_data('environments.json', environ_name)
15
21
  end
16
22
  @current = Environ.new(data)
17
23
  Environ.current = @current
18
24
  end
25
+
26
+ def self.read(key_name, node_name)
27
+ if @environ_specific_data.key?(key_name) && @environ_specific_data[key_name].key?(node_name)
28
+ node_data = @environ_specific_data[key_name][node_name]
29
+ else
30
+ raise "No key named #{key_name} in generic and environment-specific data" unless @generic_data.key?(key_name)
31
+ raise "No node named #{node_name} in #{key_name} section of generic and environment-specific data" unless @generic_data[key_name].key?(node_name)
32
+
33
+ node_data = @generic_data[key_name][node_name]
34
+ end
35
+
36
+ if node_data.is_a?(Hash)
37
+ node_data.each do |key, value|
38
+ node_data[key] = calculate_dynamic_value(value) if value.to_s.start_with?('eval!')
39
+ end
40
+ end
41
+ node_data
42
+ end
19
43
  end
20
44
 
21
45
 
@@ -355,3 +379,4 @@ module TestCentricity
355
379
  end
356
380
  end
357
381
  end
382
+
@@ -1,6 +1,3 @@
1
- require 'time'
2
- require 'chronic'
3
- require 'faker'
4
1
  require 'spreadsheet'
5
2
 
6
3
 
@@ -273,27 +270,6 @@ module TestCentricity
273
270
  # rename new Excel document, replacing the original
274
271
  File.rename(outfile, file)
275
272
  end
276
-
277
- private
278
-
279
- def self.calculate_dynamic_value(value)
280
- test_value = value.split('!', 2)
281
- parameter = test_value[1].split('.', 2)
282
- case parameter[0]
283
- when 'Date'
284
- result = eval("Chronic.parse('#{parameter[1]}')")
285
- when 'FormattedDate', 'FormatDate'
286
- date_time_params = parameter[1].split(' format! ', 2)
287
- date_time = eval("Chronic.parse('#{date_time_params[0].strip}')")
288
- result = date_time.to_s.format_date_time("#{date_time_params[1].strip}")
289
- else
290
- result = if Faker.constants.include?(parameter[0].to_sym)
291
- eval("Faker::#{parameter[0]}.#{parameter[1]}")
292
- else
293
- eval(test_value[1])
294
- end
295
- end
296
- result.to_s
297
- end
298
273
  end
299
274
  end
275
+
@@ -1,3 +1,3 @@
1
1
  module TestCentricityWeb
2
- VERSION = '4.0.0'
2
+ VERSION = '4.0.1'
3
3
  end
@@ -1,6 +1,6 @@
1
1
  module WorldData
2
2
  def environs
3
- @environs ||= TestCentricity::EnvironData.new
3
+ @environs ||= TestCentricity::EnvironData
4
4
  end
5
5
 
6
6
  # instantiate and register all data objects specified in data_objects method
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testcentricity_web
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - A.J. Mrozinski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-19 00:00:00.000000000 Z
11
+ date: 2021-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler