itms_automation 2.6.7 → 2.7.2
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 +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 +159 -174
- 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 +14 -7
- data/lib/itms_automation/methods/input_methods.rb +58 -15
- data/lib/itms_automation/methods/javascript_handling_methods.rb +1 -1
- data/lib/itms_automation/methods/misc_methods.rb +1 -2
- data/lib/itms_automation/methods/navigate_methods.rb +52 -45
- data/lib/itms_automation/methods/progress_methods.rb +73 -6
- data/lib/itms_automation/methods/store_methods.rb +36 -0
- data/lib/itms_automation/version.rb +1 -1
- metadata +40 -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: 8113d92ae42388d312d06addf7983729e8c339394101e42e5bf7696b157159ba
|
4
|
+
data.tar.gz: 99c7336da205831dad925b554d538992031423b5d712c10722482708ad96075b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5705b378186e404e89587da1b64d5b05dedbd3289120b73a209daef2598c2b5d4ce6055b007654be5fa38255ea098a6f145fa7bc4703c8846bd4cd3cbbf2099
|
7
|
+
data.tar.gz: 6d8065f8be72393b605c9135c923a259fcbbdeab9e1fec1b71bd0a4137a9cdca846cbfa63b81526679bd9349e5cffb26b28e57c79125e0ac47c5cae5ee836f7f
|
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,228 +1,208 @@
|
|
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
|
|
6
|
-
# Method to
|
7
|
-
|
8
|
-
|
7
|
+
# Method to verify title
|
8
|
+
# param 1: String : expected title
|
9
|
+
def assert_title(title)
|
10
|
+
expect($driver.title).to eq(title)
|
9
11
|
end
|
10
12
|
|
11
|
-
# Method to
|
12
|
-
# param 1 : String :
|
13
|
-
# param 2 :
|
14
|
-
def
|
15
|
-
|
16
|
-
|
17
|
-
|
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
|
13
|
+
# Method to check element text
|
14
|
+
# param 1 : String : Element
|
15
|
+
# param 2 : String : Expected element text
|
16
|
+
def assert_text(element, expected_value)
|
17
|
+
found_element = find_object(element)
|
18
|
+
element_text = found_element.text
|
19
|
+
expect(element_text).to eq(expected_value)
|
25
20
|
end
|
26
21
|
|
27
|
-
#
|
28
|
-
# param 1
|
29
|
-
|
30
|
-
|
31
|
-
|
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
|
22
|
+
# method to check element presence
|
23
|
+
# param 1: String: Element
|
24
|
+
def assert_element_present(element)
|
25
|
+
found_element = find_object(element)
|
26
|
+
expect(found_element.length).to be > 0
|
41
27
|
end
|
42
28
|
|
43
|
-
#
|
44
|
-
# param : String
|
45
|
-
def
|
46
|
-
|
29
|
+
# method to check element not presence
|
30
|
+
# param 1: String: Element
|
31
|
+
def assert_element_not_present(element)
|
32
|
+
found_element = find_object(element)
|
33
|
+
expect(found_element.length).to eq(0)
|
47
34
|
end
|
48
35
|
|
49
|
-
#
|
36
|
+
# method to assert checkbox check
|
50
37
|
# param 1 : String : Element
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
38
|
+
def assert_checked(element)
|
39
|
+
checkbox = find_object(element)
|
40
|
+
expect(checkbox.selected?).to be_truthy
|
41
|
+
end
|
55
42
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
end
|
60
|
-
else
|
61
|
-
if element_text == expected_value
|
62
|
-
raise TestCaseFailed, "Text Matched. Actual Value :#{expected_value}"
|
63
|
-
end
|
64
|
-
end
|
43
|
+
def assert_not_checked(element)
|
44
|
+
checkbox = find_object(element)
|
45
|
+
expect(checkbox.selected?).to be_falsey
|
65
46
|
end
|
66
47
|
|
67
|
-
#
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
def check_element_partial_text(element, expected_value, test_case)
|
72
|
-
element_text = get_element_text(element)
|
73
|
-
|
74
|
-
if test_case
|
75
|
-
if not element_text.include? "#{expected_value}"
|
76
|
-
raise TestCaseFailed, "Text Not Matched. Actual Value :#{expected_value}"
|
77
|
-
end
|
78
|
-
else
|
79
|
-
if element_text.include? "#{expected_value}"
|
80
|
-
raise TestCaseFailed, "Text Matched. Actual Value :#{expected_value}"
|
81
|
-
end
|
82
|
-
end
|
48
|
+
# method to check javascript pop-up alert text
|
49
|
+
def assert_alert(text)
|
50
|
+
alert_text = $driver.switch_to.alert.text
|
51
|
+
expect(alert_text).to eq(text)
|
83
52
|
end
|
84
53
|
|
85
|
-
# method to
|
86
|
-
|
87
|
-
|
88
|
-
|
54
|
+
# method to check javascript pop-up alert text
|
55
|
+
def assert_confirmation(text)
|
56
|
+
alert_text = $driver.switch_to.alert.text
|
57
|
+
expect(alert_text).to eq(text)
|
89
58
|
end
|
90
59
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
result = is_element_enabled(element)
|
60
|
+
def assert_editable(element)
|
61
|
+
found_element = find_object(element)
|
62
|
+
expect(found_element.enabled?).to be_truthy
|
63
|
+
end
|
96
64
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
raise TestCaseFailed, 'Element Enabled' unless !result
|
101
|
-
end
|
65
|
+
def assert_not_editable
|
66
|
+
found_element = find_object(element)
|
67
|
+
expect(found_element.enabled?).to be_falsey
|
102
68
|
end
|
103
69
|
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
WAIT.until{ find_object(element) }.attribute("#{attribute_name}")
|
70
|
+
def assert_not_selected_value(element, text)
|
71
|
+
found_element = find_object(element)
|
72
|
+
value = found_element.attribute("value")
|
73
|
+
expect(value).not_to eq(text)
|
109
74
|
end
|
110
75
|
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
# param 4 : Boolean : test case [true or flase]
|
116
|
-
def check_element_attribute(element, attribute_name, attribute_value, test_case)
|
76
|
+
def assert_not_text(element, text)
|
77
|
+
found_element = find_object(element)
|
78
|
+
expect(found_element.text).not_to eq(text)
|
79
|
+
end
|
117
80
|
|
118
|
-
|
81
|
+
def assert_prompt(text)
|
82
|
+
alert_text = $driver.switch_to.alert.text
|
83
|
+
expect(alert_text).to eq(text)
|
84
|
+
end
|
119
85
|
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
if attr_val == attribute_value
|
126
|
-
raise TestCaseFailed, "Attribute Value Matched. Actual Value :#{attr_val}"
|
127
|
-
end
|
128
|
-
end
|
86
|
+
def assert_selected_label(element, text)
|
87
|
+
found_element = find_object(element)
|
88
|
+
locator = "option[@value='#{found_element.attribute('value')}']"
|
89
|
+
selected_text = found_element.find_element(:xpath, locator).text
|
90
|
+
expect(selected_text).to eq(text)
|
129
91
|
end
|
130
92
|
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
93
|
+
def assert_value(element, text)
|
94
|
+
found_element = find_object(element)
|
95
|
+
value = found_element.attribute("value")
|
96
|
+
expect(value).to eq(text)
|
135
97
|
end
|
136
98
|
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
if test_case
|
142
|
-
if !is_element_displayed(element)
|
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
|
99
|
+
def assert_selected_value
|
100
|
+
found_element = find_object(element)
|
101
|
+
value = found_element.attribute("value")
|
102
|
+
expect(value).to eq(text)
|
156
103
|
end
|
157
104
|
|
158
|
-
|
105
|
+
def assert(var_name, value)
|
106
|
+
if (value == "true" || value == "false") {
|
107
|
+
_value = value
|
108
|
+
} elseif (value == '0' || !!number_or_nil(value)) {
|
109
|
+
_value = value
|
110
|
+
}
|
111
|
+
result = _value
|
112
|
+
? expect($vars[var_name]).to eq(_value)
|
113
|
+
: expect($vars[var_name]).to eq(value)
|
114
|
+
end
|
115
|
+
|
116
|
+
# Method to verify title
|
117
|
+
# param 1: String : expected title
|
118
|
+
def verify_title(title)
|
119
|
+
expect($driver.title).to eq(title)
|
120
|
+
end
|
121
|
+
|
122
|
+
# Method to check element text
|
159
123
|
# param 1 : String : Element
|
160
|
-
# param 2 :
|
161
|
-
def
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
124
|
+
# param 2 : String : Expected element text
|
125
|
+
def verify_text(element, expected_value)
|
126
|
+
found_element = find_object(element)
|
127
|
+
element_text = found_element.text
|
128
|
+
expect(element_text).to eq(expected_value)
|
129
|
+
end
|
130
|
+
|
131
|
+
# method to check element presence
|
132
|
+
# param 1: String: Element
|
133
|
+
def verify_element_present(element)
|
134
|
+
found_element = find_object(element)
|
135
|
+
expect(found_element.length).to be > 0
|
169
136
|
end
|
170
137
|
|
171
|
-
# method to
|
138
|
+
# method to check element not presence
|
139
|
+
# param 1: String: Element
|
140
|
+
def verify_element_not_present(element)
|
141
|
+
found_element = find_object(element)
|
142
|
+
expect(found_element.length).to eq(0)
|
143
|
+
end
|
144
|
+
|
145
|
+
# method to assert checkbox check
|
172
146
|
# param 1 : String : Element
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
if !radio_button.selected? && should_be_selected
|
178
|
-
raise TestCaseFailed, 'Radio Button not selected'
|
179
|
-
elsif radio_button.selected? && !should_be_selected
|
180
|
-
raise TestCaseFailed, 'Radio Button is selected'
|
181
|
-
end
|
147
|
+
def verify_checked(element)
|
148
|
+
checkbox = find_object(element)
|
149
|
+
expect(checkbox.selected?).to be_truthy
|
182
150
|
end
|
183
151
|
|
184
|
-
|
185
|
-
|
186
|
-
|
152
|
+
def verify_not_checked(element)
|
153
|
+
checkbox = find_object(element)
|
154
|
+
expect(checkbox.selected?).to be_falsey
|
155
|
+
end
|
187
156
|
|
188
|
-
|
157
|
+
def verify_editable(element)
|
158
|
+
found_element = find_object(element)
|
159
|
+
expect(found_element.enabled?).to be_truthy
|
160
|
+
end
|
189
161
|
|
190
|
-
|
162
|
+
def verify_not_editable
|
163
|
+
found_element = find_object(element)
|
164
|
+
expect(found_element.enabled?).to be_falsey
|
165
|
+
end
|
191
166
|
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
end
|
167
|
+
def verify_not_selected_value(element, text)
|
168
|
+
found_element = find_object(element)
|
169
|
+
value = found_element.attribute("value")
|
170
|
+
expect(value).not_to eq(text)
|
197
171
|
end
|
198
172
|
|
199
|
-
|
200
|
-
|
201
|
-
|
173
|
+
def verify_not_text(element, text)
|
174
|
+
found_element = find_object(element)
|
175
|
+
expect(found_element.text).not_to eq(text)
|
202
176
|
end
|
203
177
|
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
178
|
+
def verify_selected_label(element, text)
|
179
|
+
found_element = find_object(element)
|
180
|
+
locator = "option[@value='#{found_element.attribute('value')}']"
|
181
|
+
selected_text = found_element.find_element(:xpath, locator).text
|
182
|
+
expect(selected_text).to eq(text)
|
209
183
|
end
|
210
184
|
|
211
|
-
def
|
212
|
-
|
213
|
-
|
185
|
+
def verify_value(element, text)
|
186
|
+
found_element = find_object(element)
|
187
|
+
value = found_element.attribute("value")
|
188
|
+
expect(value).to eq(text)
|
189
|
+
end
|
214
190
|
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
191
|
+
def verify_selected_value
|
192
|
+
found_element = find_object(element)
|
193
|
+
value = found_element.attribute("value")
|
194
|
+
expect(value).to eq(text)
|
195
|
+
end
|
220
196
|
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
197
|
+
def verify(var_name, value)
|
198
|
+
if (value == "true" || value == "false") {
|
199
|
+
_value = value
|
200
|
+
} elseif (value == '0' || !!number_or_nil(value)) {
|
201
|
+
_value = value
|
202
|
+
}
|
203
|
+
result = _value
|
204
|
+
? expect($vars[var_name]).to eq(_value)
|
205
|
+
: expect($vars[var_name]).to eq(value)
|
226
206
|
end
|
227
207
|
|
228
208
|
# Method to find difference between images
|
@@ -331,3 +311,8 @@ def compare_png_images(expected_img_url, actual_img_url)
|
|
331
311
|
end
|
332
312
|
true
|
333
313
|
end
|
314
|
+
|
315
|
+
def number_or_nil(string)
|
316
|
+
num = string.to_i
|
317
|
+
num if num.to_s == string
|
318
|
+
end
|