Skip to content

Commit

Permalink
[Added] test coverage for Playwright.launch/2 with options
Browse files Browse the repository at this point in the history
  • Loading branch information
coreyti committed Apr 8, 2023
1 parent 1bfca8f commit a8ba505
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
13 changes: 12 additions & 1 deletion test/playwright_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ defmodule Playwright.PlaywrightTest do
use Playwright.UnitTest
alias Playwright.API.{Browser, Page}

describe "Playwright.launch/1" do
describe "Playwright.launch/2" do
test "with :chromium" do
with {:ok, br} <- Playwright.launch(:chromium),
{:ok, pg} <- Browser.new_page(br),
Expand Down Expand Up @@ -33,5 +33,16 @@ defmodule Playwright.PlaywrightTest do
end
|> pass()
end

@tag :headed
test "with options: `%{headless: false}`" do
with {:ok, br} <- Playwright.launch(:chromium, %{headless: false}),
{:ok, pg} <- Browser.new_page(br),
{:ok, rs} <- Page.goto(pg, "https://www.whatsmybrowser.org") do
assert Playwright.Response.ok(rs)
assert Playwright.Page.text_content(pg, "h2.header") =~ "Chrome"
end
|> pass()
end
end
end
1 change: 1 addition & 0 deletions test/test_helper.exs
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
:erlang.system_flag(:backtrace_depth, 20)
ExUnit.configure(exclude: [:headed])
ExUnit.start()

0 comments on commit a8ba505

Please sign in to comment.