scoutui 2.0.3.25.pre → 2.0.3.26.pre

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fc82c07173e93d9774896bf6ab4e621a00990174
4
- data.tar.gz: 108d391194512236200a2abb6d7415643c83b0cd
3
+ metadata.gz: 7c6783826768bc5977a384aa09b0e27983ad1288
4
+ data.tar.gz: 42feaae713b7d18c646bb03ae2a69a2486426868
5
5
  SHA512:
6
- metadata.gz: 0ac17a5606dcc0191b1c28aa6870392bd52571a24182625ad10516e0b385c6d8ed4d42bf1a5c2d101091e505dafc7f3cec1b5f795eeb9e1a795aabae5eb1b8b4
7
- data.tar.gz: 33692c0644b4076b37a0ee7f3f38f89f8edbfa792e3263536f5a98e2c24b21db7d9945b62e6d9ac27efae36daca50ba296b0c35324a61464b76dc040ba545fcf
6
+ metadata.gz: 981d41edbbe8bc9d4b2139653eb30cdbb0b32adebe99962b41fff99cfaa99ba9a5149bd6ff8d12e68205f7c252dbde42cc33c925369cd6cf1ce32312f2f343f7
7
+ data.tar.gz: faeb7c953e1eb6cfd5b83d12f2bcc5e12a14cb7749f213e0e31bbb54ee562eaa65c01f5685471a334208b4ce1415124f3662a93ac8c1ce61d27cad66085466bb
@@ -51,7 +51,7 @@ run1()
51
51
 
52
52
  ruby $SCOUTUI_BIN \
53
53
  --config ${TESTCFG} \
54
- --user "expense.admin@scoutui.com" --password password1 \
54
+ --user "expense.admin@scoutui.com" --password password1 --role qa \
55
55
  --diff /tmp/vt \
56
56
  --pages ../appmodel/model.json \
57
57
  --eyes:run false \
@@ -15,6 +15,167 @@ module Scoutui::Base
15
15
  @drv=_drv
16
16
  end
17
17
 
18
+ def isValue?(my_driver, page_elt)
19
+
20
+ rc = false
21
+ _txt = nil
22
+
23
+ if page_elt.is_a?(String) && page_elt.match(/^\s*(text|value)\s*\(/)
24
+ #
25
+ # text(page(home).get(elt))
26
+ # value(page(home).get(elt))
27
+ #
28
+ _processed=true
29
+ condition = page_elt.match(/(value|text)\((.*)\)/)[1].to_s
30
+ tmpObj = page_elt.match(/(value|text)\((.*)\)/)[2].to_s
31
+ expectedVal = page_elt.match(/(value|text)\s*\(.*\)\s*\=\s*(.*)/)[2].to_s
32
+
33
+ xpath = Scoutui::Base::UserVars.instance.get(tmpObj)
34
+
35
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " locator : #{xpath}"; #gets
36
+
37
+ obj = Scoutui::Base::QBrowser.getObject(my_driver, xpath, Scoutui::Commands::Utils.instance.getTimeout)
38
+
39
+ puts __FILE__ + (__LINE__).to_s + " #{condition} : #{obj}"
40
+
41
+ if !obj.nil?
42
+ if condition.match(/^text/)
43
+ _txt = obj.text
44
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " text : #{_txt}"
45
+ expected_regex = Regexp.new(expectedVal)
46
+ rc = !_txt.to_s.match(expected_regex).nil?
47
+ elsif condition.match(/^value/)
48
+ _txt = obj.attribute('value')
49
+ expected_regex = Regexp.new(expectedVal)
50
+ rc = !_txt.to_s.match(expected_regex).nil?
51
+ end
52
+
53
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + "txt/val: #{_txt} rc => #{rc}"
54
+ end
55
+
56
+ end
57
+
58
+ rc
59
+ end
60
+
61
+
62
+ def isEnabled?(my_driver, _execute_when)
63
+ rc=true
64
+
65
+ _locator = _execute_when.match(/^\s*[!]*isEnabled\((.*)\)\s*$/i)[1].to_s
66
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " isChecked => #{_locator}"
67
+
68
+ _obj = Scoutui::Base::QBrowser.findElement(my_driver, _locator, Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
69
+
70
+ _state = _obj.enabled?
71
+
72
+ puts __FILE__ + (__LINE__).to_s + " _obj.enabled? => #{_state}"
73
+
74
+ if _execute_when.match(/^\s*!isEnabled/i) && _state
75
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " !isEnabled(#{_locator}) : false"
76
+ rc=false
77
+ elsif _execute_when.match(/^\s*isEnabled/i) && !_state
78
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " isEnabled(#{_locator}) : false"
79
+ rc=false
80
+ end
81
+
82
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " isEnabled?(#{_execute_when}) => #{rc}"
83
+ rc
84
+ end
85
+
86
+ def isSelected?(my_driver, _execute_when)
87
+ rc=true
88
+
89
+ _locator = _execute_when.match(/^\s*[!]*(isSelected|selected)\((.*)\)\s*$/i)[2].to_s
90
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " isChecked => #{_locator}"
91
+
92
+ _obj = Scoutui::Base::QBrowser.findElement(my_driver, _locator, Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
93
+
94
+ _state = _obj.selected?
95
+ puts __FILE__ + (__LINE__).to_s + " _obj.selected? => #{_state}"
96
+
97
+ if _execute_when.match(/^\s*!(isSelected|selected)/i) && _state
98
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " !isSelected(#{_locator}) : false"
99
+ rc=false
100
+ elsif _execute_when.match(/^\s*(isSelected|selected)/i) && !_state
101
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " isSelected(#{_locator}) : false"
102
+ rc=false
103
+ end
104
+
105
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " isSelected?(#{_execute_when}) => #{rc}"
106
+ rc
107
+ end
108
+
109
+
110
+ def isVisible?(my_driver, _execute_when)
111
+ rc=true
112
+
113
+ begin
114
+ _locator = _execute_when.match(/^\s*[!]*visible\((.*)\)\s*$/i)[1].to_s
115
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " visible => #{_locator}"
116
+
117
+ _obj = Scoutui::Base::QBrowser.findElement(my_driver, _locator, Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
118
+
119
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " obj => #{_obj}"
120
+
121
+ _state = false
122
+ if !_obj.nil? && _obj.is_a?(Selenium::WebDriver::Element)
123
+ wait = Selenium::WebDriver::Wait.new(:timeout => Scoutui::Commands::Utils.instance.getTimeout)
124
+ _state = wait.until { _obj.displayed? }
125
+ end
126
+
127
+
128
+ puts __FILE__ + (__LINE__).to_s + " _obj.displayed? => #{_state}"
129
+
130
+ if _execute_when.match(/^\s*!visible/i) && _state
131
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " !visible(#{_locator}) : false"
132
+ rc=false
133
+ elsif _execute_when.match(/^\s*visible/i) && !_state
134
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " visible(#{_locator}) : false"
135
+ rc=false
136
+ end
137
+
138
+ rescue => ex
139
+ rc=false
140
+ Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " #{ex.class.to_s}"
141
+ puts __FILE__ + (__LINE__).to_s + "Backtrace:\n\t#{ex.backtrace.join("\n\t")}"
142
+ end
143
+
144
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " visible?(#{_execute_when}) => #{rc}"
145
+ rc
146
+ end
147
+
148
+
149
+ def isRole?(_execute_when)
150
+
151
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " isRole?(#{_execute_when})"
152
+
153
+ rc=false
154
+
155
+ if _execute_when.match(/^\s*(isrole|role)\s*(.*)\s*$/i)
156
+ _role = _execute_when.match(/^\s*(isrole|role)\s*(.*)\s*$/i)[2].to_s
157
+ _expected_role = Scoutui::Utils::TestUtils.instance.getRole()
158
+
159
+ Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " Trigger: expected : #{_expected_role.to_s}, actual: #{_role.to_s}"
160
+
161
+ if !_expected_role.nil?
162
+ if _role.match(/#{_expected_role}/i)
163
+ Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " role matches"
164
+ rc=true
165
+ else
166
+ Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " roles do not match"
167
+ end
168
+
169
+ elsif _expected_role.nil?
170
+ Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + " Skip role based assertion since role was not provided"
171
+ end
172
+
173
+ end
174
+
175
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " isRole() => #{rc}"
176
+ rc
177
+ end
178
+
18
179
 
19
180
  def assertPage(my_driver, _pg, _req=nil)
20
181
  if _req.nil?
@@ -191,6 +352,8 @@ module Scoutui::Base
191
352
  Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " isEanbled(#{page_elt}"
192
353
  end
193
354
 
355
+
356
+
194
357
  #
195
358
  # { reqid : <pageElt> }
196
359
  def isVisible(my_driver, page_elt, _req=nil, _immediate=false)
@@ -453,14 +453,19 @@ module Scoutui::Base
453
453
 
454
454
  _req = Scoutui::Utils::TestUtils.instance.getReq()
455
455
 
456
- Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + "\to Expected: #{e[STEP_KEY]['expected'].class.to_s}" if Scoutui::Utils::TestUtils.instance.isDebug?
456
+ Scoutui::Logger::LogMgr.instance.info __FILE__ + (__LINE__).to_s + "processExpected()"
457
457
 
458
458
  Scoutui::Base::Assertions.instance.setDriver(my_driver)
459
459
 
460
460
  if e[STEP_KEY].has_key?('expected')
461
+
461
462
  expected_list=e[STEP_KEY]['expected']
463
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " => #{expected_list}"
464
+
462
465
 
463
466
  if expected_list.is_a?(Array)
467
+
468
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Process Arr of Expected"
464
469
  expected_list.each do |_condition|
465
470
  verifyCondition(my_driver, _condition)
466
471
  end
@@ -819,6 +824,77 @@ module Scoutui::Base
819
824
  next
820
825
  end
821
826
 
827
+ elsif _execute_when.is_a?(String) && _execute_when.match(/^\s*[!]*isEnabled\((.*)\)\s*$/i)
828
+
829
+
830
+ if !Scoutui::Base::Assertions.instance.isEnabled?(my_driver, _execute_when)
831
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " isEnabled => false"
832
+ next
833
+ end
834
+
835
+ elsif _execute_when.is_a?(String) && _execute_when.match(/^\s*[!]*isSelected\((.*)\)\s*$/i)
836
+
837
+ if !Scoutui::Base::Assertions.instance.isSelected?(my_driver, _execute_when)
838
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " isSelected => false"
839
+ next
840
+ end
841
+
842
+ elsif _execute_when.is_a?(Array)
843
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Process series of execute_when : #{_execute_when}"
844
+
845
+ _executeIt=true
846
+
847
+ _execute_when.each do |_a|
848
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " exeucute_when => #{_a}"
849
+
850
+ if _a.is_a?(String) && _a.match(/^\s*[!]*isEnabled\((.*)\)\s*$/i)
851
+ if !Scoutui::Base::Assertions.instance.isEnabled?(my_driver, _a)
852
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " isEnabled #{_e} : failed"
853
+ _executeIt=false
854
+ end
855
+
856
+
857
+ elsif _a.is_a?(String) && _a.match(/^\s*(isrole|role)\(.*\)\s*/i)
858
+
859
+ if !Scoutui::Base::Assertions.instance.isRole?(_a)
860
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " isRole #{_a} : failed"
861
+ _executeIt = false
862
+ end
863
+
864
+ elsif _a.is_a?(String) && _a.match(/^\s*[!]*visible\((.*)\)\s*$/i)
865
+
866
+ if !Scoutui::Base::Assertions.instance.isVisible?(my_driver, _a)
867
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " visible #{_a} : failed"
868
+ _executeIt = false
869
+ end
870
+
871
+ elsif _a.is_a?(String) && _a.match(/^\s*[!]*(isSelected|selected)\((.*)\)\s*$/i)
872
+
873
+ if !Scoutui::Base::Assertions.instance.isSelected?(my_driver, _a)
874
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " isSelected => false"
875
+ _executeIt=false
876
+ end
877
+
878
+ elsif _a.is_a?(String) && _a.match(/(value|text)\s*\(.*\)\s*\=\s*(.*)/i)
879
+
880
+ if !Scoutui::Base::Assertions.instance.isValue?(my_driver, _a)
881
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " value doesnt match"
882
+ _executeIt = false
883
+ end
884
+
885
+ end
886
+
887
+ if !_executeIt
888
+ break
889
+ end
890
+
891
+ end
892
+
893
+ if !_executeIt
894
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Dont execute"
895
+ next
896
+ end
897
+
822
898
 
823
899
  elsif _execute_when.is_a?(String)
824
900
  _rc=Scoutui::Base::Assertions.instance.isVisible(my_driver, _execute_when, _reqid, true)
@@ -184,7 +184,7 @@ module Scoutui::Commands
184
184
 
185
185
  def isSelectWindow?(_action)
186
186
  Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " isSelectWindow?(#{_action})"
187
- !_action.match(/select_window/i).nil?
187
+ !_action.match(/^\s*select_window/i).nil?
188
188
  end
189
189
 
190
190
  def isExistsAlert?(_action)
@@ -236,7 +236,7 @@ module Scoutui::Commands
236
236
  end
237
237
 
238
238
  def isSelect?(_action)
239
- !_action.nil? && _action.match(/select/i)
239
+ !_action.nil? && _action.match(/^\s*select\s*\(/i)
240
240
  end
241
241
 
242
242
  def isNavigate?(_action)
@@ -1,3 +1,3 @@
1
1
  module Scoutui
2
- VERSION = "2.0.3.25.pre"
2
+ VERSION = "2.0.3.26.pre"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scoutui
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3.25.pre
4
+ version: 2.0.3.26.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Kim
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-07-15 00:00:00.000000000 Z
11
+ date: 2016-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler