question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Feature] More intuitive setup and installation of Playwright

See original GitHub issue

I’m a fan of PowerShell, but I think having to add Microsoft.Playwright.NUnit or a similar package, then build your project, then execute a PowerShell script that you can find in the bin/something...something/playwright.ps1 is not the ideal experience or the experience .NET developers expect. It works great tho!

I was hoping the Playwright setup experience could be more in line with what we expect as .NET developers. I’m not an expert on MSBuild and still new to Playwright, so call me out if I’m off base!

When installing any Playwright NuGet package, I’d expect the installation to modify the MSBuild project file, and the MSBuild project file would setup all of Playwright the first time. I’m not sure if Playwright updates its dependencies automatically over time, but if it did, I’d expect that to be checked for and updated during build. This could also be a standalone MSBuild target.

Alternatively, I think Playwright may also be a good fit for a global tool, or a local tool like the ef core tool. Then inside the project, you may be able to run dotnet playwright init or dotnet playwright update.

Based on the NuGet package and MSBuild target described above, I’d expect there to be additional .NET templates for NUnit, MsTest, and xUnit. These templates would be the most intuitive ways to get started with Playwright and also to be reused for .NET IDEs like Visual Studio, VS Code, and Rider.

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:26
  • Comments:19 (8 by maintainers)

github_iconTop GitHub Comments

9reactions
IanChamberlain-SMScommented, Nov 2, 2022

For Visual Studio the user experience should be:

  1. Create a test project (Nunit/xUnit/MSTest whatever)
  2. Add Nuget dependency for Playwright
  3. Write Test Code
  4. Run Tests

This experience currently fails because browsers aren’t installed. By default it should check to see if the browser specified has been installed and if not install it or alternatively use the Users Default Browser if it is supported.

6reactions
AngelMunozcommented, Sep 11, 2022

I just found this myself as well last time I tried it I was using the CLI tool which was bizarre for me as well. A global CLI tool that requires a project build to work… that’s now that I would expect, specially when the node.js experience is quite smooth (npx playwright install like a .NET global tool)

I expected the global CLI tool to at minimum (and sometimes even at most) to just install the browsers because my builds and F# scripts failed just because playwright browsers were not installed nothing else, once I ran npx playwright install things just worked and I could live with that

Now I come back and find that I need to run powershell scripts? which are generated after build?

That’s simply too bizarre for me to be honest I’d prefer to have a global CLI tool that’s just a wrapper over npx playwright install if that would let me do the following

dotnet tool restore
dotnet playwright install
dotnet build # or test

I don’t think this is a cosmetic issue, while I know every project is different I find it hard to justify that I need to modify my .NET workflow just because a library seems to have weird requirements

Now I’m not sure how my wording is for this feedback but I certainly have no intention to annoy anyone it is just my raw experience with this tool from a few minutes ago after a couple of months away from it. The install experience hasn’t been there from the get go, once we’re past that things just work very nicely and smooth, it is a very sweet library to work with

Extra: It would be nice to pin this issue to make it more visible

Read more comments on GitHub >

github_iconTop Results From Across the Web

Installation | Playwright
Run the install command and select the following to get started: Choose between TypeScript or JavaScript (default is TypeScript)
Read more >
Playwright Tutorial: Getting Started With ...
This Playwright tutorial will guide you through the setup of the Playwright framework, which will enable you to write end-to-end tests for ...
Read more >
what is nor0x.Playwright.BrowserDownloader
I really like the Playwright project. It's a great tool to automate browser tasks and has a well-designed API. I use it for...
Read more >
Mastering Test Automation with Playwright Java
Playwright provides a flexible and intuitive way to handle environment-specific configurations such as URLs, credentials, and API endpoints.
Read more >
Our experiences and impressions with Playwright
Explore the process of setting up and using Playwright, while also offering a comparative analysis with its counterparts.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found