microsoft / playwright-dotnet

.NET version of the Playwright testing and automation library.
https://playwright.dev/dotnet/
MIT License
2.47k stars 235 forks source link

[Question]: run playwright.ps1 after `dotnet publish` #2098

Closed 304NotModified closed 2 years ago

304NotModified commented 2 years ago

Hi,

I'm trying to run the playwright.ps1 instead of the Microsoft.Playwright.CLI.

We create an artifact of the published application (with the tests) and run that. We do something like: dotnet publish --ouput .dist --configuration Release --no-restore). From that artifact we create an docker container.

In the publish there is no playwright.ps1 file. I tried copying that, but it failed when running as it probably needs more files.

How could I fix that the playwright.ps1 is in my publish folder? I prefer no to create an artifact of the bin folder.

PS: we hoped we did not need the playwright.ps1 when using -p:PlaywrightPlatform=linux on dotnet build. But we get sometimes, but not always, Looks like Playwright Test or Playwright was just installed or updated.

campersau commented 2 years ago

Copying the playwright.ps1 file to the correct output folder during publish could be fixed like I have done for the node platform folders here https://github.com/microsoft/playwright-dotnet/pull/1955 by using a <ItemGroup> instead of <Copy>. I left it out in the PR because you could use Microsoft.Playwright.Program.Main(new[] {" install" }) instead.

mxschmitt commented 2 years ago

@campersau lets add it so we have the same experience for the users who publish it and they don't have to rely on the API call nor not recommended CLI for it? wdyt?