diff --git a/cypress/integration/other/configuration.spec.js b/cypress/integration/other/configuration.spec.js index 51cbb0da5..3b6e12cf2 100644 --- a/cypress/integration/other/configuration.spec.js +++ b/cypress/integration/other/configuration.spec.js @@ -132,7 +132,17 @@ describe('Configuration', () => { const url = 'http://localhost:9000/suppressError.html?suppressErrorRendering=true'; cy.viewport(1440, 1024); cy.visit(url); - cy.get('#test'); + cy.window().should('have.property', 'rendered', true); + cy.get('#test') + .find('svg') + .should(($svg) => { + expect($svg).to.have.length(2); // all failing diagrams should not appear! + $svg.each((_index, svg) => { + expect(cy.$$(svg)).to.be.visible(); + // none of the diagrams should be error diagrams + expect($svg).to.not.contain('Syntax error'); + }); + }); cy.matchImageSnapshot( 'configuration.spec-should-not-render-error-diagram-if-suppressErrorRendering-is-set' ); @@ -142,6 +152,7 @@ describe('Configuration', () => { const url = 'http://localhost:9000/suppressError.html'; cy.viewport(1440, 1024); cy.visit(url); + cy.window().should('have.property', 'rendered', true); cy.get('#test'); cy.matchImageSnapshot( 'configuration.spec-should-render-error-diagram-if-suppressErrorRendering-is-not-set' diff --git a/cypress/platform/suppressError.html b/cypress/platform/suppressError.html index 19e8da22d..02591ce70 100644 --- a/cypress/platform/suppressError.html +++ b/cypress/platform/suppressError.html @@ -46,7 +46,11 @@ import mermaid from './mermaid.esm.mjs'; const shouldSuppress = new URLSearchParams(window.location.search).get('suppressErrorRendering') === 'true'; - mermaid.initialize({ startOnLoad: true, suppressErrorRendering: shouldSuppress }); + mermaid.initialize({ startOnLoad: false, suppressErrorRendering: shouldSuppress }); + await mermaid.run(); + if (window.Cypress) { + window.rendered = true; + }