Sha256: 2bc3cf3a253e3bc679174f1662f88bd6c3e68da05bdce01ac167fffe6859c395

Contents?: true

Size: 1.51 KB

Versions: 12

Compression:

Stored size: 1.51 KB

Contents

require 'spec_helper'

describe Jasmine::Runners::ChromeHeadless do

  let(:config) {
    {
      show_console_log: nil,
      show_full_stack_trace: nil,
      chrome_cli_options: nil,
      chrome_binary: nil,
    }
  }

  it 'uses chrome_binary from config is set' do
    config[:chrome_binary] = "some_path"
    runner = Jasmine::Runners::ChromeHeadless.new(nil, nil, double(config))

    expect(runner.chrome_binary).to eq("some_path")
  end

  it 'uses chrome_binary from default chrome path if it exist' do
    allow(File).to receive(:file?).and_return(true)
    runner = Jasmine::Runners::ChromeHeadless.new(nil, nil, double(config))

    expect(runner.chrome_binary).to eq("/usr/bin/google-chrome")
  end

  it 'chrome_binary raise an exeption if nowhere to be found' do
    allow(File).to receive(:file?).and_return(false)
    runner = Jasmine::Runners::ChromeHeadless.new(nil, nil, double(config))

    expect {
      runner.chrome_binary
    }.to raise_error(RuntimeError)
  end

  describe "cli_options_string" do
    it "empty hash is empty result" do
      runner = Jasmine::Runners::ChromeHeadless.new(nil, nil, double(config))
      expect(runner.cli_options_string).to eq("")
    end

    it "formats hash properly" do
      config[:chrome_cli_options] = {"no-sandbox" => nil, "headless" => nil, "remote-debugging-port" => 9222}
      runner = Jasmine::Runners::ChromeHeadless.new(nil, nil, double(config))
      expect(runner.cli_options_string).to eq("--no-sandbox --headless --remote-debugging-port=9222")
    end
  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
jasmine-3.99.0 spec/chrome_headless_spec.rb
jasmine-3.10.0 spec/chrome_headless_spec.rb
jasmine-3.9.2 spec/chrome_headless_spec.rb
jasmine-3.9.1 spec/chrome_headless_spec.rb
jasmine-3.9.0 spec/chrome_headless_spec.rb
jasmine-3.8.1 spec/chrome_headless_spec.rb
jasmine-3.8.0 spec/chrome_headless_spec.rb
jasmine-3.7.0 spec/chrome_headless_spec.rb
jasmine-3.6.0 spec/chrome_headless_spec.rb
jasmine-3.5.1 spec/chrome_headless_spec.rb
jasmine-3.5.0 spec/chrome_headless_spec.rb
jasmine-3.4.0 spec/chrome_headless_spec.rb