Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

End To End Testing on Headless Server

I am trying to set up an environment for end-to-end testing on a droplet running Ubuntu server 12.04.3 on digital ocean.

What I am trying to achieve in the end is for my jenkins (installed on the one droplet) to be able to run my end-to-end tests. Now, the server is ofcourse headless and the end-to-end tests need to run through a browser (I am using protractor with the selenium standalone server with chromedriver).

My question is: how do I spawn a browser on that machine? I have installed xorg and if I do startx on the server, log out and ssh -X to it, I can manually run the end-to-end tests (a browser pops up on my local machine). But I can get it to work without ssh -X to it, and since jenkins is on the same droplet where the tests are to be run. Well I dont get a browser to spawn.

NOTE: I know I might be missing something really trivial here since I don't fully understand the configuration nor the xorg.

Any hints or a complete answer is very much appreciated, this is giving me gray hair.

Edit: After a little digging I think i got the xorg stuff a bit wrong, i am guessing the purpose of X is to be able to spawn a window on a remote machine ( ie my local machine). And what i am after is more along the lines of a virtual frame buffer such as Xvfb...

like image 691
hanto899 Avatar asked Mar 31 '14 19:03

hanto899


1 Answers

There is PhantomJS but with Protractor is buggy and a dead-end.

You can still use Chrome & Firefox headless through docker-selenium or, if you don't like Docker you can do it yourself with ubuntu-headless sample. Both solutions provide Chrome & Firefox by using Xvfb even though there is no real DISPLAY.

UPDATE 2 Seems to be possible to run Xvfb in OSX: http://xquartz.macosforge.org/landing/

UPDATE 1 Mac OSX selenium headless solution:

Enable multi-user remote desktop access to OSX machine

So can test selenium headless on mac. Not headless really but as another user so it doesn't interfere with your current user display. To do this you need kickstart: http://support.apple.com/en-us/HT201710 Begin using the kickstart utility

sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -restart -agent

Activate Remote Desktop Sharing, enable access privileges for all users and restart ARD Agent:

sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -access -on -restart -agent -privs -all 
Apple Remote Desktop 3.2 or later only

Allow access for all users and give all users full access

sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -allowAccessFor -allUsers -privs -all

Kickstart help command

sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -help
like image 89
Leo Gallucci Avatar answered Dec 04 '22 03:12

Leo Gallucci