-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Playwright driver #136
Conversation
@@ -66,13 +66,13 @@ defmodule PhoenixTest.PageView do | |||
data-to="/page/delete_record" | |||
data-csrf="sometoken" | |||
> | |||
Data-method Delete | |||
Data_method Delete |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Playwright treats exact: false
as case insensitive. PhoenixTest remains case sensitive.
d035d38
to
bfa8f06
Compare
b983204
to
ca83bfb
Compare
c6a2bce
to
c17b997
Compare
page = Playwright.Browser.new_page(context.browser) | ||
ExUnit.Callbacks.on_exit(fn -> Playwright.Page.close(page) end) | ||
|
||
[conn: page] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This just overwrites the conn
context field with a playwright page
.
Probably not the best way of doing this.
Just chose this as it was minimally invasive.
@@ -0,0 +1,66 @@ | |||
defmodule PhoenixTest.Case do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly copied from PlaywrightTest.Case
|> fill_in("Email", with: nil) | ||
|> within("#email-form", fn session -> | ||
session | ||
|> fill_in("Email", with: "email") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add text first, them remove.
Otherwise this is a no-op when using playwright.
conn | ||
|> visit("/live/index") | ||
|> fill_in("Email", with: "some@example.com") | ||
|> within("#email-form", fn session -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Workaround for #142
Implicit and explicit labels not treated equally by Live
and Static
drivers: explicit wins, no error is.
But Playwright treats them equally and raises an error.
<label for="email">Email</label>
<input id="email" name="email" />
<label>Email<input type="email" name="email" /></label>
2b617c1
to
47160e7
Compare
@@ -69,5 +69,8 @@ jobs: | |||
- name: Check Formatting | |||
run: mix format --check-formatted | |||
|
|||
- name: Install playwright browsers | |||
run: mix playwright.install |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cache?
2823f40
to
c7402bf
Compare
@@ -0,0 +1,66 @@ | |||
defmodule PhoenixTest.Case do | |||
@moduledoc false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add docs (API tbd)
use PhoenixTest.Case,
playwright: chromium,
headless: false,
slow_mo: 500
c7402bf
to
7ff956e
Compare
|
I don't think we need to use much of what Somewhat comparable to |
That's exactly where I landed too. I don't know if I'm misrepresenting what I started exploring that (even started creating a project to handle Elixir <-> CDP communication through websockets), but had to halt due to time constraints. So... now, I don't know if we need Wallaby or Playwright. It would be cool (but not sure if a ton more work) to create an Elixir CDP wrapper that allows us to communicate with chrome (kind of like |
Elixir CDP wrapper: bitcrowd/chromic_pdf might be a good starting point. But I still think "vanilla" playwright (not via |
Oh cool. I didn't know about that package. I'll take a look.
Yeah, that's an interesting idea. I didn't realize that's what you had suggested at first (though, now I see it 😄 ). I like that idea too. I can see how we need maybe 1/10th of what playwright-elixir is trying to do. We could do it directly with playwright, and leverage what we already have in |
Closing in favour of #145 |
@germsvel I know you're working on this anyway. I'm just leaving this here in case you want to have a look.
I wanted to play around with playwright a bit to get more input for my upcoming CodeBEAM talk.
Fairly smooth sailing so far. I see you've been active in
playwright-elixir
getting things ready 🙂 .