ferrum-har 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 652f3679a70306ac244d2a0627a3609da85ae96c8360365c3b21c1cb315b994c
4
- data.tar.gz: 77443a4e93f2e05dfbc63b3370176778c2857a4bdf8663c4c953a88f6eca635d
3
+ metadata.gz: 90c64095f327010a5364542de46bdb7eb2b5af3bbb401b0d643438900311c8ea
4
+ data.tar.gz: b53a43f0a6198c95cb20968ba4bd941ac8b085484e4592bc5853a72716a29043
5
5
  SHA512:
6
- metadata.gz: '0358163ac7ff98f450c9027f2909713d8d5fcfafb0e0668de62d3de288b62912b2109a091340236bb3719b12a92e159be0ab3f379fb3137120f4e900110ec536'
7
- data.tar.gz: 6b5aab790b3d341338734b73527bdc3532613fc2248b3b291d1cf856b96b0444bb3073ca4f8fbe053ae5db806807a0f00834304ed22cb950602a15f324e0d32a
6
+ metadata.gz: fcf185fd1cd4b579fc0a1a2a57169285f7333f189eb8eeebd11d61202a8fc797bcce03db925e522dfa381f83f84038ce9b41fdced0957e7d8a4af3477fb88581
7
+ data.tar.gz: 951491f82275957ad30ea99a8e50f07867388744173e360f887558259bc6a252cffa2e96d99f2eb3ae8ee16b93c93ce1b44ce186a49093b6110acbff7dc4ea89
@@ -19,6 +19,14 @@ module Ferrum
19
19
  Gem::Version.new(p.split("/")[1])
20
20
  }
21
21
  end
22
+
23
+ return if @path
24
+
25
+ raise <<~ERR
26
+ Browser path not found. Please set BROWSER_PATH environment variable, or trigger a download of Chrome Testing by using:
27
+
28
+ bundle exec rake chrome:install
29
+ ERR
22
30
  end
23
31
 
24
32
  private def check_har_related_browser_options(options)
@@ -12,7 +12,7 @@ module Ferrum
12
12
  def har
13
13
  network.wait_for_idle
14
14
  execute("document.ferrumHarRequested = true;")
15
- base64_encoded_har = Ferrum::Utils::Attempt.with_retry(
15
+ har_hash_result = Ferrum::Utils::Attempt.with_retry(
16
16
  errors: [HarNotReadyError],
17
17
  # 10 seconds
18
18
  max: 20,
@@ -21,13 +21,18 @@ module Ferrum
21
21
  found = evaluate("document.ferrumHar;")
22
22
  raise HarNotReadyError unless found
23
23
 
24
- found
24
+ inlined_har = Base64.decode64(found)
25
+ har_hash = JSON.parse(inlined_har)
26
+ raise HarNotReadyError, "Result does not appear to be a HAR" unless har_hash.key?("log")
27
+
28
+ entries = har_hash.dig("log", "entries")
29
+ # If entries is nil or empty, the HAR is not ready yet.
30
+ raise HarNotReadyError if entries.nil? || entries.empty?
31
+
32
+ har_hash
25
33
  end
26
- inlined_har = Base64.decode64(base64_encoded_har)
27
- har_hash = JSON.parse(inlined_har)
28
- raise "Result does not appear to be a HAR" unless har_hash.key?("log")
29
34
 
30
- JSON.pretty_generate(har_hash)
35
+ JSON.pretty_generate(har_hash_result)
31
36
  end
32
37
  end
33
38
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ferrum
4
4
  module Har
5
- VERSION = "1.0.0"
5
+ VERSION = "1.0.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ferrum-har
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Harry Lascelles
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-06-12 00:00:00.000000000 Z
11
+ date: 2025-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64