Sha256: 22fbed75df5c6928bbd84cbc7c167bfb43db93df7b29f2a98020c9a1b529ba45

Contents?: true

Size: 1002 Bytes

Versions: 7

Compression:

Stored size: 1002 Bytes

Contents

# frozen_string_literal: true

module Superbot
  module CLI
    class RunCommand < Clamp::Command
      include Superbot::Validations

      parameter "PATH", "project directory" do |path|
        validates_project_path path
      end

      option ['--browser'], 'BROWSER', "Browser type to use. Can be either local or cloud", default: 'cloud' do |browser|
        validates_browser_type browser
      end
      option ['--region'], 'REGION', 'Region for remote webdriver'

      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
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
superbot-0.1.31 lib/superbot/cli/run_command.rb
superbot-0.1.30 lib/superbot/cli/run_command.rb
superbot-0.1.29 lib/superbot/cli/run_command.rb
superbot-0.1.28 lib/superbot/cli/run_command.rb
superbot-0.1.27 lib/superbot/cli/run_command.rb
superbot-0.1.26 lib/superbot/cli/run_command.rb
superbot-0.1.25 lib/superbot/cli/run_command.rb