📜 ⬆️ ⬇️

Dalek.js - simple functional testing of web applications.

Do you know what Selenium and / or PhantomJS are ? And with what they eat? Then, perhaps, you will be interested in the project Dalek.js - cross-browser utility for testing web applications.

Dalek.js allows you to write tests that go through web pages, click links, fill out forms, send data and take screenshots. The same and even more do the tests written using Selenium or Phantom.js, what's the catch?


')
But! See how simple this test is.
test.js
module.exports = { 'Page title is correct': function (test) { test .open('http://google.com') .assert.title().is('Google', 'It has title') .done(); } }; 

Open google.com in your browser and make sure that the title of the page really says 'Google'.

To run it you need:
a) install Dalek.js and drivers for the desired browsers (PhantomJS works out of the box) in the directory of the previously created node project (although the project itself is not needed)
For example: Dalek.js + Chrome Driver
 $ npm install dalek-cli -g $ npm install dalekjs --save-dev $ npm install dalek-browser-chrome --save-dev 

b) and execute the command:
 $ dalek test.js //   PhantomJS $ dalek test.js -b chrome //   Chrome 


Another simple test from the documentation:
 module.exports = { 'Amazon does its thing': function (test) { test .open('http://www.amazon.com/') .type('#twotabsearchtextbox', 'Blues Brothers VHS') .click('.nav-submit-input') .waitForElement('#result_0') .assert.text('#result_0 .newaps a span').is('The Blues Brothers') .done(); } }; 

On Amazon, we search for the Blues Brothers videotape and make sure that the search results really have what we are looking for.

I will not further copy the official documentation and examples (everything is detailed and understandable at www.dalekjs.com ), and I will ask you to support the project with your attention. Why?

Having decided to master the use of PhantomJS for testing instead of Selenium, I began to search on which framework (Mocha, Jasmine, ...) it would be more convenient to write tests. Word for word, and now Google gave a link to this project. Write a test and run it first in visual mode (on Chrome), and then in the console (on PhantomJS) it came out very quickly.

I believe that Dalek.js has several handy chips: the chain-style of function calls with a minimum of parameters, does not require super Shaman dances with the installation, is well documented. The project has a large number of open bugs and promises to add functionality (for example, at least, I want mouse movements, file uploads to forms).

Community attention in the form of an increase in the number of stars on GitHub and tweets in the media can be at least a little conducive to the development activity of Dalek.js, which has been sawing for about a year by a few guys from Germany, what do you think?

Off.site Dalek.js
Dalek.js on github
Dalek.js on Twitter

Source: https://habr.com/ru/post/232191/


All Articles