microsoft / playwright-dotnet

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

Actually run the `EnsurePrerequisitsRan` target #2989

Closed 0xced closed 2 months ago

0xced commented 2 months ago

The DedupeDriver target doesn't exist anywhere so the EnsurePrerequisitsRan never runs. If the drivers were never downloaded by Playwright.Tooling then the following occurs when building Playwright.csproj if EnsurePrerequisitsRan doesn't run before:

Playwright failed with 5 error(s) (3.0s)
  /usr/local/share/dotnet/sdk/8.0.401/Microsoft.Common.CurrentVersion.targets(5321,5): error MSB3030: Could not copy the file "~/playwright-dotnet/src/Playwright/.drivers/linux/node" because it was not found.
  /usr/local/share/dotnet/sdk/8.0.401/Microsoft.Common.CurrentVersion.targets(5321,5): error MSB3030: Could not copy the file "~/playwright-dotnet/src/Playwright/.drivers/mac-arm64/node" because it was not found.
  /usr/local/share/dotnet/sdk/8.0.401/Microsoft.Common.CurrentVersion.targets(5321,5): error MSB3030: Could not copy the file "~/playwright-dotnet/src/Playwright/.drivers/win32_x64/node.exe" because it was not found.
  /usr/local/share/dotnet/sdk/8.0.401/Microsoft.Common.CurrentVersion.targets(5321,5): error MSB3030: Could not copy the file "~/playwright-dotnet/src/Playwright/.drivers/mac/node" because it was not found.
  /usr/local/share/dotnet/sdk/8.0.401/Microsoft.Common.CurrentVersion.targets(5321,5): error MSB3030: Could not copy the file "~/playwright-dotnet/src/Playwright/.drivers/linux-arm64/node" because it was not found.

By actually running the EnsurePrerequisitsRan target we get a much better, actionable error instead:

Playwright failed with 1 error(s) (2.5s)
  ~/playwright-dotnet/src/Playwright/Playwright.csproj(56,5): error : Playwright prerequisites are missing. Ensure you've ran `dotnet run --project ./src/tools/Playwright.Tooling/Playwright.Tooling.csproj -- download-drivers --basepath .`