Skip to content

duplicated screenshots? #126

@jbures

Description

@jbures

Hey there guys, i'm trying to create a POC of a visual diff tool and i'm having an issue where i get duplicated screenshots every time i run my test...

I get what appears to be a default screenshot and the one i named, so for example with this run:

const Differencify = require('differencify');
const differencify = new Differencify({
    debug: true,
    imageSnapshotPath: './evidence'
});

const hideElement = () => {
    document.querySelector('.small-spots__container').style.display = "none";
};

const snap = async () => {
    await differencify.launchBrowser();

    const target = differencify.init({ chain: false });
    const page = await target.newPage();

    await page.setViewport({ width: 1360, height: 768 });
    await page.goto('https://www.gog.com');
    await page.addStyleTag({ path: './src/freeze.css' }); // Freezing animations and transitions
    await page.evaluate(hideElement); // hiding dynamic elements to avoid false-positives
    await page.waitFor('.js-background-0'); // waiting for big image to continue

    const image = await page.screenshot({
        type: 'jpeg',
        path: './evidence/frontpage_big_spot.jpg'
    });

    await target.toMatchSnapshot(image);

    await page.close();
    await differencify.cleanup();
};

snap();

This runs fine, the problem is that i get two screenshots here instead of one...
frontpage_big_spot.jpg
test 1.snap.png

The first one is the intended one as you can see in line path: './evidence/frontpage_big_spot.jpg'
The second one i have no idea where is it coming from, also it's the wrong format?
How can i avoid this? I can't find any info in other issues or in the docs.

Thanks and regards.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions