Can I host Cypress to a server? - javascript

So we're using Cypress + Cucumber to perform E2E UI tests. Everything is running fine, whenever I trigger the script, it shows the cypress pop-up, and I trigger a few tasks manually. Now we want our QA person to use the same prompt to test a few specific scenarios as they will. I know one way to trigger the test is during the CI/CD pipeline, but I was wondering if there's a way to host the app on some server, and a QA person can trigger a particular flow whenever they want.
So far I found cypress run --browser chrome --headed --no-exit --port 9000 command to keep the server active and run the tests when you click on it. But when I copy the URL and open it in another browser, I see an error saying that it can't run the test because the browser was not opened by cypress.
Please let me know if there's a way to achieve it.

Related

Out of memory issue with Chrome and unit tests

I have a test suite of around 800 tests in a repository.
When I run the tests locally I end up with an Aw Snap screen at some point during the tests running.
It's more or less running on the build server (running headless), but locally it breaks almost every time.
Is there any way to free up memory to make it possible to run through the tests locally again?
It's an issue that recently started to appear and we haven't changed the unit tests to something that should cause this issue so I am afraid that it has to do with a Chrome update or so.
Chrome either loses connection to the dev tools with a Render Process Gone error or DevTools was disconnected from the page.
If I run the tests in incognito it actually says it ran out of memory.
We have an index file that runs
WCT.loadSuites([arrayOfSuites]) and each unit test have their own file
with suite(), setup and tests.
We're using Polymer 3.
Thanks

Open Cypress browser when running from Jenkins

I created in Jenkins a freestyle project in which I wanted to run Cypress.
In the command line I used this command line:
npx cypress run --browser chrome --headed --spec "cypress/integration/examples/actions.spec.js" --config pageLoadTimeout=10000
The issue that it runs silent mode, there is no browser that is open, and perform test actions.
What should I do so that the browser appears while executing the test? Thanks in advance.
CI tools like Jenkins aren't designed to open browser.
That is why Cypress offers two ways to run it:
For local dev/debug: cypress open
For CI/automatisation : cypress run
You are using it the right way.
Interesting things for CI are screenshots and videos.
Yes, actually when you launch tests based on Cypress on CI (not only Jenkins) - you can't watch the process in debug mode.
Only on the local machine with the open parameter.
Also, save the video OR screenshots of running tests from Jenkins - and look after

Intern test case execution hangs forever after importing snapsvg-cjs in ts file

After importing snapsvg-cjs in .ts file(in Dojo2 Project) intern test case got stuck after executing all test cases.
Any idea what I am doing wrong?
When Intern is stuck open after test cases have finished, it typically means that a file or socket is still open. Intern is done, but the Node process won't shut down while handles are still open. This can happen if, say, an asynchronous process were started in a test without returning a Promise.
One way to diagnose what's preventing the Intern process from exiting is to run it with wtfnode. When wtfnode is used to run a node program and the program is manually killed (like with with ctrl-c), wftnode will display any open resources. Run Intern with wtfnode, ctrl-c when it appears to be hung, then see what's still open.

How can i debug a nodejs backend with node-inspector?

I am trying to debug my backend and i am not really sure if i am doing it the correct way.
I have set up the debugging as follows:
Node 6.9.1 and node-inspector 0.12.8
open a command prompt and run the following command:
node-inspector --web-port=3030 (server app port)
open another command prompt and run the following command:
node --inspect --debug-brk server.js
browse to the given URL in the second command prompt log on screen
press F8 to make the server run
eventually put some others breakpoints
browse on another tab to your app (address and port defined in 1-)
see server execution stops on breakpoints defined on step 5.
Now when i run node --inspect app.js and everything looks good so far. I can debug the first start in the app.js. But if I want to debug an endpoint with POSTMAN, I get the error "Cannot POST /api/trainingsWeek". The endpoint works if I don't debug.
Do I have to take another address? Or another tool than POSTMAN?
ANd what is the difference between node --inspect app.js and node-debug
GitHub Issue
UPDATE
This was my stupid mistake :P Here is the solution: https://github.com/node-inspector/node-inspector/issues/907#issuecomment-280620108
I use VS Code to debug. I guess you don't need node-inspector, it will run with the integrated debugger from Node. To get it running, open your project and the debug view. There should be no configuration available. Click on the little wheel -> choose node.js as the environment.
After that the standard json will be created and looks like this:
And then click on the play button with the selection start programm. With that the debugging should run. Now you can use POSTMAN with the same url when you just run your server and the debugger from VS Code should hit your breakpoint.

Failing to debug with node-inspector - what is wrong?

I have a javascript code that checks whether a point is inside a polygon. I am trying to debug it with node-inspector, following these steps:
In the first window:
PS Z:\dev> node-inspector.cmd
info - socket.io started
visit http://0.0.0.0:8080/debug?port=5858 to start debugging
In the second window:
PS Z:\dev\poc\SDR> node --debug-brk .\IsPointInside.js
debugger listening on port 5858
Now I navigate to http://localhost:8080/debug?port=5858 in my Chrome browser.
What happens is that Chrome gets stuck waiting for localhost presenting me the empty screen.
I must add that I have successfully debugged the r.js javascript optimizer using the same steps before, but now I cannot debug it as well.
according to this there seems to be an order in which the components should be started.
Its application -> debugger -> web browser.
Could be your issue.
You can also send a "debug on demand" command. Use this command:
kill -USR1 $PROCESSID

Categories