-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
[Feature] "Headless" CLI Watch Mode #21960
Comments
Try setting environment variable |
While we all waiting on this there's also a way to run a watch mode if you're on CI, using the git staged files. You can pull the files changed in
at the end, the above would issue a command like
|
I really love |
This only watches test files. Especially with component testing which are basically unit tests and follow short "Red light - Green light - Refactor" loops, it would be very useful if the CLI watched source files also the way Jest's VS Code extension does. |
That's what it does. |
UPDATE: Now using This is the new
Hi @pavelfeldman, I am pretty certain that watch mode of Another thing it doesn't do is create or serve HTML report that can be really useful when there are failures. I am currently using a workaround using My current watch mode setup is as follows: I have a script named
Since every run of
and instead launch Then at the end of every run of To get the above scripts to work, I think the following NPM packages would need to be installed (in addition to playwright of course):
Finally, for anyone using VS Code who wants
In
With the three patterns in If there are failures, you can see indications in a few different places: |
Everybody: are you still using this mode? How do you feel about us removing this experiment? Do you feel like it's adding enough value atop of chokidar? Let us know what you think! |
Dear Andrey,
I don’t think it’s adding any value as the UX is not there.
A watch mode should be supplemented with visual indicators of failure and
launch on opening the folder in the editor of the sort you get when you run
the watch command from a VS Code task in .vscode/tasks.json.
Also, the mode doesn’t generate or serve Playwright’s marvellous HTML
report. I had to stitch that together with concurrently, http-server and
plain “npm playwright test –reporter=html”.
See my comment below if you haven't already; this I think is a fairly
complete watch mode with a good UX:
#21960 (comment)
One place where you could add lots of value I think is if you could provide
a command in Command Pallette to generate both the watch command in
package.json and an accompanying task in .vscode/tasks.json. Writing the
whole thing for the first time can be real pain because:
* some patterns that regex101 excepts are not matched by VS Code.
Playwright watch mode generates a line of text with a chevron in it that VS
Code can't match. Figuring this out can be a pain.
* In all my watch modes (Storybook, accessibility tests and Playwright
tests) I have to echo out a beginning line of text and an ending line of
text so that the problemMatcher in VS Code task can know when a tests run
started and when it ended (crucial as the watch task itself runs
perpetually). You could instead use echo these out to match you VS Code
task's regex patterns.
* There are lots of nuances of VS Code tasks that take a lot of trial and
error to figure out the first time you write a watch mode.
Bests,
Naveed
Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for Windows
*From: *Andrey Lushnikov ***@***.***>
*Sent: *31 July 2023 19:05
*To: *microsoft/playwright ***@***.***>
*Cc: *naveedausaf ***@***.***>; Comment
***@***.***>
*Subject: *Re: [microsoft/playwright] [Feature] "Headless" CLI Watch Mode
(Issue #21960)
*Everybody*: are you still using this mode? How do you feel about us
removing this experiment? Do you feel like it's adding enough value atop of
chokidar?
Let us know what you think!
—
Reply to this email directly, view it on GitHub
<#21960 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AE3REKWEFACZPJJUAQISNWLXS7XWVANCNFSM6AAAAAAWGZ4ERE>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
On second thoughts, it would be great if Playwright extension could just
provide a command that could launch a similar watch mode in a separate
terminal window with similar UX (indications of failure, successful
completion and running tests in terminal header).
The folders to watch in addition to `tests` could be configured in
`playwright.config.ts`.
It really is very useful to have it. Basically, iPlaywright is so fast and
I have enough cores that as I am done with git add and git commit, I see a
tick to say that all my tests have passed. I can then do git push:
![image](https://github.com/microsoft/playwright/assets/20386346/902a43bd-5396-4b93-8e9a-945626a71803)
Thanks,
Naveed
…On Tue, Aug 1, 2023 at 1:33 AM Naveed Ausaf ***@***.***> wrote:
Dear Andrey,
I don’t think it’s adding any value as the UX is not there.
A watch mode should be supplemented with visual indicators of failure and
launch on opening the folder in the editor of the sort you get when you run
the watch command from a VS Code task in .vscode/tasks.json.
Also, the mode doesn’t generate or serve Playwright’s marvellous HTML
report. I had to stitch that together with concurrently, http-server and
plain “npm playwright test –reporter=html”.
See my comment below if you haven't already; this I think is a fairly
complete watch mode with a good UX:
#21960 (comment)
One place where you could add lots of value I think is if you could
provide a command in Command Pallette to generate both the watch command
in package.json and an accompanying task in .vscode/tasks.json. Writing the
whole thing for the first time can be real pain because:
* some patterns that regex101 excepts are not matched by VS Code.
Playwright watch mode generates a line of text with a chevron in it that VS
Code can't match. Figuring this out can be a pain.
* In all my watch modes (Storybook, accessibility tests and Playwright
tests) I have to echo out a beginning line of text and an ending line of
text so that the problemMatcher in VS Code task can know when a tests run
started and when it ended (crucial as the watch task itself runs
perpetually). You could instead use echo these out to match you VS Code
task's regex patterns.
* There are lots of nuances of VS Code tasks that take a lot of trial and
error to figure out the first time you write a watch mode.
Bests,
Naveed
Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for
Windows
*From: *Andrey Lushnikov ***@***.***>
*Sent: *31 July 2023 19:05
*To: *microsoft/playwright ***@***.***>
*Cc: *naveedausaf ***@***.***>; Comment
***@***.***>
*Subject: *Re: [microsoft/playwright] [Feature] "Headless" CLI Watch Mode
(Issue #21960)
*Everybody*: are you still using this mode? How do you feel about us
removing this experiment? Do you feel like it's adding enough value atop of
chokidar?
Let us know what you think!
—
Reply to this email directly, view it on GitHub
<#21960 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AE3REKWEFACZPJJUAQISNWLXS7XWVANCNFSM6AAAAAAWGZ4ERE>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
@aslushnikov I like this mode. Even though I mostly use UI Mode, I still regularly use Some of our team members even prefer |
@aslushnikov I use this mode for component testing, with and without showing the browser. Also, without browser, the experience is similar to Jest's |
I do think it's a good idea to have a console watch mode like Jest. But Jest watches code files also (not just tests files like Playwright console watch mode does). This is a good idea in Playwright, especially for component tests. Also, once you enable watch mode,
|
If the
That enables me to very quickly try different changes towards the end of the test without needing to wait for dozens of steps I know will pass to complete every iteration loop. edit: found a similar question and figured out how to hack this in https://github.com/microsoft/playwright/discussions/22883#discussioncomment-6732710. |
Would love a native, traditional watch mode for Playwright. I typically write code in the terminal and use tmux for subwindows. With other test runners, I can have them run in a subwindow and whenever I modify a test or part of the code, it will rerun the affected tests and show me a red/green result quickly. I can't do that with Playwright. The |
Would it be possible to run only the tests related to the open Git changes when initiating tests using Is it also an option to add test cancelation by, for example, typing |
I really like PWTEST_WATCH=1 Basically when I use "Show & reuse browser: on" Only my setup project runs in headful browser, afterwards all tests run headlessly, any one knows what could be the issue ? |
Ideally, the CLI watch mode behaves exactly like |
PWTEST_WATCH=1 works perfectly. Regardless of what the final solution will be it should be documented right away. |
I give +1 for By the way, I think your comment had a lot of upvotes, so, what do you think?
So what do you think could be the reason why when I use |
Another +1 for watch. It's really important to have in a TDD workflow and just a good DX. Thanks for the |
Playwright CLI has an |
Playwright recently introduced a watch mode via a new
--ui
flag. While awesome, it doesn't quite meet some other use cases for a "Watch Mode". Namely continuous background validation of tests where a UI might be intrusive, but you still want red/green when test srcs are updated. At that point you might jump in the UI to debug, but by default you're mostly just interested in continuous background validation.Playwright is also increasingly being used for unit tests or integration tests, where a full browser step through might not be relevant.
The text was updated successfully, but these errors were encountered: