itms_automation 2.8.2 → 2.8.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/itms_automation/methods/assertion_methods.rb +36 -19
- data/lib/itms_automation/methods/condition_methods.rb +6 -3
- data/lib/itms_automation/methods/input_methods.rb +9 -5
- data/lib/itms_automation/methods/misc_methods.rb +12 -1
- data/lib/itms_automation/methods/navigate_methods.rb +5 -3
- data/lib/itms_automation/methods/progress_methods.rb +21 -11
- data/lib/itms_automation/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dec98f9acd2a74f763a02858397331752fde66e5bd1ab36422085026b12b2c2b
|
4
|
+
data.tar.gz: 34dd0b3422166bbef9b37b4a1486e2d994474d7b8f79794ce63ae450254a24a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f708a4d1cbd74c4bc2025f4c75e40d49b78b0310e4231c070ecb6455133090870d4f3cd747e680445eabd4ec0e18bcbd2cbaf0e050a01cc37f430524049d3863
|
7
|
+
data.tar.gz: 5700dee490875c1790adb9c8276a36e40aa678bb5aa25f7843599b08c9cd508aab4408ba63b26ccdd119c9f986174fcbd8e75eafacb5e9909a8fd008b93415bc
|
@@ -7,16 +7,18 @@ require 'rspec'
|
|
7
7
|
# Method to verify title
|
8
8
|
# param 1: String : expected title
|
9
9
|
def assert_title(title)
|
10
|
-
|
10
|
+
text = check_is_using_variable(title)
|
11
|
+
expect($driver.title).to eq(text)
|
11
12
|
end
|
12
13
|
|
13
14
|
# Method to check element text
|
14
15
|
# param 1 : String : Element
|
15
16
|
# param 2 : String : Expected element text
|
16
17
|
def assert_text(element, expected_value)
|
18
|
+
text = check_is_using_variable(expected_value)
|
17
19
|
found_element = find_object(element)
|
18
20
|
element_text = found_element.text
|
19
|
-
expect(element_text).to eq(
|
21
|
+
expect(element_text).to eq(text)
|
20
22
|
end
|
21
23
|
|
22
24
|
# method to check element presence
|
@@ -47,14 +49,16 @@ end
|
|
47
49
|
|
48
50
|
# method to check javascript pop-up alert text
|
49
51
|
def assert_alert(text)
|
52
|
+
value = check_is_using_variable(text)
|
50
53
|
alert_text = $driver.switch_to.alert.text
|
51
|
-
expect(alert_text).to eq(
|
54
|
+
expect(alert_text).to eq(value)
|
52
55
|
end
|
53
56
|
|
54
57
|
# method to check javascript pop-up alert text
|
55
58
|
def assert_confirmation(text)
|
59
|
+
value = check_is_using_variable(text)
|
56
60
|
alert_text = $driver.switch_to.alert.text
|
57
|
-
expect(alert_text).to eq(
|
61
|
+
expect(alert_text).to eq(value)
|
58
62
|
end
|
59
63
|
|
60
64
|
def assert_editable(element)
|
@@ -68,38 +72,44 @@ def assert_not_editable
|
|
68
72
|
end
|
69
73
|
|
70
74
|
def assert_not_selected_value(element, text)
|
75
|
+
value = check_is_using_variable(text)
|
71
76
|
found_element = find_object(element)
|
72
77
|
value = found_element.attribute("value")
|
73
|
-
expect(value).not_to eq(
|
78
|
+
expect(value).not_to eq(value)
|
74
79
|
end
|
75
80
|
|
76
81
|
def assert_not_text(element, text)
|
82
|
+
value = check_is_using_variable(text)
|
77
83
|
found_element = find_object(element)
|
78
|
-
expect(found_element.text).not_to eq(
|
84
|
+
expect(found_element.text).not_to eq(value)
|
79
85
|
end
|
80
86
|
|
81
87
|
def assert_prompt(text)
|
88
|
+
value = check_is_using_variable(text)
|
82
89
|
alert_text = $driver.switch_to.alert.text
|
83
|
-
expect(alert_text).to eq(
|
90
|
+
expect(alert_text).to eq(value)
|
84
91
|
end
|
85
92
|
|
86
93
|
def assert_selected_label(element, text)
|
94
|
+
value = check_is_using_variable(text)
|
87
95
|
found_element = find_object(element)
|
88
96
|
locator = "option[@value='#{found_element.attribute('value')}']"
|
89
97
|
selected_text = found_element.find_element(:xpath, locator).text
|
90
|
-
expect(selected_text).to eq(
|
98
|
+
expect(selected_text).to eq(value)
|
91
99
|
end
|
92
100
|
|
93
101
|
def assert_value(element, text)
|
102
|
+
value = check_is_using_variable(text)
|
94
103
|
found_element = find_object(element)
|
95
104
|
value = found_element.attribute("value")
|
96
|
-
expect(value).to eq(
|
105
|
+
expect(value).to eq(value)
|
97
106
|
end
|
98
107
|
|
99
|
-
def assert_selected_value
|
108
|
+
def assert_selected_value(text)
|
109
|
+
value = check_is_using_variable(text)
|
100
110
|
found_element = find_object(element)
|
101
111
|
value = found_element.attribute("value")
|
102
|
-
expect(value).to eq(
|
112
|
+
expect(value).to eq(value)
|
103
113
|
end
|
104
114
|
|
105
115
|
def assert(var_name, value)
|
@@ -118,16 +128,18 @@ end
|
|
118
128
|
# Method to verify title
|
119
129
|
# param 1: String : expected title
|
120
130
|
def verify_title(title)
|
121
|
-
|
131
|
+
value = check_is_using_variable(title)
|
132
|
+
expect($driver.title).to eq(value)
|
122
133
|
end
|
123
134
|
|
124
135
|
# Method to check element text
|
125
136
|
# param 1 : String : Element
|
126
137
|
# param 2 : String : Expected element text
|
127
138
|
def verify_text(element, expected_value)
|
139
|
+
text = check_is_using_variable(expected_value)
|
128
140
|
found_element = find_object(element)
|
129
141
|
element_text = found_element.text
|
130
|
-
expect(element_text).to eq(
|
142
|
+
expect(element_text).to eq(text)
|
131
143
|
end
|
132
144
|
|
133
145
|
# method to check element presence
|
@@ -167,33 +179,38 @@ def verify_not_editable
|
|
167
179
|
end
|
168
180
|
|
169
181
|
def verify_not_selected_value(element, text)
|
182
|
+
value = check_is_using_variable(text)
|
170
183
|
found_element = find_object(element)
|
171
184
|
value = found_element.attribute("value")
|
172
|
-
expect(value).not_to eq(
|
185
|
+
expect(value).not_to eq(value)
|
173
186
|
end
|
174
187
|
|
175
188
|
def verify_not_text(element, text)
|
189
|
+
value = check_is_using_variable(text)
|
176
190
|
found_element = find_object(element)
|
177
|
-
expect(found_element.text).not_to eq(
|
191
|
+
expect(found_element.text).not_to eq(value)
|
178
192
|
end
|
179
193
|
|
180
194
|
def verify_selected_label(element, text)
|
195
|
+
value = check_is_using_variable(text)
|
181
196
|
found_element = find_object(element)
|
182
197
|
locator = "option[@value='#{found_element.attribute('value')}']"
|
183
198
|
selected_text = found_element.find_element(:xpath, locator).text
|
184
|
-
expect(selected_text).to eq(
|
199
|
+
expect(selected_text).to eq(value)
|
185
200
|
end
|
186
201
|
|
187
202
|
def verify_value(element, text)
|
203
|
+
value = check_is_using_variable(text)
|
188
204
|
found_element = find_object(element)
|
189
205
|
value = found_element.attribute("value")
|
190
|
-
expect(value).to eq(
|
206
|
+
expect(value).to eq(value)
|
191
207
|
end
|
192
208
|
|
193
|
-
def verify_selected_value
|
209
|
+
def verify_selected_value(text)
|
210
|
+
value = check_is_using_variable(text)
|
194
211
|
found_element = find_object(element)
|
195
212
|
value = found_element.attribute("value")
|
196
|
-
expect(value).to eq(
|
213
|
+
expect(value).to eq(value)
|
197
214
|
end
|
198
215
|
|
199
216
|
def verify(var_name, value)
|
@@ -1,13 +1,16 @@
|
|
1
1
|
require_relative 'required_files'
|
2
2
|
|
3
3
|
def if(condition_script)
|
4
|
-
|
4
|
+
value = check_is_using_variable(condition_script)
|
5
|
+
$driver.execute_script(value)
|
5
6
|
end
|
6
7
|
|
7
8
|
def else_if(condition_script)
|
8
|
-
|
9
|
+
value = check_is_using_variable(condition_script)
|
10
|
+
$driver.execute_script(value)
|
9
11
|
end
|
10
12
|
|
11
13
|
def while(condition_script)
|
12
|
-
|
14
|
+
value = check_is_using_variable(condition_script)
|
15
|
+
$driver.execute_script(value)
|
13
16
|
end
|
@@ -8,10 +8,11 @@ end
|
|
8
8
|
|
9
9
|
# method to send keys
|
10
10
|
def send_keys(element, key)
|
11
|
+
value = check_is_using_variable(key)
|
11
12
|
keys_support = ["KEY_LEFT", "KEY_UP", "KEY_RIGHT", "KEY_DOWN", "KEY_PAGE_UP", "KEY_PAGE_DOWN", "KEY_BACKSPACE", "KEY_DELETE", "KEY_ENTER", "KEY_TAB"]
|
12
13
|
foundElement = find_object(element)
|
13
|
-
if
|
14
|
-
get_key =
|
14
|
+
if value
|
15
|
+
get_key = value.strip[/^\$\{(.*?)\}$/, 1]
|
15
16
|
raise TestCaseFailed, "${get_key} key is not supported. Supported keys: KEY_LEFT, KEY_UP, KEY_RIGHT, KEY_DOWN, KEY_PAGE_UP, KEY_PAGE_DOWN, KEY_BACKSPACE, KEY_DELETE, KEY_ENTER, KEY_TAB" unless keys_support.include?(get_key)
|
16
17
|
key_convert = get_key[/^KEY_(.*?)$/, 1].downcase.to_sym
|
17
18
|
foundElement.send_keys(key_convert)
|
@@ -72,18 +73,21 @@ def select_option_from_radio_button_group(element, by, option)
|
|
72
73
|
end
|
73
74
|
|
74
75
|
def edit_content(element, text)
|
76
|
+
value = check_is_using_variable(text)
|
75
77
|
found_element = find_object(element)
|
76
|
-
$driver.execute_script("if (arguments[0].contentEditable === 'true') {arguments[0].innerText = '#{
|
78
|
+
$driver.execute_script("if (arguments[0].contentEditable === 'true') {arguments[0].innerText = '#{value}'}", found_element)
|
77
79
|
end
|
78
80
|
|
79
81
|
def add_selection(element, label)
|
82
|
+
value = check_is_using_variable(label)
|
80
83
|
found_element = find_object(element)
|
81
|
-
found_element.find_element(:xpath, "//option[. = '#{
|
84
|
+
found_element.find_element(:xpath, "//option[. = '#{value}']").click
|
82
85
|
end
|
83
86
|
|
84
87
|
def remove_selection(element, label)
|
88
|
+
value = check_is_using_variable(label)
|
85
89
|
found_element = find_object(element)
|
86
|
-
found_element.find_element(:xpath, "//option[. = '#{
|
90
|
+
found_element.find_element(:xpath, "//option[. = '#{value}']").click
|
87
91
|
end
|
88
92
|
|
89
93
|
def select(element)
|
@@ -51,7 +51,6 @@ def load_object_repository
|
|
51
51
|
begin
|
52
52
|
loadYAMLfile("features/step_definitions/repositories/project_object.yml")
|
53
53
|
rescue => exception
|
54
|
-
p "exception:::#{exception.message}"
|
55
54
|
print_error_object_repository
|
56
55
|
end
|
57
56
|
end
|
@@ -63,3 +62,15 @@ def loadYAMLfile(filename)
|
|
63
62
|
raise "Syntax error when reading file: #{ex}"
|
64
63
|
end
|
65
64
|
end
|
65
|
+
|
66
|
+
def check_using_variable(text)
|
67
|
+
regex = /\$\{(.*?)\}/
|
68
|
+
text.scan(regex).each do |var|
|
69
|
+
value = $vars[var[0].to_sym]
|
70
|
+
if value
|
71
|
+
replace = "${#{var[0]}}"
|
72
|
+
text.gsub!(replace, "#{value}")
|
73
|
+
end
|
74
|
+
end
|
75
|
+
text
|
76
|
+
end
|
@@ -2,7 +2,8 @@ require_relative 'required_files'
|
|
2
2
|
|
3
3
|
# method to open link
|
4
4
|
def open(link)
|
5
|
-
|
5
|
+
value = check_is_using_variable(link)
|
6
|
+
$driver.get(value)
|
6
7
|
end
|
7
8
|
|
8
9
|
# method to navigate back & forward
|
@@ -53,8 +54,9 @@ end
|
|
53
54
|
|
54
55
|
# Method to resize browser
|
55
56
|
def set_window_size(resolution)
|
56
|
-
|
57
|
-
|
57
|
+
value = check_is_using_variable(resolution)
|
58
|
+
raise TestCaseFailed, 'Wrong format of resolution. (e.g., 1280x800)' unless value.match(/^\d+x\d+$/)
|
59
|
+
width, height = value.split("x")
|
58
60
|
$driver.manage.resize_to(width, heigth)
|
59
61
|
end
|
60
62
|
|
@@ -1,21 +1,25 @@
|
|
1
1
|
require_relative 'required_files'
|
2
2
|
|
3
3
|
def pause(time)
|
4
|
-
|
4
|
+
value = check_is_using_variable(time)
|
5
|
+
sleep value.to_i
|
5
6
|
end
|
6
7
|
|
7
8
|
def wait_for_element_editable(element, duration)
|
8
|
-
|
9
|
+
value = check_is_using_variable(duration)
|
10
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => value.to_i / 1000)
|
9
11
|
wait.until { find_object(element).enabled? }
|
10
12
|
end
|
11
13
|
|
12
14
|
def wait_for_element_not_editable(element, duration)
|
13
|
-
|
15
|
+
value = check_is_using_variable(duration)
|
16
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => value.to_i / 1000)
|
14
17
|
wait.until { !find_object(element).enabled? }
|
15
18
|
end
|
16
19
|
|
17
20
|
def wait_for_element_not_present(element, duration)
|
18
|
-
|
21
|
+
value = check_is_using_variable(duration)
|
22
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => value.to_i / 1000)
|
19
23
|
wait.until do
|
20
24
|
begin
|
21
25
|
!find_object(element)
|
@@ -26,28 +30,33 @@ def wait_for_element_not_present(element, duration)
|
|
26
30
|
end
|
27
31
|
|
28
32
|
def wait_for_element_not_visible(element, duration)
|
29
|
-
|
33
|
+
value = check_is_using_variable(duration)
|
34
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => value.to_i / 1000)
|
30
35
|
wait.until { !find_object(element).displayed? }
|
31
36
|
end
|
32
37
|
|
33
38
|
def wait_for_text(element, text)
|
39
|
+
value = check_is_using_variable(text)
|
34
40
|
wait = Selenium::WebDriver::Wait.new(:timeout => 30)
|
35
|
-
wait.until { find_object(element).text ==
|
41
|
+
wait.until { find_object(element).text == value }
|
36
42
|
end
|
37
43
|
|
38
44
|
def wait_for_element_visible(element, duration)
|
39
|
-
|
45
|
+
value = check_is_using_variable(duration)
|
46
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => value.to_i / 1000)
|
40
47
|
wait.until { find_object(element).displayed? }
|
41
48
|
end
|
42
49
|
|
43
50
|
def wait_for_element_present(element, duration)
|
44
|
-
|
51
|
+
value = check_is_using_variable(duration)
|
52
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => value.to_i / 1000)
|
45
53
|
wait.until { find_object(element) }
|
46
54
|
end
|
47
55
|
|
48
56
|
def answer_on_next_prompt(answer)
|
57
|
+
value = check_is_using_variable(answer)
|
49
58
|
alert = $driver.switch_to.alert
|
50
|
-
alert.send_keys(
|
59
|
+
alert.send_keys(value)
|
51
60
|
alert.accept()
|
52
61
|
end
|
53
62
|
|
@@ -63,9 +72,10 @@ def choose_ok_on_next_confirmation
|
|
63
72
|
$driver.switch_to.alert.accept
|
64
73
|
end
|
65
74
|
|
66
|
-
def webdriver_answer_on_visible_prompt
|
75
|
+
def webdriver_answer_on_visible_prompt(answer)
|
76
|
+
value = check_is_using_variable(answer)
|
67
77
|
alert = $driver.switch_to.alert
|
68
|
-
alert.send_keys(
|
78
|
+
alert.send_keys(value)
|
69
79
|
alert.accept()
|
70
80
|
end
|
71
81
|
|
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.8.
|
4
|
+
version: 2.8.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- INFOdation
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-04-
|
11
|
+
date: 2021-04-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cucumber
|