On Github JHeimbach / dalekjs-slides
PHP UG Düsseldorf / @j_heimbach
DalekJS is an open source UI testing tool written in JavaScript, it will:
npm install dalek-cli -g
{
"name": "myCssTardis",
"description": "Is awesome",
"version": "0.0.2"
}
npm install dalekjs --save-dev
module.exports = {
'Page title is correct': function (test) {
test
.open('http://google.com')
.assert.title().is('Google', 'It has title')
.done();
}
};
dalek test/my_first_test.js
Running tests
Running Browser: Phantomjs
RUNNING TEST - "Page title is correct"
▶ OPEN http://google.com
✔ TITLE It has title
✔ 1 Assertions run
✔ TEST - "Page title is correct" SUCCEEDED
1/1 assertions passed. Elapsed Time: 2 sec
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 [VHS]')
.done();
}
};
...but no User will visit your Page with it
DalekJS supports:
npm install dalek-browser-chrome --save-dev
dalek test/my_first_test.js -b chrome
DalekJS speaks:
npm install dalek-reporter-html --save-dev
dalek your_test.js -r console,html
insert every Single Letter in the Inputfield
.type('#twotabsearchtextbox', 'Blues Brothers VHS')
Webdriver
Selenium
Sauce Labs
Test your code on remote Machines (VM, Network, etc)