How to use the gemini-core.Image.create 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.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gemini-testing / gemini / test / unit / state-processor / capture-processor / capture-processor.js View on Github external
it('should not save a reference image if it is already exists', () => {
            fs.readFileSync.withArgs('/existent/path').returns('existent-buffer-data');

            const refImage = mkImage({size: {width: 100, height: 200}});
            Image.create.withArgs('existent-buffer-data').returns(refImage);

            return exec_({refImg: {path: '/existent/path'}})
                .then((res) => {
                    assert.notCalled(utils.saveRef);
                    assert.deepEqual(res, {
                        refImg: {path: '/existent/path'},
                        updated: false
                    });
                });
        });
github gemini-testing / gemini / test / unit / state-processor / capture-processor / capture-processor.js View on Github external
it('should update a reference image size', () => {
                    fs.readFileSync.withArgs('/ref/path').returns('ref-buffer-data');
                    const refImage = mkImage({size: {width: 100, height: 200}});
                    Image.create.withArgs('ref-buffer-data').returns(refImage);

                    const currImage = mkImage({size: {width: 300, height: 400}});

                    return exec_({refImg: {path: '/ref/path', size: null}}, {image: currImage})
                        .then((res) => {
                            assert.deepEqual(res, {
                                refImg: {path: '/ref/path', size: {width: 300, height: 400}},
                                updated: true
                            });
                        });
                });
github gemini-testing / hermione / test / lib / browser / commands / assert-view / index.js View on Github external
getScreenshotPath
            .withArgs(sinon.match.any, 'plain').returns('/ref/path/plain')
            .withArgs(sinon.match.any, 'complex').returns('/ref/path/complex');

        const bufferPlain = new Buffer('plain-data', 'base64');
        const bufferComplex = new Buffer('complex-data', 'base64');

        fs.readFileSync
            .withArgs('/ref/path/plain').returns(bufferPlain)
            .withArgs('/ref/path/complex').returns(bufferComplex);

        const imagePlain = stubImage_({size: {width: 100, height: 200}});
        const imageComplex = stubImage_({size: {width: 300, height: 400}});

        Image.create
            .withArgs(bufferPlain).returns(imagePlain)
            .withArgs(bufferComplex).returns(imageComplex);

        const browser = stubBrowser_({getScreenshotPath});

        await browser.publicAPI.assertView('plain');
        await browser.publicAPI.assertView('complex');

        assert.deepEqual(browser.publicAPI.executionContext.hermioneCtx.assertViewResults.get(), [
            {stateName: 'plain', refImg: {path: '/ref/path/plain', size: {width: 100, height: 200}}},
            {stateName: 'complex', refImg: {path: '/ref/path/complex', size: {width: 300, height: 400}}}
        ]);
    });
});