Encountering the following issue in my docker build.
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: connect ECONNREFUSED 127.0.0.1:90
Cypress tests are failing due to the link provided in my tests.
I would like to my tests to be able to navigate the localhost in my Dockerfile. I am able to execute unit tests fine since they do not rely on a web server to be hosted but my functional tests are using
https://localhost:90/lib/3.0/
dockerfile
FROM cypress/base:6
USER root
RUN apt-get update && apt-get install -y nginx git
# Remove the default Nginx configuration file
RUN rm -v /etc/nginx/nginx.conf
# Copy a configuration file from the current directory
ADD nginx.conf /etc/nginx/
# Append "daemon off;" to the beginning of the configuration
RUN echo "daemon off;" >> /etc/nginx/nginx.conf
# Update npm
RUN npm install [email protected] && rm -rf /usr/local/lib/node_modules/npm && mv node_modules/npm /usr/local/lib/node_modules/npm && npm install -g npx
# Install grunt-cli
RUN npm install -g grunt-cli
# npm install all dev dependencies (keep this before COPY source code so that Docker will re-use an existing Image if possible)
COPY ./lib/3.0/package.json /usr/build/package.json
WORKDIR /usr/build
RUN npm install --no-optional --ignore-scripts --only=dev
# Install Cypress
RUN npx cypress install
# Copy source code
COPY ./lib/3.0/ /usr/build
# Force all files to lower-case (also copies tests to root)
RUN node toLower node_modules "^ss-|^lv_" "^ss-tracker$"
# Copy CSS
RUN curl http://spatialstream.com/microsite/proto/ui/production/css/app-desktop.css > ./Design/UI/build/css/app-desktop.css
# Run grunt to build
RUN npm install --no-optional --ignore-scripts --only=prod && grunt
# Run tests
RUN npm test
# Expose service endpoint at port 90
expose 90
# Set the default command to execute
# when creating a new container
CMD service nginx start
RUN npm start && npm run-script smallTest
# Cleanup source files
WORKDIR ..
RUN rm -rf build
nginx.conf
worker_processes 1;
events { worker_connections 1024; }
http {
include mime.types;
sendfile on;
server {
root /usr/share/nginx/html/;
index BDEst2.html;
server_name localhost;
listen 90;
}
}
Docker CI,
well, can you connect to that localhost url from container but not from Cypress?
well, can you connect to that localhost url from container but not from Cypress?
I tried the following:
cy.visit('https://localhost:90')
and it is still unable to access my localhost. I believe it works in the container but not when cypress tries to visit.
I am having this exact issue. I can connect to it and run a curl to the local container, but cypress isn't having any of it.
I might have a similar issue (sorry for offtopic if not). I am using cypress/base:8. App itself is able to connect and listen on docker's localhost (as I get Ready on http://localhost:3000) but cypress ends with
CypressError: cy.visit() failed trying to load:
http://localhost:3000/
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: connect ECONNREFUSED 127.0.0.1:443
I am not really sure where the port 443 comes from?
EDIT: So this mistake was caused by redirect in the app. It was not caused by cypress in any way, sorry for off topic. For those who might use curl for debug, check -L option ;)
any updates ?
I'm having the same problem. Are there any updates?
Any updates on this issue?
I am facing the same issue.anybody here solved this issue ?
Most helpful comment
any updates ?