simonsmith/cypress-image-snapshot

`cy.screenshot()` failed because it requires a DOM element

Closed this issue · 2 comments

I am getting an error while running the basic test using the cypress. The issue seems very small, as I can see most of the developers are using it successfully but have spent 2-3 hours already to get it started.

The test file is:

describe('Snapshot Testing', () => {
    context('720p resolution', () => {
        beforeEach(() => {
            cy.viewport(1280, 720);
        });
        it('Create a reference image',{tags: '1'} ,() => {
            cy.visit("a14cf4f0-4365-4b47-a1d9-c2ebb1c0e26c.html");
            cy.get('body').matchImageSnapshot("a14cf4f0-4365-4b47-a1d9-c2ebb1c0e26c");
        });
    });
});

While running getting this error
Screenshot 2024-07-10 at 12 53 16 PM

Does your test have an actual body element?

Show your html, maybe you do not have body