1

I'm using dalek. I want use custom function after the creation of an screenshot. Example:

var fs = require('fs');
module.exports = {
    'Amazon does its thing': function (test) {
        test['open']('http://ya.ru/');
        test.type('#text', "xddfg")
        .screenshot(':date/homepage.png', function(data){console.log(data);})
        .done(); 
    }
};

How i can careate custom function? Now when i write code after done() this code performed at example:

     var fs = require('fs');
    module.exports = {
        'Amazon does its thing': function (test) {
            test['open']('http://ya.ru/');
            test.type('#text', "xddfg")
            .screenshot(':date/homepage.png')
            .done(); 
console.log(11111111111);
        }
    };

Running tests
Running Browser: PhantomJS
11111111111
OS: windows 7 32bit
Browser Version: 1.9.8

RUNNING TEST - "Amazon does its thing"
> OPEN http://ya.ru/
> TYPE #text
> SCREENSHOT 2015-03-25/homepage.png
* 0 Assertions run
* TEST - "Amazon does its thing" SUCCEEDED

 0/0 assertions passed. Elapsed Time: 3.4 sec

How i can create callback function?

Thanks!

dezhavi
  • 61
  • 1
  • 4

1 Answers1

0

I found how to do it. Following code be run after each done()

module.exports = {
  options: {
        setup: function () {
            console.log('setup');
        },
        teardown: function () {
           console.log('teardown');
        },
        beforeEach: function () {
           console.log('beforeEach');
        },
        afterEach: function () {
           console.log('afterEach');
        },
      }
dezhavi
  • 61
  • 1
  • 4