Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | 2x 2x 2x 56x 6x 62x 5x 5x 5x 2x 2x 1x 5x 5x 1x 2x | "use strict";
/**
* Fixture make screenshon on chunk failure.
*
* @function
*/
const U = require("glace-utils");
const LOG = U.logger;
const beforeChunkCb = ctx => () => {
ctx.errNumber = CONF.test.curCase.errors.length;
};
const afterChunkCb = ctx => async () => {
if (CONF.test.curCase.errors.length === ctx.errNumber) return;
var opts = {
imageName: `fail ${CONF.test.curCase.name} ${CONF.test.curCase.chunks[0]}`
};
try {
if ($.webdriver && await $.webdriver.session()) {
opts.by = "selenium";
} else {
opts.by = "system";
};
} catch (e) {
opts.by = "system";
};
try {
await $.makeScreenshot(opts);
} catch (e) {
LOG.error(e);
};
};
module.exports = U.makeFixture({ beforeChunk: beforeChunkCb, afterChunk: afterChunkCb });
|