NoelDeMartin / cypress-laravel

Cypress plugin to test Laravel applications
MIT License
31 stars 7 forks source link

How do I set the base URL if the laravel setup is on another setup? #2

Closed stirredo closed 4 years ago

stirredo commented 4 years ago

I checked the code and it seems like this library was designed with laravel setup in same directory or domain as the vue.

I am using vue-cli and I have a separate front-end and backend. Please make the base URL configurable.

Edit: I should mention that vue-cli already sets the baseUrl config in cypress.json according to vue-cli. I haven't been able to figure out how to override the setting. It would be really nice if the library provided a way to set a baseUrl to the laravel setup.

NoelDeMartin commented 4 years ago

The base url for Laravel is configured in the .env file, I don't think this library is responsible to change that. What I normally do is that I have a .env.testing file with configuration for a testing environment and use it for running tests. You can see an example of how this works in this project that is running the tests in github actions: https://github.com/NoelDeMartin/laravel-cypress-sandbox

About vue-cli, this library doesn't know if your application is using Vue, plain JS or anything else. The way Cypress works is that it visits a url and uses the browser like a normal user would (or as close as possible).