When I set a baseUrl and attempt to run the tests in Chrome, instead of the test runner it attempts to directly go to that URL.

Removing the baseUrl property will load Cypress as normal, as does having a value set but running the tests using Electron.
When I run the tests with Chrome, it should navigate to Cypress running on localhost and show me the Cypress Test Runner. This is how it behaves when using Electron as the browser.
"baseUrl": "https://doesntmatteranyurl" to Cypress.jsonCypress: 2.1.0 (happened on previous versions too)
OS: Windows 10 1803
This is the intended behavior of baseUrl as outlined here
How are you seeing the main url in the Electron browser? - the main url bar does not display for me in Electron.
Are you having an issue running the tests in Chrome versus Electron? Are the tests not running / displaying an error?
Ah, I've misunderstood it then. I assumed it was always going to be Cypress' URL in the address bar. and the site in question in the secondary bar.
In that case, the issue is that when I attempt to write a test for https://e2e-webapp-dev-brighthr-canadev.azurewebsites.net I don't see the Test Runner UI in Chrome and the tests do nothing (it also breaks the page, removing the background and causing JS errors).
When I run the tests in Electron through the UI, it's working correctly, and I'm pretty sure we're not doing any frame-busting, so I'm not sure why they are behaving differently.
I'm unable to recreate this in my environment using Cypress 2.1.0 on Mac. Tried Chrome 66, Chromium 65, Canary 68 and Electron 59. The only other obvious difference I see is Windows, which I would have to test.
Do you have any other configuration set up? Anything in your cypress.json or env vars?
It could be, my colleages also had it but they were all running Windows 7 or 10 too.
Here's the full cypress.json, no environment variables set.
{
"baseUrl": "https://e2e-webapp-dev-brighthr.azurewebsites.net",
"viewportWidth": 1440,
"viewportHeight": 900,
"env": {
"apiUrl": "https://e2e-brighthr-api-dev.azurewebsites.net",
"region": "uk"
},
"reporter": "mochawesome",
"reporterOptions": {
"inline": true,
"reportDir": "cypress/report",
"reportFilename": "e2e",
"configFile": "cypress.json"
},
"reporterEnabled": "mochawesome,@cypress/mocha-teamcity-reporter",
"mochawesomeReporterOptions": {
"quiet": true,
"configFile": "cypress.json"
}
}
@jennifer-shehane: Just asked a colleague on a Mac to run it and it's fine for them, so it appears to be a Windows issue. Here's what I see:

And here's what my colleague sees (note the Test Runner UI in the background):

Still an issue on 3.0.1.
I'm experiencing the same issue on Fedora 28:
With Chrome 68: the baseUrl is opened instead of the test runner and I get a 404 error.
When I use Chromium 67 or Electron 59 everything is working as expected.
Another hint: the error occurs in Cypress version 2.1.0 (where it already worked before) and in version 3.0.3.
This seems to indicate that something changed in a newer Chrome version which causes the problem.
Oftentimes Windows has a different major Chrome release version than Linux/Mac machines, so while it is only happening on Windows - it may be a specific Chrome version issue - would need full versions of Chrome it is happening on.
I'm still unable to replicate on:
These just happen to be the chrome versions on my machine at the moment though.
I have the same issue...
Chrome 68, Cypress 3.1.0, Mac OS.
Still an issue for us. Interestingly, @TPiddy above is on a Mac, implying it's something other than the OS, but I haven't been able to reproduce it on the Macs in our office.
Same problem here with a create-react-app application:
Version 72.0.3622.0 (Official Build) canary (64-bit))cypress.json:
{
"baseUrl": "http://localhost:3000"
}
Test run:
context('Redirections', () => {
it('goes to github', () => {
cy.visit('https://github.com/')
cy.url().should('contains', '/');
})
})
URL I see on the browser: http://localhost:3000/__/#/tests/integration/actions.spec.js
The problem happened using cypress run --browser canary and cypress open
I'm running into a similar issue – a locally hosted web server and Cypress' test runner not displaying when baseUrl is set to that local URL (e.g. http://localhost:8080). There appears to be some issue with some versions of Chrome/Chromium (currently I get this issue on Chromium Version 73 and Chrome Version 72) regarding localhost/127.0.0.1 URLs bypassing the configured proxy, which is what Cypress uses to inspect network traffic and provide the test runner under the /__/ path.
I have some more details about that here: https://github.com/cypress-io/cypress/issues/1872#issuecomment-445581050
Still an issue with Cypress 3.1.4 and Chrome 71.0.3578.98 (Official Build) (64-bit) on Windows 10 1803.
I have this issue as well on Windows 7, Cypress 3.1.4 and 71.0.3578.98 (Official Build) (32-bit).
Can any of you experiencing this issue, try to add the code below and respond whether it fixes the issue or not?
Add the code below to your cypress/plugins/index.js file:
module.exports = (on) => {
on('before:browser:launch', (browser = {}, args) => {
if (browser.name === 'chrome') {
// ^ make sure this is your browser name, you may
// be using 'canary' or 'chromium' for example, so change it to match!
args.push('--proxy-bypass-list=<-loopback>')
return args
}
})
}
Hi @jennifer-shehane, I confirm that adding these lines fixes the issue :D
@jennifer-shehane yes, that seems to fix it for me.
This PR will automatically pass these flags through to Chrome and should resolve this issue when released: https://github.com/cypress-io/cypress/pull/3049
Released in 3.1.5.
@jennifer-shehane interestingly, this doesn't work for every machine I have. It worked on my home machine yesterday, but when I try it on my work machine I'm still getting this. I've tried with and without your code snippet and tried 3.1.5 too, but no luck. I've also upgraded to Chrome 72.0.3626.81 (Official Build) (64-bit), reinstalled it from scratch and completely wiped Chrome's settings, but no change.
Hey @StormPooper, can you try setting "modifyObstructiveCode": false in your cypress.json? Does that fix the issue?
@jennifer-shehane just tried it, no difference.
This issue happens to me also. The only way to get around is restarting my machine. I am using a MacBook
Had the same issue with the following browser:
{
isChosen: true,
majorVersion: '73',
name: 'chromium',
path: 'chromium-browser',
version: '73.0.3683.75',
isHeaded: true,
isHeadless: false
}
https://github.com/cypress-io/cypress/issues/1777#issuecomment-458842728 doesn't solve it for me.
It also happens when I select Electron 59 instead of Chromium in the cypress client.
The line that causes the issue is:
cy.visit('http://localhost:1080');
Config
baseUrl is set to http://localhost:3000Preview

For those who really need to move forward, here is my to cents hack to bypass this issue:
/**
* Open a link not covered by `baseUrl`.
* See https://github.com/cypress-io/cypress/issues/1777
*/
Cypress.Commands.add('openExternalLink', url => {
cy.visit('/').then(window => {
const linkIdentifier = `__TMP_CY_EXTERNAL_LINK__`;
const link = window.document.createElement('a');
link.innerHTML = linkIdentifier;
link.setAttribute('href', url);
link.setAttribute('id', linkIdentifier);
window.document.body.appendChild(link);
cy.get(`#${linkIdentifier}`).click();
});
});
I'm not able to replicate this issue by simply visiting 2 localhosts, with 1 of the localhosts being set as my baseUrl.
In Chrome Version 73.0.3683.86

test code
it('visits 3030 port', () => {
cy.visit('http://localhost:3030')
})
it('visits 2222 port', () => {
cy.visit('http://localhost:2222')
})
cypress.json
{
"baseUrl": "http://localhost:3030"
}
Can you verify that visiting the second localhost directly - with no baseUrl set - loads the page properly? I want to make sure there is not some misdirection - that the page loads usually within Cypress.
Anyways, we will need a reproducible example in order to reopen the issue unfortunately.
I have similar issue - I can visit my baseUrl, but not with a relative path

cy.visit("http://localhost:4200/index.html"); //OK
cy.visit("index.html"); // fails
cypress.json:
{
"baseUrl": "http://localhost:4200"
}
so it appears I have missed a subtle difference between cy.request and cy.visit
beginner's error!
Most helpful comment
Can any of you experiencing this issue, try to add the code below and respond whether it fixes the issue or not?
Add the code below to your
cypress/plugins/index.jsfile: