diff --git a/cypress/helpers/util.ts b/cypress/helpers/util.ts index ab4bbef64..c77ae50aa 100644 --- a/cypress/helpers/util.ts +++ b/cypress/helpers/util.ts @@ -97,10 +97,18 @@ export const openURLAndVerifyRendering = ( cy.visit(url); cy.window().should('have.property', 'rendered', true); - cy.get('svg').should('be.visible'); - if (validation) { - cy.get('svg').should(validation); + // Handle sandbox mode where SVG is inside an iframe + if (options.securityLevel === 'sandbox') { + cy.get('iframe').should('be.visible'); + if (validation) { + cy.get('iframe').should(validation); + } + } else { + cy.get('svg').should('be.visible'); + if (validation) { + cy.get('svg').should(validation); + } } verifyScreenshot(name); diff --git a/cypress/integration/rendering/flowchart-v2.spec.js b/cypress/integration/rendering/flowchart-v2.spec.js index 5ef32c269..cd3676fbf 100644 --- a/cypress/integration/rendering/flowchart-v2.spec.js +++ b/cypress/integration/rendering/flowchart-v2.spec.js @@ -79,6 +79,18 @@ describe('Flowchart v2', () => { { htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' } ); }); + it('6a: should render complex HTML in labels with sandbox security', () => { + imgSnapshotTest( + `flowchart TD + A[Christmas] -->|Get money| B(Go shopping) + B --> C{Let me think} + C -->|One| D[Laptop] + C -->|Two| E[iPhone] + C -->|Three| F[fa:fa-car Car] + `, + { securityLevel: 'sandbox', flowchart: { htmlLabels: true } } + ); + }); it('7: should render a flowchart when useMaxWidth is true (default)', () => { renderGraph( `flowchart TD