diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b8150e8571..8f0f3b95da 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -38,13 +38,21 @@ jobs: - name: Run Unit Tests run: | yarn test --coverage - cat ./coverage/lcov.info | ./node_modules/.bin/coveralls - env: - COVERALLS_SERVICE_NAME: ${{ secrets.COVERALLS_SERVICE_NAME }} - COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} + + - name: Upload Test Results + uses: coverallsapp/github-action@v1.0.1 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + parallel: true - name: Run E2E Tests run: yarn e2e env: PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }} CYPRESS_CACHE_FOLDER: .cache/Cypress + + - name: Post Upload Test Results + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + parallel-finished: true diff --git a/cypress/helpers/util.js b/cypress/helpers/util.js index 143fc7ed7d..a3f92defd4 100644 --- a/cypress/helpers/util.js +++ b/cypress/helpers/util.js @@ -26,3 +26,9 @@ export const imgSnapshotTest = (graphStr, options, api) => { cy.get('svg'); cy.percySnapshot(); }; + +export const renderGraph = (graphStr, options, api) => { + const url = mermaidUrl(graphStr, options, api); + + cy.visit(url); +}; diff --git a/cypress/integration/other/configuration.spec.js b/cypress/integration/other/configuration.spec.js new file mode 100644 index 0000000000..c2f1533b2c --- /dev/null +++ b/cypress/integration/other/configuration.spec.js @@ -0,0 +1,100 @@ +import { renderGraph } from '../../helpers/util'; +/* eslint-env jest */ +describe('Configuration', () => { + describe('arrowMarkerAbsolute', () => { + it('should handle default value false of arrowMarkerAbsolute', () => { + renderGraph( + `graph 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] + `, + { } + ); + + // Check the marker-end property to make sure it is properly set to + // start with # + cy.get('.edgePath path').first().should('have.attr', 'marker-end') + .should('exist') + .and('include', 'url(#'); + }); + it('should handle default value false of arrowMarkerAbsolute', () => { + renderGraph( + `graph 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] + `, + { } + ); + + // Check the marker-end property to make sure it is properly set to + // start with # + cy.get('.edgePath path').first().should('have.attr', 'marker-end') + .should('exist') + .and('include', 'url(#'); + }); + it('should handle arrowMarkerAbsolute excplicitly set to false', () => { + renderGraph( + `graph 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] + `, + { + arrowMarkerAbsolute: false + } + ); + + // Check the marker-end property to make sure it is properly set to + // start with # + cy.get('.edgePath path').first().should('have.attr', 'marker-end') + .should('exist') + .and('include', 'url(#'); + }); + it('should handle arrowMarkerAbsolute excplicitly set to "false" as false', () => { + renderGraph( + `graph 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] + `, + { + arrowMarkerAbsolute: "false" + } + ); + + // Check the marker-end property to make sure it is properly set to + // start with # + cy.get('.edgePath path').first().should('have.attr', 'marker-end') + .should('exist') + .and('include', 'url(#'); + }); + it('should handle arrowMarkerAbsolute set to true', () => { + renderGraph( + `graph 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] + `, + { + arrowMarkerAbsolute: true + } + ); + + cy.get('.edgePath path').first().should('have.attr', 'marker-end') + .should('exist') + .and('include', 'url(http://localhost'); + }); + }); +}); diff --git a/cypress/integration/other/interaction.spec.js b/cypress/integration/other/interaction.spec.js index cfd937e63e..6d37af2735 100644 --- a/cypress/integration/other/interaction.spec.js +++ b/cypress/integration/other/interaction.spec.js @@ -16,7 +16,7 @@ describe('Interaction', () => { cy.viewport(1440, 1024); cy.visit(url); cy.get('body') - .find('g#mermaid-dom-id-1Function') + .find('g[id="1Function"]') .click(); cy.get('.created-by-click').should('have.text', 'Clicked By Flow'); @@ -38,7 +38,7 @@ describe('Interaction', () => { cy.viewport(1440, 1024); cy.visit(url); cy.get('body') - .find('g#mermaid-dom-id-2URL') + .find('g[id="2URL"]') .click(); cy.location().should(location => { @@ -108,7 +108,7 @@ describe('Interaction', () => { cy.viewport(1440, 1024); cy.visit(url); cy.get('body') - .find('g#mermaid-dom-id-1Function') + .find('g[id="1Function"]') .click(); cy.get('.created-by-click').should('not.have.text', 'Clicked By Flow'); @@ -130,7 +130,7 @@ describe('Interaction', () => { cy.viewport(1440, 1024); cy.visit(url); cy.get('body') - .find('g#mermaid-dom-id-2URL') + .find('g[id="2URL"]') .click(); cy.location().should(location => { @@ -200,7 +200,7 @@ describe('Interaction', () => { cy.viewport(1440, 1024); cy.visit(url); cy.get('body') - .find('g#mermaid-dom-id-1Function') + .find('g[id="1Function"]') .click(); cy.get('.created-by-click').should('not.have.text', 'Clicked By Flow'); diff --git a/cypress/integration/rendering/classDiagram.spec.js b/cypress/integration/rendering/classDiagram.spec.js index 1e45851499..0125a43733 100644 --- a/cypress/integration/rendering/classDiagram.spec.js +++ b/cypress/integration/rendering/classDiagram.spec.js @@ -19,6 +19,9 @@ describe('Class diagram', () => { Class01 : size() Class01 : int chimp Class01 : int gorilla + Class01 : -int privateChimp + Class01 : +int publicGorilla + Class01 : #int protectedMarmoset Class08 <--> C2: Cool label class Class10 { <<service>> @@ -58,6 +61,25 @@ describe('Class diagram', () => { ); cy.get('svg'); }); + + it('should render a simple class diagram with different visibilities', () => { + imgSnapshotTest( + ` + classDiagram + Class01 <|-- AveryLongClass : Cool + <<interface>> Class01 + Class01 : -int privateMethod() + Class01 : +int publicMethod() + Class01 : #int protectedMethod() + Class01 : -int privateChimp + Class01 : +int publicGorilla + Class01 : #int protectedMarmoset + `, + {} + ); + cy.get('svg'); + }); + it('should render multiple class diagrams', () => { imgSnapshotTest( [ diff --git a/cypress/platform/e2e.html b/cypress/platform/e2e.html index 4384fd0ec3..010b11cb2c 100644 --- a/cypress/platform/e2e.html +++ b/cypress/platform/e2e.html @@ -4,9 +4,8 @@