Szabo Gergely Andras

Results 5 comments of Szabo Gergely Andras

Another solution to create a command for that. ``` Cypress.Commands.add( 'visualTest', { prevSubject: 'optional', }, (subject, options) => { const fileName = `${Cypress.currentTest.titlePath.join(' -- ')}.snap`; if (subject) { cy.wrap(subject).screenshot(fileName, options);...

The subject is null when you call purely on the `cy` object like the example above `cy.visualTest()`, and if you have a previous chainer like `cy.get('element')`, and you call that...

Yeah, looks good. Maybe your subject is not an element? With the second option you filter the usecases. `prevSubject: ['optional', 'element']` https://docs.cypress.io/api/cypress-api/custom-commands#Optional-with-Types In the documentation: ``` { prevSubject: ['optional', 'window',...

I have the same problem, do you have any solution for that?

I have the same problem. @jimmykane Do you have a solution for this?