Skip to content

Commit d648eff

Browse files
committed
[Fixed] Resolves a number of test issues
Some of which stem from internal changes, some from changes to playwright-core.
1 parent 1751810 commit d648eff

File tree

6 files changed

+16
-7
lines changed

6 files changed

+16
-7
lines changed

lib/playwright/browser_context.ex

+3
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,9 @@ defmodule Playwright.BrowserContext do
352352
{:ok, _} ->
353353
:ok
354354

355+
{:ok, _} ->
356+
:ok
357+
355358
{:error, %Channel.Error{message: "Target page, context or browser has been closed"}} ->
356359
:ok
357360
end

lib/playwright/sdk/channel_owner.ex

+2-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ defmodule Playwright.SDK.ChannelOwner do
1212
@derive {Inspect, only: [:guid] ++ @properties}
1313

1414
import Playwright.SDK.Extra.Map
15-
alias Playwright.SDK.Channel.Event
1615
alias Playwright.SDK.Channel
1716

1817
defstruct @properties ++ [:session, :guid, :initializer, :listeners, :parent, :type]
@@ -80,8 +79,8 @@ defmodule Playwright.SDK.ChannelOwner do
8079
require Logger
8180

8281
@doc false
83-
@spec on_event(struct(), Event.t()) :: {term(), struct()}
84-
def on_event(owner, %Event{} = event) do
82+
@spec on_event(struct(), Channel.Event.t()) :: {term(), struct()}
83+
def on_event(owner, %Channel.Event{} = event) do
8584
listeners = Map.get(owner.listeners, event.type, [])
8685

8786
event =

lib/playwright/sdk/helpers/serialization.ex

+6-1
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,15 @@ defmodule Playwright.SDK.Helpers.Serialization do
44
import Playwright.SDK.Extra.Map
55

66
def deserialize(:ok) do
7-
# Logger.warning("Received `Playwright.SDK.Helpers.Serialization.deserialize/1` with `:ok`. It's unclear why this is happening")
7+
Logger.warning("Received `Playwright.SDK.Helpers.Serialization.deserialize/1` with `:ok`. It's unclear why this is happening")
88
:ok
99
end
1010

11+
# NOTE: this is (probably) the desired API; need to work toward it.
12+
def deserialize({:ok, value}) do
13+
deserialize(value)
14+
end
15+
1116
def deserialize(value) when is_map(value) do
1217
case value do
1318
%{a: list} ->

test/integration/page/accessibility_test.exs

+3-2
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ defmodule Playwright.Page.AccessibilityTest do
135135
value: "Edit this image:",
136136
children: [
137137
%{role: "text", name: "Edit this image:"},
138-
%{role: "img", name: "my fake image"}
138+
%{role: "image", name: "my fake image"}
139139
]
140140
}
141141
end
@@ -155,7 +155,8 @@ defmodule Playwright.Page.AccessibilityTest do
155155
multiline: true,
156156
value: "Edit this image:",
157157
children: [
158-
%{role: "text", name: "Edit this image:"}
158+
%{role: "text", name: "Edit this image:"},
159+
%{role: "image", name: "my fake image"}
159160
]
160161
}
161162
end

test/integration/page/evaluate_handle_test.exs

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ defmodule Playwright.Page.EvaluateHandleTest do
3535

3636
test "works with a handle that references an object with nesting", %{page: page} do
3737
handle = Page.evaluate_handle(page, "function() { return { x: 1, y: { lala: 'lulu' } }; }")
38+
assert %Playwright.JSHandle{} = handle
3839
assert Page.evaluate(page, "function(o) { return o; }", handle) == %{x: 1, y: %{lala: "lulu"}}
3940
end
4041

test/integration/response_test.exs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ defmodule Playwright.ResponseTest do
1414
describe "Response.body/1" do
1515
test "for a simple HTML page", %{assets: assets, page: page} do
1616
response = Page.goto(page, assets.prefix <> "/title.html")
17-
assert Response.body(response) == "<title>Woof-Woof</title>\n"
17+
assert Response.body(response) == "<!DOCTYPE html>\n<title>Woof-Woof</title>\n"
1818
end
1919
end
2020
end

0 commit comments

Comments
 (0)