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: 6d2a03c73551065e1c8bf121c3784103fb51b5dd4d9fd3b8f63cb2e86907369a
4
- data.tar.gz: 7a66180bf3f8eae379ae8a4cbd5e1d67d8531cdfc0689719cf96524f294c5b89
3
+ metadata.gz: '08e65f3439e99bb96417025e12570fd6c036e7cacaf9c22fdc93429910cc50ff'
4
+ data.tar.gz: 6d8c6b4e5c698c249fc0cab2195a9831cf6396032f1b8edf4d4afd77f3b8c175
5
5
  SHA512:
6
- metadata.gz: 7ec32a794ca503b5d95c147834bbd7dd0b0e6c4b8b803df15c35cbe6f2044062cbc709eab9641a55da9aff084f549b98296ffe64d20a44e0ad2a41099e521927
7
- data.tar.gz: 6bfce7e393d7ab498639dca2342dfe3434b87ce0bee462b7e8c42017965ff9512e1d232de2126de0b92983dc0eb9faa1c084283eac1521b2bceb4a2d8b152be3
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
- @stacks_id = @connection.local_utils.tracing_started(@traces_dir, trace_name)
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
- @connection.local_utils.trace_discarded(@stacks_id)
50
+ local_utils.trace_discarded(@stacks_id) if local_utils
49
51
  end
50
52
 
51
53
  return
52
54
  end
53
55
 
54
- unless @connection.remote?
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
- @connection.local_utils.zip(
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
- @connection.local_utils.trace_discarded(@stacks_id)
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
- @connection.local_utils.zip(
90
+ return unless local_utils
91
+
92
+ local_utils.zip(
84
93
  zipFile: file_path,
85
94
  entries: [],
86
95
  stacksId: @stacks_id,
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Playwright
4
- VERSION = '1.57.2.alpha1'
4
+ VERSION = '1.57.2.alpha2'
5
5
  COMPATIBLE_PLAYWRIGHT_VERSION = '1.57.0'
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: playwright-ruby-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.57.2.alpha1
4
+ version: 1.57.2.alpha2
5
5
  platform: ruby
6
6
  authors:
7
7
  - YusukeIwaki