Refer: Working with iframes in Cypress
const getIframeDocument = () => {
return cy.get('iframe').its('0.contentDocument').should('exist')
};
const getIframeBody = () => {
// get the document
return getIframeDocument()
.its('body').should('not.be.undefined')
.then(cy.wrap);
}
getIframeBody().find(<selector>).should('contain', <content>);