Cypress can't load assets from Vite's devserver - docker

I have an app running at http://localhost/ which loads it's assets from a Vite's devserver which is up at http://localhost:3000/. Cypress is hitting the main app correctly, but it doesn't load the assets, leaving me with a blank page because the page received no response for the http://localhost:3000/app.js file.
Everything works fine if I visit the app directly on the browser. The browser is able to load the assets from port 3000 without problems. They're only failing when requested via the Cypress test runner.
I tried to cy.visit('http://localhost:3000/') and it seems like the Vite's devserver is refusing connections. But I checked the Vite documentation to see if there was something that could be blocking this and nothing caught my eyes. Also, the strange part is that they're only blocked when requested via the test runner.
I'm running Cypress on WSL2 and my app and the Vite devserver are running through Docker mapping to the addresses above. Is there any additional configuration I'm missing?
If I build the assets and serve them from the main app address (http://localhost/dist/app.js), everything works fine and my tests run fine. So, I'm guessing there's some sort of configuration I need to do to allow Cypress to request assets form other hosts?

Related

Cypress can't see rails server output from within the same docker container

I'm attempting to get cypress working with rails in a single docker container. I'm using the Simplest possible Rails 6 + docker-compose project (at https://github.com/bdavidxyz/simplest-rails-docker), with cypress/included:3.8.1 (at https://github.com/cypress-io/cypress-docker-images/tree/master/included), based on the End-to-End Testing Web Apps: The Painless Way blog (at https://mtlynch.io/painless-web-app-testing/).
After building, I run docker-compose up and cypress tries to start. Then the rails server starts, cypress succeeds and tests run.
Cypress baseurl http://web-srv:3000/ gets 403
"landing" http://host.docker.internal:3000/ ECONNREFUSED 192.168.65.2:3000
google https://google.com works
localhost http://localhost:3000/hello/say_hello ECONNREFUSED 127.0.0.1:3000
---but I do see the rails welcome on a browser at localhost:3000.
Does anyone know a way to get Cypress to see the Rails output?
For clarity, I made a gitub repository with code and steps to reproduce: https://github.com/Sambalero/docker-cypress-rails (I'm on windows 10)
Thank you!

Run Electron UI on different port

Is there a way to run an Electron app's UI on a different port? I have an app server (Wildfly) running on port 8080 and when I start the Electron app the app server default page is shown within the Electron app window. I believe that Electron runs on port 8080 in the background. Is there a way to change that to i.e. port 9000?
An Electron app is basically a Chromium browser with NodeJS support which loads any file you want to display from disk. It does not start any server (neither HTTP nor anything else).
With "default app page" I believe you mean the index.html file of the electron-quick-start project. This file, for example, gets loaded in main.js, line 16 using Electron's BrowserWindow#loadFile (...) function. This basically behaves equivalently to loading it using #loadURL ("file:///...") or by using file:// in your browser to load any file from disk.

Zuul not working with Jenkins

I am currently using zuul with different docker container. Everything works fine except for jenkins (not running inside a docker container). I want zuul to route to jenkins. This seems to work fine, but only for the main html page of jenkins, other files needed aren't loaded correctly. So when I open my page mypagename.com/jenkins the first request is send to the right address. But then the site tries to load the .css and .js files etc. "https://mypagename.com/static/9c0b28e1/css/layout-common.css". So for the first request zuul is working fine but for the following requests not.
The jenkins part of the application.yml looks like this:
jenkins:
path: /jenkins/**
url: "http://172.21.0.1:9000/"
What could be the reason for this?
Solved
It is now working. The root path for jenkins needed to be changed to /jenkins. Jenkins website root path. Also you need to restart jenkins after adding "--prefix=/jenkins" with something like "sudo systemctl restart jenkins" using the restart button on the jenkins website did not work.

How to set in meteor --mobile-server when using nginx

I have on digitalocean my meteor application running but when I try and test on my iphone the app I am not able to see the login screen.
I don't think it's version dependent and I therefore do not list them. I am happy to provide all the config files if this helps but want to make sure that I am not missing anything conceptually.
My setup is that on my digitalocean (not real URL: https://ABC123.com) server I run the meteor app and the app works fine at the URL. The meteor application has been deployed a while back and is a different release from what I am testing now locally. Source code is quite similar though and it never worked on the iphone. nginx is used to forward the URL domain to
proxy_pass http://127.0.0.1:3100;
Here is the issue now:
I run from my local mac:
meteor run ios-device --mobile-server https://ABC123.com
and run from xcode on the simulator or my iphone and get the attached screenshot. You can see that there is no login prompt which I believe is caused that I do not connect to the server on digitalocean.
It's a also surprising that with the command meteor runs on localhost:3000 as well. But it's probably not the issue.
The way it should look is the below which is taken from the web page:
Thanks already in advance for any responses.
This is resolved. Using Safari as a debugger I noticed that the connection to the server failed due to a non AC SSL certificate. So, after I fixed the SSL certificates it does connect now.

Getting 502 bad request after deploying Play 2.1.0 app to Cloudbees

I tried to deploy a Play app to Cloudbees (only via push to git repo from which it is built by jenkins), it compiled and should work but I get a "502 Bad Gateway" error when loading the app. There is no error shown in the console only that it answers "502 Bad Gateway" when trying to access it. But that's what I see in the browser, too.
Cloudbees say that there is no other manipulation necessary, just cloning/pulling the ClickStart-Project, making it you application and pushing it back. The Play project works fine locally.
I am very grateful for any help. Please let me know if I need to provide any other information. Thanks a lot!
Edit: It works fine with Heroku only adding a Procfile. I don't get the problem with Cloudbees...
In this case the error is due to the database needing evolutions to be run before it can start:
[warn] play - Run with -DapplyEvolutions.default=true and -DapplyDownEvolutions.default=true if you want to run them automatically (be careful)
Oops, cannot start the server.
#6eg39l651: Database 'default' needs evolution!
You can see the error in your application console:
https://run.cloudbees.com/a/strehlst#app-manage/logs:strehlst/odzh
or via bees app:tail if you have the bees CLI installed.
You can also deploy direct from your desktop if you like:
play dist
bees app:deploy -t play2 dist/yourapp.zip
And it will push direct to your app (if you don't want a continuous deployment pipeline).

Resources