meinaart / cypress-plugin-snapshots

Plugin for snapshot tests in Cypress.io
MIT License
497 stars 118 forks source link

Added examples for toMatchSnapshot() #227

Open mosofsky opened 1 year ago

mosofsky commented 1 year ago

Added examples for toMatchSnapshot() to illustrate cy.wrap() and cy.readFile():

  it('toMatchSnapshot - object of type any using cy.wrap()', () => {
    const actualString = "this is an exmample of string data you want to match to a snapshot";
    cy.wrap(actualString).toMatchSnapshot();

    const actualObject = { name: 'Jane Lane' };
    cy.wrap(actualObject).toMatchSnapshot();
  });

  it('toMatchSnapshot - readFile', () => {
    cy.readFile('menu.json').toMatchSnapshot();
  });