Closed
Description
Current behaviour:
Cypress could not verify that the server set as your 'baseUrl' is running:
> https://example.com
Your tests likely make requests to this 'baseUrl' and these tests will fail if you don't boot your server.
Desired behavior:
Tests run after successful ensureUrl
check
How to reproduce:
Run tests over proxy.
Or this might be to do with the fact our baseURL serves 403 responses - which is normal behaviour for us. Our tests query sub-urls, which return 200 responses. This theory is inconsistent with the http://example.com
call failing the ensureUrl
check.
Our hunch is that node's net.connect
method, used in the ensureUrl check isn't respecting proxy settings.
https://github.com/cypress-io/cypress/blob/master/packages/server/lib/util/connect.coffee#L10
Additional Info (images, stack traces, etc)
We are able to run via the Cypress UI, but with a warning message in the UI.
When I commented out the following ensureURL
check, tests were able to run.
_this._server.on("upgrade", onUpgrade);
_this._server.once("error", onError);
return _this._listen(port, onError).then(function(port) {
return Promise.all([
httpsProxy.create(appData.path("proxy"), port, {
onRequest: callListeners,
onUpgrade: onSniUpgrade
}), fileServer.create(fileServerFolder)
]).spread(function(httpsProxy, fileServer) {
_this._httpsProxy = httpsProxy;
_this._fileServer = fileServer;
_this._baseUrl = baseUrl;
// if (baseUrl) {
// return connect.ensureUrl(baseUrl)["return"](null)["catch"](function(err) {
// if (config.isTextTerminal) {
// return reject(errors.get("CANNOT_CONNECT_BASE_URL", baseUrl));
// } else {
// return errors.get("CANNOT_CONNECT_BASE_URL_WARNING", baseUrl);
// }
// });
// }
}).then(function(warning) {
_this._onDomainSet(baseUrl != null ? baseUrl : "<root>");
return resolve([port, warning]);
});
});
};
})(this));
- Operating System: RHEL7
- Cypress Version: 1.4.2
- Browser Version: Chome 60
- Node Version: 8.8.0
Metadata
Metadata
Assignees
Labels
No labels
Activity
[-]`ensureUrl` failure[/-][+]`ensureUrl` failure (potentially due to corporate proxy usage)[/+]brian-mann commentedon Apr 24, 2018
This is correct,
net.connect
does not respect proxies. We'll need to switch to using a regular HTTP request whennet.connect
fails or when proxies are set.knaumenko commentedon Oct 11, 2018
I am getting the same error when running my tests in circleCI and updating env variables didn't help. Are there any progress on this?
cgalbiati commentedon Oct 11, 2018
To elaborate on @katerynae's comment (I am a teammate), we started getting the error when we switched from a url that was redirected to a cdn using cname rules, to one that was proxied through cloudflare and an nginx server.
rsmets commentedon Oct 12, 2018
I have been using a workaround of just passing an environmental variable effectively replacing the
baseUrl
setting in thecypress.json
. However I think a side effect of doing so is upon first opening a test using the test runner the initial check is made onlocalhost
(and subsequently tests are run) then the browser reloads and all but the first test is reran which is what the dashboard reads as the result. This stutter step, so to speak, has had averse effects on tests as one can imagine. Below is an example to reproduce. Please open the console with preserve log checked. In this example thetestUrl
value is not used but in reality is. I have posted this a separate bug ticket here #26027 remaining items