Add new data property to iframe that indicates if the content is ready.

Some tests fail because the iframe hasn't loaded the inner hedgedoc renderer yet
but cypress tries to travel through the dom and verify the render results.

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
Tilman Vatteroth 2021-06-19 16:00:23 +02:00
parent 93d860be71
commit 1fef30bebc
2 changed files with 2 additions and 1 deletions

View file

@ -14,7 +14,7 @@ declare namespace Cypress {
Cypress.Commands.add('getMarkdownRenderer', () => { Cypress.Commands.add('getMarkdownRenderer', () => {
return cy return cy
.get(`iframe[data-cy="documentIframe"]`) .get(`iframe[data-cy="documentIframe"][data-content-ready="true"]`)
.should('be.visible') .should('be.visible')
.its('0.contentDocument') .its('0.contentDocument')
.should('exist') .should('exist')

View file

@ -140,6 +140,7 @@ export const RenderIframe: React.FC<RenderIframeProps> = ({
{...(isTestMode() ? {} : { sandbox: 'allow-downloads allow-same-origin allow-scripts allow-popups' })} {...(isTestMode() ? {} : { sandbox: 'allow-downloads allow-same-origin allow-scripts allow-popups' })}
ref={frameReference} ref={frameReference}
className={`border-0 ${frameClasses ?? ''}`} className={`border-0 ${frameClasses ?? ''}`}
data-content-ready={rendererReady}
/> />
</Fragment> </Fragment>
) )