Running protractor scripts on Jenkins - jenkins

I need to integrate my protractor scripts on Jenkins . My code is in Bit bucket and i configured the details on my project in Jenkins.
My Jenkins server is on Linux so i have used Execute shell .
Below are the steps i mentioned in execute shell in order to run.
npm install
webdriver-manager update
webdriver-manager start
protractor conf.js
Initialising WebDriverServlet
20:23:34.444 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 4444
Selenium server is up and running but it got stuck there and unable to execute next step.
.................................
I have also tried executing
npm install
protractor conf.js
by commenting selenium address on conf.js
For which m getting the below error
I/launcher - Running 1 instances of WebDriver
[20:02:30] I/local - Starting selenium standalone server...
[20:02:32] I/local - Selenium standalone server started at .........
Unable to create new service: ChromeDriverService
I need help on how to run the scripts on jenkins. Any help will be appreciated. Thanks in adavnce

I can tell what your problem is, but nor ready to provide a solution
so when you run webdriver-manager start it starts a process. When that process is running, you can't run another one, until you exit this one. When you do it manually, you're using 2 terminal windows, right?
so theoretical solution - you need to look up how to run commands in parallel on linux and this page has many https://www.slashroot.in/how-run-multiple-commands-parallel-linux
Another option that I'm using is to set directConnect: true in config file. This way you don't even need to start a server, protractor will do it for you. And honestly I don't know why not everyone is using it...

Related

Cypress gpu_init.cc(441) passthrough is not supported GL is Swiftshader

I'm trying to setup Cypress in my project to run e2e tests and when I start it up I get the error
Cypress gpu_init.cc(441) passthrough is not supported GL is Swiftshader.
I've seen some people on here with the same error but with 'disabled' at the end instead of Swiftshader.
I think it has something to do with browser GPU acceleration but I don't know how to fix it.
I'm on MacOS and my project runs in a Ubuntu remote machine.
I was trying to use Cypress on a remote machine but as it turns out remotes don't have the Cypress GUI because of $DISPLAY. Only working locally for me now.

Jenkins stalls after selenium server is started

I am trying to run automated tests in Jenkins. The tests had been running well for a long time. But now, when selenium server starts the tests, Jenkins stalls and outputs the following error messages:
[09:18:55] E/launcher - Unable to parse new session response:
[09:18:55] E/launcher - WebDriverError: Unable to parse new session
response:
at doSend.then.response..."
The tests run successfully when I run them manually at the command prompt using the same commands. I am not sure what could be the problem. Any help would be appreciated.
Solution 1:
You may be using old version of chrome with a newer Selenium WebDriver version. You may want to update your chrome to the latest version.
Solution 2:
Multiple versions of Chrome may have been installed. Purge and install a stable package. Do something like:
sudo apt-get purge chrome
sudo apt-get install chrome-stable
Solution 3:
Reinstall your JDK. This is a sure fire way to revive sleeping Jenkins.

Starting Rails server issue - Jenkins Pipeline

We are starting integrate our build and automation testing process to jenkins pipeline, and I have some issue with starting rails server.
First of all, this is our pipeline chart:
In any step of "Config" (0,1,2), I start different rails app with specific port, using: rails s -p XXXX -d, and just after the execution command, I run lsof -i:XXXX and I DO see the server running.
But, in QA stage, I want to use the servers I ran in Servers Configuration stage, but I get connection refused in our tests, and also, when accessing the server the apps ran on, I don't see them running anymore, even that I used -d to daemonize them.
Any ideas? it seems like the rails servers ran only for the servers configuration stage and then closed, is that possible? and if so, how do I handle them?
Thanks!

Re-bundle on changes with Docker or PM2

So I've deployed an app to a remote server. The app is quite large, so I've made some production configs for bundling the client files with webpack.
Currently I'm running the server with docker-compose, and in the server-container I'm running pm2-docker (as there are some workers that needs to be run).
To bundle the client, I'm just using a command like npm run build, so I'm wondering how I could rebuild the client whenever I push changes to the remote server.
To duck it down: whenever there is changes, do npm run build
What would be the best way to do this? Are you able to run some kind of command specified in the PM2-.yml-file or in the docker-compose .yml-file?
Thankful for any help!

Remote Debugging HTTP requests using Go and GoLand IDE

I am new to go, delve and GoLand IDE. I would like to remote debug some REST endpoints that are deployed using make and run in a docker (using docker + docker-compose).
The command I use to bring up my environment is make myproject
My endpoints get hosted at: localhost:8080
When creating a debug configuration in GoLand it specifies that before running
dlv debug --headless --listen=:2345 --api-version 2, do the following:
go build -gcflags='-N -l' github.com/myproject
dlv --listen=:2345 --headless=true --api version=2 exec ./myproject
Is there a way for me to attach to my project once it's running on localhost:8080? How will these commands differ if that is the case?
Thanks in advance
This command dlv debug --headless --listen=:2345 --api-version 2 your/package/name allows delve to compile the package then launch itself and the compiled binary.
On the other hand, these commands
go build -gcflags='-N -l' github.com/myproject
dlv --listen=:2345 --headless=true --api version=2 exec ./myproject
show you that you can compile the binary separately, in case you need more flexibility and then launch the debugger. Keep in mind that it's really important to add -gcflags='-N -l' or -gcflags='all=-N -l', depending on which Go version you have, in order for the debugger to be able to have more data available about your application.
As for the:
Is there a way for me to attach to my project once it's running on localhost:8080? How will these commands differ if that is the case?
It depends on where you are running the process. If it's on your machine directly, without a VM or a container, then the IDE has the option in Run|Attach to Process. If the process is running on a different machine then you need to login into that machine and use dlv --headless --listen=:2345 --api-version 2 attach <pid>.
We published an article dedicated to this problem a couple of months ago, please have a look at it for a more detailed reply.

Resources