I, personally, would not use NCrunch for end-to-end with Playwright or similar stuff. Too many external, heavy dependencies. Just use the normal Test Runner.
Playwright with C# just a Remote Browser Controller.
"Tests fail" without details cannot yield answers with a Solution. I think more details are needed.
Are the Playwright Dependencies installed?
What is the error?
Der-Albert.com wrote:
I, personally, would not use NCrunch for end-to-end with Playwright or similar stuff. Too many external, heavy dependencies. Just use the normal Test Runner.
I have a reason to run the tests through NCrunch. I'm looking for how to do what I want to do, not for how to not do what I want to do.
Der-Albert.com wrote:
"Tests fail" without details cannot yield answers with a Solution. I think more details are needed.
Fair! Here is the exception message -
'C:\Users\despicableMe\AppData\Local\NCrunch\992\6\src\Query.Playwright.Tests\bin\Debug\net10.0\..\..\..\..\Query.Web'. The directory name is invalid.)
---> System.ComponentModel.Win32Exception (267): An error occurred trying to start process 'dotnet' with working directory 'C:\Users\despicableMe\AppData\Local\NCrunch\992\6\src\Query.Playwright.Tests\bin\Debug\net10.0\..\..\..\..\Query.Web'. The directory name is invalid.
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
at Query.Playwright.Tests.LandingPagePlaywrightTests.RunWithAppAsync(Func`2 test) in C:\repos\QueryLocal\src\Query.Playwright.Tests\LandingPagePlaywrightTests.cs:line 269
at Query.Playwright.Tests.LandingPagePlaywrightTests.FileBasedAllSpacesResetsToDefault_Playwright() in C:\repos\QueryLocal\src\Query.Playwright.Tests\LandingPagePlaywrightTests.cs:line 171
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.Wait()
at InvokeStub_Task.Wait(Object, Object, IntPtr*)
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
Playwright isn't supported by NCrunch. As Albert has stated, it's big, it's heavy and relies on a lot of complex infrastructure to manage the test process itself. The exception you're receiving is caused by NCrunch's workspacing. Basically, Playwright is trying to reach between projects inside the solution structure to spin up a sub-process, which is something that is difficult to do under NCrunch because of project atomicity constraints.
To my knowledge, the only way to make NCrunch work with Playwright would be to introduce some kind of integration layer between them, and probably find a way to modify playwright itself. I don't necessarily think that this would be impossible, but it would require quite a bit of investment. Since very few people seem interested in using Playwright with NCrunch, I think it's unlikely to happen.
Sorry, I realise this is probably not the response you were hoping for, but sometimes it pays to be realistic about these things.
'C:\Users\despicableMe\AppData\Local\NCrunch\992\6\src\Query.Playwright.Tests\bin\Debug\net10.0\..\..\..\..\Query.Web'. The directory name is invalid.)
---> System.ComponentModel.Win32Exception (267): An error occurred trying to start process 'dotnet' with working directory 'C:\Users\despicableMe\AppData\Local\NCrunch\992\6\src\Query.Playwright.Tests\bin\Debug\net10.0\..\..\..\..\Query.Web'. The directory name is invalid.
at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
at Query.Playwright.Tests.LandingPagePlaywrightTests.RunWithAppAsync(Func`2 test) in C:\repos\QueryLocal\src\Query.Playwright.Tests\LandingPagePlaywrightTests.cs:line 269
at Query.Playwright.Tests.LandingPagePlaywrightTests.FileBasedAllSpacesResetsToDefault_Playwright() in C:\repos\QueryLocal\src\Query.Playwright.Tests\LandingPagePlaywrightTests.cs:line 171
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.Wait()
at InvokeStub_Task.Wait(Object, Object, IntPtr*)
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
From that Exception, which seem to be coming from a functionality in your Test Assembly. I would assume thare is something of with the path, NCrunch copies all Source Code and Dependencies it thinks it needed to a different folder, but this is mostly just compile time dependencies. If you need additional files in your tests, you must configure NCrunch to also copy them.
Your are doing you, but NCrunch using fat dependencies and limiting the Tests to be executed serial, and i would a assume in a specific order is nothing what main point of NCrunch is - running impacted tests as I type as fast as possible.
I could see that you would like to use this as an automated runner as you type also in C#. But Playwright, together with C#, is not a good fit for that (has nothing to do with NCrunch, Playwright without TypeScript is not a superb experience, I'm also stuck with Playwright with .NET, i don't like it).
With Playwright in TypeScript, this is a different story; this has this out of the box. And NCrunch is not involved.
Thanks for the reply, Remco. I could try to figure out what needs to be copied, but given that I can use the MSTest runner I can switch to it and run the Playwright tests.
As for the comment "But Playwright, together with C#, is not a good fit for that." This misses the practical aspect of - I am already using the NCrunch test runner, all i have to do is manually run the playwright tests.
https://learn.microsoft.com/en-us/visualstudio/test/run-unit-tests-with-test-explorer?view=visualstudio#run-tests-after-every-build Run Test after a build would be, in my (just a random dude on the internet, an NCrunch user since its early days, but I'm not Remco, who is the author of NCrunch) opinion, the better option for that.