ruby_raider 4.1.0 → 4.2.0
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 +4 -4
- data/.github/workflows/e2e_tests.yml +3 -0
- data/README.md +52 -53
- data/RELEASE.md +14 -1
- data/lib/commands/schedule_commands.rb +84 -0
- data/lib/generators/templates/common/git_ignore.tt +1 -0
- data/lib/ruby_raider/runtime/retry_reset.rb +32 -0
- data/lib/ruby_raider/runtime/rspec.rb +1 -0
- data/lib/ruby_raider/runtime/show_browser.rb +53 -0
- data/lib/ruby_raider/runtime.rb +2 -0
- data/lib/ruby_raider.rb +22 -7
- data/lib/utilities/schedules/adapter.rb +22 -0
- data/lib/utilities/schedules/base.rb +27 -0
- data/lib/utilities/schedules/kind.rb +74 -0
- data/lib/utilities/schedules/legacy.rb +196 -0
- data/lib/utilities/schedules/legacy_stub.rb +62 -0
- data/lib/utilities/{flows → schedules}/next_run.rb +2 -2
- data/lib/utilities/{flows → schedules}/notifier.rb +6 -6
- data/lib/utilities/{flows → schedules}/os/command_runner.rb +1 -1
- data/lib/utilities/{flows → schedules}/os/cron.rb +27 -17
- data/lib/utilities/{flows → schedules}/os/launchd.rb +32 -14
- data/lib/utilities/{flows → schedules}/os/linux.rb +23 -5
- data/lib/utilities/{flows → schedules}/os/systemd.rb +33 -17
- data/lib/utilities/{flows → schedules}/os/task_scheduler.rb +36 -20
- data/lib/utilities/schedules/os_enumerator.rb +30 -0
- data/lib/utilities/schedules/project.rb +70 -0
- data/lib/utilities/schedules/rule.rb +162 -0
- data/lib/utilities/schedules/run_lock.rb +160 -0
- data/lib/utilities/schedules/run_log.rb +122 -0
- data/lib/utilities/schedules/run_report.rb +139 -0
- data/lib/utilities/schedules/run_wrapper.rb +216 -0
- data/lib/utilities/schedules/schedule.rb +89 -0
- data/lib/utilities/schedules/schedule_store.rb +53 -0
- data/lib/utilities/schedules/scheduler.rb +178 -0
- data/lib/utilities/schedules/scheduler_steps.rb +69 -0
- data/lib/utilities/schedules/selection.rb +133 -0
- data/lib/utilities/schedules/spawn.rb +68 -0
- data/lib/utilities/{flows/schedule_store.rb → schedules/store.rb} +17 -13
- data/lib/version +1 -1
- data/ruby_raider.gemspec +1 -0
- data/sig/commands/schedule_commands.rbs +12 -0
- data/sig/ruby_raider/runtime/retry_reset.rbs +7 -0
- data/sig/ruby_raider/runtime/show_browser.rbs +27 -0
- data/sig/ruby_raider.rbs +4 -0
- data/sig/utilities/schedules/adapter.rbs +5 -0
- data/sig/utilities/schedules/base.rbs +15 -0
- data/sig/utilities/schedules/kind.rbs +32 -0
- data/sig/utilities/schedules/legacy.rbs +45 -0
- data/sig/utilities/schedules/legacy_stub.rbs +15 -0
- data/sig/utilities/{flows → schedules}/next_run.rbs +3 -3
- data/sig/utilities/{flows → schedules}/notifier.rbs +1 -1
- data/sig/utilities/{flows → schedules}/os/command_runner.rbs +1 -1
- data/sig/utilities/{flows → schedules}/os/cron.rbs +7 -7
- data/sig/utilities/{flows → schedules}/os/launchd.rbs +7 -6
- data/sig/utilities/{flows → schedules}/os/linux.rbs +10 -4
- data/sig/utilities/{flows → schedules}/os/systemd.rbs +8 -7
- data/sig/utilities/{flows → schedules}/os/task_scheduler.rbs +13 -10
- data/sig/utilities/schedules/os_enumerator.rbs +12 -0
- data/sig/utilities/schedules/project.rbs +22 -0
- data/sig/utilities/{flows/schedule.rbs → schedules/rule.rbs} +23 -12
- data/sig/utilities/schedules/run_lock.rbs +29 -0
- data/sig/utilities/schedules/run_log.rbs +33 -0
- data/sig/utilities/schedules/run_report.rbs +34 -0
- data/sig/utilities/schedules/run_wrapper.rbs +45 -0
- data/sig/utilities/schedules/schedule.rbs +27 -0
- data/sig/utilities/schedules/schedule_store.rbs +21 -0
- data/sig/utilities/{flows → schedules}/scheduler.rbs +22 -15
- data/sig/utilities/schedules/scheduler_steps.rbs +22 -0
- data/sig/utilities/schedules/selection.rbs +36 -0
- data/sig/utilities/schedules/spawn.rbs +10 -0
- data/sig/utilities/{flows/schedule_store.rbs → schedules/store.rbs} +14 -9
- data/spec/commands/schedule_commands_spec.rb +284 -0
- data/spec/integration/content/common_content_spec.rb +8 -2
- data/spec/integration/content/gemfile_content_spec.rb +2 -2
- data/spec/integration/end_to_end_spec.rb +0 -63
- data/spec/runtime/retry_reset_spec.rb +112 -0
- data/spec/runtime/show_browser_project_spec.rb +70 -0
- data/spec/runtime/show_browser_spec.rb +101 -0
- data/spec/utilities/schedules/kind_spec.rb +81 -0
- data/spec/utilities/schedules/legacy_spec.rb +433 -0
- data/spec/utilities/schedules/legacy_stub_spec.rb +144 -0
- data/spec/utilities/{flows → schedules}/next_run_spec.rb +5 -5
- data/spec/utilities/{flows → schedules}/notifier_spec.rb +3 -4
- data/spec/utilities/{flows → schedules}/os/command_runner_spec.rb +2 -3
- data/spec/utilities/{flows → schedules}/os/cron_spec.rb +34 -29
- data/spec/utilities/{flows → schedules}/os/launchd_spec.rb +42 -29
- data/spec/utilities/{flows → schedules}/os/linux_spec.rb +27 -13
- data/spec/utilities/schedules/os/list_ids_spec.rb +202 -0
- data/spec/utilities/{flows → schedules}/os/systemd_spec.rb +35 -31
- data/spec/utilities/{flows → schedules}/os/task_scheduler_spec.rb +40 -34
- data/spec/utilities/schedules/os_entry_spec.rb +54 -0
- data/spec/utilities/schedules/os_enumerator_spec.rb +57 -0
- data/spec/utilities/schedules/project_spec.rb +125 -0
- data/spec/utilities/schedules/run_lock_spec.rb +143 -0
- data/spec/utilities/schedules/run_log_spec.rb +83 -0
- data/spec/utilities/schedules/run_report_spec.rb +150 -0
- data/spec/utilities/schedules/run_wrapper_integration_spec.rb +166 -0
- data/spec/utilities/schedules/run_wrapper_spec.rb +430 -0
- data/spec/utilities/schedules/schedule_spec.rb +120 -0
- data/spec/utilities/schedules/schedule_store_spec.rb +151 -0
- data/spec/utilities/schedules/scheduler_launchd_spec.rb +77 -0
- data/spec/utilities/schedules/scheduler_spec.rb +445 -0
- data/spec/utilities/schedules/selection_spec.rb +176 -0
- data/spec/utilities/schedules/spawn_spec.rb +104 -0
- metadata +106 -53
- data/lib/commands/flow_commands.rb +0 -104
- data/lib/generators/templates/flows/flow_helper.tt +0 -42
- data/lib/generators/templates/flows/run.tt +0 -332
- data/lib/utilities/flows/project.rb +0 -170
- data/lib/utilities/flows/run_log.rb +0 -61
- data/lib/utilities/flows/runner.rb +0 -206
- data/lib/utilities/flows/schedule.rb +0 -221
- data/lib/utilities/flows/scheduler.rb +0 -187
- data/sig/commands/flow_commands.rbs +0 -13
- data/sig/utilities/flows/project.rbs +0 -46
- data/sig/utilities/flows/run_log.rbs +0 -22
- data/sig/utilities/flows/runner.rbs +0 -35
- data/spec/commands/flow_commands_spec.rb +0 -128
- data/spec/generators/flow_helper_spec.rb +0 -40
- data/spec/integration/flows/flow_project.rb +0 -62
- data/spec/integration/flows/run_command_spec.rb +0 -91
- data/spec/integration/flows/run_lifecycle_spec.rb +0 -383
- data/spec/utilities/flows/project_spec.rb +0 -178
- data/spec/utilities/flows/run_log_spec.rb +0 -47
- data/spec/utilities/flows/runner_spec.rb +0 -313
- data/spec/utilities/flows/schedule_spec.rb +0 -233
- data/spec/utilities/flows/schedule_store_spec.rb +0 -137
- data/spec/utilities/flows/scheduler_spec.rb +0 -329
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'tmpdir'
|
|
4
|
+
require_relative '../../../lib/utilities/schedules/spawn'
|
|
5
|
+
|
|
6
|
+
RSpec.describe RubyRaider::Schedules::Spawn do # rubocop:disable RSpec/FilePath
|
|
7
|
+
let(:dir) { File.realpath(Dir.mktmpdir('schedules-spawn')) }
|
|
8
|
+
let(:ready) { File.join(dir, 'ready') }
|
|
9
|
+
let(:got) { File.join(dir, 'got') }
|
|
10
|
+
# Counts the INTs it gets (TERM counts 100), then exits 0
|
|
11
|
+
let(:child) do
|
|
12
|
+
"n = 0; trap('INT') { n += 1 }; trap('TERM') { n += 100 }; File.write(#{ready.inspect}, ''); " \
|
|
13
|
+
"sleep 1.5; File.write(#{got.inspect}, n.to_s)"
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
after { FileUtils.rm_rf(dir) }
|
|
17
|
+
|
|
18
|
+
def signal_when_ready(*signals)
|
|
19
|
+
Thread.new do
|
|
20
|
+
sleep 0.05 until File.exist?(ready)
|
|
21
|
+
signals.each { |signal| Process.kill(signal, Process.pid) }
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it 'runs without a shell and returns the exit status, not stopped' do
|
|
26
|
+
result = described_class.call({ 'X' => '; exit 7' }, [RbConfig.ruby, '-e', 'exit(ENV["X"] == "; exit 7" ? 5 : 6)'], dir)
|
|
27
|
+
|
|
28
|
+
expect(result).to eq([5, false])
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
it 'unsets a variable given as nil' do
|
|
32
|
+
ENV['RAIDER_SPAWN_SPEC'] = 'inherited'
|
|
33
|
+
result = described_class.call({ 'RAIDER_SPAWN_SPEC' => nil }, [RbConfig.ruby, '-e', 'exit(ENV.key?("RAIDER_SPAWN_SPEC") ? 1 : 0)'], dir)
|
|
34
|
+
|
|
35
|
+
expect(result.first).to eq(0)
|
|
36
|
+
ensure
|
|
37
|
+
ENV.delete('RAIDER_SPAWN_SPEC')
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
describe 'stopping', skip: Gem.win_platform? do
|
|
41
|
+
it 'passes TERM then INT on as one INT when the INT could not have reached the child' do
|
|
42
|
+
signal_when_ready('TERM', 'INT')
|
|
43
|
+
|
|
44
|
+
result = described_class.call({}, [RbConfig.ruby, '-e', child], dir, forward_int: true)
|
|
45
|
+
|
|
46
|
+
expect([result, File.read(got)]).to eq([[0, true], '1'])
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
it 'does not pass on an INT that the terminal already sent to the child' do
|
|
50
|
+
signal_when_ready('INT')
|
|
51
|
+
|
|
52
|
+
result = described_class.call({}, [RbConfig.ruby, '-e', child], dir, forward_int: false)
|
|
53
|
+
|
|
54
|
+
expect([result, File.read(got)]).to eq([[0, true], '0'])
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
it 'passes TERM on as one INT even when INTs are not forwarded' do
|
|
58
|
+
signal_when_ready('TERM')
|
|
59
|
+
|
|
60
|
+
result = described_class.call({}, [RbConfig.ruby, '-e', child], dir, forward_int: false)
|
|
61
|
+
|
|
62
|
+
expect([result, File.read(got)]).to eq([[0, true], '1'])
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
it 'sends no second INT for a TERM after a terminal Ctrl-C' do
|
|
66
|
+
signal_when_ready('INT', 'TERM')
|
|
67
|
+
|
|
68
|
+
result = described_class.call({}, [RbConfig.ruby, '-e', child], dir, forward_int: false)
|
|
69
|
+
|
|
70
|
+
expect([result, File.read(got)]).to eq([[0, true], '0'])
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
it 'passes on a stop that came before the child existed, once it does, whatever forward_int says' do
|
|
74
|
+
started = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
|
75
|
+
state = { pid: nil, stopped: true, interrupted: false }
|
|
76
|
+
|
|
77
|
+
code = described_class.run({}, [RbConfig.ruby, '-e', 'sleep 5'], dir, state, false)
|
|
78
|
+
|
|
79
|
+
expect([code, state[:interrupted], Process.clock_gettime(Process::CLOCK_MONOTONIC) - started < 4]).to eq([nil, true, true])
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
it 'forgets the pid once the child is reaped, so a late signal reaches no other process' do
|
|
83
|
+
state = { pid: nil, stopped: false, interrupted: false }
|
|
84
|
+
described_class.run({}, [RbConfig.ruby, '-e', 'exit 0'], dir, state, true)
|
|
85
|
+
described_class.stop(state, 'TERM', true)
|
|
86
|
+
|
|
87
|
+
expect(state).to eq(pid: nil, stopped: true, interrupted: false)
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
it 'restores the previous handlers' do
|
|
91
|
+
previous = trap('INT', 'IGNORE')
|
|
92
|
+
described_class.call({}, [RbConfig.ruby, '-e', 'exit 0'], dir)
|
|
93
|
+
|
|
94
|
+
expect(trap('INT', previous)).to eq('IGNORE')
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
it 'returns no exit status with one line on stderr when the command is not found' do
|
|
99
|
+
result = nil
|
|
100
|
+
|
|
101
|
+
expect { result = described_class.call({}, ['raider-no-such-command'], dir) }.to output(/Could not start raider-no-such-command/).to_stderr
|
|
102
|
+
expect(result).to eq([nil, false])
|
|
103
|
+
end
|
|
104
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ruby_raider
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.
|
|
4
|
+
version: 4.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Agustin Pequeno
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-11-
|
|
11
|
+
date: 2026-11-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler-audit
|
|
@@ -80,6 +80,20 @@ dependencies:
|
|
|
80
80
|
- - "~>"
|
|
81
81
|
- !ruby/object:Gem::Version
|
|
82
82
|
version: 3.11.0
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: rspec-retry
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - "~>"
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: '0.6'
|
|
90
|
+
type: :development
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - "~>"
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '0.6'
|
|
83
97
|
- !ruby/object:Gem::Dependency
|
|
84
98
|
name: rubocop
|
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -260,8 +274,8 @@ files:
|
|
|
260
274
|
- assets/ruby_raider_logo.svg
|
|
261
275
|
- bin/raider
|
|
262
276
|
- bin/release
|
|
263
|
-
- lib/commands/flow_commands.rb
|
|
264
277
|
- lib/commands/scaffolding_commands.rb
|
|
278
|
+
- lib/commands/schedule_commands.rb
|
|
265
279
|
- lib/commands/utility_commands.rb
|
|
266
280
|
- lib/generators/automation/automation_generator.rb
|
|
267
281
|
- lib/generators/automation/templates/account.tt
|
|
@@ -306,8 +320,6 @@ files:
|
|
|
306
320
|
- lib/generators/templates/common/reek.tt
|
|
307
321
|
- lib/generators/templates/common/rspec.tt
|
|
308
322
|
- lib/generators/templates/common/rubocop.tt
|
|
309
|
-
- lib/generators/templates/flows/flow_helper.tt
|
|
310
|
-
- lib/generators/templates/flows/run.tt
|
|
311
323
|
- lib/generators/templates/helpers/appium_helper.tt
|
|
312
324
|
- lib/generators/templates/helpers/driver_helper.tt
|
|
313
325
|
- lib/generators/templates/helpers/gesture_helper.tt
|
|
@@ -342,9 +354,11 @@ files:
|
|
|
342
354
|
- lib/ruby_raider/runtime/matchers/presence.rb
|
|
343
355
|
- lib/ruby_raider/runtime/matchers/retrying_block.rb
|
|
344
356
|
- lib/ruby_raider/runtime/observer.rb
|
|
357
|
+
- lib/ruby_raider/runtime/retry_reset.rb
|
|
345
358
|
- lib/ruby_raider/runtime/role_finder.rb
|
|
346
359
|
- lib/ruby_raider/runtime/rspec.rb
|
|
347
360
|
- lib/ruby_raider/runtime/selectors.rb
|
|
361
|
+
- lib/ruby_raider/runtime/show_browser.rb
|
|
348
362
|
- lib/ruby_raider/runtime/strict.rb
|
|
349
363
|
- lib/ruby_raider/runtime/wait.rb
|
|
350
364
|
- lib/scaffolding/name_normalizer.rb
|
|
@@ -355,28 +369,41 @@ files:
|
|
|
355
369
|
- lib/scaffolding/templates/page_object.tt
|
|
356
370
|
- lib/scaffolding/templates/spec.tt
|
|
357
371
|
- lib/utilities/desktop_downloader.rb
|
|
358
|
-
- lib/utilities/flows/next_run.rb
|
|
359
|
-
- lib/utilities/flows/notifier.rb
|
|
360
|
-
- lib/utilities/flows/os/command_runner.rb
|
|
361
|
-
- lib/utilities/flows/os/cron.rb
|
|
362
|
-
- lib/utilities/flows/os/launchd.rb
|
|
363
|
-
- lib/utilities/flows/os/linux.rb
|
|
364
|
-
- lib/utilities/flows/os/systemd.rb
|
|
365
|
-
- lib/utilities/flows/os/task_scheduler.rb
|
|
366
|
-
- lib/utilities/flows/project.rb
|
|
367
|
-
- lib/utilities/flows/run_log.rb
|
|
368
|
-
- lib/utilities/flows/runner.rb
|
|
369
|
-
- lib/utilities/flows/schedule.rb
|
|
370
|
-
- lib/utilities/flows/schedule_store.rb
|
|
371
|
-
- lib/utilities/flows/scheduler.rb
|
|
372
372
|
- lib/utilities/logger.rb
|
|
373
373
|
- lib/utilities/logo.rb
|
|
374
|
+
- lib/utilities/schedules/adapter.rb
|
|
375
|
+
- lib/utilities/schedules/base.rb
|
|
376
|
+
- lib/utilities/schedules/kind.rb
|
|
377
|
+
- lib/utilities/schedules/legacy.rb
|
|
378
|
+
- lib/utilities/schedules/legacy_stub.rb
|
|
379
|
+
- lib/utilities/schedules/next_run.rb
|
|
380
|
+
- lib/utilities/schedules/notifier.rb
|
|
381
|
+
- lib/utilities/schedules/os/command_runner.rb
|
|
382
|
+
- lib/utilities/schedules/os/cron.rb
|
|
383
|
+
- lib/utilities/schedules/os/launchd.rb
|
|
384
|
+
- lib/utilities/schedules/os/linux.rb
|
|
385
|
+
- lib/utilities/schedules/os/systemd.rb
|
|
386
|
+
- lib/utilities/schedules/os/task_scheduler.rb
|
|
387
|
+
- lib/utilities/schedules/os_enumerator.rb
|
|
388
|
+
- lib/utilities/schedules/project.rb
|
|
389
|
+
- lib/utilities/schedules/rule.rb
|
|
390
|
+
- lib/utilities/schedules/run_lock.rb
|
|
391
|
+
- lib/utilities/schedules/run_log.rb
|
|
392
|
+
- lib/utilities/schedules/run_report.rb
|
|
393
|
+
- lib/utilities/schedules/run_wrapper.rb
|
|
394
|
+
- lib/utilities/schedules/schedule.rb
|
|
395
|
+
- lib/utilities/schedules/schedule_store.rb
|
|
396
|
+
- lib/utilities/schedules/scheduler.rb
|
|
397
|
+
- lib/utilities/schedules/scheduler_steps.rb
|
|
398
|
+
- lib/utilities/schedules/selection.rb
|
|
399
|
+
- lib/utilities/schedules/spawn.rb
|
|
400
|
+
- lib/utilities/schedules/store.rb
|
|
374
401
|
- lib/utilities/utilities.rb
|
|
375
402
|
- lib/version
|
|
376
403
|
- plugins.yml
|
|
377
404
|
- ruby_raider.gemspec
|
|
378
|
-
- sig/commands/flow_commands.rbs
|
|
379
405
|
- sig/commands/scaffolding_commands.rbs
|
|
406
|
+
- sig/commands/schedule_commands.rbs
|
|
380
407
|
- sig/commands/utility_commands.rbs
|
|
381
408
|
- sig/generators/automation/automation_generator.rbs
|
|
382
409
|
- sig/generators/common_generator.rbs
|
|
@@ -408,42 +435,56 @@ files:
|
|
|
408
435
|
- sig/ruby_raider/runtime/matchers/presence.rbs
|
|
409
436
|
- sig/ruby_raider/runtime/matchers/retrying_block.rbs
|
|
410
437
|
- sig/ruby_raider/runtime/observer.rbs
|
|
438
|
+
- sig/ruby_raider/runtime/retry_reset.rbs
|
|
411
439
|
- sig/ruby_raider/runtime/role_finder.rbs
|
|
412
440
|
- sig/ruby_raider/runtime/selectors.rbs
|
|
441
|
+
- sig/ruby_raider/runtime/show_browser.rbs
|
|
413
442
|
- sig/ruby_raider/runtime/strict.rbs
|
|
414
443
|
- sig/ruby_raider/runtime/wait.rbs
|
|
415
444
|
- sig/scaffolding/name_normalizer.rbs
|
|
416
445
|
- sig/scaffolding/project_detector.rbs
|
|
417
446
|
- sig/scaffolding/scaffolding.rbs
|
|
418
447
|
- sig/utilities/desktop_downloader.rbs
|
|
419
|
-
- sig/utilities/flows/next_run.rbs
|
|
420
|
-
- sig/utilities/flows/notifier.rbs
|
|
421
|
-
- sig/utilities/flows/os/command_runner.rbs
|
|
422
|
-
- sig/utilities/flows/os/cron.rbs
|
|
423
|
-
- sig/utilities/flows/os/launchd.rbs
|
|
424
|
-
- sig/utilities/flows/os/linux.rbs
|
|
425
|
-
- sig/utilities/flows/os/systemd.rbs
|
|
426
|
-
- sig/utilities/flows/os/task_scheduler.rbs
|
|
427
|
-
- sig/utilities/flows/project.rbs
|
|
428
|
-
- sig/utilities/flows/run_log.rbs
|
|
429
|
-
- sig/utilities/flows/runner.rbs
|
|
430
|
-
- sig/utilities/flows/schedule.rbs
|
|
431
|
-
- sig/utilities/flows/schedule_store.rbs
|
|
432
|
-
- sig/utilities/flows/scheduler.rbs
|
|
433
448
|
- sig/utilities/logger.rbs
|
|
434
449
|
- sig/utilities/logo.rbs
|
|
450
|
+
- sig/utilities/schedules/adapter.rbs
|
|
451
|
+
- sig/utilities/schedules/base.rbs
|
|
452
|
+
- sig/utilities/schedules/kind.rbs
|
|
453
|
+
- sig/utilities/schedules/legacy.rbs
|
|
454
|
+
- sig/utilities/schedules/legacy_stub.rbs
|
|
455
|
+
- sig/utilities/schedules/next_run.rbs
|
|
456
|
+
- sig/utilities/schedules/notifier.rbs
|
|
457
|
+
- sig/utilities/schedules/os/command_runner.rbs
|
|
458
|
+
- sig/utilities/schedules/os/cron.rbs
|
|
459
|
+
- sig/utilities/schedules/os/launchd.rbs
|
|
460
|
+
- sig/utilities/schedules/os/linux.rbs
|
|
461
|
+
- sig/utilities/schedules/os/systemd.rbs
|
|
462
|
+
- sig/utilities/schedules/os/task_scheduler.rbs
|
|
463
|
+
- sig/utilities/schedules/os_enumerator.rbs
|
|
464
|
+
- sig/utilities/schedules/project.rbs
|
|
465
|
+
- sig/utilities/schedules/rule.rbs
|
|
466
|
+
- sig/utilities/schedules/run_lock.rbs
|
|
467
|
+
- sig/utilities/schedules/run_log.rbs
|
|
468
|
+
- sig/utilities/schedules/run_report.rbs
|
|
469
|
+
- sig/utilities/schedules/run_wrapper.rbs
|
|
470
|
+
- sig/utilities/schedules/schedule.rbs
|
|
471
|
+
- sig/utilities/schedules/schedule_store.rbs
|
|
472
|
+
- sig/utilities/schedules/scheduler.rbs
|
|
473
|
+
- sig/utilities/schedules/scheduler_steps.rbs
|
|
474
|
+
- sig/utilities/schedules/selection.rbs
|
|
475
|
+
- sig/utilities/schedules/spawn.rbs
|
|
476
|
+
- sig/utilities/schedules/store.rbs
|
|
435
477
|
- sig/utilities/utilities.rbs
|
|
436
478
|
- sig/vendor/selenium_webdriver.rbs
|
|
437
479
|
- sig/vendor/thor.rbs
|
|
438
480
|
- sig/vendor/tty_prompt.rbs
|
|
439
|
-
- spec/commands/flow_commands_spec.rb
|
|
440
481
|
- spec/commands/raider_commands_spec.rb
|
|
441
482
|
- spec/commands/scaffolding_commands_spec.rb
|
|
483
|
+
- spec/commands/schedule_commands_spec.rb
|
|
442
484
|
- spec/commands/utility_commands_spec.rb
|
|
443
485
|
- spec/generators/fixtures/templates/test.tt
|
|
444
486
|
- spec/generators/fixtures/templates/test_partial.tt
|
|
445
487
|
- spec/generators/fixtures/video_helper_stubs/selenium-webdriver.rb
|
|
446
|
-
- spec/generators/flow_helper_spec.rb
|
|
447
488
|
- spec/generators/gesture_helper_spec.rb
|
|
448
489
|
- spec/generators/network_helper_spec.rb
|
|
449
490
|
- spec/generators/screenshot_helper_spec.rb
|
|
@@ -468,9 +509,6 @@ files:
|
|
|
468
509
|
- spec/integration/content/test_content_spec.rb
|
|
469
510
|
- spec/integration/end_to_end_features_spec.rb
|
|
470
511
|
- spec/integration/end_to_end_spec.rb
|
|
471
|
-
- spec/integration/flows/flow_project.rb
|
|
472
|
-
- spec/integration/flows/run_command_spec.rb
|
|
473
|
-
- spec/integration/flows/run_lifecycle_spec.rb
|
|
474
512
|
- spec/integration/frozen_string_literal_matcher.rb
|
|
475
513
|
- spec/integration/generators/automation_generator_spec.rb
|
|
476
514
|
- spec/integration/generators/axe_addon_spec.rb
|
|
@@ -512,9 +550,12 @@ files:
|
|
|
512
550
|
- spec/runtime/matchers/presence_spec.rb
|
|
513
551
|
- spec/runtime/matchers/retrying_block_spec.rb
|
|
514
552
|
- spec/runtime/observer_spec.rb
|
|
553
|
+
- spec/runtime/retry_reset_spec.rb
|
|
515
554
|
- spec/runtime/role_finder_spec.rb
|
|
516
555
|
- spec/runtime/role_query_spec.rb
|
|
517
556
|
- spec/runtime/selectors_spec.rb
|
|
557
|
+
- spec/runtime/show_browser_project_spec.rb
|
|
558
|
+
- spec/runtime/show_browser_spec.rb
|
|
518
559
|
- spec/runtime/strict_spec.rb
|
|
519
560
|
- spec/runtime/support/browser.rb
|
|
520
561
|
- spec/runtime/support/fake_bridge.rb
|
|
@@ -526,21 +567,33 @@ files:
|
|
|
526
567
|
- spec/system/support/system_test_helper.rb
|
|
527
568
|
- spec/utilities/desktop_downloader_spec.rb
|
|
528
569
|
- spec/utilities/ffmpeg_spec.rb
|
|
529
|
-
- spec/utilities/flows/next_run_spec.rb
|
|
530
|
-
- spec/utilities/flows/notifier_spec.rb
|
|
531
|
-
- spec/utilities/flows/os/command_runner_spec.rb
|
|
532
|
-
- spec/utilities/flows/os/cron_spec.rb
|
|
533
|
-
- spec/utilities/flows/os/launchd_spec.rb
|
|
534
|
-
- spec/utilities/flows/os/linux_spec.rb
|
|
535
|
-
- spec/utilities/flows/os/systemd_spec.rb
|
|
536
|
-
- spec/utilities/flows/os/task_scheduler_spec.rb
|
|
537
|
-
- spec/utilities/flows/project_spec.rb
|
|
538
|
-
- spec/utilities/flows/run_log_spec.rb
|
|
539
|
-
- spec/utilities/flows/runner_spec.rb
|
|
540
|
-
- spec/utilities/flows/schedule_spec.rb
|
|
541
|
-
- spec/utilities/flows/schedule_store_spec.rb
|
|
542
|
-
- spec/utilities/flows/scheduler_spec.rb
|
|
543
570
|
- spec/utilities/headless_config_spec.rb
|
|
571
|
+
- spec/utilities/schedules/kind_spec.rb
|
|
572
|
+
- spec/utilities/schedules/legacy_spec.rb
|
|
573
|
+
- spec/utilities/schedules/legacy_stub_spec.rb
|
|
574
|
+
- spec/utilities/schedules/next_run_spec.rb
|
|
575
|
+
- spec/utilities/schedules/notifier_spec.rb
|
|
576
|
+
- spec/utilities/schedules/os/command_runner_spec.rb
|
|
577
|
+
- spec/utilities/schedules/os/cron_spec.rb
|
|
578
|
+
- spec/utilities/schedules/os/launchd_spec.rb
|
|
579
|
+
- spec/utilities/schedules/os/linux_spec.rb
|
|
580
|
+
- spec/utilities/schedules/os/list_ids_spec.rb
|
|
581
|
+
- spec/utilities/schedules/os/systemd_spec.rb
|
|
582
|
+
- spec/utilities/schedules/os/task_scheduler_spec.rb
|
|
583
|
+
- spec/utilities/schedules/os_entry_spec.rb
|
|
584
|
+
- spec/utilities/schedules/os_enumerator_spec.rb
|
|
585
|
+
- spec/utilities/schedules/project_spec.rb
|
|
586
|
+
- spec/utilities/schedules/run_lock_spec.rb
|
|
587
|
+
- spec/utilities/schedules/run_log_spec.rb
|
|
588
|
+
- spec/utilities/schedules/run_report_spec.rb
|
|
589
|
+
- spec/utilities/schedules/run_wrapper_integration_spec.rb
|
|
590
|
+
- spec/utilities/schedules/run_wrapper_spec.rb
|
|
591
|
+
- spec/utilities/schedules/schedule_spec.rb
|
|
592
|
+
- spec/utilities/schedules/schedule_store_spec.rb
|
|
593
|
+
- spec/utilities/schedules/scheduler_launchd_spec.rb
|
|
594
|
+
- spec/utilities/schedules/scheduler_spec.rb
|
|
595
|
+
- spec/utilities/schedules/selection_spec.rb
|
|
596
|
+
- spec/utilities/schedules/spawn_spec.rb
|
|
544
597
|
- spec/utilities/trace_command_spec.rb
|
|
545
598
|
- spec/utilities/utilities_spec.rb
|
|
546
599
|
- spec/utilities/video_command_spec.rb
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'thor'
|
|
4
|
-
require 'json'
|
|
5
|
-
require_relative '../utilities/flows/runner'
|
|
6
|
-
require_relative '../utilities/flows/scheduler'
|
|
7
|
-
|
|
8
|
-
# raider flow: recordings without assertions that run on their own.
|
|
9
|
-
class FlowCommands < Thor
|
|
10
|
-
def self.exit_on_failure? = true
|
|
11
|
-
|
|
12
|
-
class_option :project, type: :string, desc: 'The project folder (default: the current folder)'
|
|
13
|
-
|
|
14
|
-
desc 'init', 'Adds flows/flow_helper.rb and the .gitignore lines to a Selenium web project'
|
|
15
|
-
|
|
16
|
-
def init
|
|
17
|
-
code = project.init
|
|
18
|
-
exit(code) unless code.zero?
|
|
19
|
-
rescue RubyRaider::Flows::Error => e
|
|
20
|
-
stop(e)
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
# `run` is a Thor reserved word, so the method has another name
|
|
24
|
-
desc 'run NAME', 'Runs flows/NAME_flow.rb headless with its own results folder and run log'
|
|
25
|
-
option :headed, type: :boolean, desc: 'Show the browser'
|
|
26
|
-
option :retries, type: :numeric, default: 0, desc: 'Re-run the whole flow up to N times (0-3), 30 s apart'
|
|
27
|
-
option :input, type: :array, desc: 'Flow inputs as name=value (read with flow_input)'
|
|
28
|
-
option :trigger, type: :string, default: 'manual', desc: 'manual, schedule or desktop'
|
|
29
|
-
option :notify, type: :boolean, desc: 'Show a desktop notification when the flow fails'
|
|
30
|
-
|
|
31
|
-
def run_flow(name)
|
|
32
|
-
runner = RubyRaider::Flows::Runner.new(project)
|
|
33
|
-
exit(runner.run(name, headed: options[:headed], retries: options[:retries], inputs: options[:input],
|
|
34
|
-
trigger: options[:trigger], notify: options[:notify] || false))
|
|
35
|
-
rescue RubyRaider::Flows::Error => e
|
|
36
|
-
stop(e)
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
map 'run' => :run_flow
|
|
40
|
-
|
|
41
|
-
desc 'list', 'Lists the flows with their last result'
|
|
42
|
-
option :json, type: :boolean, desc: 'Print JSON for the desktop app'
|
|
43
|
-
|
|
44
|
-
def list
|
|
45
|
-
summaries = RubyRaider::Flows::RunLog.summaries(project)
|
|
46
|
-
return puts(JSON.generate(summaries)) if options[:json]
|
|
47
|
-
return puts('No flows yet: write one in flows/<name>_flow.rb') if summaries.empty?
|
|
48
|
-
|
|
49
|
-
summaries.each { |flow| puts(list_line(flow)) }
|
|
50
|
-
rescue RubyRaider::Flows::Error => e
|
|
51
|
-
stop(e)
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
desc 'schedule NAME', 'Runs a flow on a schedule with the OS scheduler'
|
|
55
|
-
option :every, type: :string, desc: 'hour, day, weekday or week'
|
|
56
|
-
option :at, type: :string, desc: 'HH:MM (24h, local time); for every hour :MM'
|
|
57
|
-
option :on, type: :string, desc: 'mon to sun, for every week'
|
|
58
|
-
option :retries, type: :numeric, default: 0, desc: 'Re-run the whole flow up to N times (0-3)'
|
|
59
|
-
option :input, type: :array, desc: 'Flow inputs as name=value'
|
|
60
|
-
option :notify, type: :boolean, desc: 'Show a desktop notification when a scheduled run fails'
|
|
61
|
-
|
|
62
|
-
def schedule(name)
|
|
63
|
-
scheduler.schedule(name, every: options[:every], at: options[:at], on: options[:on], retries: options[:retries],
|
|
64
|
-
inputs: options[:input] || [], notify: options[:notify] || false)
|
|
65
|
-
rescue RubyRaider::Flows::Error => e
|
|
66
|
-
stop(e)
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
desc 'unschedule NAME', 'Removes the schedule of a flow'
|
|
70
|
-
|
|
71
|
-
def unschedule(name)
|
|
72
|
-
scheduler.unschedule(name)
|
|
73
|
-
rescue RubyRaider::Flows::Error => e
|
|
74
|
-
stop(e)
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
desc 'schedules', 'Lists the scheduled flows with their next run and last result'
|
|
78
|
-
option :json, type: :boolean, desc: 'Print JSON for the desktop app'
|
|
79
|
-
|
|
80
|
-
def schedules
|
|
81
|
-
scheduler.schedules(json: options[:json] || false)
|
|
82
|
-
rescue RubyRaider::Flows::Error => e
|
|
83
|
-
stop(e)
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
no_commands do
|
|
87
|
-
def project
|
|
88
|
-
RubyRaider::Flows::Project.new(options[:project] || Dir.pwd)
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
def scheduler = RubyRaider::Flows::Scheduler.new(project)
|
|
92
|
-
|
|
93
|
-
def list_line(flow)
|
|
94
|
-
last = flow['last']
|
|
95
|
-
result = last ? RubyRaider::Flows.printable("#{last['status']} #{last['finished_at']}") : 'never run'
|
|
96
|
-
"#{flow['name'].ljust(30)} #{result}"
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
def stop(error)
|
|
100
|
-
warn(error.message)
|
|
101
|
-
exit(error.exit_code)
|
|
102
|
-
end
|
|
103
|
-
end
|
|
104
|
-
end
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# Every flow (flows/<name>_flow.rb) requires this file. A flow is an RSpec file without assertions:
|
|
4
|
-
# it completes when every step ran. Run one with `raider flow run <name>`, or `bundle exec rspec flows/<name>_flow.rb`.
|
|
5
|
-
# Generated by `raider flow init`.
|
|
6
|
-
|
|
7
|
-
require_relative 'support/run'
|
|
8
|
-
|
|
9
|
-
# Before the driver starts: take the flow's lock, pick its results folder, load .raider/flows/env, go headless.
|
|
10
|
-
# The report goes to this run's folder even when start! refuses the run, so a flow never cleans raider-results.
|
|
11
|
-
begin
|
|
12
|
-
RaiderFlows::Run.start!
|
|
13
|
-
ensure
|
|
14
|
-
RaiderFlows::Run.configure_reporter
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
require_relative '../helpers/spec_helper'
|
|
18
|
-
|
|
19
|
-
# Helpers available inside a flow.
|
|
20
|
-
module FlowHelper
|
|
21
|
-
# A value passed with `raider flow run <name> --input name=value`, or the recorded default.
|
|
22
|
-
def flow_input(name, default = nil)
|
|
23
|
-
key = name.to_s
|
|
24
|
-
raise ArgumentError, "invalid flow input name #{key.inspect}" unless RaiderFlows::Run::INPUT.match?(key)
|
|
25
|
-
|
|
26
|
-
ENV.fetch("RAIDER_INPUT_#{key.upcase}", default)
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
# Again now that spec_helper is surely loaded
|
|
31
|
-
RaiderFlows::Run.configure_reporter
|
|
32
|
-
|
|
33
|
-
RSpec.configure do |config|
|
|
34
|
-
config.include(FlowHelper)
|
|
35
|
-
# Flows don't touch spec/examples.txt, so `rspec --only-failures` stays about tests
|
|
36
|
-
config.example_status_persistence_file_path = nil
|
|
37
|
-
# A flow is not idempotent mid-way: never re-run it from step 1 inside one run (raider flow run --retries re-runs it whole)
|
|
38
|
-
config.default_retry_count = 0 if config.respond_to?(:default_retry_count=)
|
|
39
|
-
config.define_derived_metadata(file_path: %r{/flows/[^/]+_flow\.rb\z}) { |metadata| metadata[:flow] = true }
|
|
40
|
-
# Runs after spec_helper's hooks started the browser: a failure before this is a setup error, not a step
|
|
41
|
-
config.append_before(:each) { RaiderFlows::Run.steps_started! }
|
|
42
|
-
end
|