const getIframeDocument = ( ) => { return cy . get ( 'iframe' ) . its ( '0.contentDocument' ) . should ( 'exist' ) ; } ; const getIframeBody = ( ) => { return ( getIframeDocument ( ) . its ( 'body' ) . should ( 'not.be.undefined' ) . should ( 'not.be.null' ) . then ( cy . wrap ) ) ; } ; describe ( 'iframe editor' , ( ) => { beforeEach ( ( ) => { cy . visit ( 'examples/iframe' ) ; } ) ; it ( 'should be editable' , ( ) => { getIframeBody ( ) . findByRole ( 'textbox' ) . type ( '{movetostart}' ) . type ( 'Hello World' ) . should ( 'contain.text' , 'Hello World' ) ; } ) ; } ) ;