itms_automation 2.5.6 → 2.6.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 583b36e2ec92b94f520492dc60d2e6664b258f37033c793a6b5898aabca7685b
4
- data.tar.gz: ee00d5a2d671302e486317afbd252014a12ef04ed64fe707ec5cf2ba166fc9ce
3
+ metadata.gz: 30a810fadeedd85c66be2487e85f27f592ba294587aae14e2cd76f88bb3bebe3
4
+ data.tar.gz: f571985b3f188a311c31fffdc572eb48eb2df8bb4a5052a57363f0099489e50d
5
5
  SHA512:
6
- metadata.gz: 50903bb26b4a64cac5b3fe53e14851de2917462605d52eba2e54c8ebfc9a2146440be7bb3f85ee7f61a7b099c395d0b44a5920cfede8a153f2f5323ac992d397
7
- data.tar.gz: 6aaf390948a96cbb711e3a04e14e9002ec3c3dc2c26457ceaa8fc4a790d977cd95cd1123b36b6ff830b145a36c3d873982bc32e2f8d7a9924764ada53dce56e1
6
+ metadata.gz: 6ab5441cff00f45a7fa1d336512374680ffa4e241a7dea3b53c1a6755e12f570fcf509182287e7c5d9fe6d358853c35119dd675b6bdb9c1a8d75fc6775bb70e1
7
+ data.tar.gz: a22c540ada6ef13902b7e8a4e0beda12892c27f88b381e7ba6229a563f7419c9f18e3d12a8e2a5f866e4e65698b4f10e73645697e79984c73d7177180fc8c005
@@ -1,8 +1,10 @@
1
1
  require 'rubygems'
2
- require 'itms_automation'
3
-
2
+ # require 'itms_automation'
3
+ require_relative '../../../lib/itms_automation.rb'
4
+ # require 'appium_lib'
5
+ require 'appium_lib_core'
4
6
  # Store command line arguments
5
- $browser_type = ENV['BROWSER'] || 'ff'
7
+ $browser_type = ENV['BROWSER'] || 'firefox'
6
8
  $platform = ENV['PLATFORM'] || 'desktop'
7
9
  $os_version = ENV['OS_VERSION']
8
10
  $device_name = ENV['DEVICE_NAME']
@@ -23,29 +25,82 @@ if $platform == 'android' or $platform == 'iOS'
23
25
  $device_name, $os_version = get_device_info
24
26
  end
25
27
 
26
- desired_caps = {
27
- caps: {
28
- platformName: $platform,
28
+ # desired_caps = {
29
+ # caps: {
30
+ # platformName: $platform,
31
+ # browserName: $browser_type,
32
+ # versionNumber: $os_version,
33
+ # deviceName: $device_name,
34
+ # udid: $udid,
35
+ # app: ".//#{$app_path}"
36
+ # }
37
+ # }
38
+ # appium_url = 'http://localhost:4723/wd/hub'
39
+ # opts = {
40
+ # desired_capabilities: { # or { caps: {....} }
41
+ # platformName: :android,
42
+ # deviceName: 'Android Simulator',
43
+ # app: "WikipediaSample.apk"
44
+ # },
45
+ # appium_lib: {
46
+ # wait: 30
47
+ # }
48
+ # }
49
+
50
+ opts = {
51
+ desired_capabilities: { # or { caps: {....} }
52
+ platformName: $platform,
29
53
  browserName: $browser_type,
30
- versionNumber: $os_version,
31
54
  deviceName: $device_name,
32
- udid: $udid,
33
- app: ".//#{$app_path}"
34
- },
55
+ versionNumber: $os_version,
56
+ app: "WikipediaSample.apk"
57
+ },
58
+ appium_lib: {
59
+ wait: 30
35
60
  }
61
+ }
36
62
 
37
63
  begin
38
- $driver = Appium::Driver.new(desired_caps).start_driver
64
+ # $driver = Appium::Driver.new(desired_caps, url: appium_url).start_driver
65
+
66
+ # $driver = Selenium::WebDriver.for(:remote, :url => appium_url, :desired_capabilities => desired_caps)
67
+ @core = Appium::Core.for(opts) # create a core driver with `opts`
68
+ $driver = @core.start_driver
69
+
39
70
  rescue Exception => e
40
71
  puts e.message
41
72
  Process.exit(0)
42
73
  end
43
74
  else # else create driver instance for desktop browser
44
75
  begin
45
- $driver = Selenium::WebDriver.for(:"#{$browser_type}")
76
+ $driver = case $browser_type
77
+ when "chrome"
78
+ Selenium::WebDriver.for(:chrome)
79
+ when "safari"
80
+ Selenium::WebDriver.for(:safari)
81
+ when "internet_explorer"
82
+ Selenium::WebDriver.for(:internet_explorer)
83
+ when "chrome_headless"
84
+ Selenium::WebDriver.for(:chrome, :desired_capabilities => Selenium::WebDriver::Remote::Capabilities.chrome(chromeOptions: { args: %w(headless) }))
85
+ when "remote"
86
+ if ENV['SERVER_URL'].nil? || ENV['REMOTE_BROWSER'].nil?
87
+ puts "\nMissing SERVER_URL : SERVER_URL=http//SERVER_URL:4444/wd/hub"
88
+ puts "\nMissing REMOTE_BROWSER: REMOTE_BROWSER=browser_name"
89
+ Process.exit(0)
90
+ else
91
+ caps = Selenium::WebDriver::Remote::Capabilities.new
92
+ caps["browserName"] = ENV['REMOTE_BROWSER']
93
+ Selenium::WebDriver.for(:remote, :url => ENV['SERVER_URL'], :desired_capabilities => caps)
94
+ end
95
+
96
+ else
97
+ Selenium::WebDriver.for(:firefox)
98
+ end
46
99
  $driver.manage().window().maximize()
100
+ p "session_id: #{$driver.session_id}"
47
101
  rescue Exception => e
48
102
  puts e.message
49
103
  Process.exit(0)
50
104
  end
51
105
  end
106
+
@@ -1,26 +1,38 @@
1
- #Cucumber provides a number of hooks which allow us to run blocks at various points in the Cucumber test cycle
2
-
3
- Before do
4
- # Do something before each scenario.
5
- end
6
-
7
- Before do |scenario|
8
- # The +scenario+ argument is optional, but if you use it, you can get the title,
9
- # description, or name (title + description) of the scenario that is about to be
10
- # executed.
11
- end
12
-
13
- After do
14
- # Do something after each scenario.
1
+ def validate_params_exist
2
+ raise "❌ ERROR: Missing param SERVER_URL." if ENV['SERVER_URL'].nil?
3
+ raise "❌ ERROR: Missing param BROWSER." if ENV['BROWSER'].nil?
4
+ if ENV['REPORT']
5
+ raise "❌ ERROR: Missing param TESTSUITE." if ENV['TESTSUITE'].nil?
6
+ raise "❌ ERROR: Missing param TESTCASE_REPORT_NAME." if ENV['TESTCASE_REPORT_NAME'].nil?
7
+ $report_path = "Reports/#{ENV['TESTSUITE']}"
8
+ $testcase_report_name = ENV['TESTCASE_REPORT_NAME']
9
+ end
15
10
  end
16
11
 
17
- After do |scenario|
18
- # Do something after each scenario.
19
- # The +scenario+ argument is optional, but
20
- # if you use it, you can inspect status with
21
- # the #failed?, #passed? and #exception methods.
22
-
23
- if(scenario.failed?)
24
- #Do something if scenario fails.
12
+ at_exit do
13
+ # quite driver
14
+ $driver.close()
15
+ if ENV['REPORT']
16
+ begin
17
+ # validateReport
18
+ time = Time.now.getutc
19
+ ReportBuilder.configure do |config|
20
+ config.report_path = "#{$report_path}/#{$testcase_report_name}"
21
+ config.input_path = "#{$report_path}/#{$testcase_report_name}.json"
22
+ config.report_types = [:json, :html]
23
+ config.color = 'blue'
24
+ config.additional_info = {
25
+ 'Browser' => $browser_type,
26
+ 'Platform' => $platform ,
27
+ 'OS Version' => $os_version,
28
+ 'Report Generated' => time
29
+ }
30
+ end
31
+ options = { report_title: "INFODation - Test Management System" }
32
+ ReportBuilder.build_report options
33
+ rescue Exception => e
34
+ puts e.message
35
+ Process.exit( 0 )
36
+ end
25
37
  end
26
38
  end
@@ -0,0 +1,3 @@
1
+ source 'http://rubygems.org'
2
+ gem 'report_builder'
3
+ gem 'itms_automation'
@@ -0,0 +1,132 @@
1
+ Welcome to itms_automation
2
+ =================
3
+
4
+ itms_automation : Automation Tesing Using Ruby
5
+
6
+ itms_automation is a behavior driven development (BDD) approach to write automation test script to test Web and Android Apps.
7
+ It enables you to write and execute automated acceptance/unit tests.
8
+ It is cross-platform, open source and free.
9
+ Automate your test cases with minimal coding.
10
+
11
+ itms_automation Ruby API's
12
+ ============================
13
+
14
+ If you are writing code for your custom steps you can use the following methods :
15
+
16
+ Note : For some of the API paramtere values are fixed. Such values for paramaters are mentioned below.
17
+
18
+ Navigation API's
19
+ ----------------
20
+
21
+ navigate_to("link")
22
+
23
+ navigate(direction) # direction => "back" / "forward"
24
+
25
+ close_driver()
26
+
27
+
28
+ Browser Interaction API's
29
+ -------------------------
30
+
31
+ resize_browser(width, height)
32
+
33
+ scroll_page(to) # to => "top" / "end"
34
+
35
+ scroll_to_element(by, access_value)
36
+
37
+ zoom_in_out(in_out) # in_out => "add" / "subtract"
38
+
39
+ zoom_in_out_till_element_display(by, in_out, access_value) # in_out => "add" / "subtract"
40
+
41
+
42
+ Input API's
43
+ ------------
44
+
45
+ click(element)
46
+
47
+ double_click(element)
48
+
49
+ click_forcefully(element)
50
+
51
+ enter_text(element, text)
52
+
53
+ clear_text(element)
54
+
55
+ check_checkbox(element)
56
+
57
+ uncheck_checkbox(element)
58
+
59
+ toggle_checkbox(element)
60
+
61
+ select_radio_button(element)
62
+
63
+ get_page_title()
64
+
65
+ get_element_text(element)
66
+
67
+ get_element_attribute(element, attribute)
68
+
69
+ is_element_enabled(element)
70
+
71
+ is_element_displayed(element)
72
+
73
+ hover_over_element(element)
74
+
75
+ by => "locators type" ("id", "name", "class", "xpath", "css")
76
+
77
+ access_value => "locator value"
78
+
79
+
80
+ Javascript Handling API
81
+ -----------------------
82
+
83
+ handle_alert(decision) # decision => "accept" / "dismiss"
84
+
85
+ get_alert_text
86
+
87
+
88
+ Progress API's
89
+ --------------
90
+
91
+ wait(time_in_sec)
92
+
93
+ wait_for_element_to_display(element, duration)
94
+
95
+ wait_for_element_to_enable(element, duration)
96
+
97
+
98
+ by => "locators type" ("id", "name", "class", "xpath", "css")
99
+
100
+ access_value => "locator value"
101
+
102
+ duration => duration in seconds.
103
+
104
+
105
+ Screenshot API
106
+ --------------
107
+ take_screenshots
108
+
109
+
110
+ Configuration API
111
+ -----------------
112
+
113
+ print_congifugartion
114
+
115
+
116
+ Usage: itms_automation <command-name> [parameters] [options]
117
+
118
+ <command-name> can be one of
119
+ help
120
+ gen
121
+ version
122
+
123
+ Commands:
124
+ help : prints more detailed help information.
125
+
126
+ gen : creates a skeleton features dir. This is usually used once when
127
+ setting up selnium-cucumber to ensure that the features folder contains
128
+ the right step definitions and environment to run with cucumber.
129
+
130
+ version : prints the gem version
131
+
132
+ Options: -v, --verbose Turns on verbose logging
@@ -0,0 +1,4 @@
1
+ chrome: BROWSER=chrome
2
+ firefox: BROWSER=firefox
3
+ ie: BROWSER=internet_explorer
4
+ parallel: parallel_cucumber
@@ -1,5 +1,10 @@
1
- Feature: Login feature
1
+ Feature: Addition
2
+ As a math idiot
3
+ In order to not feel silly
4
+ I add two numbers
2
5
 
3
- Scenario: As a valid user I can log into my web app
4
- When I press "Login"
5
- Then I see "Welcome to coolest web app ever"
6
+ Scenario: Adding a and b
7
+ Given I have variable a
8
+ And I have variable b
9
+ When I add a and b
10
+ Then I display the sum
@@ -2,6 +2,8 @@ require "rubygems"
2
2
  require "itms_automation"
3
3
  require "httparty"
4
4
  require "cucumber"
5
+ require "report_builder"
6
+ require "selenium-webdriver"
5
7
 
6
8
  $browser_type = ENV["BROWSER"] || "firefox"
7
9
  $platform = ENV["PLATFORM"] || "desktop"
@@ -81,22 +83,23 @@ else # else create driver instance for desktop browser
81
83
  Selenium::WebDriver.for(:chrome, :desired_capabilities => Selenium::WebDriver::Remote::Capabilities.chrome(chromeOptions: { args: %w(headless) }))
82
84
  when "remote"
83
85
  if ENV["SERVER_URL"].nil? || ENV["REMOTE_BROWSER"].nil?
84
- puts "\nMissing SERVER_URL : SERVER_URL=http//SERVER_URL:4444/wd/hub"
86
+ puts "\nMissing SERVER_URL : SERVER_URL=http://SERVER_URL:4444/wd/hub"
85
87
  puts "\nMissing REMOTE_BROWSER: REMOTE_BROWSER=browser_name"
86
88
  Process.exit(0)
87
89
  else
88
90
  caps = Selenium::WebDriver::Remote::Capabilities.new
89
91
  caps["browserName"] = ENV["REMOTE_BROWSER"]
92
+ caps["enableVNC"] = !ENV["ENABLE_VNC"].nil? && ENV["ENABLE_VNC"] == "true"
93
+ caps["enableVideo"] = !ENV["ENABLE_VIDEO"].nil? && ENV["ENABLE_VIDEO"] == "true"
94
+ caps["screenResolution"] = ENV["SCREEN_RESOLUTION"] unless ENV["SCREEN_RESOLUTION"].nil?
95
+ caps["projectId"] = ENV["PROJECT_ID"] unless ENV["PROJECT_ID"].nil?
96
+ caps["issueId"] = ENV["ISSUE_ID"] unless ENV["ISSUE_ID"].nil?
90
97
  Selenium::WebDriver.for(:remote, :url => ENV["SERVER_URL"], :desired_capabilities => caps)
91
98
  end
92
99
  else
93
100
  Selenium::WebDriver.for(:firefox)
94
101
  end
95
102
  $driver.manage().window().maximize()
96
- p "session_id: #{$driver.session_id}"
97
- if ENV["UPDATE_SESSION_ID_API"]
98
- HTTParty.post(ENV["UPDATE_SESSION_ID_API"], body: { session_id: $driver.session_id })
99
- end
100
103
  rescue Exception => e
101
104
  puts e.message
102
105
  Process.exit(0)
@@ -1,43 +1,3 @@
1
- #Cucumber provides a number of hooks which allow us to run blocks at various points in the Cucumber test cycle
2
-
3
- Before do
4
- # Do something before each scenario.
5
- end
6
-
7
- Before do |scenario|
8
- # The +scenario+ argument is optional, but if you use it, you can get the title,
9
- # description, or name (title + description) of the scenario that is about to be
10
- # executed.
11
- end
12
-
13
- After do
14
- # Do something after each scenario.
15
- end
16
-
17
- After do |scenario|
18
- # Do something after each scenario.
19
- # The +scenario+ argument is optional, but
20
- # if you use it, you can inspect status with
21
- # the #failed?, #passed? and #exception methods.
22
-
23
- if(scenario.failed?)
24
- #Do something if scenario fails.
25
- end
26
- end
27
-
28
-
29
- AfterConfiguration do
30
- $OBJECT = loadYAMLfile("features/step_definitions/repositories/project_object.yml")
31
- end
32
-
33
- def loadYAMLfile(filename)
34
- begin
35
- return YAML.load_file(filename)
36
- rescue Psych::SyntaxError => ex
37
- raise "❌ SyntaxError when reading file: #{ex}"
38
- end
39
- end
40
-
41
1
  def validate_params_exist
42
2
  raise "❌ ERROR: Missing param SERVER_URL." if ENV['SERVER_URL'].nil?
43
3
  raise "❌ ERROR: Missing param BROWSER." if ENV['BROWSER'].nil?
@@ -50,6 +10,8 @@ def validate_params_exist
50
10
  end
51
11
 
52
12
  at_exit do
13
+ # quite driver
14
+ $driver.close()
53
15
  if ENV['REPORT']
54
16
  begin
55
17
  # validateReport
@@ -68,7 +30,9 @@ at_exit do
68
30
  end
69
31
  options = { report_title: "INFODation - Test Management System" }
70
32
  ReportBuilder.build_report options
71
- rescue NoMethodError
33
+ rescue Exception => e
34
+ puts e.message
35
+ Process.exit( 0 )
72
36
  end
73
37
  end
74
38
  end
@@ -41,61 +41,56 @@ def check_partial_title(partial_text_title, test_case)
41
41
  end
42
42
 
43
43
  # Method to get element text
44
- # param 1 : String : Locator type (id, name, class, xpath, css)
45
- # param 2 : String : Locator value
44
+ # param : String
46
45
  def get_element_text(element)
47
46
  WAIT.until { find_object(element) }.text
48
47
  end
49
48
 
50
49
  # Method to check element text
51
- # param 1 : String : Locator type (id, name, class, xpath, css)
50
+ # param 1 : String : Element
52
51
  # param 2 : String : Expected element text
53
- # param 3 : String : Locator value
54
- # param 4 : Boolean : test case [true or flase]
55
- def check_element_text(element, actual_value, test_case)
52
+ # param 3 : Boolean : test case [true or flase]
53
+ def check_element_text(element, expected_value, test_case)
56
54
  element_text = get_element_text(element)
57
55
 
58
56
  if test_case
59
- if element_text != actual_value
60
- raise TestCaseFailed, 'Text Not Matched'
57
+ if element_text != expected_value
58
+ raise TestCaseFailed, "Text Not Matched. Actual Value :#{expected_value}"
61
59
  end
62
60
  else
63
- if element_text == actual_value
64
- raise TestCaseFailed, 'Text Matched'
61
+ if element_text == expected_value
62
+ raise TestCaseFailed, "Text Matched. Actual Value :#{expected_value}"
65
63
  end
66
64
  end
67
65
  end
68
66
 
69
67
  # Method to check partial element text
70
- # param 1 : String : Locator type (id, name, class, xpath, css)
68
+ # param 1 : String : Element
71
69
  # param 2 : String : Expected element partial text
72
- # param 3 : String : Locator value
73
- # param 4 : Boolean : test case [true or flase]
74
- def check_element_partial_text(element, actual_value, test_case)
70
+ # param 3 : Boolean : test case [true or flase]
71
+ def check_element_partial_text(element, expected_value, test_case)
75
72
  element_text = get_element_text(element)
76
73
 
77
74
  if test_case
78
- if not element_text.include? "#{actual_value}"
79
- raise TestCaseFailed, 'Text Not Matched'
75
+ if not element_text.include? "#{expected_value}"
76
+ raise TestCaseFailed, "Text Not Matched. Actual Value :#{expected_value}"
80
77
  end
81
78
  else
82
- if element_text.include? "#{actual_value}"
83
- raise TestCaseFailed, 'Text Matched'
79
+ if element_text.include? "#{expected_value}"
80
+ raise TestCaseFailed, "Text Matched. Actual Value :#{expected_value}"
84
81
  end
85
82
  end
86
83
  end
87
84
 
88
85
  # Method to return element status - enabled?
89
- # param 1 : String : Locator type (id, name, class, xpath, css)
90
- # param 2 : String : Locator value
86
+ # param : String : Element
91
87
  def is_element_enabled(element)
92
88
  WAIT.until{ find_object(element) }.enabled?
93
89
  end
94
90
 
95
91
  # Element enabled checking
96
- # param 1 : String : Locator type (id, name, class, xpath, css)
97
- # param 2 : String : Expected element text
98
- # param 4 : Boolean : test case [true or flase]
92
+ # param 1 : String : Element
93
+ # param 2 : Boolean : test case [true or flase]
99
94
  def check_element_enable(element, test_case)
100
95
  result = is_element_enabled(element)
101
96
 
@@ -107,45 +102,41 @@ def check_element_enable(element, test_case)
107
102
  end
108
103
 
109
104
  # method to get attribute value
110
- # param 1 : String : Locator type (id, name, class, xpath, css)
111
- # param 2 : String : Expected element text
112
- # param 3 : String : atrribute name
105
+ # param 1 : String : Element
106
+ # param 2 : String : atrribute name
113
107
  def get_element_attribute(element, attribute_name)
114
108
  WAIT.until{ find_object(element) }.attribute("#{attribute_name}")
115
109
  end
116
110
 
117
111
  # method to check attribute value
118
- # param 1 : String : Locator type (id, name, class, xpath, css)
112
+ # param 1 : String : Element
119
113
  # param 2 : String : atrribute name
120
114
  # param 3 : String : atrribute value
121
- # param 4 : String : Locator value
122
- # param 5 : Boolean : test case [true or flase]
115
+ # param 4 : Boolean : test case [true or flase]
123
116
  def check_element_attribute(element, attribute_name, attribute_value, test_case)
124
117
 
125
118
  attr_val = get_element_attribute(element, attribute_name)
126
119
 
127
120
  if test_case
128
121
  if attr_val != attribute_value
129
- raise TestCaseFailed, 'Attribute Value Not Matched'
122
+ raise TestCaseFailed, "Attribute Value Not Matched. Actual Value :#{attr_val}"
130
123
  end
131
124
  else
132
125
  if attr_val == attribute_value
133
- raise TestCaseFailed, 'Attribute Value Matched'
126
+ raise TestCaseFailed, "Attribute Value Matched. Actual Value :#{attr_val}"
134
127
  end
135
128
  end
136
129
  end
137
130
 
138
131
  # method to get element status - displayed?
139
- # param 1 : String : Locator type (id, name, class, xpath, css)
140
- # param 2 : String : Locator value
141
- def is_element_displayed(access_type, access_name)
132
+ # param : String : Element
133
+ def is_element_displayed(element)
142
134
  WAIT.until{ find_object(element) }.displayed?
143
135
  end
144
136
 
145
137
  # method to check element presence
146
- # param 1 : String : Locator type (id, name, class, xpath, css)
147
- # param 2 : String : Locator value
148
- # param 3 : Boolean : test case [true or flase]
138
+ # param 1 : String : Element
139
+ # param 2 : Boolean : test case [true or flase]
149
140
  def check_element_presence(element, test_case)
150
141
  if test_case
151
142
  if !is_element_displayed(element)
@@ -165,9 +156,8 @@ def check_element_presence(element, test_case)
165
156
  end
166
157
 
167
158
  # method to assert checkbox check/uncheck
168
- # param 1 : String : Locator type (id, name, class, xpath, css)
169
- # param 2 : String : Locator value
170
- # param 3 : Boolean : test case [true or flase]
159
+ # param 1 : String : Element
160
+ # param 2 : Boolean : test case [true or flase]
171
161
  def is_checkbox_checked(element, should_be_checked = true)
172
162
  checkbox = WAIT.until{ find_object(element) }
173
163
 
@@ -179,9 +169,8 @@ def is_checkbox_checked(element, should_be_checked = true)
179
169
  end
180
170
 
181
171
  # method to assert radio button selected/unselected
182
- # param 1 : String : Locator type (id, name, class, xpath, css)
183
- # param 2 : String : Locator value
184
- # param 3 : Boolean : test case [true or flase]
172
+ # param 1 : String : Element
173
+ # param 2 : Boolean : test case [true or flase]
185
174
  def is_radio_button_selected(element, should_be_selected = true)
186
175
  radio_button = WAIT.until{ find_object(element) }
187
176
 
@@ -215,7 +204,7 @@ end
215
204
  # method to check javascript pop-up alert text
216
205
  def check_alert_text(text)
217
206
  if get_alert_text != text
218
- raise TestCaseFailed, 'Text on alert pop up not matched'
207
+ raise TestCaseFailed, "Text on alert pop up not matched. Actual Value :#{get_alert_text}"
219
208
  end
220
209
  end
221
210
 
@@ -8,15 +8,14 @@ def click_forcefully(element)
8
8
  $driver.execute_script('arguments[0].click();', WAIT.until { find_object(element) })
9
9
  end
10
10
 
11
- def double_click(access_type, access_value)
12
- element = WAIT.until { find_object(element) }
13
- $driver.action.double_click(element).perform
11
+ def double_click(element)
12
+ found_element = WAIT.until { find_object(element) }
13
+ $driver.action.double_click(found_element).perform
14
14
  end
15
15
 
16
-
17
- def long_press( access_name, duration)
18
- element = WAIT.until { find_object(access_name) }
19
- parameters = { "element" => "#{element}", "duration" => "#{duration}" }
16
+ def long_press( element, duration)
17
+ found_element = WAIT.until { find_object(element) }
18
+ parameters = { "element" => "#{found_element}", "duration" => "#{duration}" }
20
19
  args = parameters.select { |k, v| [:element, :duration].include? k }
21
20
  args = args_with_ele_ref(args)
22
21
  chain_method(:longPress, args)
@@ -85,3 +85,9 @@ def print_invalid_platform
85
85
  puts "\nTo run on Desktop no need to mention platform."
86
86
  Process.exit(0)
87
87
  end
88
+
89
+ def print_error_object_repository
90
+ puts "\nNo Object Repository found."
91
+ puts "\nPlease create file \"project_object.yml\" in path \"features/step_definitions/repositories/\""
92
+ Process.exit(0)
93
+ end
@@ -34,6 +34,7 @@ def get_device_info
34
34
  end
35
35
 
36
36
  def find_object(string_object)
37
+ $OBJECT = load_object_repository
37
38
  string_object = string_object.gsub(/"/, "'")
38
39
  hash_object = $OBJECT[string_object]
39
40
  if hash_object == nil
@@ -45,3 +46,18 @@ def find_object(string_object)
45
46
  $driver.find_element(:"#{locator_type}" => "#{locator_value}")
46
47
  end
47
48
 
49
+ def load_object_repository
50
+ begin
51
+ loadYAMLfile("features/step_definitions/repositories/project_object.yml")
52
+ rescue => exception
53
+ print_error_object_repository
54
+ end
55
+ end
56
+
57
+ def loadYAMLfile(filename)
58
+ begin
59
+ return YAML.load_file(filename)
60
+ rescue Psych::SyntaxError => ex
61
+ raise "❌ SyntaxError when reading file: #{ex}"
62
+ end
63
+ end
@@ -1,5 +1,5 @@
1
1
  module ITMS
2
2
  module Automation
3
- VERSION = '2.5.6'
3
+ VERSION = '2.6.4'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: itms_automation
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.6
4
+ version: 2.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - INFOdation
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-14 00:00:00.000000000 Z
11
+ date: 2020-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber
@@ -16,20 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.3'
19
+ version: 3.1.2
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 1.3.18
22
+ version: 3.1.2
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
- version: '1.3'
29
+ version: 3.1.2
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 1.3.18
32
+ version: 3.1.2
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: selenium-webdriver
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -76,20 +76,40 @@ dependencies:
76
76
  requirements:
77
77
  - - "~>"
78
78
  - !ruby/object:Gem::Version
79
- version: 0.13.7
79
+ version: 0.18.1
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: 0.13.7
82
+ version: 0.18.1
83
83
  type: :runtime
84
84
  prerelease: false
85
85
  version_requirements: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 0.13.7
89
+ version: 0.18.1
90
90
  - - ">="
91
91
  - !ruby/object:Gem::Version
92
- version: 0.13.7
92
+ version: 0.18.1
93
+ - !ruby/object:Gem::Dependency
94
+ name: report_builder
95
+ requirement: !ruby/object:Gem::Requirement
96
+ requirements:
97
+ - - "~>"
98
+ - !ruby/object:Gem::Version
99
+ version: '1.8'
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '1.8'
103
+ type: :runtime
104
+ prerelease: false
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ requirements:
107
+ - - "~>"
108
+ - !ruby/object:Gem::Version
109
+ version: '1.8'
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: '1.8'
93
113
  description: Behavior driven development (BDD) approach to write automation test script
94
114
  to test Web and Android applications.
95
115
  email: anh.pham@infodation.vn
@@ -127,9 +147,13 @@ files:
127
147
  - example/desktop web/desktop_web_gmail_login/features/step_definitions/custom_steps.rb
128
148
  - example/desktop web/desktop_web_gmail_login/features/support/env.rb
129
149
  - example/desktop web/desktop_web_gmail_login/features/support/hooks.rb
150
+ - features-skeleton/Gemfile
151
+ - features-skeleton/README.md
152
+ - features-skeleton/cucumber.yml
130
153
  - features-skeleton/my_first.feature
131
154
  - features-skeleton/screenshots/test.png
132
155
  - features-skeleton/step_definitions/custom_steps.rb
156
+ - features-skeleton/step_definitions/repositories/project_object.yml
133
157
  - features-skeleton/support/env.rb
134
158
  - features-skeleton/support/hooks.rb
135
159
  - lib/itms_automation.rb