Skip to content

Commit

Permalink
[Changed] bump playwright-core to v1.33.0
Browse files Browse the repository at this point in the history
  • Loading branch information
coreyti committed May 28, 2024
1 parent bf695e2 commit af4a527
Show file tree
Hide file tree
Showing 5 changed files with 470 additions and 196 deletions.
30 changes: 15 additions & 15 deletions assets/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion assets/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"dependencies": {
"electron": "24.0.0",
"playwright": "1.32.0"
"playwright": "1.33.0"
}
}
5 changes: 5 additions & 0 deletions lib/playwright/channel.ex
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ defmodule Playwright.Channel do
connection = Session.connection(session)
message = Message.new(guid, message, params)

# IO.inspect(message, label: "---> Channel.post/4")

with_timeout(params, fn timeout ->
case Connection.post(connection, message, timeout) do
{:ok, %{id: _} = result} ->
Expand All @@ -46,10 +48,13 @@ defmodule Playwright.Channel do
end

def recv(session, {nil, message}) when is_map(message) do
# IO.inspect(message, label: "<--- Channel.recv/2 A")
Response.recv(session, message)
end

def recv(session, {from, message}) when is_map(message) do
# IO.inspect(message, label: "<--- Channel.recv/2 B")

Response.recv(session, message)
|> reply(from)
end
Expand Down
10 changes: 9 additions & 1 deletion lib/playwright/route.ex
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ defmodule Playwright.Route do
def continue(route, options \\ %{})

def continue(%Route{session: session} = route, options) do
params = Map.merge(options, %{intercept_response: false})
# HACK to deal with changes in v1.33.0
catalog = Playwright.Channel.Session.catalog(session)
request = Playwright.Channel.Catalog.get(catalog, route.request.guid)
params = Map.merge(options, %{request_url: request.url})
Channel.post(session, {:guid, route.guid}, :continue, params)
end

Expand All @@ -40,10 +43,15 @@ defmodule Playwright.Route do
def fulfill(%Route{session: session} = route, %{status: status, body: body}) when is_binary(body) do
length = String.length(body)

# HACK to deal with changes in v1.33.0
catalog = Playwright.Channel.Session.catalog(session)
request = Playwright.Channel.Catalog.get(catalog, route.request.guid)

params = %{
body: body,
is_base64: false,
length: length,
request_url: request.url,
status: status,
headers:
serialize_headers(%{
Expand Down
Loading

0 comments on commit af4a527

Please sign in to comment.