Ifd_Automation 1.6.0 → 1.7.0
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/bin/Ifd_Automation +34 -15
- data/bin/console +14 -0
- data/bin/documentation_generator.rb +119 -0
- data/bin/helper.rb +24 -19
- data/bin/setup +8 -0
- data/lib/Ifd_Automation.rb +2 -1
- data/lib/Ifd_Automation/all_steps.rb +8 -0
- data/lib/Ifd_Automation/database_steps.rb +106 -0
- data/lib/Ifd_Automation/email_steps.rb +67 -82
- data/lib/Ifd_Automation/file_steps.rb +30 -0
- data/lib/Ifd_Automation/{javascript_handling_steps.rb → javascript_steps.rb} +1 -2
- data/lib/Ifd_Automation/required_libs.rb +7 -0
- data/lib/Ifd_Automation/response.rb +105 -0
- data/lib/Ifd_Automation/ssh_steps.rb +47 -0
- data/lib/Ifd_Automation/version.rb +3 -5
- data/lib/Ifd_Automation/web_steps.rb +293 -0
- data/lib/Ifd_Automation/webservice_steps.rb +261 -0
- data/lib/{Ifd_Automation/methods/IFD_Assertion_methods.rb → Ifd_Automation_support/assertion_helpers.rb} +0 -1
- data/lib/Ifd_Automation_support/connection_helpers.rb +14 -0
- data/lib/{Ifd_Automation/methods → Ifd_Automation_support}/core.rb +103 -34
- data/lib/{Ifd_Automation/methods/javascript_handling_methods.rb → Ifd_Automation_support/javascript_helpers.rb} +0 -1
- data/lib/Ifd_Automation_support/mail_helpers.rb +17 -0
- data/lib/Ifd_Automation_support/selenium_sync_issues.rb +62 -0
- data/lib/{Ifd_Automation/methods/web_methods.rb → Ifd_Automation_support/web_steps_helpers.rb} +6 -1
- data/project/Gemfile +1 -19
- data/project/Gemfile.lock +203 -0
- data/project/features/TestData/globalData.yml +3 -11
- data/project/features/TestData/sshtest.txt +2 -0
- data/project/features/TestData/testfile.sql +2 -0
- data/project/features/{TestData/DownloadFolder/test.txt → TestSuite/test} +0 -0
- data/project/features/step_definitions/lib_steps/test.rb +16 -0
- data/project/features/step_definitions/repositories/project_object.yml +6 -6
- data/project/features/support/env.rb +46 -68
- data/project/features/support/project_config.yml +6 -37
- metadata +231 -51
- data/lib/Ifd_Automation/assertion_steps.rb +0 -96
- data/lib/Ifd_Automation/lib_file_steps.rb +0 -54
- data/lib/Ifd_Automation/lib_schema_data_steps.rb +0 -115
- data/lib/Ifd_Automation/lib_web_steps.rb +0 -184
- data/lib/Ifd_Automation/lib_webservice_steps.rb +0 -44
- data/lib/Ifd_Automation/methods/IFD_Connection.rb +0 -28
- data/lib/Ifd_Automation/methods/IFD_email_methods.rb +0 -16
- data/lib/Ifd_Automation/methods/IFD_webservice.rb +0 -17
- data/lib/Ifd_Automation/methods/database_methods.rb +0 -25
- data/lib/Ifd_Automation/methods/db_utils.rb +0 -37
- data/lib/Ifd_Automation/methods/error_handling_methods.rb +0 -87
- data/lib/Ifd_Automation/methods/lib_var.rb +0 -59
- data/lib/Ifd_Automation/methods/misc_methods.rb +0 -33
- data/lib/Ifd_Automation/methods/required_files.rb +0 -33
- data/lib/Ifd_Automation/methods/util.rb +0 -168
- data/lib/Ifd_Automation/methods/web_service_methods.rb +0 -63
- data/project/config/cucumber.yml +0 -3
- data/project/features/TestData/ExpectedDataFile/test.txt +0 -0
- data/project/features/TestData/SqlScript/test.sql +0 -0
- data/project/features/TestData/actual_images/infodation.jpg +0 -0
- data/project/features/TestData/expected_images/infodation.jpg +0 -0
- data/project/features/TestData/image_difference/infodation.jpg +0 -0
- data/project/features/TestData/screenshots/infodation.jpg +0 -0
- data/project/features/TestSuite/Login/login.feature +0 -11
- data/project/features/step_definitions/lib_steps/login_steps.rb +0 -16
@@ -0,0 +1,30 @@
|
|
1
|
+
Given /^I read data from file "(.*)"$/ do |file_name|
|
2
|
+
@file_data = ""
|
3
|
+
file_path = $test_data_dir + file_name
|
4
|
+
if File.exist?(file_path)
|
5
|
+
file = File.open(file_path)
|
6
|
+
@file_data += file.read
|
7
|
+
file.close
|
8
|
+
else
|
9
|
+
puts "*** WARNING: File #{file_name} does not exist."
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
Then /^I delete file "(.*)"$/ do |file_name|
|
14
|
+
file_path = ($test_data_dir + file_name)
|
15
|
+
if File.exists?(file_path)
|
16
|
+
File.delete(file_path)
|
17
|
+
puts "#{file_name} is deleted successfully"
|
18
|
+
else
|
19
|
+
puts "File #{file_name} does not exists"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
When /^show me the params of "(.*)"$/ do |params_name|
|
24
|
+
if $PARAMS["#{params_name}"]
|
25
|
+
params_value = $PARAMS["#{params_name}"]
|
26
|
+
p params_value
|
27
|
+
else
|
28
|
+
p "WARNING: *** Value of parameter #{params_name} not found"
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
require_relative '../Ifd_Automation_support/assertion_helpers.rb'
|
2
|
+
require_relative '../Ifd_Automation_support/connection_helpers.rb'
|
3
|
+
require_relative '../Ifd_Automation_support/core.rb'
|
4
|
+
require_relative '../Ifd_Automation_support/javascript_helpers.rb'
|
5
|
+
require_relative '../Ifd_Automation_support/mail_helpers.rb'
|
6
|
+
require_relative '../Ifd_Automation_support/selenium_sync_issues.rb'
|
7
|
+
require_relative '../Ifd_Automation_support/web_steps_helpers.rb'
|
@@ -0,0 +1,105 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'jsonpath'
|
3
|
+
require 'rest-client'
|
4
|
+
|
5
|
+
module CucumberApi
|
6
|
+
|
7
|
+
# Extension of {RestClient::Response} with support for JSON path traversal and validation
|
8
|
+
module Response
|
9
|
+
|
10
|
+
# include RestClient::Response
|
11
|
+
|
12
|
+
# Create a Response with JSON path support
|
13
|
+
# @param response [RestClient::Response] original response
|
14
|
+
# @return [Response] self
|
15
|
+
def self.create response
|
16
|
+
# include RestClient::Response
|
17
|
+
result = response
|
18
|
+
result.extend Response
|
19
|
+
result
|
20
|
+
end
|
21
|
+
|
22
|
+
# Check if given JSON path exists
|
23
|
+
# @param json_path [String] a valid JSON path expression
|
24
|
+
# @param json [String] optional JSON from which to check JSON path, default to response body
|
25
|
+
# @return [true, false] true if JSON path is valid and exists, false otherwise
|
26
|
+
def has json_path, json=nil
|
27
|
+
if json.nil?
|
28
|
+
json = JSON.parse body
|
29
|
+
end
|
30
|
+
not JsonPath.new(json_path).on(json).empty?
|
31
|
+
end
|
32
|
+
|
33
|
+
# Retrieve value of the first JSON element with given JSON path
|
34
|
+
# @param json_path [String] a valid JSON path expression
|
35
|
+
# @param json [String] optional JSON from which to apply JSON path, default to response body
|
36
|
+
# @return [Object] value of first retrieved JSON element in form of Ruby object
|
37
|
+
# @raise [Exception] if JSON path is invalid or no matching JSON element found
|
38
|
+
def get json_path, json=nil
|
39
|
+
if json.nil?
|
40
|
+
json = JSON.parse body
|
41
|
+
end
|
42
|
+
results = JsonPath.new(json_path).on(json)
|
43
|
+
if results.empty?
|
44
|
+
raise %/Expected json path '#{json_path}' not found\n#{to_json_s}/
|
45
|
+
end
|
46
|
+
results.first
|
47
|
+
end
|
48
|
+
|
49
|
+
# Retrieve value of the first JSON element with given JSON path as given type
|
50
|
+
# @param json_path [String] a valid JSON path expression
|
51
|
+
# @param type [String] required type, possible values are 'numeric', 'array', 'string', 'boolean', 'numeric_string'
|
52
|
+
# or 'object'
|
53
|
+
# @param json [String] optional JSON from which to apply JSON path, default to response body
|
54
|
+
# @return [Object] value of first retrieved JSON element in form of given type
|
55
|
+
# @raise [Exception] if JSON path is invalid or no matching JSON element found or matching element does not match
|
56
|
+
# required type
|
57
|
+
def get_as_type json_path, type, json=nil
|
58
|
+
value = get json_path, json
|
59
|
+
case type
|
60
|
+
when 'numeric'
|
61
|
+
valid = value.is_a? Numeric
|
62
|
+
when 'array'
|
63
|
+
valid = value.is_a? Array
|
64
|
+
when 'string'
|
65
|
+
valid = value.is_a? String
|
66
|
+
when 'boolean'
|
67
|
+
valid = !!value == value
|
68
|
+
when 'numeric_string'
|
69
|
+
valid = value.is_a?(Numeric) or value.is_a?(String)
|
70
|
+
when 'object'
|
71
|
+
valid = value.is_a? Hash
|
72
|
+
else
|
73
|
+
raise %/Invalid expected type '#{type}'/
|
74
|
+
end
|
75
|
+
|
76
|
+
unless valid
|
77
|
+
raise %/Expect '#{json_path}' as a '#{type}' but was '#{value.class}'\n#{to_json_s}/
|
78
|
+
end
|
79
|
+
value
|
80
|
+
end
|
81
|
+
|
82
|
+
# Retrieve value of the first JSON element with given JSON path as given type, with nil value allowed
|
83
|
+
# @param json_path [String] a valid JSON path expression
|
84
|
+
# @param type [String] required type, possible values are 'numeric', 'array', 'string', 'boolean', 'numeric_string'
|
85
|
+
# or 'object'
|
86
|
+
# @param json [String] optional JSON from which to apply JSON path, default to response body
|
87
|
+
# @return [Object] value of first retrieved JSON element in form of given type or nil
|
88
|
+
# @raise [Exception] if JSON path is invalid or no matching JSON element found or matching element does not match
|
89
|
+
# required type
|
90
|
+
def get_as_type_or_null json_path, type, json=nil
|
91
|
+
value = get json_path, json
|
92
|
+
value.nil? ? value : get_as_type(json_path, type, json)
|
93
|
+
end
|
94
|
+
|
95
|
+
# Retrieve pretty JSON response for logging
|
96
|
+
# @return [String] pretty JSON response if verbose setting is true, empty string otherwise
|
97
|
+
def to_json_s
|
98
|
+
if ENV['cucumber_api_verbose'] == 'true'
|
99
|
+
JSON.pretty_generate(JSON.parse to_s)
|
100
|
+
else
|
101
|
+
''
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'net/ssh'
|
2
|
+
When /^I ssh to "([^\"]*)" with the following credentials:$/ do |hostname, table|
|
3
|
+
@keys = []
|
4
|
+
@auth_methods ||= %w(password)
|
5
|
+
session = table.hashes.first
|
6
|
+
session_keys = Array.new(@keys)
|
7
|
+
session_auth_methods = Array.new(@auth_methods)
|
8
|
+
if session["keyfile"]
|
9
|
+
session_keys << session["keyfile"]
|
10
|
+
session_auth_methods << "publickey"
|
11
|
+
end
|
12
|
+
|
13
|
+
@connection = Net::SSH.start(hostname, session["username"], :password => session["password"],
|
14
|
+
:auth_methods => session_auth_methods,
|
15
|
+
:keys => session_keys)
|
16
|
+
end
|
17
|
+
|
18
|
+
When /^I run "([^\"]*)"$/ do |command|
|
19
|
+
@output = @connection.exec!(command)
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
Then /^show me the output$/ do
|
24
|
+
p @output
|
25
|
+
end
|
26
|
+
|
27
|
+
Then /^I should see "([^\"]*)" in the output$/ do |string|
|
28
|
+
IFD_Assertion.assert_string_equal(string, @output.strip)
|
29
|
+
end
|
30
|
+
|
31
|
+
When /^I run ssh command from previous step$/ do
|
32
|
+
unless @file_data.nil?
|
33
|
+
begin
|
34
|
+
@file_data.each_line do |line|
|
35
|
+
if line.nil? || line =~ /^\s*\n*--/
|
36
|
+
next
|
37
|
+
end
|
38
|
+
line = line.strip();
|
39
|
+
p line
|
40
|
+
@output = @connection.exec!(line)
|
41
|
+
sleep 1
|
42
|
+
end
|
43
|
+
rescue Exception => e
|
44
|
+
raise e.message
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,293 @@
|
|
1
|
+
require_relative 'required_libs'
|
2
|
+
# require_relative 'Ifd_Automation_support/web_service_helpers.rb'
|
3
|
+
# Navigate to a particular page
|
4
|
+
Given(/^I am on the "([^"]*)" page$/) do |url|
|
5
|
+
request_url = check_match_url url
|
6
|
+
execute_openbrowser(request_url)
|
7
|
+
end
|
8
|
+
|
9
|
+
#Navigating to the login page
|
10
|
+
Given /^I am on Login Page$/ do
|
11
|
+
execute_openbrowser($_CFWEB['Page Address'])
|
12
|
+
end
|
13
|
+
|
14
|
+
# Wait for the specific time
|
15
|
+
When /^I wait for (\d+) seconds$/ do |second|
|
16
|
+
sleep(second.to_i)
|
17
|
+
end
|
18
|
+
|
19
|
+
# Finds a button or link by id, text or value and clicks it
|
20
|
+
And /^I click on "([^\"]*)"$/ do |object|
|
21
|
+
patiently do
|
22
|
+
execute_click(object)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
# Finds and clicks it with JS
|
27
|
+
And /^I move mouse to element "([^\"]*)" then click$/ do |object|
|
28
|
+
patiently do
|
29
|
+
execute_mousehoverandclick(object)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
# Fill in a text box or text area with a value
|
34
|
+
And /^I set text on "(.*?)" with "(.*?)"$/ do |object, text|
|
35
|
+
patiently do
|
36
|
+
request_url = check_match_url text
|
37
|
+
# text = var_collect(text)
|
38
|
+
# text = replace_pipe(text)
|
39
|
+
execute_settext(object, request_url)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# set state for check box, combo box
|
44
|
+
And /^I set state on "(.*?)" with "(.*?)"$/ do |object, state|
|
45
|
+
patiently do
|
46
|
+
execute_setstate(object, state)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
# Input data to text box, this function support in case user want to input data into many text boxes on the same time
|
51
|
+
When /^I input data to web form with following values:$/ do |value|
|
52
|
+
patiently do
|
53
|
+
records = Util.read_table_data_from_steps_with_header(value.raw)
|
54
|
+
records = JSON.parse(JSON.generate(records))
|
55
|
+
records.each { |rows|
|
56
|
+
rows.each { |col, val|
|
57
|
+
step %{I set text on "#{col}" with "#{val}"}
|
58
|
+
}
|
59
|
+
}
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
When /^I run the following steps?:$/ do |steps_table|
|
64
|
+
patiently do
|
65
|
+
steps = steps_table.raw.flatten
|
66
|
+
steps.each do |step|
|
67
|
+
call_step step
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
When /^I click on following elements:$/ do |object|
|
73
|
+
patiently do
|
74
|
+
object.raw.each do |lines|
|
75
|
+
lines.each do |line|
|
76
|
+
step %{I click on "#{line}"}
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
Then /^I run following steps in iframe (index|name) (.*):$/ do |frame_type, frame, step_table|
|
83
|
+
case frame_type.to_sym
|
84
|
+
when :index
|
85
|
+
steps = step_table.raw.flatten
|
86
|
+
browser = page.driver.browser
|
87
|
+
browser.switch_to.frame(frame.to_i)
|
88
|
+
steps.each do |step|
|
89
|
+
call_step step
|
90
|
+
end
|
91
|
+
browser.switch_to.default_content
|
92
|
+
when :name
|
93
|
+
browser = page.driver.browser
|
94
|
+
browser.switch_to.frame(frame.to_s)
|
95
|
+
steps.each do |step|
|
96
|
+
call_step step
|
97
|
+
end
|
98
|
+
browser.switch_to.default_content
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
Given /^I get text on "(.*)" then store it as "(.*)"$/ do |object, place_holder|
|
103
|
+
if object.nil?
|
104
|
+
raise 'No text found'
|
105
|
+
end
|
106
|
+
@stored = {} if @stored.nil?
|
107
|
+
@stored[%/#{place_holder}/] = execute_gettext(object)
|
108
|
+
end
|
109
|
+
|
110
|
+
# get text for object
|
111
|
+
# And /^I get text on "(.*?)" then store it into file "(.*)"$/ do |object, file_name|
|
112
|
+
# patiently do
|
113
|
+
# $text = execute_gettext(object)
|
114
|
+
# open($test_data_dir+file_name, 'a+') do |f|
|
115
|
+
# f << $text + "\n"
|
116
|
+
# end
|
117
|
+
# end
|
118
|
+
# end
|
119
|
+
|
120
|
+
# Fill in a text box or text area with a value from $test_data_dir file
|
121
|
+
# And /^I set text on "(.*?)" with value from file "(.*)"$/ do |object, file_name|
|
122
|
+
# patiently do
|
123
|
+
# expected_file= ($test_data_dir + file_name)
|
124
|
+
# if File.exist?(expected_file)
|
125
|
+
# # data_file = File.read(expected_file)
|
126
|
+
# data_file = read_file(expected_file)
|
127
|
+
# execute_settext(object, data_file)
|
128
|
+
# # data_file.each_line do |line|
|
129
|
+
# # execute_settext(object, line)
|
130
|
+
# # end
|
131
|
+
# else
|
132
|
+
# raise "*** ERROR: File #{file_name} is not existed!"
|
133
|
+
# end
|
134
|
+
# end
|
135
|
+
# end
|
136
|
+
|
137
|
+
# Upload new file windows
|
138
|
+
When /^I click on "(.*?)" to upload file "(.*?)"$/ do |object, file_name|
|
139
|
+
patiently do
|
140
|
+
execute_click_to_upload(object, file_name)
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
# Drag mouse hover on element
|
145
|
+
When /^I move mouse to element "(.*?)"$/ do |element|
|
146
|
+
patiently do
|
147
|
+
execute_hover_mouse_on(element)
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
And /^I click on "(.*?)" and wait (\d+) seconds$/ do |object, seconds|
|
152
|
+
execute_click(object)
|
153
|
+
sleep(seconds.to_i)
|
154
|
+
end
|
155
|
+
|
156
|
+
And /^I drag object "(.*?)" to "(.*?)"$/ do |from_object, object|
|
157
|
+
patiently do
|
158
|
+
execute_drag_to_new_object(from_object, object)
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
And /^I type to "(.*)" key is "(.*?)"$/ do |object, keys|
|
163
|
+
patiently do
|
164
|
+
keys = var_collect(keys)
|
165
|
+
execute_sendkeys(object, keys)
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
# Click on ID of link or text of link
|
170
|
+
When /^I click on "([^\"]*)" link$/ do |link|
|
171
|
+
patiently do
|
172
|
+
click_link link
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
# Attach a file to a file upload form field
|
177
|
+
When /^(?:|I )attach the file "([^"]*)" to "([^"]*)"$/ do |path, field|
|
178
|
+
patiently do
|
179
|
+
attach_file(field, File.expand_path(path))
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
# double click on web element
|
184
|
+
Then(/^I double click on element "(.*?)"$/) do |element|
|
185
|
+
patiently do
|
186
|
+
double_click(element)
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
# step to resize browser
|
191
|
+
Then(/^I resize browser window size to width (\d+) and height (\d+)$/) do |width, heigth|
|
192
|
+
resize_browser(width, heigth)
|
193
|
+
end
|
194
|
+
|
195
|
+
# step to maximize browser
|
196
|
+
Then(/^I maximize browser window$/) do
|
197
|
+
maximize_browser
|
198
|
+
end
|
199
|
+
|
200
|
+
Then(/^I switch to window having title "(.*?)"$/) do |window_title|
|
201
|
+
switch_to_window_by_title window_title
|
202
|
+
end
|
203
|
+
|
204
|
+
Then(/^I take screenshot$/) do
|
205
|
+
take_screenshot
|
206
|
+
end
|
207
|
+
|
208
|
+
# steps to scroll web page to top or end
|
209
|
+
Then(/^I scroll to (top|end) of page$/) do |to|
|
210
|
+
scroll_page(to)
|
211
|
+
end
|
212
|
+
|
213
|
+
Then /^I should( not)? see page title as (.*)$/ do |present, title|
|
214
|
+
check_title(title, present.empty?)
|
215
|
+
end
|
216
|
+
|
217
|
+
Then(/^I should\s*((?:not)?)\s+see page title having partial text as "(.*?)"$/) do |present, partial_text_title|
|
218
|
+
check_partial_title(partial_text_title, present.empty?)
|
219
|
+
end
|
220
|
+
|
221
|
+
# check property for object
|
222
|
+
Then /^I check property "(.*?)" with "(.*?)" has( | not)? value "(.*?)"$/ do |object, property, negate, value|
|
223
|
+
value = var_collect(value)
|
224
|
+
execute_checkproperty(object, property, negate, value)
|
225
|
+
end
|
226
|
+
|
227
|
+
Then /^the following multiline step should (fail|succeed):$/ do |expectation, multiline_step|
|
228
|
+
multiline_step = multiline_step.gsub(%{'''}, %{"""})
|
229
|
+
if expectation == 'fail'
|
230
|
+
expect { steps(multiline_step) }.to raise_error(RSPEC_EXPECTATION_NOT_MET_ERROR)
|
231
|
+
else # succeed
|
232
|
+
steps(multiline_step)
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
236
|
+
Then /^I should see a form with the following values:$/ do |table|
|
237
|
+
expectations = table.raw
|
238
|
+
expectations.each do |label, expected_value|
|
239
|
+
step %(I check property "#{label}" with "text" has value "#{expected_value}")
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
Then /^Status of "([^\"]*)" should be "(disabled|enabled)"$/ do |element, status|
|
244
|
+
puts "status: #{status} => status =='disabled': #{status =='disabled'}"
|
245
|
+
foundElement = if(status =='disabled')
|
246
|
+
find_object(element + "{'disabled':'true'}")
|
247
|
+
elsif (status =='enabled')
|
248
|
+
find_object(element + "{'disabled':''}")
|
249
|
+
else
|
250
|
+
puts "Error >> '#{status }' status is not support."
|
251
|
+
exit
|
252
|
+
end
|
253
|
+
|
254
|
+
if foundElement == nil
|
255
|
+
puts "Error >> Not found object..."
|
256
|
+
exit
|
257
|
+
end
|
258
|
+
end
|
259
|
+
|
260
|
+
And /^I check( not)? exists element is "(.*?)"$/ do |negate, object|
|
261
|
+
#negate = negate.strip if negate != nil
|
262
|
+
execute_checkexists(negate, object,2)
|
263
|
+
end
|
264
|
+
|
265
|
+
# step to assert checkbox is checked or unchecked
|
266
|
+
Then(/^checkbox "(.*?)" should be (checked|unchecked)$/) do |element, state|
|
267
|
+
flag = state == 'checked'
|
268
|
+
is_checkbox_checked(element, flag)
|
269
|
+
end
|
270
|
+
|
271
|
+
# steps to assert radio button checked or unchecked
|
272
|
+
Then(/^radio button "(.*?)" should be (selected|unselected)$/) do |element, state|
|
273
|
+
flag = state == 'selected'
|
274
|
+
is_radio_button_selected(element, flag)
|
275
|
+
end
|
276
|
+
|
277
|
+
# step to assert javascript pop-up alert text
|
278
|
+
Then(/^I should see alert text as "(.*?)"$/) do |actual_value|
|
279
|
+
check_alert_text(actual_value)
|
280
|
+
end
|
281
|
+
|
282
|
+
# step to assert difference in images
|
283
|
+
Then(/^actual image having (.+) "(.*?)" and expected image having (.+) "(.*?)" should be similar$/) do |actual_img_access_type, actual_img_access_name, excp_img_access_type, excp_img_access_name|
|
284
|
+
IFD_Assertion.does_images_similar?(actual_img_access_type, actual_img_access_name, excp_img_access_type, excp_img_access_name)
|
285
|
+
end
|
286
|
+
|
287
|
+
# step to check element enabled or not
|
288
|
+
Then(/^element "([^\"]*)" should\s*((?:not)?)\s+be (enabled|disabled)$/) do |element, present, state|
|
289
|
+
flag = state == 'enabled'
|
290
|
+
flag = !flag unless present.empty?
|
291
|
+
check_element_enable(element, flag)
|
292
|
+
end
|
293
|
+
|