Sha256: e166ba08d0dfe6fc58ffcc570b54159cd90cdf40337baa3edf992002dd311d43

Contents?: true

Size: 1.12 KB

Versions: 2

Compression:

Stored size: 1.12 KB

Contents

require 'spec_helper'

describe "Proxy + WebDriver" do
  let(:driver)  { Selenium::WebDriver.for :firefox, :profile => profile }
  let(:proxy) { new_proxy }

  let(:profile) {
    pr = Selenium::WebDriver::Firefox::Profile.new
    pr.proxy = proxy.selenium_proxy

    pr
  }

  after {
    driver.quit
    proxy.close
  }

  it "should fetch a HAR" do
    proxy.new_har("1")
    driver.get url_for("1.html")

    proxy.new_page "2"
    driver.get url_for("2.html")

    har = proxy.har

    har.should be_kind_of(HAR::Archive)
    har.pages.size.should == 2
  end

  it "should fetch a HAR and capture headers" do
    proxy.new_har("2", :capture_headers => true)

    driver.get url_for("2.html")

    entry = proxy.har.entries.first
    entry.should_not be_nil

    entry.request.headers.should_not be_empty
  end

  it "should set whitelist and blacklist" do
    proxy.whitelist(/example\.com/, 201)
    proxy.blacklist(/bad\.com/, 404)
  end

  it "should set headers" do
    proxy.headers('Content-Type' => "text/html")
  end

  it "should set limits" do
    proxy.limit(:downstream_kbps => 100, :upstream_kbps => 100, :latency => 2)
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
browsermob-proxy-0.0.9 spec/e2e/selenium_spec.rb
browsermob-proxy-0.0.8 spec/e2e/selenium_spec.rb