playwright-ruby-client 1.57.2.alpha1 → 1.57.2.alpha2
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: '08e65f3439e99bb96417025e12570fd6c036e7cacaf9c22fdc93429910cc50ff'
|
|
4
|
+
data.tar.gz: 6d8c6b4e5c698c249fc0cab2195a9831cf6396032f1b8edf4d4afd77f3b8c175
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7bc076b12e0f1c3b857c8b1d2c92902ea74fd79f3423d880850af115c893963df1d55ae4e86faeb10da45906306315c8115342995b4853ee20dbb544180fb71a
|
|
7
|
+
data.tar.gz: 98afeada2083bd4953c2cafd67fdd4f6f155528e89a87deb97ad93327fda51c7e63a66d9a962aa6e8c092e3637c3aa4e083ca2b00543b729adc1dd7b7c286bd7
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
require 'base64'
|
|
2
|
+
require 'fileutils'
|
|
2
3
|
|
|
3
4
|
module Playwright
|
|
4
5
|
define_channel_owner :Stream do
|
|
5
6
|
def save_as(path)
|
|
7
|
+
parent_dir = File.dirname(path)
|
|
8
|
+
FileUtils.mkdir_p(parent_dir) unless parent_dir == '.'
|
|
9
|
+
|
|
6
10
|
File.open(path, 'wb') do |f|
|
|
7
11
|
read_with_block do |chunk|
|
|
8
12
|
f.write(chunk)
|
|
@@ -23,7 +23,8 @@ module Playwright
|
|
|
23
23
|
@is_tracing = true
|
|
24
24
|
@connection.set_in_tracing(true)
|
|
25
25
|
end
|
|
26
|
-
|
|
26
|
+
local_utils = @connection.local_utils
|
|
27
|
+
@stacks_id = local_utils&.tracing_started(@traces_dir, trace_name)
|
|
27
28
|
end
|
|
28
29
|
|
|
29
30
|
def stop_chunk(path: nil)
|
|
@@ -40,20 +41,26 @@ module Playwright
|
|
|
40
41
|
@is_tracing = false
|
|
41
42
|
@connection.set_in_tracing(false)
|
|
42
43
|
end
|
|
44
|
+
local_utils = @connection.local_utils
|
|
43
45
|
|
|
44
46
|
unless file_path
|
|
45
47
|
# Not interested in any artifacts
|
|
46
48
|
@channel.send_message_to_server('tracingStopChunk', mode: 'discard')
|
|
47
49
|
if @stacks_id
|
|
48
|
-
|
|
50
|
+
local_utils.trace_discarded(@stacks_id) if local_utils
|
|
49
51
|
end
|
|
50
52
|
|
|
51
53
|
return
|
|
52
54
|
end
|
|
53
55
|
|
|
54
|
-
|
|
56
|
+
is_local = !@connection.remote?
|
|
57
|
+
if is_local
|
|
58
|
+
unless local_utils
|
|
59
|
+
raise 'Cannot save trace because localUtils is unavailable.'
|
|
60
|
+
end
|
|
61
|
+
|
|
55
62
|
result = @channel.send_message_to_server_result('tracingStopChunk', mode: 'entries')
|
|
56
|
-
|
|
63
|
+
local_utils.zip(
|
|
57
64
|
zipFile: file_path,
|
|
58
65
|
entries: result['entries'],
|
|
59
66
|
stacksId: @stacks_id,
|
|
@@ -69,7 +76,7 @@ module Playwright
|
|
|
69
76
|
# The artifact may be missing if the browser closed while stopping tracing.
|
|
70
77
|
unless result['artifact']
|
|
71
78
|
if @stacks_id
|
|
72
|
-
|
|
79
|
+
local_utils.trace_discarded(@stacks_id) if local_utils
|
|
73
80
|
end
|
|
74
81
|
|
|
75
82
|
return
|
|
@@ -80,7 +87,9 @@ module Playwright
|
|
|
80
87
|
artifact.save_as(file_path)
|
|
81
88
|
artifact.delete
|
|
82
89
|
|
|
83
|
-
|
|
90
|
+
return unless local_utils
|
|
91
|
+
|
|
92
|
+
local_utils.zip(
|
|
84
93
|
zipFile: file_path,
|
|
85
94
|
entries: [],
|
|
86
95
|
stacksId: @stacks_id,
|
data/lib/playwright/version.rb
CHANGED