I have a Laravel 10 app running in Homestead on my Windows 10 machine and I'm trying to get Dusk running properly.
It's important to note that this is a Laravel/Vue application and so I'm running Vite for hot reloads.
Dusk runs fine if the vite server is not running and I build the resources manually, but I don't want to have to do that while I'm writing my tests.
With vite running I get Facebook\WebDriver\Exception\TimeoutException:
Because there are issues with npm and symlinks within Homestead, I'm running Vite in the Windows environment instead which might be the problem. I'm very new to this and don't think I've really got my head around how it works.
Grateful for any help!
After a great deal of exploration, I have finally solved this.
In my case, using Homestead in Windows, I am running my vite server in a Windows terminal but not for lack of trying*
So for my test running inside Homestead, it needs to be able to access the vite server running on windows
Running
npm run dev --showed me the local IP that vite was usingThen in vite.config.js
Now when I run dusk it can see the vite server rather than having to build assets every time I run the tests
Hope this helps someone else!
I tried installing vite inside Homestead, but npm install was failing trying to create symlinks. I had to then restart vagrant from a windows terminal running as admin. This allowed me to install everything and then run vite. However, I have using vscode as my editor and I have learned that as I'm changing files vite was not registering the change. From the vite docs:
"Using Vite on Windows Subsystem for Linux (WSL) 2
When running Vite on WSL2, file system watching does not work when a file is edited by Windows applications (non-WSL2 process). This is due to a WSL2 limitation. This also applies to running on Docker with a WSL2 backend.
To fix it, you could either:
Recommended: Use WSL2 applications to edit your files. It is also recommended to move the project folder outside of a Windows filesystem. Accessing Windows filesystem from WSL2 is slow. Removing that overhead will improve performance. Set { usePolling: true }. Note that usePolling leads to high CPU utilization."
And yes,
userPolling:truemade my server crawl to a halt.