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

ERR_CONNECTION_CLOSED (-100) loading 'https://app/__/#/tests/integration/home.test.js' #5482

Closed
textbook opened this issue Oct 26, 2019 · 9 comments

Comments

@textbook
Copy link

textbook commented Oct 26, 2019

Current behavior:

Cypress seems to be trying to read the test files from entirely the wrong place (the HTTPS version of the CYPRESS_BASE_URL environment variable and the tests/ directory), when I run it in a docker-compose network. As the app I'm testing doesn't serve those files, this fails.

When I run the E2E tests normally, they pass: https://circleci.com/gh/textbook/starter-kit/443

However, when I run them in a network using docker-compose, they crash https://circleci.com/gh/textbook/starter-kit/437

The error message is:

ERR_CONNECTION_CLOSED (-100) loading 'https://app/__/#/tests/integration/home.test.js'

which suggests that Cypress is looking for the test files at the CYPRESS_BASE_URL and in the wrong directory; in that project (https://github.com/textbook/starter-kit) my integrationFolder is /e2e/integration.

It also mentions Fontconfig warning: "/etc/fonts/fonts.conf", line 100: unknown element "blank" as Cypress starts - I don't know if this is related, but it doesn't happen in the success case.

Desired behavior:

I would like the Docker version to behave normally; I use this setup to regression test my code against multiple versions of Node.

Steps to reproduce: (app code and test code)

Test example repo: https://github.com/textbook/cypress-test-tiny/tree/recreate-base-url-issue

If you run Cypress in the container network (npm run cypress:docker), it fails with an error similar to the above complaint (and again looks in /tests, not /cypress):

ERR_CONNECTION_CLOSED (-100) loading 'https://app/__/#/tests/integration/spec.js'

If you start the app (npm start) and then run Cypress with a base URL (CYPRESS_BASE_URL=http://localhost:3000 npm run cypress:run), it seems fine, suggesting that it's not just the setting of the URL that's the problem.

Versions

Cypress: 3.5.0 (I noticed this because it started failing when Dependabot PRd the upgrade: textbook/starter-kit#24)
OS: macOS 10.14.6 locally, also fails on CircleCI remotely

This happens with both cypress/included:3.5.0 and cypress/included:3.3.1; my first assumption was the problem was in trying to run Cypress 3.5 in the older image, but upgrading didn't help.

@textbook
Copy link
Author

Bafflingly, when Dependabot rebased the PR and the tests re-ran (https://circleci.com/gh/textbook/starter-kit/528), they worked, and when I re-run the example repo it works too. Don't know what changed over the weekend, but I'll close this out for now.

@textbook
Copy link
Author

This has come up again - a bunch more PRs from Dependabot (from textbook/starter-kit#87) have failed for the same reason as above. I've updated the example and it's failing locally again: https://github.com/textbook/cypress-test-tiny/tree/recreate-base-url-issue

Cypress and cypress/included v3.8.0.

@textbook textbook reopened this Dec 21, 2019
@textbook
Copy link
Author

This still happens if I build my own E2E container, based on https://docs.cypress.io/guides/guides/continuous-integration.html#Dependencies, so it's not a problem with cypress/included:

FROM node:12.13.0-buster-slim

RUN apt-get update && apt-get install -y xvfb libgtk-3-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2

...

textbook added a commit to textbook/starter-kit that referenced this issue Jan 15, 2020
The docker-compose Cypress tests were very unhappy on Circle, see cypress-io/cypress#5482.
@jakewisse
Copy link

I'm also seeing this after moving our CI Cypress runs from using --network="host" to docker-compose or manually setting up shared bridge network.

@jakewisse
Copy link

Looks like this is related to #2996 and HSTS. I was using the service name app, and Cypress baseUrl http://app. Changed to something much more specific to our application and bingo, the tests are found over http.

@textbook
Copy link
Author

textbook commented Feb 7, 2020

@jakewisse you're right, nice catch; if I change the app name in docker-compose.yml to e.g. my-test-app it passes just fine:

--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,6 +1,6 @@
 version: '3.3'
 services:
-  app:
+  my-test-app:
     build:
       context: .
       dockerfile: Dockerfile-app
@@ -9,6 +9,6 @@ services:
       context: .
       dockerfile: Dockerfile-e2e
     environment:
-      - CYPRESS_BASE_URL=http://app
+      - CYPRESS_BASE_URL=http://my-test-app
     links:
-      - app
+      - my-test-app

@Hulkmaster
Copy link

after some testing i found out that it had been broken here
cypress/included:3.8.1 -> cypress/included:3.8.2

@6a616e
Copy link

6a616e commented Apr 23, 2020

Wow, I had the exact same problem.
This really needs to be fixed or at least a warning should be displayed. I have wasted quite some time before finding this.
Thanks for sharing @Hulkmaster

@jennifer-shehane
Copy link
Member

Duplicate of cypress-io/cypress-docker-images#262

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants