Skip to content
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

Cy.visit() does not load page #3941

Closed
chris2kus31 opened this issue Apr 11, 2019 · 18 comments
Closed

Cy.visit() does not load page #3941

chris2kus31 opened this issue Apr 11, 2019 · 18 comments
Labels
pkg/https-proxy This is due to an issue in the packages/https-proxy directory type: duplicate This issue or pull request already exists

Comments

@chris2kus31
Copy link

Current behavior:

Upon running cy.visity() and inputing a URL, the request times out.

Desired behavior:

Trying to run a simple cy.visit() command but unable to

Page does not load and hangs until it times out. On the command line there is a Head 500 error

Steps to reproduce: (app code and test code)

Versions

running 3.1.5 as i am having issues with 3.2

Linux

@mateosilguero
Copy link

What is the url you are trying to visit ?

Could you share the line of code ?

@chris2kus31
Copy link
Author

The tutorial URL. https://example.cypress.io. It lags and then times out. on the command line i can see a HEAD 500 error.

HEAD / 500 48.458 ms - -
HEAD / 500 41.724 ms - -
HEAD / 500 37.204 ms - -
GET /generate_204 204 9.275 ms - -

@mateosilguero
Copy link

This works fine for me (v3.2.0)

describe('Cy Visit', function() {
  it('test visit method', function() {
    cy.visit('https://example.cypress.io')
  })
});

@chris2kus31
Copy link
Author

right, it might be a proxy issue. as it returns an error saying that Page could not load

@mateosilguero
Copy link

The pages load in the browser ? i mean, outside cypress.

i'm seeing this logs too

HEAD / 500 76.457 ms - -
HEAD / 500 83.168 ms - -
HEAD / 500 100.969 ms - -

but it's working anyway

@chris2kus31
Copy link
Author

The page doesnt load on my browser. I get a 'page could not load" message

@flotwig
Copy link
Contributor

flotwig commented Apr 11, 2019

Those HEAD / 500 errors are unrelated, they're a result of Chrome's behavior, detailed in #3151.

@chris2kus31 if you're behind a corporate proxy, this is a known issue with visiting HTTPS domains behind a proxy and will be fixed in the upcoming Cypress 3.3.0 release. Here is the relevant issue, note that the workarounds listed here will not enable you to test HTTPS-hosted websites (including example.cypress.io): #1469

Closing as duplicate of #1459

@flotwig flotwig closed this as completed Apr 11, 2019
@flotwig flotwig added type: duplicate This issue or pull request already exists pkg/https-proxy This is due to an issue in the packages/https-proxy directory labels Apr 11, 2019
@chris2kus31
Copy link
Author

@flotwig so there is no workaround for this right now?

@flotwig
Copy link
Contributor

flotwig commented Apr 11, 2019

@chris2kus31 Sadly not. However, this limitation only applies to https-hosted websites.

If you're testing something on http://localhost, it won't go through your proxy and it'll work fine.

If you're testing another http site (say http://example.com), then the workaround of setting the HTTP_PROXY environment variable as described in #1469 will allow Cypress to use your proxy to access that website pre-3.3.0.

Other than that, you'll have to wait for 3.3.0 to use Cypress behind a corporate proxy.

@chris2kus31
Copy link
Author

@flotwig so if i am testing say this local site https://local-giving.kcmhq.org/ it will failed to load right now?

@flotwig
Copy link
Contributor

flotwig commented Apr 11, 2019

@chris2kus31 it depends. If you need to go through your corporate proxy to access this site, then no, it will not work because Cypress before 3.3.0 does not support proxies for https websites.

If it's an https site on localhost, it should work fine since it doesn't try to use your corporate proxy.

@chris2kus31
Copy link
Author

Got it. Thank you @flotwig

@chris2kus31
Copy link
Author

@flotwig is there an estimate as to when 3.3 will be release?

@flotwig
Copy link
Contributor

flotwig commented Apr 11, 2019

@chris2kus31 No, but we're working to get it out very soon.

@matrixn
Copy link

matrixn commented May 19, 2019

The tutorial URL. https://example.cypress.io. It lags and then times out. on the command line i can see a HEAD 500 error.

HEAD / 500 48.458 ms - -
HEAD / 500 41.724 ms - -
HEAD / 500 37.204 ms - -
GET /generate_204 204 9.275 ms - -

Try to do this, i managed to get cypress 3.3.0 behind a corporate firewall like this:

PROXY_HTTP="http://your_corp_proxy.xxx.com:3128"
PROXY_HTTPS="https://your_corp_proxy.xxx.com:3128"
NO_PROXY="localhost,undefined,domain_which_works_without_proxy.com" npx cypress open

I've added that undefined string into NO_PROXY var after i saw that when I executed the same line with DEBUG=cypress:* i found out that several connections http://undefined/... were trying to go through the proxy which obviously will never work.

@calebcadainoo
Copy link

For mine I had to remove from the top of the app
Using v10.3.0

const { cy } = require("date-fns/locale");

@SIVAN006
Copy link

i have similar issue, it was working few days ago and now i am getting below error, any help

my code
describe('template spec', () => {
it('passes', () => {
cy.wait(5000)
cy.clearAllCookies()
cy.visit('https:google.com');

})
})

visithttps:google.com
CypressError
cy.visit() failed trying to load:

https:google.com

We attempted to make an http request to this URL but the request failed without a response.

We received this error at the network level:

Error: Error establishing proxy connection. Response from server was: HTTP/1.1 400 Bad Request

Server: nginx

Date: Fri, 31 Mar 2023 14:31:39 GMT

Content-Type: text/html

Content-Length: 150

Connection: close

<title>400 Bad Request</title>

400 Bad Request


nginx

Common situations why this would fail:

  • you don't have internet access

  • you forgot to run / boot your web server

  • your web server isn't accessible

  • you have weird network configuration settings on your computer

@omkar9-kennect
Copy link

right, it might be a proxy issue. as it returns an error saying that Page could not load

how to solve it this issue

@cypress-io cypress-io locked and limited conversation to collaborators Nov 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pkg/https-proxy This is due to an issue in the packages/https-proxy directory type: duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

7 participants