browsermob-proxy 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
@@ -19,10 +19,14 @@ module BrowserMob
|
|
19
19
|
@port = port
|
20
20
|
end
|
21
21
|
|
22
|
-
def new_har(
|
23
|
-
previous = @resource["har"].put :initialPageRef =>
|
22
|
+
def new_har(ref = nil)
|
23
|
+
previous = @resource["har"].put :initialPageRef => ref
|
24
24
|
HAR::Archive.from_string(previous) unless previous.empty?
|
25
25
|
end
|
26
|
+
|
27
|
+
def new_page(ref)
|
28
|
+
@resource['har/pageRef'].put :pageRef => ref
|
29
|
+
end
|
26
30
|
|
27
31
|
def har
|
28
32
|
HAR::Archive.from_string @resource["har"].get
|
data/spec/e2e/selenium_spec.rb
CHANGED
data/spec/unit/client_spec.rb
CHANGED
@@ -7,9 +7,11 @@ module BrowserMob
|
|
7
7
|
let(:resource) { mock(RestClient::Resource) }
|
8
8
|
let(:client) { Client.new(resource, "localhost", 9091) }
|
9
9
|
let(:har_resource) { mock("resource[har]") }
|
10
|
+
let(:page_ref_resource) { mock("resource[har/pageRef]") }
|
10
11
|
|
11
12
|
before do
|
12
13
|
resource.stub!(:[]).with("har").and_return(har_resource)
|
14
|
+
resource.stub!(:[]).with("har/pageRef").and_return(page_ref_resource)
|
13
15
|
end
|
14
16
|
|
15
17
|
it "creates a new har" do
|
@@ -29,6 +31,12 @@ module BrowserMob
|
|
29
31
|
|
30
32
|
client.har.should be_kind_of(HAR::Archive)
|
31
33
|
end
|
34
|
+
|
35
|
+
it "creates a new page" do
|
36
|
+
page_ref_resource.should_receive(:put).with :pageRef => "foo"
|
37
|
+
|
38
|
+
client.new_page("foo")
|
39
|
+
end
|
32
40
|
end
|
33
41
|
|
34
42
|
end
|