cypress: Server is running but 404s on visit to application during cypress run
Current behavior:
Circle config.yml:
frontend-test:
<<: *defaults
docker:
- image: cypress/base:8
- image: circleci/node:10
working_directory: ~/repo
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run: npm ci
- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}
- run: npm run test:cypress
Package.json:
{
"cypress:run": "cypress run",
"start": "webpack-dev-server --config ./webpack.config.js --mode development",
"test:cypress": "start-server-and-test start http://localhost:8080 cypress",
"cypress": "cypress run",
}
cypress:json:
{
"baseUrl": "http://localhost:8080/",
"fixturesFolder": "cypress/fixtures",
"integrationFolder": "cypress/integration",
"pluginsFile": "cypress/plugins",
"screenshotsFolder": "cypress/screenshots",
"supportFile": "cypress/support",
"videosFolder": "cypress/videos"
}
webpack.config.js:
module.exports = {
entry: "./public/js/app.js"
}
GETTING ERROR:

Desired behavior:
it says:
CypressError: cy.visit() failed trying to load:
http://localhost:8080/login
The response we received from your web server was:
> 404: Not Found
I have been trying this past 4 days, I don’t know what is wrong, please help
The front-end is vuejs, hence the login page is login.vue which is loading vue-router
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 22 (5 by maintainers)
Links to this issue
Commits related to this issue
- testing potential fix https://github.com/cypress-io/cypress/issues/3245 — committed to jsueling/full-stack-open-pokedex by jsueling 3 years ago
@embiem try this : https://github.com/cypress-io/cypress/issues/1872#issuecomment-450807452
We’re experiencing a similar issue right now. It looks like cypress reloads the whole page with the baseUrl of the site we want to test instead of cypress’s baseUrl. In more detail:
When no baseUrl is set, we see the test page (where the tests are listed on the left side) at the url
http://localhost:56113/__/#/tests/integration\myTestFolder\myTest.spec.jsand once we go into the first test and call cy.visit(), the whole page reloads with thehttp://localhost:3000/__/#/tests/integration\myTestFolder\myTest.spec.jsURL, which of course is a 404 on our website. The whole test run is then stuck. It pretty much looks like in the gif @TanvirAlam posted above, where the blank at the end is loading our website which then shows the 404 page.When we have the baseURL set in the cypress.json, then the test window immediately loads the 404 page. The actual test window is not shown.
This only happens when running the tests in Chrome, but works when running in Electron. We have a dependency on Chrome because of our CI setup.
@jennifer-shehane Just give you little more information as to this is a Laravel vue SPA project run on Docker.
Do I need to install something? like
composer? and donpm run devSo far tried many things ended up with this:
Still the same ERROR:
I am so sorry, but I am little new to Cypress and I would really like it if CircleCI could take care of it
Locally, it works just fine
As far as I understood #1872 it has to do with a chromium update. So if your Chrome browser was updated between yesterday and today, this might be the reason.
@OussamaBaybay thanks, that fixes our issue!
@jennifer-shehane converted mp4 to gif
I’m also having an issue similar to this.