NoelDeMartin / cypress-laravel

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

Feature request: make plugin work when Laravel App is served from a different domain/server #5

Closed lucaspottersky closed 4 years ago

lucaspottersky commented 4 years ago

Problem:

In setups where the PHP app backend is being served from a different server than where the the one where frontend is running (say an API at http://backend.localhost), the plugin throws exceptions:

CypressError: cy.request() failed on:

http://frontend.localhost/_cypress/setup

Suggested solution:

There could be some sort of setting where you could specify to override the "baseUrl". For example, in cypress.json

env: {
  cypress-laravel-baseUrl: "http://backend.localhost"
}

When none is specified, than follow the current behaviour.

NoelDeMartin commented 4 years ago

Hey thanks for the suggestion. It sounds reasonable, I'll look into it 👍.

NoelDeMartin commented 4 years ago

I've released a new version (0.2.0) with support for this, thanks for your contribution in the PR!

I've also added a decoupled frontend with tests in the sandbox project, in case you want to see how I've configured it.