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
35
36
37
# File 'lib/superbot/cli/run_command.rb', line 17

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

  webdriver_proxy = Superbot::Web.new(webdriver_endpoint: Superbot.webdriver_endpoint(browser))
  webdriver_proxy.run_async_after_running!
  puts "🤖 active"

  chromedriver = Kommando.run_async 'chromedriver --silent --port=9515' if browser == 'local'

  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
  chromedriver&.kill
  webdriver_proxy&.quit!
  capybara_runner&.kill_session
end