lotte icon indicating copy to clipboard operation
lotte copied to clipboard

A flag for auto screenshots during asserts

Open thomasdavis opened this issue 14 years ago • 1 comments

Possibly not the best solution but maybe lotte could have a flag in Lottefile that does a render of the current page when a test fails.

Don't mind attempting to do a fork request on the weekend if you point me in the right direction.

thomasdavis avatar Dec 08 '11 23:12 thomasdavis

I'll probably look at this over the weekend. I'd like to keep the core as small as possible so will be working towards #2 Setup/teardown (before/after all). What this means is I want to be able to allow third-party scripts to hook to events Lotte will emit. It will likely look like this (Lottefile):

on('fail', function(test) {
  test.page.render('failure.png');
});

As you said, a flag would probably be a better option. In spirit of keeping the core small, I'd also want to add support for loading plug-ins so the end result should look like this (Lottefile):

require('screenshot_on_failure');

In the interim, if you want to hack around the project, have a look at lib/inject/test/page.js:135. This is the one place where test fails are handled. A simple child.page.render(..) would do the work if you are in a rush.

StanAngeloff avatar Dec 09 '11 08:12 StanAngeloff