Class: Superbot::CLI::RunCommand

Inherits:
Clamp::Command
  • Object
show all
Includes:
Validations
Defined in:
lib/superbot/cli/run_command.rb

Instance Method Summary collapse

Methods included from Validations

#validates_browser_type, #validates_project_path

Instance Method Details

#executeObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/superbot/cli/run_command.rb', line 17

def execute
  script = File.read(File.join(path, 'main.rb'))

  @teleport = Thread.new do
    Superbot::CLI::TeleportCommand.run(nil, ARGV[2..-1], context)
  end

  @capybara_runner = Superbot::Capybara::Runner.new(browser: browser, region: region)
  @capybara_runner.run(script)
  puts @capybara_runner.test_result

  puts "Press ENTER to exit"

  $stdin.gets
ensure
  @teleport&.kill
  @capybara_runner&.kill_session
end