core icon indicating copy to clipboard operation
core copied to clipboard

Automated browser tests with DalekJS

Open ganomi opened this issue 12 years ago • 3 comments

Hello there,

i saw that you guys started with some unit tests for JavaScript (https://github.com/owncloud/core/pull/6736).

The last few days i tried out the testing tool DalekJS (http://dalekjs.com/). It offers a JavaScript API to do UnitTests which will run in webbrowsers controlled via WebDriver Implementations (f.e. https://code.google.com/p/selenium/wiki/ChromeDriver).

Watch the screencast (which features file creation and deletion in OwnCloud) and you will know what i mean: http://goo.gl/sCqLdG

What you see there is controlled by the following code: https://gist.github.com/ganomi/9916035

DalekJS is based on Node.js and for execution of graphical browsers a display server is needed. (in my case i installed a tightvncserver to see whats happening)

I have to admit that DalekJS still has its edges and sometimes needs workarounds to get going, but it is still in active development (i.e. Version 0.0.8). At the moment it works best with Chrome, but there are modules for Firefox and Internet Explorer as well. There are also reporters that can output xml to be used by CI servers

Just wanted to let you know about this possibility of testing. Maybe you are interested.

ganomi avatar Apr 01 '14 15:04 ganomi

Thanks. It looks like what DalekJS does is simulate clicks in the UI a bit like automation tests would do, not necessarily unit tests. By introducing Jasmine I wanted to have unit tests for the methods in Javascript, which means testing what goes into the API and what comes out, very narrow testing, but also have a little bit broader testing but seldom simulating clicks.

However there is already a work in progress to do automation with the "simulate clicking, filling fields" style, which is here: https://github.com/owncloud/acceptance-testing

It uses vagrant to fire up and configure a test VM and runs cucumber tests.

PVince81 avatar Apr 01 '14 20:04 PVince81

Ah yes, that project also uses Selenium, please have a look.

PVince81 avatar Apr 01 '14 20:04 PVince81

@ganomi did you have a look at our karma JS unit tests and the acceptance-testing project that uses Selenium ? The acceptance-testing project could need some help if you are interested in contributing.

I think we currently don't have the need of switching to a new framework, so I'm going to close this.

PVince81 avatar Apr 08 '14 09:04 PVince81