question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tests run in Chrome with baseUrl set navigate directly to baseUrl instead of Test Runner URL

See original GitHub issue

Current behavior:

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. image Removing the baseUrl property will load Cypress as normal, as does having a value set but running the tests using Electron.

Desired behavior:

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.

Steps to reproduce:

  1. Add "baseUrl": "https://doesntmatteranyurl" to Cypress.json
  2. Open Cypress
  3. Set browser to Chrome
  4. Run any tests

Versions

Cypress: 2.1.0 (happened on previous versions too) OS: Windows 10 1803

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:30 (7 by maintainers)

github_iconTop GitHub Comments

6reactions
jennifer-shehanecommented, Jan 30, 2019

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
    }
  })
}
1reaction
alastair-toddcommented, May 23, 2019

I have similar issue - I can visit my baseUrl, but not with a relative path

cypress
      cy.visit("http://localhost:4200/index.html"); //OK
      cy.visit("index.html"); // fails

cypress.json:

{
  "baseUrl": "http://localhost:4200"
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Cypress: How to visit a url of a different origin? - Stack Overflow
I have my base URL set to the domain I want to test, the issue is when I want to test the ability...
Read more >
How to set baseUrl at runtime? - Google Groups
I'm utilizing the example project at https://github.com/geb/geb-example-cucumber-jvm to run Cucumber with Geb. The baseUrl changes depending on if I'm testing ...
Read more >
Configuration - Cypress Documentation
This guide is for Cypress 10 and the new JavaScript configuration file format. If you are on an older version of Cypress that...
Read more >
Running a Test against Multiple Environments Using BaseURL
Using BaseURL in a Test Studio project. Multiple test environments in which to execute test scripts. The server URL is different for each...
Read more >
Testrunner - WebdriverIO
WebdriverIO comes with its own test runner to help you start testing as quickly as ... --baseUrl shorten url command calls by setting...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found