scoutui 2.0.3.46.pre → 2.0.3.47.pre

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c691428857271925fb5fea46cba6f9509b6f081b
4
- data.tar.gz: c65ec3009234e04180a5990ab163c8c17d00ce23
3
+ metadata.gz: 7f2e05e8583a2bb3f7ab2f96933910804573ff57
4
+ data.tar.gz: 2d4ffd9211c59b61ceb550f468365d8c4483b8f7
5
5
  SHA512:
6
- metadata.gz: 4fcf246e1cc2986cd76eb1a1364a14879b6058049a9bcf75db1f81565b7c9091df97f8dbd3afe09dc3a21d822b3968b0858311f91c17f33afd4ad7b766dc4056
7
- data.tar.gz: 07aaa24292db0d6eb3d33a6bbeadaa678cf999a812cd0ca7e2f2a154dbf7f586838820322cc64a26e48ccf66875fb34c08818c3e74b58608f951dcdf31511bdf
6
+ metadata.gz: 775220693e34d5c5c1b7ccd2e0ad9fec7fe77065e5cd6f721bdd39d2462cd8cc649d18e18515f58797d621b4d2e316d4bcb6763758ad3d2b2ca9e6d8c18ebeab
7
+ data.tar.gz: 95b89eb656deb793fbfe5bddba0687b8121cffa35c2fd594d8a14bc72cdab51d7d09a35bc72b8bec700685d6a7d6600114690e29da780f2b27cb8b5862fc06c0
@@ -0,0 +1,41 @@
1
+
2
+
3
+ require 'singleton'
4
+
5
+
6
+ module Scoutui::Base
7
+
8
+ class TestContext
9
+ include Singleton
10
+
11
+ attr_accessor :settings
12
+
13
+ def initialize
14
+ @settings={}
15
+ end
16
+
17
+ def add(_id, _v)
18
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " add(#{_id}, #{_v})"
19
+ @settings[_id]=_v
20
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " => #{@settings[_id]}"
21
+ end
22
+
23
+
24
+ def set(_id, _v)
25
+ if @settings.has_key?(_id)
26
+ @settings[_id]=_v
27
+ else
28
+ add(_id, _v)
29
+ end
30
+
31
+ get(_id)
32
+ end
33
+
34
+ def get(_id)
35
+ @settings[_id]
36
+ end
37
+
38
+ end
39
+
40
+
41
+ end
@@ -0,0 +1,82 @@
1
+
2
+ module Scoutui::Commands
3
+
4
+ class ThenClause
5
+
6
+ attr_accessor :drv
7
+
8
+ def initialize(driver)
9
+ @drv=driver
10
+ @pageElt=nil
11
+ end
12
+
13
+
14
+ def execute(pageElt)
15
+ return if pageElt.nil?
16
+
17
+ @pageElt=pageElt
18
+
19
+ if !pageElt.nil? && pageElt.has_key?('page') && pageElt['page'].has_key?('then')
20
+ pageElt['page']['then'].each do |_subcmd|
21
+
22
+ if _subcmd.is_a?(String)
23
+
24
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " | then => #{_subcmd}"
25
+
26
+ if _subcmd.match(/^\s*press\(__TAB__\)$/)
27
+ @drv.action.send_keys(:tab).perform
28
+
29
+ elsif _subcmd.match(/^\s*press\(__HOLD_SHIFT__\)\s*$/)
30
+ @drv.action.key_down(:shift).perform
31
+ Scoutui::Base::TestContext.instance.set(:shift_down, true)
32
+
33
+ elsif _subcmd.match(/^\s*press\(__RELEASE_SHIFT__\)\s*$/)
34
+ @drv.action.key_up(:shift).perform
35
+ Scoutui::Base::TestContext.instance.set(:shift_down, false)
36
+
37
+ elsif _subcmd.match(/^\s*press\(__HOLD_COMMAND__\)$/)
38
+ @drv.action.key_down(:command).perform
39
+ Scoutui::Base::TestContext.instance.set(:command_down, true)
40
+
41
+ elsif _subcmd.match(/^\s*press\(__RELEASE_COMMAND__\)$/)
42
+ @drv.action.key_up(:command).perform
43
+ Scoutui::Base::TestContext.instance.set(:command_down, false)
44
+
45
+ elsif _subcmd.match(/^\s*press\(__CONTROL__\)$/)
46
+
47
+ @drv.driver.action.key_down(:control).perform
48
+ @drv.action.key_up(:control).perform
49
+
50
+ # Check for list of elements to click
51
+
52
+ elsif _subcmd.match(/^\s*press\(__DOWN__\)$/)
53
+ @drv.action.send_keys(:arrow_down).perform
54
+
55
+ elsif _subcmd.match(/^\s*press\(__UP__\)$/)
56
+ @drv.action.send_keys(:arrow_up).perform
57
+
58
+ elsif _subcmd.match(/^\s*press\(__ENTER__\)\s*$/)
59
+ @drv.action.send_keys(:enter).perform
60
+
61
+ elsif _subcmd.match(/^\s*click\((.*)\)\s*$/)
62
+ # Click on the locator
63
+
64
+ _c = Scoutui::Commands::ClickObject.new(_subcmd)
65
+ _c.run(driver: @drv)
66
+
67
+ elsif _subcmd.match(/^\s*press\((.*)\)\s*$/)
68
+ _locator = _subcmd.match(/^\s*press\((.*)\)\s*$/)[1].to_s
69
+ _locator = Scoutui::Base::UserVars.instance.normalize(_locator)
70
+ obj = Scoutui::Base::QBrowser.getElement(@drv, _locator, Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
71
+ obj.click
72
+ end
73
+
74
+ end
75
+ end
76
+ end
77
+ end
78
+
79
+
80
+ end
81
+
82
+ end
@@ -4,31 +4,6 @@ module Scoutui::Commands
4
4
 
5
5
  class ClickObject < Command
6
6
 
7
- def _then(pageElt)
8
- return if pageElt.nil?
9
-
10
- if !pageElt.nil? && pageElt.has_key?('page') && pageElt['page'].has_key?('then')
11
- pageElt['page']['then'].each do |_subcmd|
12
- if _subcmd.is_a?(String)
13
-
14
-
15
- puts __FILE__ + (__LINE__).to_s + " | then => #{_subcmd}"
16
-
17
- if _subcmd.match(/^\s*press\(__TAB__\)$/)
18
- @drv.action.send_keys(:tab).perform
19
- elsif _subcmd.match(/^\s*press\(__DOWN__\)$/)
20
- @drv.action.send_keys(:arrow_down).perform
21
- elsif _subcmd.match(/^\s*press\(__UP__\)$/)
22
- @drv.action.send_keys(:arrow_up).perform
23
- elsif _subcmd.match(/^\s*press\(__ENTER__\)\s*$/)
24
- @drv.action.send_keys(:enter).perform
25
- end
26
-
27
- end
28
- end
29
- end
30
- end
31
-
32
7
  def _whenClicked(page_elt)
33
8
 
34
9
  return if page_elt.nil?
@@ -58,8 +33,6 @@ module Scoutui::Commands
58
33
  puts __FILE__ + (__LINE__).to_s + " => #{_pg}"
59
34
  end
60
35
 
61
- # Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " IsVisible #{isVisible} - PAUSE"; gets
62
-
63
36
  end
64
37
 
65
38
  end
@@ -89,24 +62,6 @@ module Scoutui::Commands
89
62
 
90
63
  obj = Scoutui::Base::QBrowser.getElement(@drv, _locator, Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
91
64
 
92
- if false
93
- obj = Scoutui::Base::QBrowser.findElement(@drv, _locator, Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
94
-
95
- if Scoutui::Base::QBrowser.isStale?(obj) && !_locator.nil?
96
-
97
- wait = Selenium::WebDriver::Wait.new(:timeout => Scoutui::Commands::Utils.instance.getTimeout)
98
- isDisplayed = wait.until {
99
- if Scoutui::Base::QBrowser.isStale?(obj)
100
- obj = Scoutui::Base::QBrowser.findElement(@drv, _locator, Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
101
- end
102
- true if obj.enabled?
103
- }
104
-
105
- end
106
- end
107
-
108
-
109
-
110
65
  if obj
111
66
 
112
67
  # Refactor in qbrowser
@@ -143,9 +98,12 @@ module Scoutui::Commands
143
98
  _retry = true
144
99
  puts __FILE__ + (__LINE__).to_s + " #{_i} => click(#{obj})"
145
100
  begin
101
+
146
102
  obj = Scoutui::Base::QBrowser.getElement(@drv, _locator, Scoutui::Commands::Utils.instance.getFrameSearch(), Scoutui::Commands::Utils.instance.getTimeout)
147
103
  @drv.action.move_to(obj).perform
148
- bm=Benchmark.measure { obj.click }
104
+ bm=Benchmark.measure {
105
+ obj.click
106
+ }
149
107
  setBenchmark(bm)
150
108
  _retry = false
151
109
  _clicked=true
@@ -162,7 +120,7 @@ module Scoutui::Commands
162
120
 
163
121
  page_elt = Scoutui::Utils::TestUtils.instance.getPageElement(_locator)
164
122
 
165
- Scoutui::Logger::LogMgr.instance.debug "PageElement(#{_locator}) => #{page_elt}"
123
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " PageElement(#{_locator}) => #{page_elt}"
166
124
 
167
125
  if all_windows > @drv.window_handles.size
168
126
  Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " WINDOW was CLOSED. Activate first window as our default";
@@ -171,7 +129,15 @@ module Scoutui::Commands
171
129
  end
172
130
 
173
131
  _whenClicked(page_elt)
174
- _then(page_elt)
132
+
133
+ if e.is_a?(Hash) && e.has_key?('page') && e['page'].has_key?('then')
134
+ thenClause = Scoutui::Commands::ThenClause.new(@drv)
135
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " thenClause => #{thenClause.class}"
136
+ thenClause.execute(e)
137
+ end
138
+
139
+
140
+ # _then(e)
175
141
 
176
142
  else
177
143
  Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " Unable to click object that is not displayed."
@@ -181,7 +147,7 @@ module Scoutui::Commands
181
147
 
182
148
  rescue => ex
183
149
  Scoutui::Logger::LogMgr.instance.warn __FILE__ + (__LINE__).to_s + " #{ex.class.to_s} : Error during processing: #{ex.message}"
184
- Scoutui::Logger::LogMgr.instance.warn "Backtrace:\n\t#{ex.backtrace.join("\n\t")}"
150
+ Scoutui::Logger::LogMgr.instance.warn " Backtrace:\n\t#{ex.backtrace.join("\n\t")}"
185
151
  end
186
152
 
187
153
  Scoutui::Logger::LogMgr.instance.asserts.info "Verify object to click exists #{_locator} : #{obj.class.to_s} - #{!obj.nil?.to_s}"
@@ -119,14 +119,8 @@ module Scoutui::Commands
119
119
  elsif Scoutui::Commands::Utils.instance.isClick?(_action)
120
120
  _cmd='Click'
121
121
  _c = Scoutui::Commands::ClickObject.new(_action)
122
-
123
122
  _c.run(driver: my_driver, dut: e)
124
123
 
125
-
126
- if e[STEP_KEY].has_key?('then')
127
- Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " then => #{e[STEP_KEY]['then]']}"
128
- end
129
-
130
124
  elsif Scoutui::Commands::Utils.instance.isExistsAlert?(_action)
131
125
  _cmd='ExistsAlert'
132
126
  _c = Scoutui::Commands::JsAlert::ExistsAlert.new(_action)
@@ -197,24 +197,8 @@ module Scoutui::Commands
197
197
 
198
198
 
199
199
  if !pageElt.nil? && pageElt['page'].has_key?('then')
200
- pageElt['page']['then'].each do |_subcmd|
201
- if _subcmd.is_a?(String)
202
-
203
-
204
- puts __FILE__ + (__LINE__).to_s + " | then => #{_subcmd}"
205
-
206
- if _subcmd.match(/^\s*press\(__TAB__\)$/)
207
- @drv.action.send_keys(:tab).perform
208
- elsif _subcmd.match(/^\s*press\(__DOWN__\)$/)
209
- @drv.action.send_keys(:arrow_down).perform
210
- elsif _subcmd.match(/^\s*press\(__UP__\)$/)
211
- @drv.action.send_keys(:arrow_up).perform
212
- elsif _subcmd.match(/^\s*press\(__ENTER__\)\s*$/)
213
- @drv.action.send_keys(:enter).perform
214
- end
215
-
216
- end
217
- end
200
+ thenClause = Scoutui::Commands::ThenClause.new(@drv)
201
+ thenClause.execute(pageElt)
218
202
  end
219
203
 
220
204
  if !obj.nil? && false
@@ -1,3 +1,3 @@
1
1
  module Scoutui
2
- VERSION = "2.0.3.46.pre"
2
+ VERSION = "2.0.3.47.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.46.pre
4
+ version: 2.0.3.47.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-09-08 00:00:00.000000000 Z
11
+ date: 2016-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -287,12 +287,14 @@ files:
287
287
  - lib/scoutui/base/q_browser.rb
288
288
  - lib/scoutui/base/q_form.rb
289
289
  - lib/scoutui/base/requirements.rb
290
+ - lib/scoutui/base/test_context.rb
290
291
  - lib/scoutui/base/test_data.rb
291
292
  - lib/scoutui/base/test_scout.rb
292
293
  - lib/scoutui/base/test_settings.rb
293
294
  - lib/scoutui/base/user_vars.rb
294
295
  - lib/scoutui/base/visual_test_framework.rb
295
296
  - lib/scoutui/commands/assign_var.rb
297
+ - lib/scoutui/commands/clauses/then_clause.rb
296
298
  - lib/scoutui/commands/click_object.rb
297
299
  - lib/scoutui/commands/command.rb
298
300
  - lib/scoutui/commands/commands.rb