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

Change browser name programmatically / run test across multiple browsers in NUnit #2938

Closed hayters closed 5 months ago

hayters commented 5 months ago

Please do not submit this issue.

mxschmitt commented 5 months ago

This issue is not following the bug template. Please re-file and provide a self-contained reproduction, which we can run locally to reproduce your issue. Thanks for your understanding!

hayters commented 5 months ago

I've been evaluating Playwright.NET with the NUnit test runner, and am curious if there is a way to execute tests across multiple browsers?

Is there any way of running the tests across multiple browsers from within the C# tests? I've been looking at using the TestFixture attribute with the browser names, but there isn't any way (or at least not an obvious way) to set the browser name programmically from within the test.

(I know I can go up a level and run the tests multiple times and pass settings in, but was curious if there was a way of controlling this from within the C#)

mxschmitt commented 5 months ago

We recommend the same browser per the whole test-execution. If you still need a different browser, you can launch it manually: https://playwright.dev/dotnet/docs/api/class-browsertype#browser-type-launch inside your test, using the Playwright class property.

Running all the tests in multiple browsers is not possible as of today.

hayters commented 5 months ago

Thank you @mxschmitt for the clarification :).