scoutui 2.0.3.6.pre → 2.0.3.7.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/scoutui/commands/assign_var.rb +93 -0
- data/lib/scoutui/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d1bde2243f6f7d0ad9afd542006b072fdcd0c98
|
4
|
+
data.tar.gz: 6306c24279d6787ab6f73cad34262f7de9f0eafe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 742cc96860a30b60c161c0f718e8379b23ef3a264cff6b06dac9df40d2c101ac13a6b12b481c0bb73b3644c2602eea7a81d585560d52037aa2bd35765e98ce08
|
7
|
+
data.tar.gz: 059fcb3c7d249019cc58c6181f0a7c9d72f6487da13fb754e64bc4337c2e5e7f4ddb8b4cc949f20578db8da929ec17dc2718cb1837c6bba486396256b86428e8
|
@@ -0,0 +1,93 @@
|
|
1
|
+
require_relative './commands'
|
2
|
+
|
3
|
+
module Scoutui::Commands
|
4
|
+
|
5
|
+
class AssignVar < Command
|
6
|
+
|
7
|
+
|
8
|
+
def execute(drv, e=nil)
|
9
|
+
@drv=drv if !drv.nil?
|
10
|
+
rc=nil
|
11
|
+
|
12
|
+
_req = Scoutui::Utils::TestUtils.instance.getReq()
|
13
|
+
|
14
|
+
_uservar = @cmd.match(/assign\(([\w]+)\s*\,(.*)\)\s*$/)[1].to_s.strip
|
15
|
+
_condition = @cmd.match(/assign\(([\w]+)\s*\,(.*)\)\s*$/)[2].to_s.strip
|
16
|
+
|
17
|
+
Scoutui::Logger::LogMgr.instance.command.info __FILE__ + (__LINE__).to_s + " assignVar => #{_uservar} : #{_condition}"
|
18
|
+
|
19
|
+
|
20
|
+
if _condition.match(/^\s*(text|value)\s*\(/i)
|
21
|
+
_locator=_condition.match(/^\s*(text|value)\s*\((.*)\)\s*$/i)[2].to_s.strip
|
22
|
+
end
|
23
|
+
|
24
|
+
_locator = Scoutui::Base::UserVars.instance.normalize(_locator)
|
25
|
+
|
26
|
+
Scoutui::Logger::LogMgr.instance.command.info __FILE__ + (__LINE__).to_s + " | translate : #{_locator}" if Scoutui::Utils::TestUtils.instance.isDebug?
|
27
|
+
|
28
|
+
begin
|
29
|
+
|
30
|
+
obj = Scoutui::Base::QBrowser.findElement(@drv, _locator, Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
|
31
|
+
|
32
|
+
|
33
|
+
if obj
|
34
|
+
|
35
|
+
# Refactor in qbrowser
|
36
|
+
|
37
|
+
wait = Selenium::WebDriver::Wait.new(:timeout => Scoutui::Commands::Utils.instance.getTimeout)
|
38
|
+
|
39
|
+
isDisplayed=false
|
40
|
+
isDisplayed = wait.until {
|
41
|
+
true if obj.displayed?
|
42
|
+
}
|
43
|
+
|
44
|
+
|
45
|
+
rc = obj.text if _condition.match(/^\s*text/i)
|
46
|
+
rc = obj.attribute('value') if _condition.match(/^\s*value/i)
|
47
|
+
Scoutui::Base::UserVars.instance.setVar(_uservar, rc)
|
48
|
+
|
49
|
+
|
50
|
+
puts __FILE__ + (__LINE__).to_s + " rc :: #{Scoutui::Base::UserVars.instance.getVar(_uservar)}"
|
51
|
+
|
52
|
+
|
53
|
+
|
54
|
+
# puts __FILE__ + (__LINE__).to_s + " Pause"; gets
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
if isDisplayed
|
60
|
+
|
61
|
+
# isEnabled = wait.until { obj.enabled? }
|
62
|
+
# Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " obj is enabled : #{isEnabled}"
|
63
|
+
# obj.click
|
64
|
+
# _clicked=true
|
65
|
+
|
66
|
+
# page_elt = Scoutui::Utils::TestUtils.instance.getPageElement(_locator)
|
67
|
+
# Scoutui::Logger::LogMgr.instance.debug "PageElement(#{_locator}) => #{page_elt}"
|
68
|
+
# _whenClicked(page_elt)
|
69
|
+
else
|
70
|
+
Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " Element, #{_locator} is not displayed."
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
74
|
+
|
75
|
+
rescue => ex
|
76
|
+
Scoutui::Logger::LogMgr.instance.warn "Error during processing: #{ex}"
|
77
|
+
Scoutui::Logger::LogMgr.instance.warn "Backtrace:\n\t#{ex.backtrace.join("\n\t")}"
|
78
|
+
end
|
79
|
+
|
80
|
+
Scoutui::Logger::LogMgr.instance.asserts.info "Verify object to assign exists #{_locator} : #{obj.class.to_s} - #{!obj.nil?.to_s}"
|
81
|
+
# Scoutui::Logger::LogMgr.instance.asserts.info "Verify clicked #{_locator} - #{_clicked.to_s}"
|
82
|
+
|
83
|
+
Testmgr::TestReport.instance.getReq(_req).testcase('click').add(!obj.nil?, "Verify object to assign exists #{_locator} : #{obj.class.to_s}")
|
84
|
+
# Testmgr::TestReport.instance.getReq(_req).testcase('click').add(_clicked, "Verify clicked #{_locator}")
|
85
|
+
|
86
|
+
setResult(!rc.nil?)
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
end
|
data/lib/scoutui/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scoutui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.3.
|
4
|
+
version: 2.0.3.7.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Kim
|
@@ -226,6 +226,7 @@ files:
|
|
226
226
|
- lib/scoutui/base/test_settings.rb
|
227
227
|
- lib/scoutui/base/user_vars.rb
|
228
228
|
- lib/scoutui/base/visual_test_framework.rb
|
229
|
+
- lib/scoutui/commands/assign_var.rb
|
229
230
|
- lib/scoutui/commands/click_object.rb
|
230
231
|
- lib/scoutui/commands/command.rb
|
231
232
|
- lib/scoutui/commands/commands.rb
|