-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with artisan route #61
Comments
@enigmatic-user do you have the web server running? For example I have this command in my
and this in my cypress config
|
@i-bajrai Thank you for your reply! Yes, XAMPP (Apache) is always running on my system; when I remove the artisan calls, the tests work, but of course I can't use anything that uses artisan. I have defined a local domain and added an entry in the hosts file so I can call the site using https://www.efa2021.test/. The baseUrl is defined in the cypress.config.js (laracasts/cypress add this entry when executing I haven't tried using |
@enigmatic-user I was receiving the same error when trying to use the I did however manage a workaround, by adding a route and controller action specifically for the command I wanted. Currently this is editing the package files in the vendor directory, but it probably wouldn't be too hard to extract it to its own controller until it gets fixed. I've been able to run tests without issue (thus far) on my set up (Laravel Homestead on Windows).
Sidenote: I have no idea why this works, since it does basically the same thing except skips parsing the command portion. tests\cypress\support\laravel-commands.jsCypress.Commands.add("refreshDatabase", (parameters = {}, options = {}) => {
- return cy.artisan("migrate:fresh", options);
+ return cy.csrfToken().then((token) => {
+ return cy.request({
+ method: "POST",
+ url: "/__cypress__/refresh-database",
+ body: { parameters: parameters, _token: token },
+ log: false,
+ });
+ });
}); vendor\laracasts\cypress\src\routes\cypress.phpRoute::post('/__cypress__/refresh-database', [CypressController::class, 'refreshDatabase'])
->name('cypress.refresh-database'); vendor\laracasts\cypress\src\Controllers\CypressController.phppublic function refreshDatabase(Request $request)
{
Artisan::call('migrate:fresh', $request->input('parameters', []));
} |
I just wanted to give Cypress a try; I need to add some integration tests to an existing Laravel 9 project (which uses Livewire, if that makes a difference).
I'm developing on a Windows 10 (21H2) system with XAMPP 8.0.5.
I installed Cypress 10.3.0 and laracasts/cypress 3.0.0 as described (copy & paste). When I try to run the example spec (or any other basic spec), an error occurs:
The artisan route seems to have a problem; when I remove
cy.artisan('config:clear', {}, { log: false });
from the tests/cypress/support/index.js (both lines), the test passes.
cy.exec('php artisan config:clear');
works, so calling artisan is no general problem.
I'm not sure if it is connected, but on the console where I started Cypress, the line
[37252:0703/093736.462:ERROR:gpu_init.cc(446)] Passthrough is not supported, GL is disabled, ANGLE is
can be found between the access log lines, and yes, the text is cropped at the end.
I tried testing with Chrome and Electron.
Could this be a Windows- or XAMPP-specific issue? I couldn't find anything about this problem.
Any help would be greatly appreciated!
The text was updated successfully, but these errors were encountered: