Get help with testing, discuss unit testing strategies etc.


Post by Edgar »

Hello,
I know that there is method to take screenshots
{screenshot:'myScreen.png'}
Is it possible to subscribe to some event, that on any test event the screenshot will be captured.
Or maybe siesta has some tool to do that?

Post by Edgar »

Moreover, is it possible to take screenshot, running tests, via phantomJS?

Post by mats »

Yes this is possible and easy. Screenshots are only supported in WebDriver.
var failCounter = 0;

Harness.on('testupdate', function(ev, test) {
    if (test.getFailCount() > failCounter) {
        failCounter = test.getFailCount();

        test.screenshot(test.url, function() {

        })
    }
})

Post by Edgar »

Than you very much :)

Post Reply