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

__/#/tests/... page errors 404 - page not found on Chrome 72+ #1872

Closed
pklejnowski opened this issue Jun 4, 2018 · 34 comments · Fixed by #3049
Closed

__/#/tests/... page errors 404 - page not found on Chrome 72+ #1872

pklejnowski opened this issue Jun 4, 2018 · 34 comments · Fixed by #3049
Assignees
Milestone

Comments

@pklejnowski
Copy link

pklejnowski commented Jun 4, 2018

Is this a Feature or Bug?

BUG

Current behavior:

Sometimes when I run all tests I have such error:
image

Important thing that I noticed If i remove tests "group_page.js" (check gif) it seems that the problem disappeared. "group_page.js" using different page: cy.visit(https://localhost:5002) for testing when the other tests that crashing using cy.visit(https://localhost:5000)
error2

Check this gif, I had to run 3 times RUN ALL TESTS to make it work. Before always failed at login_page.js

I was trying hardcode url in cy.visit() (before I had url from cypress.json). The same result.

Steps to reproduce:

Run a few tests that include cy.visit(https://localhost:5002) for 1st test and cy.visit(https://localhost:5000) for 2nd test.

Versions

Cypress: 3.0.1
Windows 10
Chrome

@bgp1
Copy link

bgp1 commented Jun 4, 2018

I want to add in that I have this same issue. Thought upgrading to 3.x branch would fix this but persists as it did in the 2.x branch.

I have two spec files, each testing a different user experience. One is on one domain, one is on another. The first spec file to run (alpha order first) completes without issue. When it tries to go to the second spec file it refreshes, runs the first spec file again, then when it hits the second spec file for a second time, results in a 404 not found for the /#/tests/__all path.

If I run each file individually the tests complete successfully. This is problematic as these run after each release and therefore both files need to be able to run for each request.

This occurs via interactive mode. If I run it via command line the first spec file completes successfully and the second file hangs. Cypress never terminates, which is also problematic.

Cypress 2.1.0 or 3.0.1
Windows 10
Chrome

@bgp1
Copy link

bgp1 commented Jun 4, 2018

Wanted to add to my previous comment with additional information. I have been testing this and I can't seem to get this to work when it's on the same domain, either. The second feature I wanted to test is a self-hosted feature, meaning it's a JS file that other sites would add to their site. I was testing it on a different domain that we own. However, I have since created a page to host this for testing on the same domain as the other tests and it still does this same behavior as before. So I don't believe this to just be an issue because of two different domains.

I believe this is an issue with the tests being broken out into multiple spec files. Even though neither test file inherits from the other I am able to replicate that the first file completes, runs a second time (for some unknown reason) and then the second test file stalls.

I have been trying to see if I can get all tests to run in a single spec file, but so far that has proved unsuccessful for some unknown reason I am still trying to determine.

I tested this on both 2.x and 3.x versions and the problem persists when tests are split between files.

@jennifer-shehane jennifer-shehane added the stage: needs investigating Someone from Cypress needs to look at this label Jun 5, 2018
@pklejnowski pklejnowski reopened this Jun 7, 2018
@pklejnowski
Copy link
Author

@bgp1 Did you find any workaround so far?

@bgp1
Copy link

bgp1 commented Jun 7, 2018

My workaround is to host the second application on the same domain as the first (I just created a page on there to trigger it) and then included all of the tests for both applications in a single spec file. Working for me, although not ideal.

@pklejnowski
Copy link
Author

:/ I can't do the same thing. So I have to wait for fix...

@pklejnowski
Copy link
Author

pklejnowski commented Jun 12, 2018

How long it can be in stage: "needs investigating"?

@pklejnowski
Copy link
Author

@jennifer-shehane is it possible that you are going to fix it soon?

@jennifer-shehane
Copy link
Member

I was not able to reproduce this issue.

I visited 2 websites on localhost with different ports - visiting the first url in spec1.js and the second url in spec2.js then running "All Tests" and ran this several times.

spec1.js

context('Site 1', () => {
  beforeEach(() => {
    cy.visit('http://localhost:8080/commands/actions')
  })

  it('get an el', () => {
    cy.get('.action-email')
  })
})

spec2.js

context('Site 2', () => {
  beforeEach(() => {
    cy.visit('http://localhost:3030/')
  })

  it('gets el', () => {
    cy.contains('Features')
  })
})

screen shot 2018-07-12 at 3 32 32 pm

@pklejnowski There is some other factor that is influencing the crash and will have to have a reproducible issue in order to begin investigating what the issue is.

@jennifer-shehane
Copy link
Member

@bgp1 In reference to your comment:

When it tries to go to the second spec file it refreshes, runs the first spec file again

The first test file is not running again, but since we did go to a different url in the main window browser, the first test in the Command Line does have to re - render, so it * looks * like it is running again, when the Command is just rendering to the fresh page.

@jennifer-shehane jennifer-shehane added stage: needs information Not enough info to reproduce the issue and removed stage: needs investigating Someone from Cypress needs to look at this labels Jul 12, 2018
@Gachapen
Copy link

Gachapen commented Aug 22, 2018

I'm having the same issue, and am struggling to debug it. It works fine when running against localhost, but when I try running it against a deployed version of the application from my computer, I get 404 instead of the cypress runner application. The 404 page shown is the 404 page generated by our application (using Vue). This makes sense, because the URL path is /__/ which should result into a 404 in our application. Something seems to prevent the cypress runner from starting up, instead it loads the application directly.

This happens both when I run a single spec file and when I run all.

@SimoneDahmen
Copy link

SimoneDahmen commented Sep 26, 2018

I have the same Issue as @Gachapen. A "/_" is added to the app's URL and it's loaded in the chrome address bar not in the cypress-created view within.
happens with cy.visit():

describe('create content', function () {
        it('opening app', function () {
            cy.wait(1000),
                cy.visit('https://dev.site.com');
        });
});

and the result is our App's 404 page on baseurl + "/underscore"

For me it might be an issue that I'm using an external URL.

@acailly
Copy link

acailly commented Oct 23, 2018

If it helps, I ran into this problem by following the tutorial.

Steps I followed:

mkdir cypress-test
cd cypress-test
yarn init -y
yarn add cypress --dev
yarn cypress open

Then create a sample_specs.js file with:

describe('My First Test', function() {
  it('Visits the Kitchen Sink', function() {
    cy.visit('https://example.cypress.io')
  })
})

Then click on this file in cypress GUI:

  • the browser open at http://localhost:65327/__/#/tests/integration\sample_specs.js
  • the browser navigate to https://example.cypress.io/__/#/tests/integration\sample_specs.js which gives a 404 error

Node version: 8.11.1
Npm version: 5.6.0
Yarn version: 1.10.1
OS: Windows 7

@SimoneDahmen
Copy link

SimoneDahmen commented Oct 23, 2018

thank you @acailly . That really did help because it made me check the examples again.

Did you check wether your sample_specs.js file was really in the directory you created? My cypress was not installed through yarn but npm, I see no other difference though

The browser also navigated to example.cypress.io but successfully:
image

@vadymkukhtinOD
Copy link

vadymkukhtinOD commented Oct 23, 2018

@jennifer-shehane @acailly @SimoneDahmen
Same issue here.
The reason for me is that I have service-worker which is precaching assets.
If I unregister service-worker everything works fine.
If I remove manually "//" on debug mode and reload page, tests are working fine.
The problem is that first test runs well, then cypress goes to 2nd one and 2nd test case starts on 404 "..../
/#/tests/integration" already even not reaching beforeEach func.

@acailly
Copy link

acailly commented Oct 23, 2018

@vadymkukhtinOD I don't see any registered service-worker in the application tab of dev tools

@pklejnowski
Copy link
Author

pklejnowski commented Oct 23, 2018

I don't have any service-worker and this problem still occurs in my application.
What is interesting. I have 3 test files. When I run each test separatly, then this problem is not occurs, but when I run all at once, then this problem occurs.

@blakelee-pendo

This comment has been minimized.

@vadymkukhtinOD
Copy link

@acailly Probably service-worker just covering the real issue. Still investigating

@matt212

This comment has been minimized.

@matt212
Copy link

matt212 commented Nov 9, 2018

@jennifer-shehane any updates or workaround since it's bit of a hinderance when writing test cases.

@jennifer-shehane
Copy link
Member

jennifer-shehane commented Nov 28, 2018

Unfortunately we cannot investigate an issue if no reproducible example is provided. Can anyone provide a way to reproduce this exactly?

@SimoneDahmen
Copy link

@jennifer-shehane I am working on a Mac, have a parent folder with one cypress child and one yarn child. In the yarn child I have the app files, in the cypress/integration I have my tests files. Both child folders have their own git repository.
I installed cypress via console, using npm.

That very integration folder I open in cypress (cypress I have in my applications so I'm not starting it via terminal).
Then I click the file in the cypress window.
Then the chrome window opens and starts running the test but is redirected to the url mentioned above after a second.
This is the code I try to visit the page with:
it('opening /moments', function () { cy.visit('localhost:3000/moments'); });

When reproducing this again, I noticed that the first script I run after opening cypress works, but the ones afterwards don't. So when I close/stop the remote chrome window and try to run another test file, I will have this issue.

bildschirmfoto 2018-11-30 um 16 17 07
bildschirmfoto 2018-11-30 um 16 54 15
bildschirmfoto 2018-11-30 um 16 54 52
('this site does not exist – back to index')

@jennifer-shehane
Copy link
Member

@SimoneDahmen Ok, you are running cypress in what we call 'global mode'.

I'm still a bit confused as to what your project directory looks like and which part you are opening in global mode from the screenshots and information given.

📁my-web-app -- // this folder I drag into cypress
  📁app
  📁cypress
    📁fixtures
    📁integration
    📁plugins
    📁support
  📁node_modules
  📄cypress.json
  📄package.json

@jarrodldavis
Copy link

jarrodldavis commented Dec 9, 2018

I'm running into this same issue and it appears to be caused by Chrome/Chromium not respecting the --proxy-server command line flag (provided by Cypress when launching the browser) for localhost and 127.0.0.1 URLs. I confirmed this behavior using debugging output both by Cypress (using DEBUG=cypress:* ./node_modules/.bin/cypress open --config baseUrl=http://127.0.0.1:8080/) and Chromium's own network logging (chrome://net-export/).

Here's a snippet of those net-export logs:

{"params":{"priority":"HIGHEST","url":"http://127.0.0.1:8080/__/#/tests/integration/test.js"},"phase":1,"source":{"id":180,"type":1},"time":"8498558","type":2},
{"phase":1,"source":{"id":180,"type":1},"time":"8498559","type":100},
{"phase":2,"source":{"id":180,"type":1},"time":"8498559","type":100},
{"params":{"load_flags":9217,"method":"GET","privacy_mode":0,"url":"http://127.0.0.1:8080/__/#/tests/integration/test.js"},"phase":1,"source":{"id":180,"type":1},"time":"8498559","type":96},
{"phase":1,"source":{"id":180,"type":1},"time":"8498559","type":99},
{"phase":2,"source":{"id":180,"type":1},"time":"8498559","type":99},
{"phase":1,"source":{"id":180,"type":1},"time":"8498559","type":113},
{"phase":2,"source":{"id":180,"type":1},"time":"8498559","type":113},
{"phase":1,"source":{"id":180,"type":1},"time":"8498559","type":114},
{"params":{"entry_hash":"0x52f2db36893f29dc"},"phase":1,"source":{"id":181,"type":13},"time":"8498559","type":355},
{"params":{"key":"http://127.0.0.1:8080/__/"},"phase":0,"source":{"id":181,"type":13},"time":"8498559","type":356},
{"phase":0,"source":{"id":181,"type":13},"time":"8498559","type":379},
{"phase":0,"source":{"id":181,"type":13},"time":"8498559","type":380},
{"params":{"net_error":-411},"phase":2,"source":{"id":180,"type":1},"time":"8498559","type":114},
{"phase":1,"source":{"id":180,"type":1},"time":"8498559","type":115},
{"params":{"entry_hash":"0x52f2db36893f29dc"},"phase":1,"source":{"id":182,"type":13},"time":"8498559","type":355},
{"params":{"key":"http://127.0.0.1:8080/__/"},"phase":0,"source":{"id":182,"type":13},"time":"8498559","type":356},
{"phase":0,"source":{"id":182,"type":13},"time":"8498559","type":360},
{"phase":0,"source":{"id":182,"type":13},"time":"8498559","type":361},
{"phase":2,"source":{"id":180,"type":1},"time":"8498559","type":115},
{"phase":1,"source":{"id":180,"type":1},"time":"8498559","type":116},
{"params":{"address_family":0,"allow_cached_response":true,"host":"127.0.0.1:8080","is_speculative":false},"phase":1,"source":{"id":183,"type":0},"time":"8498559","type":3},
{"phase":2,"source":{"id":183,"type":0},"time":"8498559","type":3},
{"phase":2,"source":{"id":180,"type":1},"time":"8498559","type":116},
{"params":{"is_preconnect":false,"url":"http://127.0.0.1:8080/__/#/tests/integration/test.js"},"phase":1,"source":{"id":184,"type":23},"time":"8498559","type":151},
{"phase":1,"source":{"id":180,"type":1},"time":"8498559","type":137},
{"params":{"source_dependency":{"id":184,"type":23}},"phase":0,"source":{"id":180,"type":1},"time":"8498559","type":152},
{"params":{"source_dependency":{"id":180,"type":1}},"phase":0,"source":{"id":184,"type":23},"time":"8498559","type":152},
{"phase":1,"source":{"id":184,"type":23},"time":"8498559","type":23},
{"params":{"pac_string":"DIRECT"},"phase":0,"source":{"id":184,"type":23},"time":"8498560","type":25},
{"phase":2,"source":{"id":184,"type":23},"time":"8498560","type":23},
{"params":{"proxy_server":"DIRECT"},"phase":0,"source":{"id":184,"type":23},"time":"8498560","type":153},

Notice the last line: {"proxy_server":"DIRECT"},.

Here's another snippet of those same logs, this time connecting to the same local server using my computer's network IP instead of 127.0.0.1:

{"params":{"priority":"HIGHEST","url":"http://10.0.0.249:8080/__/#/tests/integration/test.js"},"phase":1,"source":{"id":195,"type":1},"time":"8515014","type":2},
{"phase":1,"source":{"id":195,"type":1},"time":"8515015","type":100},
{"phase":2,"source":{"id":195,"type":1},"time":"8515015","type":100},
{"params":{"load_flags":9216,"method":"GET","privacy_mode":0,"url":"http://10.0.0.249:8080/__/#/tests/integration/test.js"},"phase":1,"source":{"id":195,"type":1},"time":"8515015","type":96},
{"phase":1,"source":{"id":195,"type":1},"time":"8515015","type":99},
{"phase":2,"source":{"id":195,"type":1},"time":"8515015","type":99},
{"phase":1,"source":{"id":195,"type":1},"time":"8515015","type":113},
{"phase":2,"source":{"id":195,"type":1},"time":"8515015","type":113},
{"phase":1,"source":{"id":195,"type":1},"time":"8515015","type":114},
{"params":{"entry_hash":"0xfcb31c53c472bc92"},"phase":1,"source":{"id":196,"type":13},"time":"8515015","type":355},
{"params":{"key":"http://10.0.0.249:8080/__/"},"phase":0,"source":{"id":196,"type":13},"time":"8515015","type":356},
{"phase":0,"source":{"id":196,"type":13},"time":"8515015","type":357},
{"params":{"net_error":-2},"phase":0,"source":{"id":196,"type":13},"time":"8515015","type":359},
{"phase":2,"source":{"id":196,"type":13},"time":"8515015","type":355},
{"params":{"net_error":-2},"phase":2,"source":{"id":195,"type":1},"time":"8515015","type":114},
{"phase":1,"source":{"id":195,"type":1},"time":"8515015","type":115},
{"params":{"entry_hash":"0xfcb31c53c472bc92"},"phase":1,"source":{"id":197,"type":13},"time":"8515015","type":355},
{"params":{"key":"http://10.0.0.249:8080/__/"},"phase":0,"source":{"id":197,"type":13},"time":"8515015","type":356},
{"phase":0,"source":{"id":197,"type":13},"time":"8515015","type":360},
{"phase":0,"source":{"id":197,"type":13},"time":"8515015","type":361},
{"phase":0,"source":{"id":197,"type":13},"time":"8515015","type":362},
{"phase":2,"source":{"id":195,"type":1},"time":"8515016","type":115},
{"phase":1,"source":{"id":195,"type":1},"time":"8515016","type":116},
{"phase":2,"source":{"id":195,"type":1},"time":"8515016","type":116},
{"params":{"is_preconnect":false,"url":"http://10.0.0.249:8080/__/#/tests/integration/test.js"},"phase":1,"source":{"id":198,"type":23},"time":"8515016","type":151},
{"phase":1,"source":{"id":195,"type":1},"time":"8515016","type":137},
{"params":{"source_dependency":{"id":198,"type":23}},"phase":0,"source":{"id":195,"type":1},"time":"8515016","type":152},
{"params":{"source_dependency":{"id":195,"type":1}},"phase":0,"source":{"id":198,"type":23},"time":"8515016","type":152},
{"phase":1,"source":{"id":198,"type":23},"time":"8515016","type":23},
{"params":{"pac_string":"PROXY localhost:58283"},"phase":0,"source":{"id":198,"type":23},"time":"8515016","type":25},
{"phase":2,"source":{"id":198,"type":23},"time":"8515016","type":23},
{"params":{"proxy_server":"PROXY localhost:58283"},"phase":0,"source":{"id":198,"type":23},"time":"8515016","type":153},

This time, Cypress' proxy server is being used: {"proxy_server":"PROXY localhost:58283"}

Additional notes:

  • I'm using Cypress as configured by Vue CLI, which provides a nice wrapper around cypress to launch webpack dev server and feed the URL to cypress using --config baseUrl=<url>
  • I'm on a Mac running macOS Mojave Version 10.14.1 (18B75)
  • I'm (currently) using Chromium Version 73.0.3634.0
  • I installed the latest Stable Chrome (Version 71.0.3578.80) and this issue doesn't appear to occur, so perhaps upcoming versions of Chrome may have this issue (or Google is A/B testing something).
  • I've tested with other versions (Beta and Dev), and the change appears to have occurred somewhere between the current Beta build (71.0.3578.80) and the current Dev build (72.0.3626.7).
    • The Beta build works – and has the same major version (71) as Stable – but the Dev version does not.

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Jan 30, 2019

Released in 3.1.5.

@jennifer-shehane jennifer-shehane removed the stage: needs review The PR code is done & tested, needs review label Jan 31, 2019
thc202 added a commit to thc202/zap-extensions that referenced this issue Jan 31, 2019
Change ExtensionSelenium to add an argument to ChromeOptions to not
bypass localhost when proxying, thanks to:
cypress-io/cypress#1872 (comment)
for the syntax to use with `proxy-bypass-list`.
Update changes in ZapAddOn.xml file.
@smoothdvd
Copy link

It's not working in headless mode

@jennifer-shehane
Copy link
Member

Hey @smoothdvd, could you open a new issue with a reproducible example of your problem? This issue has been fixed and likely you are experiencing a similar issue due to another cause. Thanks!

@yeya
Copy link

yeya commented Feb 24, 2019

Same issue with cypress 3.1.5 and chrome 72.
I'm running npx cypress open on new project with no files at all. Just the auto generated specs.

Same issue with localhost site.

image

I tried to add the temp code to plugins but I see that the argument already there:
'--disable-default-apps', '--use-fake-ui-for-media-stream', '--use-fake-device-for-media-stream', '--proxy-server=http://localhost:30943', '--proxy-bypass-list=<-loopback>', '--proxy-bypass-list=<-loopback>' ]

@RicardoVaranda
Copy link

This is still happening to me in 3.2.0

@gwpetersenag
Copy link

I also am still seeing this exact issue on 3.2.0

@jennifer-shehane
Copy link
Member

Hey if you're experiencing a similar issue, could you open a new issue with a complete reproducible example of your problem? Thanks!

@cypress-io cypress-io locked as resolved and limited conversation to collaborators Mar 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.