How to use the gemini-core.temp.path function in gemini-core

To help you get started, we’ve selected a few gemini-core examples, based on popular ways it is used in public projects.

github gemini-testing / gemini / lib / state-processor / capture-processor / index.js View on Github external
const throwNoRefError = (refImg, capture) => {
    const currImg = {path: temp.path({suffix: '.png'}), size: capture.image.getSize()};

    return capture.image.save(currImg.path)
        .then(() => Promise.reject(new NoRefImageError(refImg, currImg)));
};
const notUpdated = (refImg) => ({refImg, updated: false});
github gemini-testing / gemini / lib / capture-session.js View on Github external
extendWithPageScreenshot(obj) {
        const path = temp.path({suffix: '.png'});

        return this.browser.captureViewportImage()
            .then((screenImage) => [screenImage.getSize(), screenImage.save(path)])
            .spread((size) => {
                obj.img = {path, size};
            })
            .catch(_.noop)
            .then(() => obj);
    }
github gemini-testing / hermione / lib / browser / commands / assert-view / index.js View on Github external
: Promise.reject(e);

        const page = await browser.prepareScreenshot(
            [].concat(selectors), {ignoreSelectors: [].concat(opts.ignoreElements)}
        );

        const {tempOpts} = RuntimeConfig.getInstance();
        temp.attach(tempOpts);

        const screenShooterOpts = {
            allowViewportOverflow: opts.allowViewportOverflow,
            screenshotDelay: opts.screenshotDelay
        };

        const currImgInst = await screenShooter.capture(page, screenShooterOpts);
        const currImg = {path: temp.path(Object.assign(tempOpts, {suffix: '.png'})), size: currImgInst.getSize()};
        await currImgInst.save(currImg.path);

        const test = getTestContext(session.executionContext);
        const refImg = {path: config.getScreenshotPath(test, state), size: null};
        const {emitter} = browser;

        if (!fs.existsSync(refImg.path)) {
            return handleNoRefImage(currImg, refImg, state, {emitter}).catch((e) => handleCaptureProcessorError(e));
        }

        const {canHaveCaret, pixelRatio} = page;
        const imageCompareOpts = {
            tolerance: opts.tolerance,
            antialiasingTolerance,
            canHaveCaret,
            pixelRatio,