-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tests run in Chrome with baseUrl set navigate directly to baseUrl instead of Test Runner URL #1777
Comments
This is the intended behavior of 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 |
It could be, my colleages also had it but they were all running Windows 7 or 10 too. Here's the full {
"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 When I use Chromium 67 or Electron 59 everything is working as expected. |
Another hint: the error occurs in Cypress version 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:
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: The problem happened using |
I'm running into a similar issue – a locally hosted web server and Cypress' test runner not displaying when I have some more details about that here: #1872 (comment) |
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 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: #3049 |
Released in |
@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 |
@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 {
isChosen: true,
majorVersion: '73',
name: 'chromium',
path: 'chromium-browser',
version: '73.0.3683.75',
isHeaded: true,
isHeadless: false
} #1777 (comment) 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:
Config
Preview |
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 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. |
so it appears I have missed a subtle difference between beginner's error! |
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.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:
"baseUrl": "https://doesntmatteranyurl"
toCypress.json
Versions
Cypress: 2.1.0 (happened on previous versions too)
OS: Windows 10 1803
The text was updated successfully, but these errors were encountered: