itms_automation 2.6.6 → 2.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/doc/installation.md +1 -1
- data/features-skeleton/my_first.feature +19 -10
- data/features-skeleton/step_definitions/input_steps.rb +3 -3
- data/features-skeleton/step_definitions/my_first_steps.rb +14 -0
- data/features-skeleton/step_definitions/repositories/project_object.yml +1 -1
- data/features-skeleton/support/env.rb +17 -88
- data/lib/itms_automation/input_steps.rb +1 -1
- data/lib/itms_automation/methods/assertion_methods.rb +26 -77
- data/lib/itms_automation/methods/click_elements_methods.rb +13 -6
- data/lib/itms_automation/methods/condition_methods.rb +13 -0
- data/lib/itms_automation/methods/configuration_methods.rb +8 -4
- data/lib/itms_automation/methods/input_methods.rb +17 -14
- data/lib/itms_automation/methods/javascript_handling_methods.rb +1 -1
- data/lib/itms_automation/methods/misc_methods.rb +2 -2
- data/lib/itms_automation/methods/navigate_methods.rb +52 -45
- data/lib/itms_automation/methods/progress_methods.rb +1 -1
- data/lib/itms_automation/version.rb +1 -1
- metadata +39 -40
- data/example/android/android_app/android_app_calculator.zip +0 -0
- data/example/android/android_app/android_app_calculator/AndroidCalculator.apk +0 -0
- data/example/android/android_app/android_app_calculator/features/calculator.feature +0 -36
- data/example/android/android_app/android_app_calculator/features/my_first.feature +0 -13
- data/example/android/android_app/android_app_calculator/features/screenshots/test.png +0 -0
- data/example/android/android_app/android_app_calculator/features/step_definitions/custom_steps.rb +0 -5
- data/example/android/android_app/android_app_calculator/features/support/env.rb +0 -52
- data/example/android/android_app/android_app_calculator/features/support/hooks.rb +0 -26
- data/example/android/android_web/android_web_gmail_login.zip +0 -0
- data/example/android/android_web/android_web_gmail_login/features/gmail_login.feature +0 -12
- data/example/android/android_web/android_web_gmail_login/features/my_first.feature +0 -1
- data/example/android/android_web/android_web_gmail_login/features/screenshots/test.png +0 -0
- data/example/android/android_web/android_web_gmail_login/features/step_definitions/custom_steps.rb +0 -5
- data/example/android/android_web/android_web_gmail_login/features/support/env.rb +0 -51
- data/example/android/android_web/android_web_gmail_login/features/support/hooks.rb +0 -27
- data/example/desktop web/desktop_web_gmail_login.zip +0 -0
- data/example/desktop web/desktop_web_gmail_login/features/gmail_login.feature +0 -9
- data/example/desktop web/desktop_web_gmail_login/features/gmail_multi_login.feature +0 -21
- data/example/desktop web/desktop_web_gmail_login/features/my_first.feature +0 -1
- data/example/desktop web/desktop_web_gmail_login/features/screenshots/test.png +0 -0
- data/example/desktop web/desktop_web_gmail_login/features/step_definitions/custom_steps.rb +0 -5
- data/example/desktop web/desktop_web_gmail_login/features/support/env.rb +0 -106
- data/example/desktop web/desktop_web_gmail_login/features/support/hooks.rb +0 -38
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '090afc5cfe29b875d3816ad9ca3e64c140c8b73a5fe2a7129d02b1641baa8d4f'
|
4
|
+
data.tar.gz: 9f36d46924317a25e1474668a4b22b19d487a155f2c24508310ee81230548196
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf5d23c33daedaaa38c3e56cd689a8bb99ef720f8efe8ddfbdf6c0a686bf8749e208503b00e3ea1990608fd83d2c86f1159446d07314c02f159dcad892086989
|
7
|
+
data.tar.gz: 6b2052bc442d517c26186e412dacb3fb94f3b23c0aa21c24937686e1263ee9c3a07ecd21b139b49a5498a4787ea0ae8e12579e908acc86da530c2a1a5e5eca6a
|
data/doc/installation.md
CHANGED
@@ -2,7 +2,7 @@ Installation
|
|
2
2
|
============
|
3
3
|
### Prerequisites
|
4
4
|
You need to have Ruby installed.
|
5
|
-
Verify your installation by running ruby -v in a terminal - it should print "ruby
|
5
|
+
Verify your installation by running ruby -v in a terminal - it should print "ruby 2.0.0" (or higher).
|
6
6
|
|
7
7
|
You need to have DevKit installed.
|
8
8
|
|
@@ -1,10 +1,19 @@
|
|
1
|
-
# Feature:
|
2
|
-
#
|
3
|
-
#
|
4
|
-
|
5
|
-
|
6
|
-
#
|
7
|
-
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
1
|
+
# Feature: Login Functionality
|
2
|
+
# In order to ensure login functionality works,
|
3
|
+
# I want to run the cucumber test to verify it is working
|
4
|
+
|
5
|
+
# Background:
|
6
|
+
# Given the login page is opened successfully
|
7
|
+
|
8
|
+
# Scenario: Login Valid
|
9
|
+
# When user input username "tomsmith" and password "SuperSecretPassword!"
|
10
|
+
# Then the message "You logged into a secure area!×" should be displayed
|
11
|
+
|
12
|
+
# Scenario Outline: Login Invalid
|
13
|
+
# When user input username "<username>" and password "<password>"
|
14
|
+
# Then the message "<messsage>" should be displayed
|
15
|
+
|
16
|
+
# Examples:
|
17
|
+
# | username | password | messsage |
|
18
|
+
# | anhpham | SuperSecretPassword! | Your username is invalid!× |
|
19
|
+
# | tomsmith | wrong_password | Your password is invalid!× |
|
@@ -4,12 +4,12 @@
|
|
4
4
|
|
5
5
|
# # enter text into input field steps
|
6
6
|
# Then(/^I enter "([^\"]*)" into element "(.*?)"$/) do |text, element|
|
7
|
-
# enter_text(
|
7
|
+
# enter_text(element, text)
|
8
8
|
# end
|
9
9
|
|
10
10
|
# # clear input field steps
|
11
|
-
# Then(/^I clear input element "(.*?)"$/) do |
|
12
|
-
# clear_text(
|
11
|
+
# Then(/^I clear input element "(.*?)"$/) do |element|
|
12
|
+
# clear_text(element)
|
13
13
|
# end
|
14
14
|
|
15
15
|
# # select option by text/value from dropdown/multiselect
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Given('the login page is opened successfully') do
|
2
|
+
# $driver.get("http://the-internet.herokuapp.com/login")
|
3
|
+
# end
|
4
|
+
|
5
|
+
# When('user input username {string} and password {string}') do |string, string2|
|
6
|
+
# $driver.find_element(:id, 'username').send_keys(string)
|
7
|
+
# $driver.find_element(:id, 'password').send_keys(string2)
|
8
|
+
# $driver.find_element(:css, '[class="fa fa-2x fa-sign-in"]').click
|
9
|
+
# end
|
10
|
+
|
11
|
+
# Then('the message {string} should be displayed') do |string|
|
12
|
+
# message = $driver.find_element(:css, '#flash').text.delete("\n")
|
13
|
+
# expect(message).to eql(string)
|
14
|
+
# end
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
test_object: {id: 'username'}
|
@@ -1,78 +1,14 @@
|
|
1
1
|
require "rubygems"
|
2
2
|
require "itms_automation"
|
3
3
|
require "httparty"
|
4
|
-
require "cucumber"
|
5
4
|
require "report_builder"
|
6
|
-
require "
|
5
|
+
require "webdrivers"
|
7
6
|
|
8
7
|
$browser_type = ENV["BROWSER"] || "firefox"
|
9
|
-
$platform = ENV["PLATFORM"] || "desktop"
|
10
|
-
$os_version = ENV["OS_VERSION"]
|
11
|
-
$device_name = ENV["DEVICE_NAME"]
|
12
|
-
$udid = ENV["UDID"]
|
13
|
-
$app_path = ENV["APP_PATH"]
|
14
8
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
# If platform is android or ios create driver instance for mobile browser
|
19
|
-
if $platform == "android" or $platform == "iOS"
|
20
|
-
if $browser_type == "native"
|
21
|
-
$browser_type = "Browser"
|
22
|
-
end
|
23
|
-
|
24
|
-
if $platform == "android"
|
25
|
-
$device_name, $os_version = get_device_info
|
26
|
-
end
|
27
|
-
|
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,
|
53
|
-
browserName: $browser_type,
|
54
|
-
deviceName: $device_name,
|
55
|
-
versionNumber: $os_version,
|
56
|
-
app: "WikipediaSample.apk",
|
57
|
-
},
|
58
|
-
appium_lib: {
|
59
|
-
wait: 30,
|
60
|
-
},
|
61
|
-
}
|
62
|
-
|
63
|
-
begin
|
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
|
-
rescue Exception => e
|
70
|
-
puts e.message
|
71
|
-
Process.exit(0)
|
72
|
-
end
|
73
|
-
else # else create driver instance for desktop browser
|
74
|
-
begin
|
75
|
-
$driver = case $browser_type
|
9
|
+
begin
|
10
|
+
$vars = {}
|
11
|
+
$driver = case $browser_type
|
76
12
|
when "chrome"
|
77
13
|
Selenium::WebDriver.for(:chrome)
|
78
14
|
when "safari"
|
@@ -82,29 +18,22 @@ else # else create driver instance for desktop browser
|
|
82
18
|
when "chrome_headless"
|
83
19
|
Selenium::WebDriver.for(:chrome, :desired_capabilities => Selenium::WebDriver::Remote::Capabilities.chrome(chromeOptions: { args: %w(headless) }))
|
84
20
|
when "remote"
|
85
|
-
if ENV[
|
86
|
-
puts "\nMissing SERVER_URL : SERVER_URL=http
|
21
|
+
if ENV['SERVER_URL'].nil? || ENV['REMOTE_BROWSER'].nil?
|
22
|
+
puts "\nMissing SERVER_URL : SERVER_URL=http//SERVER_URL:4444/wd/hub"
|
87
23
|
puts "\nMissing REMOTE_BROWSER: REMOTE_BROWSER=browser_name"
|
88
24
|
Process.exit(0)
|
89
25
|
else
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
caps["browserName"] = ENV["REMOTE_BROWSER"]
|
97
|
-
caps["enableVNC"] = true
|
98
|
-
caps["enableVideo"] = true
|
99
|
-
caps["resolution"] = ENV["resolution"] unless ENV["resolution"]
|
100
|
-
Selenium::WebDriver.for(:remote, :url => ENV["SERVER_URL"], :desired_capabilities => caps)
|
26
|
+
caps = Selenium::WebDriver::Remote::Capabilities.new
|
27
|
+
caps["browserName"] = ENV["REMOTE_BROWSER"]
|
28
|
+
caps["enableVNC"] = false
|
29
|
+
caps["enableVideo"] = false
|
30
|
+
caps["resolution"] = ENV["resolution"] unless ENV["resolution"]
|
31
|
+
Selenium::WebDriver.for(:remote, :url => ENV["SERVER_URL"], :desired_capabilities => caps)
|
101
32
|
end
|
102
|
-
|
103
|
-
|
104
|
-
end
|
105
|
-
$driver.manage().window().maximize()
|
106
|
-
rescue Exception => e
|
107
|
-
puts e.message
|
108
|
-
Process.exit(0)
|
33
|
+
else
|
34
|
+
Selenium::WebDriver.for(:firefox)
|
109
35
|
end
|
36
|
+
rescue Exception => e
|
37
|
+
puts e.message
|
38
|
+
Process.exit(0)
|
110
39
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'net/https'
|
2
2
|
require_relative 'required_files'
|
3
|
+
require 'rspec'
|
3
4
|
|
4
5
|
# This file contains assertion methods which are called from assertion_steps.rb
|
5
6
|
|
@@ -9,59 +10,23 @@ def get_page_title
|
|
9
10
|
end
|
10
11
|
|
11
12
|
# Method to verify title
|
12
|
-
# param 1
|
13
|
-
|
14
|
-
|
15
|
-
page_title = get_page_title
|
16
|
-
if test_case
|
17
|
-
if page_title != "#{title}"
|
18
|
-
raise TestCaseFailed, "Page Title Not Matched, Actual Page Title : #{page_title}"
|
19
|
-
end
|
20
|
-
else
|
21
|
-
if page_title == "#{title}"
|
22
|
-
raise TestCaseFailed, "Page Title Matched, Actual Page Title:#{page_title}"
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
# Method to verify partial title
|
28
|
-
# param 1 : String : partial title string
|
29
|
-
# param 2 : Boolean : test case [true or flase]
|
30
|
-
def check_partial_title(partial_text_title, test_case)
|
31
|
-
page_title = get_page_title
|
32
|
-
if test_case
|
33
|
-
if not page_title.include? "#{partial_text_title}"
|
34
|
-
raise TestCaseFailed, 'Partial Page Title Not Present'
|
35
|
-
end
|
36
|
-
else
|
37
|
-
if page_title.include? "#{partial_text_title}"
|
38
|
-
raise TestCaseFailed, 'Page Title Matched'
|
39
|
-
end
|
40
|
-
end
|
13
|
+
# param 1: String : expected title
|
14
|
+
def assert_title(title)
|
15
|
+
expect(get_page_title).to eq(title)
|
41
16
|
end
|
42
17
|
|
43
18
|
# Method to get element text
|
44
19
|
# param : String
|
45
20
|
def get_element_text(element)
|
46
|
-
|
21
|
+
find_object(element).text
|
47
22
|
end
|
48
23
|
|
49
24
|
# Method to check element text
|
50
25
|
# param 1 : String : Element
|
51
26
|
# param 2 : String : Expected element text
|
52
|
-
|
53
|
-
def check_element_text(element, expected_value, test_case)
|
27
|
+
def assert_text(element, expected_value)
|
54
28
|
element_text = get_element_text(element)
|
55
|
-
|
56
|
-
if test_case
|
57
|
-
if element_text != expected_value
|
58
|
-
raise TestCaseFailed, "Text Not Matched. Actual Value :#{expected_value}"
|
59
|
-
end
|
60
|
-
else
|
61
|
-
if element_text == expected_value
|
62
|
-
raise TestCaseFailed, "Text Matched. Actual Value :#{expected_value}"
|
63
|
-
end
|
64
|
-
end
|
29
|
+
expect(element_text).to eq(expected_value)
|
65
30
|
end
|
66
31
|
|
67
32
|
# Method to check partial element text
|
@@ -101,13 +66,6 @@ def check_element_enable(element, test_case)
|
|
101
66
|
end
|
102
67
|
end
|
103
68
|
|
104
|
-
# method to get attribute value
|
105
|
-
# param 1 : String : Element
|
106
|
-
# param 2 : String : atrribute name
|
107
|
-
def get_element_attribute(element, attribute_name)
|
108
|
-
WAIT.until{ find_object(element) }.attribute("#{attribute_name}")
|
109
|
-
end
|
110
|
-
|
111
69
|
# method to check attribute value
|
112
70
|
# param 1 : String : Element
|
113
71
|
# param 2 : String : atrribute name
|
@@ -137,34 +95,26 @@ end
|
|
137
95
|
# method to check element presence
|
138
96
|
# param 1 : String : Element
|
139
97
|
# param 2 : Boolean : test case [true or flase]
|
140
|
-
def
|
141
|
-
|
142
|
-
|
143
|
-
raise TestCaseFailed, 'Element Not Present'
|
144
|
-
end
|
145
|
-
else
|
146
|
-
begin
|
147
|
-
if is_element_displayed(element)
|
148
|
-
raise 'Present' # since it is negative test and we found element
|
149
|
-
end
|
150
|
-
rescue Exception => e
|
151
|
-
if e.message == 'Present' # only raise if it present
|
152
|
-
raise TestCaseFailed, 'Element Present'
|
153
|
-
end
|
154
|
-
end
|
155
|
-
end
|
98
|
+
def assert_element_present(element)
|
99
|
+
found_element = find_object(element)
|
100
|
+
raise TestCaseFailed, 'Element Not Present' unless found_element.length > 0
|
156
101
|
end
|
157
102
|
|
158
|
-
# method to assert checkbox check
|
103
|
+
# method to assert checkbox check
|
159
104
|
# param 1 : String : Element
|
160
|
-
|
161
|
-
|
162
|
-
checkbox = WAIT.until{ find_object(element) }
|
105
|
+
def assert_checked(element)
|
106
|
+
checkbox = find_object(element)
|
163
107
|
|
164
|
-
if !checkbox.selected?
|
165
|
-
raise TestCaseFailed,
|
166
|
-
|
167
|
-
|
108
|
+
if !checkbox.selected?
|
109
|
+
raise TestCaseFailed, "Checkbox is not checked"
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
def assert_not_checked(element)
|
114
|
+
checkbox = find_object(element)
|
115
|
+
|
116
|
+
if checkbox.selected?
|
117
|
+
raise TestCaseFailed, "Checkbox is checked"
|
168
118
|
end
|
169
119
|
end
|
170
120
|
|
@@ -202,10 +152,9 @@ def get_alert_text
|
|
202
152
|
end
|
203
153
|
|
204
154
|
# method to check javascript pop-up alert text
|
205
|
-
def
|
206
|
-
|
207
|
-
|
208
|
-
end
|
155
|
+
def assert_alert(text)
|
156
|
+
alert_text = $driver.switch_to.alert.text
|
157
|
+
expect(alert_text).to eq(text)
|
209
158
|
end
|
210
159
|
|
211
160
|
def is_option_from_dropdown_selected(element, by, option, should_be_selected=true)
|
@@ -1,20 +1,27 @@
|
|
1
1
|
require_relative 'required_files'
|
2
2
|
|
3
3
|
def click(element)
|
4
|
-
|
4
|
+
found_element = find_object(element)
|
5
|
+
found_element.click
|
5
6
|
end
|
6
7
|
|
7
|
-
def
|
8
|
-
|
8
|
+
def click_at(element)
|
9
|
+
found_element = find_object(element)
|
10
|
+
found_element.click
|
9
11
|
end
|
10
12
|
|
11
13
|
def double_click(element)
|
12
|
-
found_element =
|
14
|
+
found_element = find_object(element)
|
13
15
|
$driver.action.double_click(found_element).perform
|
14
16
|
end
|
15
17
|
|
16
|
-
def
|
17
|
-
found_element =
|
18
|
+
def double_click_at(element, location)
|
19
|
+
found_element = find_object(element)
|
20
|
+
$driver.action.double_click(found_element).perform
|
21
|
+
end
|
22
|
+
|
23
|
+
def long_press(element, duration)
|
24
|
+
found_element = find_object(element)
|
18
25
|
parameters = { "element" => "#{found_element}", "duration" => "#{duration}" }
|
19
26
|
args = parameters.select { |k, v| [:element, :duration].include? k }
|
20
27
|
args = args_with_ele_ref(args)
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require_relative 'required_files'
|
2
|
+
|
3
|
+
def if(condition_script)
|
4
|
+
return $driver.execute_script(condition_script)
|
5
|
+
end
|
6
|
+
|
7
|
+
def else_if(condition_script)
|
8
|
+
return $driver.execute_script(condition_script)
|
9
|
+
end
|
10
|
+
|
11
|
+
def while(condition_script)
|
12
|
+
return $driver.execute_script(condition_script)
|
13
|
+
end
|
@@ -22,14 +22,18 @@ end
|
|
22
22
|
|
23
23
|
# method to print mobile configuration
|
24
24
|
def print_mobile_configuration
|
25
|
-
puts "Platform : #{$platform.upcase}"
|
26
|
-
puts "OS version : #{$os_version}"
|
27
|
-
puts "Device : #{$device_name}"
|
25
|
+
puts "Platform : #{$platform.upcase}"
|
26
|
+
puts "OS version : #{$os_version}"
|
27
|
+
puts "Device : #{$device_name}"
|
28
28
|
|
29
29
|
if $app_path.nil?
|
30
30
|
puts 'Browser : ' + $driver.capabilities.browser_name.to_s.upcase + " " + $driver.capabilities.version.to_s
|
31
31
|
else
|
32
|
-
puts "App Tested : #{$app_path}"
|
32
|
+
puts "App Tested : #{$app_path}"
|
33
33
|
end
|
34
34
|
puts ''
|
35
35
|
end
|
36
|
+
|
37
|
+
def echo(message)
|
38
|
+
puts(message)
|
39
|
+
end
|