scoutui 2.0.3.44.pre → 2.0.3.45.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: 91a8993f5c845bd67a31b1781ffe9c9d8638974a
4
- data.tar.gz: 7d40b45a17bf991aa6732305534356ebe944ef03
3
+ metadata.gz: cf2a6c8f7fed5394754a56afa37bee22ff74ba1a
4
+ data.tar.gz: 66c65e7645d09382c04df78cd9cbb40cef269401
5
5
  SHA512:
6
- metadata.gz: 3fb9559720831f36e8b8d583e6c98c2d80ce8670a7c2c32612802ef78a4ef1e0327c1670d7bcd42e270a3cf68d25a6810773f7f0ce417ace73a3978d47e7b862
7
- data.tar.gz: 1f332172c1af3ce2f00d046b01f655619a0832b447323bd0761f8f27c2ed8112c385a69497bf8dc5a8d1a8d3408308caf9978ac2391d2d48c3b1a549adc92ec8
6
+ metadata.gz: 0f4e0e6068158b6de68193d22a09ce266a47db99aa715722c98907b731d687f287c5b78f45bd94eb4f31ff3cc2dc031b3dbe0fa763d6f13c3de65283e36f3658
7
+ data.tar.gz: 276d5a3c852bde0b4bcbfeeec33a5a3802b0c5432ca7fad57fa57be4541d867b7c3b14b04f71b7992edcf57a4ed502e1e4c494c3c7bc0c9bf00240e6c5235625
@@ -0,0 +1,92 @@
1
+ page:
2
+ name: Define ls command
3
+ description: Define a command and assign it an identifier
4
+ action: defineCommand
5
+ id: LS
6
+ commands: "/tmp/hello.sh"
7
+ ---
8
+ page:
9
+ name: Exeucte a defined command
10
+ description: Execute a command(s) by referencing its id.
11
+ comment: yml[n]['page']['commands'][n]['id']
12
+ action: executeCommands
13
+ commands:
14
+ - id: LS
15
+ asserts:
16
+ - /Peter/
17
+ - /ScoutUI
18
+ ---
19
+ page:
20
+ name: GetExit
21
+ description: GetExit
22
+ action: getExitStatus
23
+ id: LS
24
+ ---
25
+ page:
26
+ name: Retrieve results for LS
27
+ getResults:
28
+ id: LS
29
+ ---
30
+ page:
31
+ name: Extract specific values from results
32
+ getResults:
33
+ id: LS
34
+ capture: /(World)/
35
+ assignto: myHit
36
+ ---
37
+ page:
38
+ name: Type
39
+ action: type(//*[@id='uh-search-box'], ${myHit})
40
+ ---
41
+ page:
42
+ name: Pause after LS
43
+ action: pause
44
+ skip: false
45
+ ---
46
+ page:
47
+ name: Load command with action
48
+ action: defineCommand
49
+ id: findTmp
50
+ commands: whoami
51
+ ---
52
+ page:
53
+ name: Define command with multiple cmds
54
+ action: defineCommand
55
+ id: MultiLs
56
+ commands:
57
+ - ls
58
+ - echo "ScoutUI"
59
+ ---
60
+ page:
61
+ name: Execute cmd with multple commands
62
+ command:
63
+ id: MultiLs
64
+ ---
65
+ page:
66
+ name: Retrieve results
67
+ getResults:
68
+ id: MultiLs
69
+ ---
70
+ page:
71
+ name: Execute
72
+ command:
73
+ id: findTmp
74
+ ---
75
+ page:
76
+ name: Retrieve findTmp
77
+ getResults:
78
+ id: findTmp
79
+ ---
80
+ page:
81
+ name: Pause after findTmp
82
+ action: pause
83
+ skip: false
84
+ ---
85
+ page:
86
+ name: Retrieve
87
+ getResults:
88
+ id: LS
89
+ ---
90
+ page:
91
+ action: pause
92
+ skip: false
@@ -0,0 +1,45 @@
1
+
2
+
3
+ class RunShell
4
+
5
+ attr_accessor :cmd
6
+ attr_accessor :results
7
+ attr_accessor :exitStatus
8
+
9
+ def initialize(_c=nil)
10
+ @exitStatus=nil
11
+ @cmd=_c
12
+ end
13
+
14
+
15
+ def execute(opts=nil)
16
+ @results=nil
17
+
18
+ if @cmd.match(/.*\.(sh|ksh|csh)\s*$/i)
19
+ puts " execute script #{@cmd} #{opts.to_s}"
20
+ @results = %x[ #{@cmd} #{opts.to_s} ]
21
+ else
22
+ @results = %x[ #{@cmd} #{opts.to_s} ]
23
+ end
24
+ @exitStatus = $?.exitstatus
25
+
26
+ puts "results => #{@results}"
27
+ puts "exist => #{@exitStatus}"
28
+ end
29
+
30
+ def results
31
+ @results
32
+ end
33
+
34
+ end
35
+
36
+
37
+
38
+
39
+ shell = RunShell.new("./runit.sh")
40
+ shell.execute("Hello World")
41
+
42
+ cmd2 = RunShell.new("ls -lta")
43
+ cmd2.execute("/tmpxxx")
44
+
45
+ puts "Results => #{cmd2.results}"
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env bash
2
+
3
+ echo "Running from a shell"
4
+
@@ -1,4 +1,5 @@
1
1
  #require 'testmgr'
2
+ require 'CmdShellMgr'
2
3
 
3
4
  module Scoutui::Base
4
5
 
@@ -1019,6 +1020,39 @@ module Scoutui::Base
1019
1020
  next
1020
1021
  end
1021
1022
 
1023
+ if e[STEP_KEY].has_key?('load') && e[STEP_KEY]['load'].has_key?('command')
1024
+ _id = e[STEP_KEY]['load']['id'].to_s
1025
+ _c = e[STEP_KEY]['load']['command'].to_s
1026
+ CmdShellMgr::DSL.instance.cmd(:cmd => "command(#{_id}, #{_c})")
1027
+ next
1028
+ end
1029
+
1030
+ if e[STEP_KEY].has_key?('command')
1031
+ _id = e[STEP_KEY]['command']['id'].to_s
1032
+ _rc=CmdShellMgr::DSL.instance.cmd(:cmd => "execute(#{_id})")
1033
+ puts __FILE__ + (__LINE__).to_s + " rc => #{_rc}"
1034
+ next
1035
+ end
1036
+
1037
+ if e[STEP_KEY].has_key?('getResults')
1038
+ _id = e[STEP_KEY]['getResults']['id'].to_s
1039
+ _rc = CmdShellMgr::DSL.instance.cmd(:cmd => "getResults(#{_id})")
1040
+ puts __FILE__ + (__LINE__).to_s + " rc => #{_rc}"
1041
+
1042
+ if e[STEP_KEY]['getResults'].has_key?('capture')
1043
+ m2=CmdShellMgr::DSL.instance.cmd(:cmd => "getResult(#{_id}).capture(#{e[STEP_KEY]['getResults']['capture'].to_s})")
1044
+ puts __FILE__ + (__LINE__).to_s + " Capture => #{m2}"
1045
+
1046
+
1047
+ if e[STEP_KEY]['getResults'].has_key?('assignto')
1048
+ Scoutui::Base::UserVars.instance.setVar(e[STEP_KEY]['getResults']['assignto'], m2)
1049
+ end
1050
+ end
1051
+
1052
+
1053
+ next
1054
+ end
1055
+
1022
1056
 
1023
1057
  if !isRun(e).nil?
1024
1058
 
@@ -51,6 +51,16 @@ module Scoutui::Commands
51
51
  _c = Scoutui::Commands::Pause.new(nil)
52
52
  _c.execute(e);
53
53
 
54
+ elsif Scoutui::Commands::Utils.instance.isExecuteCommands?(_action)
55
+ _cmd='executecommands'
56
+ _c = Scoutui::Commands::ExecuteCommands.new(e)
57
+ _c.run(driver: my_driver, dut: e)
58
+
59
+ elsif Scoutui::Commands::Utils.instance.isDefineCommands?(_action)
60
+ _cmd='definecommands'
61
+ _c = Scoutui::Commands::DefineCommands.new(e)
62
+ _c.run(driver: my_driver, dut: e)
63
+
54
64
  elsif Scoutui::Commands::Utils.instance.isLoadDB?(_action)
55
65
  _cmd='loaddb'
56
66
  _c = Scoutui::Commands::LoadDB.new(e)
@@ -0,0 +1,73 @@
1
+ require_relative './commands'
2
+
3
+ module Scoutui::Commands
4
+
5
+ class DefineCommands < Command
6
+
7
+
8
+ def execute(drv, e=nil)
9
+ @drv=drv if !drv.nil?
10
+
11
+ rc=false
12
+ obj=nil
13
+ _locator=nil
14
+
15
+ _req = Scoutui::Utils::TestUtils.instance.getReq()
16
+
17
+ begin
18
+
19
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " DefineCommand()"
20
+
21
+ if e['page'].has_key?('id') && e['page'].has_key?('commands')
22
+
23
+ id=e['page']['id'].to_s
24
+ commands = e['page']['commands']
25
+ puts __FILE__ + (__LINE__).to_s + " id, commands => #{id}, #{commands}"
26
+
27
+
28
+ c=nil
29
+
30
+ if e['page']['commands'].is_a?(String)
31
+ c=CmdShellMgr::DSL.instance.cmd(:cmd => "command(#{e['page']['id'].to_s}, #{e['page']['commands'].to_s})")
32
+ elsif e['page']['commands'].is_a?(Array)
33
+
34
+ _cmd=""
35
+ e['page']['commands'].each do |r|
36
+ _cmd = _cmd + r.to_s + ";"
37
+ end
38
+
39
+ puts __FILE__ + (__LINE__).to_s + " command(#{e['page']['id'].to_s}, #{_cmd})"
40
+ c=CmdShellMgr::DSL.instance.cmd(:cmd => "command(#{e['page']['id'].to_s}, #{_cmd})")
41
+
42
+
43
+ else
44
+ puts __FILE__ + (__LINE__).to_s + " Unknown DSL cmd"
45
+
46
+ end
47
+
48
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " c => #{c.class}"
49
+
50
+
51
+ rc=true
52
+
53
+ end
54
+
55
+
56
+ rescue => ex
57
+ Scoutui::Logger::LogMgr.instance.warn "Error during processing: #{ex}"
58
+ Scoutui::Logger::LogMgr.instance.warn "Backtrace:\n\t#{ex.backtrace.join("\n\t")}"
59
+ end
60
+
61
+ if rc
62
+ Scoutui::Logger::LogMgr.instance.asserts.info "Verify loadCommands passed - #{rc}"
63
+ Testmgr::TestReport.instance.getReq(_req).testcase('click').add(rc, "Verify loadCommands command passed")
64
+ end
65
+
66
+ setResult(rc)
67
+ end
68
+
69
+ end
70
+
71
+
72
+
73
+ end
@@ -0,0 +1,74 @@
1
+ require_relative './commands'
2
+
3
+ module Scoutui::Commands
4
+
5
+ class ExecuteCommands < Command
6
+
7
+
8
+ def execute(drv, e=nil)
9
+ @drv=drv if !drv.nil?
10
+
11
+ rc=false
12
+ _locator=nil
13
+
14
+ _req = Scoutui::Utils::TestUtils.instance.getReq()
15
+
16
+ begin
17
+
18
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " ExecuteCommands(#{e})"
19
+
20
+ if e['page'].has_key?('commands')
21
+
22
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " [commands] => #{e['page']['commands'].class}"
23
+
24
+ c=nil
25
+
26
+ if e['page']['commands'].is_a?(String)
27
+ c=CmdShellMgr::DSL.instance.cmd(:cmd => "execute(#{e['page']['commands'].to_s})")
28
+ elsif e['page']['commands'].is_a?(Array)
29
+
30
+ e['page']['commands'].each do |_cmd|
31
+
32
+ if !_cmd.nil?
33
+ _id = _cmd['id'].to_s
34
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " execute(#{_id})"
35
+ c=CmdShellMgr::DSL.instance.cmd(:cmd => "execute(#{_id})")
36
+
37
+ if c.is_a?(CmdShellMgr::Command) && _cmd.has_key?('asserts')
38
+ _cmd['asserts'].each do |_a|
39
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " assert => #{_a}"
40
+ end
41
+ end
42
+
43
+ end
44
+
45
+ end
46
+
47
+
48
+ else
49
+ puts __FILE__ + (__LINE__).to_s + " Unknown DSL cmd"
50
+ end
51
+
52
+ rc=c.is_a?(CmdShellMgr::Command)
53
+
54
+ end
55
+
56
+
57
+ rescue => ex
58
+ Scoutui::Logger::LogMgr.instance.warn "Error during processing: #{ex}"
59
+ Scoutui::Logger::LogMgr.instance.warn "Backtrace:\n\t#{ex.backtrace.join("\n\t")}"
60
+ end
61
+
62
+ if rc
63
+ Scoutui::Logger::LogMgr.instance.asserts.info "Verify executeCommands passed - #{rc}"
64
+ Testmgr::TestReport.instance.getReq(_req).testcase('click').add(rc, "Verify loadCommands command passed")
65
+ end
66
+
67
+ setResult(rc)
68
+ end
69
+
70
+ end
71
+
72
+
73
+
74
+ end
@@ -27,6 +27,8 @@ module Scoutui::Commands
27
27
  'loaddata',
28
28
  'connect',
29
29
  'loaddb',
30
+ 'executecommands',
31
+ 'definecommands',
30
32
  'loadrequirements',
31
33
  'mouseover',
32
34
  'navigate',
@@ -271,6 +273,14 @@ module Scoutui::Commands
271
273
  !_action.match(/^\s*loaddb\s*$/i).nil?
272
274
  end
273
275
 
276
+ def isExecuteCommands?(_action)
277
+ !_action.match(/^\s*executecommand[s]*\s*$/i).nil?
278
+ end
279
+
280
+ def isDefineCommands?(_action)
281
+ !_action.match(/^\s*definecommand[s]*\s*$/i).nil?
282
+ end
283
+
274
284
  def isLoadData?(_action)
275
285
  !_action.match(/^\s*loaddata\s*$/i).nil?
276
286
  end
@@ -350,6 +360,10 @@ module Scoutui::Commands
350
360
  @totalCommands['mouseover']+=1
351
361
  elsif isConnect?(cmd)
352
362
  @totalCommands['connect']+=1
363
+ elsif isExecuteCommands?(cmd)
364
+ @totalCommands['executecommands']+=1
365
+ elsif isDefineCommands?(cmd)
366
+ @totalCommands['definecommands']+=1
353
367
  elsif isLoadDB?(cmd)
354
368
  @totalCommands['loaddb']+=1
355
369
  elsif isLoadData?(cmd)
@@ -56,7 +56,7 @@ module Scoutui::Eyes
56
56
  eyes=Applitools::Eyes.new()
57
57
  Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " Eyes Object created #{eyes}"
58
58
  eyes.api_key = license_key
59
- eyes.force_fullpage_screenshot = true
59
+ eyes.force_fullpage_screenshot = Scoutui::Utils::TestUtils.instance.eyesFullscreen? #true
60
60
 
61
61
  match_level = Scoutui::Base::UserVars.instance.getVar('eyes.match_level')
62
62
 
@@ -251,8 +251,8 @@ module Scoutui::Eyes
251
251
  browserType = Scoutui::Base::UserVars.instance.getBrowserType()
252
252
  viewport_size = Scoutui::Base::UserVars.instance.getViewPort()
253
253
 
254
- puts __FILE__ + (__LINE__).to_s + " browserType => #{browserType}"
255
- puts __FILE__ + (__LINE__).to_s + " viewport : #{viewport_size}"
254
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " browserType => #{browserType}"
255
+ Scoutui::Logger::LogMgr.instance.debug __FILE__ + (__LINE__).to_s + " viewport : #{viewport_size}"
256
256
 
257
257
 
258
258
  Testmgr::TestReport.instance.setDescription('ScoutUI Test')
@@ -43,6 +43,7 @@ module Scoutui::Utils
43
43
  @options[:role]=nil
44
44
  @options[:sauce_name]='unnamed'
45
45
  @options[:enable_eyes]=false
46
+ @options[:enable_fullscreen]=true
46
47
  @options[:enable_sauce]=false
47
48
  @options[:log_level]=:info # :debug, :info, :warn, :error, :fatal
48
49
  @options[:match_level]='layout'
@@ -246,6 +247,7 @@ module Scoutui::Utils
246
247
  @options[:enable_eyes]=true
247
248
  }
248
249
  opt.on('--eyes:run Bool', [:true, :false]) { |o| @options[:enable_eyes] = !o.match(/true/i).nil? }
250
+ opt.on('--eyes:fullscreen Bool', [:true, :false]) { |o| @options[:enable_fullscreen] = !o.match(/true/i).nil? }
249
251
  opt.on('--eyes:app AppName') { |o| @options[:app] = o }
250
252
  opt.on('--eyes:title Title') { |o| @options[:title] = o }
251
253
  opt.on('--eyes:viewport [resolution]') { |o| @options[:viewport] = o }
@@ -356,6 +358,10 @@ module Scoutui::Utils
356
358
  @options[:enable_eyes]
357
359
  end
358
360
 
361
+ def eyesFullscreen?
362
+ @options[:enable_fullscreen]
363
+ end
364
+
359
365
  def sauceEnabled?
360
366
  @options[:enable_sauce]
361
367
  end
@@ -1,3 +1,3 @@
1
1
  module Scoutui
2
- VERSION = "2.0.3.44.pre"
2
+ VERSION = "2.0.3.45.pre"
3
3
  end
data/scoutui.gemspec CHANGED
@@ -35,4 +35,5 @@ Gem::Specification.new do |spec|
35
35
  spec.add_development_dependency "testmgr", "0.3.2.pre"
36
36
  spec.add_development_dependency "tiny_tds"
37
37
  spec.add_development_dependency "DataMgr", ">= 0.1.1.1.pre"
38
+ spec.add_development_dependency "CmdShellMgr", ">= 0.1.1.0.pre"
38
39
  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.44.pre
4
+ version: 2.0.3.45.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-08-30 00:00:00.000000000 Z
11
+ date: 2016-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -192,6 +192,20 @@ dependencies:
192
192
  - - ">="
193
193
  - !ruby/object:Gem::Version
194
194
  version: 0.1.1.1.pre
195
+ - !ruby/object:Gem::Dependency
196
+ name: CmdShellMgr
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - ">="
200
+ - !ruby/object:Gem::Version
201
+ version: 0.1.1.0.pre
202
+ type: :development
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - ">="
207
+ - !ruby/object:Gem::Version
208
+ version: 0.1.1.0.pre
195
209
  description: Leverage a fully functional e2e framework that's integrated with Applitool's
196
210
  Eyes and Sauce Labs!
197
211
  email:
@@ -219,6 +233,7 @@ files:
219
233
  - examples/carmax/commands/commands.yml
220
234
  - examples/carmax/tests/test-carmax.sh
221
235
  - examples/ci_reporter/ci_example.rb
236
+ - examples/cmdshell/commands/cmd.yml
222
237
  - examples/converters/jsonupdate.rb
223
238
  - examples/converters/jsony.rb
224
239
  - examples/data_driven/data/queries.yml
@@ -260,6 +275,8 @@ files:
260
275
  - examples/eyes/diff.rb
261
276
  - examples/eyes/ex2.rb
262
277
  - examples/eyes_results/response.json
278
+ - examples/shell/run_shell.rb
279
+ - examples/shell/runit.sh
263
280
  - examples/yaml/dut.yml
264
281
  - examples/yaml/ex_yaml.rb
265
282
  - lib/scoutui.rb
@@ -280,6 +297,8 @@ files:
280
297
  - lib/scoutui/commands/command.rb
281
298
  - lib/scoutui/commands/commands.rb
282
299
  - lib/scoutui/commands/connect.rb
300
+ - lib/scoutui/commands/define_commands.rb
301
+ - lib/scoutui/commands/execute_commands.rb
283
302
  - lib/scoutui/commands/exists_alert.rb
284
303
  - lib/scoutui/commands/fill_form.rb
285
304
  - lib/scoutui/commands/highlight.rb