collab/mermaid/cypress/integration/other/configuration.spec.jsblame
View source
6dd74de1import { renderGraph, verifyScreenshot } from '../../helpers/util.ts';
6dd74de2describe('Configuration', () => {
6dd74de3 describe('arrowMarkerAbsolute', () => {
6dd74de4 it('should handle default value false of arrowMarkerAbsolute', () => {
6dd74de5 renderGraph(
6dd74de6 `graph TD
6dd74de7 A[Christmas] -->|Get money| B(Go shopping)
6dd74de8 B --> C{Let me think}
6dd74de9 C -->|One| D[Laptop]
6dd74de10 C -->|Two| E[iPhone]
6dd74de11 C -->|Three| F[fa:fa-car Car]
6dd74de12 `,
6dd74de13 {}
6dd74de14 );
6dd74de15
6dd74de16 // Check the marker-end property to make sure it is properly set to
6dd74de17 // start with #
6dd74de18 cy.get('.edgePaths').within(() => {
6dd74de19 cy.get('path')
6dd74de20 .first()
6dd74de21 .should('have.attr', 'marker-end')
6dd74de22 .should('exist')
6dd74de23 .and('include', 'url(#');
6dd74de24 });
6dd74de25 });
6dd74de26 it('should handle default value false of arrowMarkerAbsolute', () => {
6dd74de27 renderGraph(
6dd74de28 `graph TD
6dd74de29 A[Christmas] -->|Get money| B(Go shopping)
6dd74de30 B --> C{Let me think}
6dd74de31 C -->|One| D[Laptop]
6dd74de32 C -->|Two| E[iPhone]
6dd74de33 C -->|Three| F[fa:fa-car Car]
6dd74de34 `,
6dd74de35 {}
6dd74de36 );
6dd74de37
6dd74de38 // Check the marker-end property to make sure it is properly set to
6dd74de39 // start with #
6dd74de40 cy.get('.edgePaths').within(() => {
6dd74de41 cy.get('path')
6dd74de42 .first()
6dd74de43 .should('have.attr', 'marker-end')
6dd74de44 .should('exist')
6dd74de45 .and('include', 'url(#');
6dd74de46 });
6dd74de47 });
6dd74de48 it('should handle arrowMarkerAbsolute explicitly set to false', () => {
6dd74de49 renderGraph(
6dd74de50 `graph TD
6dd74de51 A[Christmas] -->|Get money| B(Go shopping)
6dd74de52 B --> C{Let me think}
6dd74de53 C -->|One| D[Laptop]
6dd74de54 C -->|Two| E[iPhone]
6dd74de55 C -->|Three| F[fa:fa-car Car]
6dd74de56 `,
6dd74de57 {
6dd74de58 arrowMarkerAbsolute: false,
6dd74de59 }
6dd74de60 );
6dd74de61
6dd74de62 // Check the marker-end property to make sure it is properly set to
6dd74de63 // start with #
6dd74de64 cy.get('.edgePaths').within(() => {
6dd74de65 cy.get('path')
6dd74de66 .first()
6dd74de67 .should('have.attr', 'marker-end')
6dd74de68 .should('exist')
6dd74de69 .and('include', 'url(#');
6dd74de70 });
6dd74de71 });
6dd74de72 // This has been broken for a long time, but something about the Cypress environment was
6dd74de73 // rewriting the URL to be relative, causing the test to incorrectly pass.
6dd74de74 it.skip('should handle arrowMarkerAbsolute explicitly set to "false" as false', () => {
6dd74de75 renderGraph(
6dd74de76 `graph TD
6dd74de77 A[Christmas] -->|Get money| B(Go shopping)
6dd74de78 B --> C{Let me think}
6dd74de79 C -->|One| D[Laptop]
6dd74de80 C -->|Two| E[iPhone]
6dd74de81 C -->|Three| F[fa:fa-car Car]
6dd74de82 `,
6dd74de83 {
6dd74de84 arrowMarkerAbsolute: 'false',
6dd74de85 }
6dd74de86 );
6dd74de87
6dd74de88 // Check the marker-end property to make sure it is properly set to
6dd74de89 // start with #
6dd74de90 cy.get('.edgePaths').within(() => {
6dd74de91 cy.get('path')
6dd74de92 .first()
6dd74de93 .should('have.attr', 'marker-end')
6dd74de94 .should('exist')
6dd74de95 .and('include', 'url(#');
6dd74de96 });
6dd74de97 });
6dd74de98 it('should handle arrowMarkerAbsolute set to true', () => {
6dd74de99 renderGraph(
6dd74de100 `flowchart TD
6dd74de101 A[Christmas] -->|Get money| B(Go shopping)
6dd74de102 B --> C{Let me think}
6dd74de103 C -->|One| D[Laptop]
6dd74de104 C -->|Two| E[iPhone]
6dd74de105 C -->|Three| F[fa:fa-car Car]
6dd74de106 `,
6dd74de107 {
6dd74de108 arrowMarkerAbsolute: true,
6dd74de109 }
6dd74de110 );
6dd74de111
6dd74de112 cy.get('.edgePaths').within(() => {
6dd74de113 cy.get('path')
6dd74de114 .first()
6dd74de115 .should('have.attr', 'marker-end')
6dd74de116 .and('include', 'url(http://localhost');
6dd74de117 });
6dd74de118 });
6dd74de119 it('should not taint the initial configuration when using multiple directives', () => {
6dd74de120 const url = '/regression/issue-1874.html';
6dd74de121 cy.visit(url);
6dd74de122 cy.window().should('have.property', 'rendered', true);
6dd74de123 verifyScreenshot(
6dd74de124 'configuration.spec-should-not-taint-initial-configuration-when-using-multiple-directives'
6dd74de125 );
6dd74de126 });
6dd74de127 });
6dd74de128
6dd74de129 describe('suppressErrorRendering', () => {
6dd74de130 beforeEach(() => {
6dd74de131 cy.on('uncaught:exception', (err, runnable) => {
6dd74de132 return !err.message.includes('Parse error on line');
6dd74de133 });
6dd74de134 });
6dd74de135
6dd74de136 it('should not render error diagram if suppressErrorRendering is set', () => {
6dd74de137 const url = '/suppressError.html?suppressErrorRendering=true';
6dd74de138 cy.visit(url);
6dd74de139 cy.window().should('have.property', 'rendered', true);
6dd74de140 cy.get('#test')
6dd74de141 .find('svg')
6dd74de142 .should(($svg) => {
6dd74de143 // all failing diagrams should not appear!
6dd74de144 expect($svg).to.have.length(2);
6dd74de145 // none of the diagrams should be error diagrams
6dd74de146 expect($svg).to.not.contain('Syntax error');
6dd74de147 });
6dd74de148 verifyScreenshot(
6dd74de149 'configuration.spec-should-not-render-error-diagram-if-suppressErrorRendering-is-set'
6dd74de150 );
6dd74de151 });
6dd74de152
6dd74de153 it('should render error diagram if suppressErrorRendering is not set', () => {
6dd74de154 const url = '/suppressError.html';
6dd74de155 cy.visit(url);
6dd74de156 cy.window().should('have.property', 'rendered', true);
6dd74de157 cy.get('#test')
6dd74de158 .find('svg')
6dd74de159 .should(($svg) => {
6dd74de160 // all five diagrams should be rendered
6dd74de161 expect($svg).to.have.length(5);
6dd74de162 // some of the diagrams should be error diagrams
6dd74de163 expect($svg).to.contain('Syntax error');
6dd74de164 });
6dd74de165 verifyScreenshot(
6dd74de166 'configuration.spec-should-render-error-diagram-if-suppressErrorRendering-is-not-set'
6dd74de167 );
6dd74de168 });
6dd74de169 });
6dd74de170});