From 8f8c685a39c801a1bae15319ac861203ebb29d58 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 13 Jun 2022 18:59:06 +0000 Subject: [PATCH 1/4] chore(deps-dev): bump cypress from 9.7.0 to 10.1.0 Bumps [cypress](https://github.com/cypress-io/cypress) from 9.7.0 to 10.1.0. - [Release notes](https://github.com/cypress-io/cypress/releases) - [Changelog](https://github.com/cypress-io/cypress/blob/develop/.releaserc.base.js) - [Commits](https://github.com/cypress-io/cypress/compare/v9.7.0...v10.1.0) --- updated-dependencies: - dependency-name: cypress dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- package.json | 2 +- yarn.lock | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index b916673ac4..d3cc8aef78 100644 --- a/package.json +++ b/package.json @@ -81,7 +81,7 @@ "concurrently": "^7.0.0", "coveralls": "^3.0.2", "css-to-string-loader": "^0.1.3", - "cypress": "9.7.0", + "cypress": "10.1.0", "cypress-image-snapshot": "^4.0.1", "documentation": "13.2.0", "eslint": "^8.4.1", diff --git a/yarn.lock b/yarn.lock index 09375a1912..e16d0e5977 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1988,7 +1988,7 @@ slash "^3.0.0" write-file-atomic "^4.0.1" -"@jest/types@^28.1.0", "@jest/types@^28.1.1": +"@jest/types@^28.1.1": version "28.1.1" resolved "https://registry.yarnpkg.com/@jest/types/-/types-28.1.1.tgz#d059bbc80e6da6eda9f081f293299348bd78ee0b" integrity sha512-vRXVqSg1VhDnB8bWcmvLzmg0Bt9CRKVgHPXqYwvWMX3TvAjeO+nRuK6+VdTKCtWOvYlmkF/HqNAL/z+N3B53Kw== @@ -4275,10 +4275,10 @@ cypress-image-snapshot@^4.0.1: pkg-dir "^3.0.0" term-img "^4.0.0" -cypress@9.7.0: - version "9.7.0" - resolved "https://registry.yarnpkg.com/cypress/-/cypress-9.7.0.tgz#bf55b2afd481f7a113ef5604aa8b693564b5e744" - integrity sha512-+1EE1nuuuwIt/N1KXRR2iWHU+OiIt7H28jJDyyI4tiUftId/DrXYEwoDa5+kH2pki1zxnA0r6HrUGHV5eLbF5Q== +cypress@10.1.0: + version "10.1.0" + resolved "https://registry.yarnpkg.com/cypress/-/cypress-10.1.0.tgz#6514a26c721822a02bc194e9a7f72c3142aea174" + integrity sha512-aQ4JVZVib4Xd9FZW8IRZfKelUvqF4y5A+oUbNvn8TlsBmEfIg3m5Xd6Mt6PVU/jHiVJ9Psl905B3ZPnrDcmyuQ== dependencies: "@cypress/request" "^2.88.10" "@cypress/xvfb" "^1.2.4" @@ -7679,7 +7679,7 @@ jest-snapshot@^28.1.1: pretty-format "^28.1.1" semver "^7.3.5" -jest-util@^28.1.0, jest-util@^28.1.1: +jest-util@^28.1.1: version "28.1.1" resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-28.1.1.tgz#ff39e436a1aca397c0ab998db5a51ae2b7080d05" integrity sha512-FktOu7ca1DZSyhPAxgxB6hfh2+9zMoJ7aEQA759Z6p45NuO8mWcqujH+UdHlCm/V6JTWwDztM2ITCzU1ijJAfw== From 648b15b00b3a9d508c114a301604cfa17613fc92 Mon Sep 17 00:00:00 2001 From: MOREL Matthieu Date: Sun, 19 Jun 2022 14:13:22 +0200 Subject: [PATCH 2/4] Upgrade Cypress --- cypress.config.js | 20 + cypress.json | 3 - .../other/configuration.spec.js | 0 .../other/interaction.spec.js | 0 .../other/rerender.spec.js | 0 .../other/webpackUsage.spec.js | 0 .../{integration => e2e}/other/xss.spec.js | 0 .../rendering/appli.spec.js | 0 .../rendering/classDiagram-v2.spec.js | 0 .../rendering/classDiagram.spec.js | 820 +++++++++--------- .../rendering/conf-and-directives.spec.js | 0 .../rendering/current.spec.js | 0 .../rendering/debug.spec.js | 0 .../rendering/erDiagram.spec.js | 0 .../rendering/flowchart-v2.spec.js | 0 .../rendering/flowchart.spec.js | 0 .../rendering/gantt.spec.js | 0 .../rendering/gitGraph.spec.js | 0 .../rendering/info.spec.js | 0 .../rendering/journey.spec.js | 0 .../rendering/pie.spec.js | 0 .../rendering/requirement.spec.js | 0 .../rendering/sequencediagram.spec.js | 0 .../rendering/stateDiagram-v2.spec.js | 0 .../rendering/stateDiagram.spec.js | 0 .../rendering/theme.spec.js | 0 cypress/plugins/index.js | 32 - 27 files changed, 430 insertions(+), 445 deletions(-) create mode 100644 cypress.config.js delete mode 100644 cypress.json rename cypress/{integration => e2e}/other/configuration.spec.js (100%) rename cypress/{integration => e2e}/other/interaction.spec.js (100%) rename cypress/{integration => e2e}/other/rerender.spec.js (100%) rename cypress/{integration => e2e}/other/webpackUsage.spec.js (100%) rename cypress/{integration => e2e}/other/xss.spec.js (100%) rename cypress/{integration => e2e}/rendering/appli.spec.js (100%) rename cypress/{integration => e2e}/rendering/classDiagram-v2.spec.js (100%) rename cypress/{integration => e2e}/rendering/classDiagram.spec.js (96%) rename cypress/{integration => e2e}/rendering/conf-and-directives.spec.js (100%) rename cypress/{integration => e2e}/rendering/current.spec.js (100%) rename cypress/{integration => e2e}/rendering/debug.spec.js (100%) rename cypress/{integration => e2e}/rendering/erDiagram.spec.js (100%) rename cypress/{integration => e2e}/rendering/flowchart-v2.spec.js (100%) rename cypress/{integration => e2e}/rendering/flowchart.spec.js (100%) rename cypress/{integration => e2e}/rendering/gantt.spec.js (100%) rename cypress/{integration => e2e}/rendering/gitGraph.spec.js (100%) rename cypress/{integration => e2e}/rendering/info.spec.js (100%) rename cypress/{integration => e2e}/rendering/journey.spec.js (100%) rename cypress/{integration => e2e}/rendering/pie.spec.js (100%) rename cypress/{integration => e2e}/rendering/requirement.spec.js (100%) rename cypress/{integration => e2e}/rendering/sequencediagram.spec.js (100%) rename cypress/{integration => e2e}/rendering/stateDiagram-v2.spec.js (100%) rename cypress/{integration => e2e}/rendering/stateDiagram.spec.js (100%) rename cypress/{integration => e2e}/rendering/theme.spec.js (100%) delete mode 100644 cypress/plugins/index.js diff --git a/cypress.config.js b/cypress.config.js new file mode 100644 index 0000000000..044c5d5234 --- /dev/null +++ b/cypress.config.js @@ -0,0 +1,20 @@ +const { defineConfig } = require('cypress'); +const { addMatchImageSnapshotPlugin } = require('cypress-image-snapshot/plugin'); +require('@applitools/eyes-cypress')(module); + +module.exports = defineConfig({ + e2e: { + specPattern: 'cypress/e2e/**/*.{js,jsx,ts,tsx}', + setupNodeEvents(on, config) { + addMatchImageSnapshotPlugin(on, config); + // copy any needed variables from process.env to config.env + config.env.useAppli = process.env.USE_APPLI ? true : false; + config.env.codeBranch = process.env.APPLI_BRANCH; + + // do not forget to return the changed config object! + return config; + }, + supportFile: 'cypress/support/index.js', + }, + video: false, +}); diff --git a/cypress.json b/cypress.json deleted file mode 100644 index 5e0725b209..0000000000 --- a/cypress.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "video": false -} \ No newline at end of file diff --git a/cypress/integration/other/configuration.spec.js b/cypress/e2e/other/configuration.spec.js similarity index 100% rename from cypress/integration/other/configuration.spec.js rename to cypress/e2e/other/configuration.spec.js diff --git a/cypress/integration/other/interaction.spec.js b/cypress/e2e/other/interaction.spec.js similarity index 100% rename from cypress/integration/other/interaction.spec.js rename to cypress/e2e/other/interaction.spec.js diff --git a/cypress/integration/other/rerender.spec.js b/cypress/e2e/other/rerender.spec.js similarity index 100% rename from cypress/integration/other/rerender.spec.js rename to cypress/e2e/other/rerender.spec.js diff --git a/cypress/integration/other/webpackUsage.spec.js b/cypress/e2e/other/webpackUsage.spec.js similarity index 100% rename from cypress/integration/other/webpackUsage.spec.js rename to cypress/e2e/other/webpackUsage.spec.js diff --git a/cypress/integration/other/xss.spec.js b/cypress/e2e/other/xss.spec.js similarity index 100% rename from cypress/integration/other/xss.spec.js rename to cypress/e2e/other/xss.spec.js diff --git a/cypress/integration/rendering/appli.spec.js b/cypress/e2e/rendering/appli.spec.js similarity index 100% rename from cypress/integration/rendering/appli.spec.js rename to cypress/e2e/rendering/appli.spec.js diff --git a/cypress/integration/rendering/classDiagram-v2.spec.js b/cypress/e2e/rendering/classDiagram-v2.spec.js similarity index 100% rename from cypress/integration/rendering/classDiagram-v2.spec.js rename to cypress/e2e/rendering/classDiagram-v2.spec.js diff --git a/cypress/integration/rendering/classDiagram.spec.js b/cypress/e2e/rendering/classDiagram.spec.js similarity index 96% rename from cypress/integration/rendering/classDiagram.spec.js rename to cypress/e2e/rendering/classDiagram.spec.js index 99fd6fb81d..8cf410d052 100644 --- a/cypress/integration/rendering/classDiagram.spec.js +++ b/cypress/e2e/rendering/classDiagram.spec.js @@ -1,410 +1,410 @@ -import { imgSnapshotTest, renderGraph } from '../../helpers/util'; - -describe('Class diagram', () => { - it('1: should render a simple class diagram', () => { - imgSnapshotTest( - ` - classDiagram - Class01 <|-- AveryLongClass : Cool - <<interface>> Class01 - Class03 *-- Class04 - Class05 o-- Class06 - Class07 .. Class08 - Class09 --> C2 : Where am i? - Class09 --* C3 - Class09 --|> Class07 - Class12 <|.. Class08 - Class11 ..>Class12 - Class07 : equals() - Class07 : Object[] elementData - Class01 : size() - Class01 : int chimp - Class01 : int gorilla - Class01 : -int privateChimp - Class01 : +int publicGorilla - Class01 : #int protectedMarmoset - Class08 <--> C2: Cool label - class Class10 { - <<service>> - int id - test() - } - `, - { logLevel: 1 } - ); - cy.get('svg'); - }); - - it('2: should render a simple class diagrams with cardinality', () => { - imgSnapshotTest( - ` - classDiagram - Class01 "1" <|--|> "*" AveryLongClass : Cool - <<interface>> Class01 - Class03 "1" *-- "*" Class04 - Class05 "1" o-- "many" Class06 - Class07 "1" .. "*" Class08 - Class09 "1" --> "*" C2 : Where am i? - Class09 "*" --* "*" C3 - Class09 "1" --|> "1" Class07 - Class07 : equals() - Class07 : Object[] elementData - Class01 : size() - Class01 : int chimp - Class01 : int gorilla - Class08 "1" <--> "*" C2: Cool label - class Class10 { - <<service>> - int id - test() - } - `, - {} - ); - cy.get('svg'); - }); - - it('3: should render a simple class diagram with different visibilities', () => { - imgSnapshotTest( - ` - classDiagram - Class01 <|-- AveryLongClass : Cool - <<interface>> Class01 - Class01 : -privateMethod() - Class01 : +publicMethod() - Class01 : #protectedMethod() - Class01 : -int privateChimp - Class01 : +int publicGorilla - Class01 : #int protectedMarmoset - `, - {} - ); - cy.get('svg'); - }); - - it('4: should render a simple class diagram with comments', () => { - imgSnapshotTest( - ` - classDiagram - %% this is a comment - Class01 <|-- AveryLongClass : Cool - <<interface>> Class01 - Class03 *-- Class04 - Class05 o-- Class06 - Class07 .. Class08 - Class09 --> C2 : Where am i? - Class09 --* C3 - Class09 --|> Class07 - Class07 : equals() - Class07 : Object[] elementData - Class01 : size() - Class01 : int chimp - Class01 : int gorilla - Class08 <--> C2: Cool label - class Class10 { - <<service>> - int id - test() - } - `, - {} - ); - cy.get('svg'); - }); - - it('5: should render a simple class diagram with abstract method', () => { - imgSnapshotTest( - ` - classDiagram - Class01 <|-- AveryLongClass : Cool - Class01 : someMethod()* - `, - {} - ); - cy.get('svg'); - }); - - it('6: should render a simple class diagram with static method', () => { - imgSnapshotTest( - ` - classDiagram - Class01 <|-- AveryLongClass : Cool - Class01 : someMethod()$ - `, - {} - ); - cy.get('svg'); - }); - - it('7: should render a simple class diagram with Generic class', () => { - imgSnapshotTest( - ` - classDiagram - class Class01~T~ - Class01 : size() - Class01 : int chimp - Class01 : int gorilla - Class08 <--> C2: Cool label - class Class10~T~ { - <<service>> - int id - test() - } - `, - {} - ); - cy.get('svg'); - }); - - it('8: should render a simple class diagram with Generic class and relations', () => { - imgSnapshotTest( - ` - classDiagram - Class01~T~ <|-- AveryLongClass : Cool - Class03~T~ *-- Class04~T~ - Class01 : size() - Class01 : int chimp - Class01 : int gorilla - Class08 <--> C2: Cool label - class Class10~T~ { - <<service>> - int id - test() - } - `, - {} - ); - cy.get('svg'); - }); - - it('9: should render a simple class diagram with clickable link', () => { - imgSnapshotTest( - ` - classDiagram - Class01~T~ <|-- AveryLongClass : Cool - Class03~T~ *-- Class04~T~ - Class01 : size() - Class01 : int chimp - Class01 : int gorilla - Class08 <--> C2: Cool label - class Class10~T~ { - <<service>> - int id - test() - } - link Class01 "google.com" "A Tooltip" - `, - {} - ); - cy.get('svg'); - }); - - it('10: should render a simple class diagram with clickable callback', () => { - imgSnapshotTest( - ` - classDiagram - Class01~T~ <|-- AveryLongClass : Cool - Class03~T~ *-- Class04~T~ - Class01 : size() - Class01 : int chimp - Class01 : int gorilla - Class08 <--> C2: Cool label - class Class10~T~ { - <<service>> - int id - test() - } - callback Class01 "functionCall" "A Tooltip" - `, - {} - ); - cy.get('svg'); - }); - - it('11: should render a simple class diagram with return type on method', () => { - imgSnapshotTest( - ` - classDiagram - class Class10~T~ { - int[] id - test(int[] ids) bool - testArray() bool[] - } - `, - {} - ); - cy.get('svg'); - }); - - it('12: should render a simple class diagram with generic types', () => { - imgSnapshotTest( - ` - classDiagram - class Class10~T~ { - int[] id - List~int~ ids - test(List~int~ ids) List~bool~ - testArray() bool[] - } - `, - {} - ); - cy.get('svg'); - }); - - it('13: should render a simple class diagram with css classes applied', () => { - imgSnapshotTest( - ` - classDiagram - class Class10 { - int[] id - List~int~ ids - test(List~int~ ids) List~bool~ - testArray() bool[] - } - - class Class10:::exClass2 - `, - {} - ); - cy.get('svg'); - }); - - it('14: should render a simple class diagram with css classes applied directly', () => { - imgSnapshotTest( - ` - classDiagram - class Class10:::exClass2 { - int[] id - List~int~ ids - test(List~int~ ids) List~bool~ - testArray() bool[] - } - `, - {} - ); - cy.get('svg'); - }); - - it('15: should render a simple class diagram with css classes applied two multiple classes', () => { - imgSnapshotTest( - ` - classDiagram - class Class10 - class Class20 - - cssClass "Class10, Class20" exClass2 - class Class20:::exClass2 - `, - {} - ); - cy.get('svg'); - }); - - it('16: should render multiple class diagrams', () => { - imgSnapshotTest( - [ - ` - classDiagram - Class01 "1" <|--|> "*" AveryLongClass : Cool - <<interface>> Class01 - Class03 "1" *-- "*" Class04 - Class05 "1" o-- "many" Class06 - Class07 "1" .. "*" Class08 - Class09 "1" --> "*" C2 : Where am i? - Class09 "*" --* "*" C3 - Class09 "1" --|> "1" Class07 - Class07 : equals() - Class07 : Object[] elementData - Class01 : size() - Class01 : int chimp - Class01 : int gorilla - Class08 "1" <--> "*" C2: Cool label - class Class10 { - <<service>> - int id - test() - } - `, - ` - classDiagram - Class01 "1" <|--|> "*" AveryLongClass : Cool - <<interface>> Class01 - Class03 "1" *-- "*" Class04 - Class05 "1" o-- "many" Class06 - Class07 "1" .. "*" Class08 - Class09 "1" --> "*" C2 : Where am i? - Class09 "*" --* "*" C3 - Class09 "1" --|> "1" Class07 - Class07 : equals() - Class07 : Object[] elementData - Class01 : size() - Class01 : int chimp - Class01 : int gorilla - Class08 "1" <--> "*" C2: Cool label - class Class10 { - <<service>> - int id - test() - } - `, - ], - {} - ); - cy.get('svg'); - }); - - // it('17: should render a class diagram when useMaxWidth is true (default)', () => { - // renderGraph( - // ` - // classDiagram - // Class01 <|-- AveryLongClass : Cool - // Class01 : size() - // Class01 : int chimp - // Class01 : int gorilla - // Class01 : -int privateChimp - // Class01 : +int publicGorilla - // Class01 : #int protectedMarmoset - // `, - // { class: { useMaxWidth: true } } - // ); - // cy.get('svg') - // .should((svg) => { - // expect(svg).to.have.attr('width', '100%'); - // const height = parseFloat(svg.attr('height')); - // expect(height).to.be.within(332, 333); - // // expect(svg).to.have.attr('height', '218'); - // const style = svg.attr('style'); - // expect(style).to.match(/^max-width: [\d.]+px;$/); - // const maxWidthValue = parseInt(style.match(/[\d.]+/g).join('')); - // // use within because the absolute value can be slightly different depending on the environment ±5% - // expect(maxWidthValue).to.be.within(203, 204); - // }); - // }); - - // it('18: should render a class diagram when useMaxWidth is false', () => { - // renderGraph( - // ` - // classDiagram - // Class01 <|-- AveryLongClass : Cool - // Class01 : size() - // Class01 : int chimp - // Class01 : int gorilla - // Class01 : -int privateChimp - // Class01 : +int publicGorilla - // Class01 : #int protectedMarmoset - // `, - // { class: { useMaxWidth: false } } - // ); - // cy.get('svg') - // .should((svg) => { - // const width = parseFloat(svg.attr('width')); - // // use within because the absolute value can be slightly different depending on the environment ±5% - // expect(width).to.be.within(100, 101); - // const height = parseFloat(svg.attr('height')); - // expect(height).to.be.within(332, 333); - // // expect(svg).to.have.attr('height', '332'); - // // expect(svg).to.not.have.attr('style'); - // }); - // }); -}); +import { imgSnapshotTest, renderGraph } from '../../helpers/util'; + +describe('Class diagram', () => { + it('1: should render a simple class diagram', () => { + imgSnapshotTest( + ` + classDiagram + Class01 <|-- AveryLongClass : Cool + <<interface>> Class01 + Class03 *-- Class04 + Class05 o-- Class06 + Class07 .. Class08 + Class09 --> C2 : Where am i? + Class09 --* C3 + Class09 --|> Class07 + Class12 <|.. Class08 + Class11 ..>Class12 + Class07 : equals() + Class07 : Object[] elementData + Class01 : size() + Class01 : int chimp + Class01 : int gorilla + Class01 : -int privateChimp + Class01 : +int publicGorilla + Class01 : #int protectedMarmoset + Class08 <--> C2: Cool label + class Class10 { + <<service>> + int id + test() + } + `, + { logLevel: 1 } + ); + cy.get('svg'); + }); + + it('2: should render a simple class diagrams with cardinality', () => { + imgSnapshotTest( + ` + classDiagram + Class01 "1" <|--|> "*" AveryLongClass : Cool + <<interface>> Class01 + Class03 "1" *-- "*" Class04 + Class05 "1" o-- "many" Class06 + Class07 "1" .. "*" Class08 + Class09 "1" --> "*" C2 : Where am i? + Class09 "*" --* "*" C3 + Class09 "1" --|> "1" Class07 + Class07 : equals() + Class07 : Object[] elementData + Class01 : size() + Class01 : int chimp + Class01 : int gorilla + Class08 "1" <--> "*" C2: Cool label + class Class10 { + <<service>> + int id + test() + } + `, + {} + ); + cy.get('svg'); + }); + + it('3: should render a simple class diagram with different visibilities', () => { + imgSnapshotTest( + ` + classDiagram + Class01 <|-- AveryLongClass : Cool + <<interface>> Class01 + Class01 : -privateMethod() + Class01 : +publicMethod() + Class01 : #protectedMethod() + Class01 : -int privateChimp + Class01 : +int publicGorilla + Class01 : #int protectedMarmoset + `, + {} + ); + cy.get('svg'); + }); + + it('4: should render a simple class diagram with comments', () => { + imgSnapshotTest( + ` + classDiagram + %% this is a comment + Class01 <|-- AveryLongClass : Cool + <<interface>> Class01 + Class03 *-- Class04 + Class05 o-- Class06 + Class07 .. Class08 + Class09 --> C2 : Where am i? + Class09 --* C3 + Class09 --|> Class07 + Class07 : equals() + Class07 : Object[] elementData + Class01 : size() + Class01 : int chimp + Class01 : int gorilla + Class08 <--> C2: Cool label + class Class10 { + <<service>> + int id + test() + } + `, + {} + ); + cy.get('svg'); + }); + + it('5: should render a simple class diagram with abstract method', () => { + imgSnapshotTest( + ` + classDiagram + Class01 <|-- AveryLongClass : Cool + Class01 : someMethod()* + `, + {} + ); + cy.get('svg'); + }); + + it('6: should render a simple class diagram with static method', () => { + imgSnapshotTest( + ` + classDiagram + Class01 <|-- AveryLongClass : Cool + Class01 : someMethod()$ + `, + {} + ); + cy.get('svg'); + }); + + it('7: should render a simple class diagram with Generic class', () => { + imgSnapshotTest( + ` + classDiagram + class Class01~T~ + Class01 : size() + Class01 : int chimp + Class01 : int gorilla + Class08 <--> C2: Cool label + class Class10~T~ { + <<service>> + int id + test() + } + `, + {} + ); + cy.get('svg'); + }); + + it('8: should render a simple class diagram with Generic class and relations', () => { + imgSnapshotTest( + ` + classDiagram + Class01~T~ <|-- AveryLongClass : Cool + Class03~T~ *-- Class04~T~ + Class01 : size() + Class01 : int chimp + Class01 : int gorilla + Class08 <--> C2: Cool label + class Class10~T~ { + <<service>> + int id + test() + } + `, + {} + ); + cy.get('svg'); + }); + + it('9: should render a simple class diagram with clickable link', () => { + imgSnapshotTest( + ` + classDiagram + Class01~T~ <|-- AveryLongClass : Cool + Class03~T~ *-- Class04~T~ + Class01 : size() + Class01 : int chimp + Class01 : int gorilla + Class08 <--> C2: Cool label + class Class10~T~ { + <<service>> + int id + test() + } + link Class01 "google.com" "A Tooltip" + `, + {} + ); + cy.get('svg'); + }); + + it('10: should render a simple class diagram with clickable callback', () => { + imgSnapshotTest( + ` + classDiagram + Class01~T~ <|-- AveryLongClass : Cool + Class03~T~ *-- Class04~T~ + Class01 : size() + Class01 : int chimp + Class01 : int gorilla + Class08 <--> C2: Cool label + class Class10~T~ { + <<service>> + int id + test() + } + callback Class01 "functionCall" "A Tooltip" + `, + {} + ); + cy.get('svg'); + }); + + it('11: should render a simple class diagram with return type on method', () => { + imgSnapshotTest( + ` + classDiagram + class Class10~T~ { + int[] id + test(int[] ids) bool + testArray() bool[] + } + `, + {} + ); + cy.get('svg'); + }); + + it('12: should render a simple class diagram with generic types', () => { + imgSnapshotTest( + ` + classDiagram + class Class10~T~ { + int[] id + List~int~ ids + test(List~int~ ids) List~bool~ + testArray() bool[] + } + `, + {} + ); + cy.get('svg'); + }); + + it('13: should render a simple class diagram with css classes applied', () => { + imgSnapshotTest( + ` + classDiagram + class Class10 { + int[] id + List~int~ ids + test(List~int~ ids) List~bool~ + testArray() bool[] + } + + class Class10:::exClass2 + `, + {} + ); + cy.get('svg'); + }); + + it('14: should render a simple class diagram with css classes applied directly', () => { + imgSnapshotTest( + ` + classDiagram + class Class10:::exClass2 { + int[] id + List~int~ ids + test(List~int~ ids) List~bool~ + testArray() bool[] + } + `, + {} + ); + cy.get('svg'); + }); + + it('15: should render a simple class diagram with css classes applied two multiple classes', () => { + imgSnapshotTest( + ` + classDiagram + class Class10 + class Class20 + + cssClass "Class10, Class20" exClass2 + class Class20:::exClass2 + `, + {} + ); + cy.get('svg'); + }); + + it('16: should render multiple class diagrams', () => { + imgSnapshotTest( + [ + ` + classDiagram + Class01 "1" <|--|> "*" AveryLongClass : Cool + <<interface>> Class01 + Class03 "1" *-- "*" Class04 + Class05 "1" o-- "many" Class06 + Class07 "1" .. "*" Class08 + Class09 "1" --> "*" C2 : Where am i? + Class09 "*" --* "*" C3 + Class09 "1" --|> "1" Class07 + Class07 : equals() + Class07 : Object[] elementData + Class01 : size() + Class01 : int chimp + Class01 : int gorilla + Class08 "1" <--> "*" C2: Cool label + class Class10 { + <<service>> + int id + test() + } + `, + ` + classDiagram + Class01 "1" <|--|> "*" AveryLongClass : Cool + <<interface>> Class01 + Class03 "1" *-- "*" Class04 + Class05 "1" o-- "many" Class06 + Class07 "1" .. "*" Class08 + Class09 "1" --> "*" C2 : Where am i? + Class09 "*" --* "*" C3 + Class09 "1" --|> "1" Class07 + Class07 : equals() + Class07 : Object[] elementData + Class01 : size() + Class01 : int chimp + Class01 : int gorilla + Class08 "1" <--> "*" C2: Cool label + class Class10 { + <<service>> + int id + test() + } + `, + ], + {} + ); + cy.get('svg'); + }); + + // it('17: should render a class diagram when useMaxWidth is true (default)', () => { + // renderGraph( + // ` + // classDiagram + // Class01 <|-- AveryLongClass : Cool + // Class01 : size() + // Class01 : int chimp + // Class01 : int gorilla + // Class01 : -int privateChimp + // Class01 : +int publicGorilla + // Class01 : #int protectedMarmoset + // `, + // { class: { useMaxWidth: true } } + // ); + // cy.get('svg') + // .should((svg) => { + // expect(svg).to.have.attr('width', '100%'); + // const height = parseFloat(svg.attr('height')); + // expect(height).to.be.within(332, 333); + // // expect(svg).to.have.attr('height', '218'); + // const style = svg.attr('style'); + // expect(style).to.match(/^max-width: [\d.]+px;$/); + // const maxWidthValue = parseInt(style.match(/[\d.]+/g).join('')); + // // use within because the absolute value can be slightly different depending on the environment ±5% + // expect(maxWidthValue).to.be.within(203, 204); + // }); + // }); + + // it('18: should render a class diagram when useMaxWidth is false', () => { + // renderGraph( + // ` + // classDiagram + // Class01 <|-- AveryLongClass : Cool + // Class01 : size() + // Class01 : int chimp + // Class01 : int gorilla + // Class01 : -int privateChimp + // Class01 : +int publicGorilla + // Class01 : #int protectedMarmoset + // `, + // { class: { useMaxWidth: false } } + // ); + // cy.get('svg') + // .should((svg) => { + // const width = parseFloat(svg.attr('width')); + // // use within because the absolute value can be slightly different depending on the environment ±5% + // expect(width).to.be.within(100, 101); + // const height = parseFloat(svg.attr('height')); + // expect(height).to.be.within(332, 333); + // // expect(svg).to.have.attr('height', '332'); + // // expect(svg).to.not.have.attr('style'); + // }); + // }); +}); diff --git a/cypress/integration/rendering/conf-and-directives.spec.js b/cypress/e2e/rendering/conf-and-directives.spec.js similarity index 100% rename from cypress/integration/rendering/conf-and-directives.spec.js rename to cypress/e2e/rendering/conf-and-directives.spec.js diff --git a/cypress/integration/rendering/current.spec.js b/cypress/e2e/rendering/current.spec.js similarity index 100% rename from cypress/integration/rendering/current.spec.js rename to cypress/e2e/rendering/current.spec.js diff --git a/cypress/integration/rendering/debug.spec.js b/cypress/e2e/rendering/debug.spec.js similarity index 100% rename from cypress/integration/rendering/debug.spec.js rename to cypress/e2e/rendering/debug.spec.js diff --git a/cypress/integration/rendering/erDiagram.spec.js b/cypress/e2e/rendering/erDiagram.spec.js similarity index 100% rename from cypress/integration/rendering/erDiagram.spec.js rename to cypress/e2e/rendering/erDiagram.spec.js diff --git a/cypress/integration/rendering/flowchart-v2.spec.js b/cypress/e2e/rendering/flowchart-v2.spec.js similarity index 100% rename from cypress/integration/rendering/flowchart-v2.spec.js rename to cypress/e2e/rendering/flowchart-v2.spec.js diff --git a/cypress/integration/rendering/flowchart.spec.js b/cypress/e2e/rendering/flowchart.spec.js similarity index 100% rename from cypress/integration/rendering/flowchart.spec.js rename to cypress/e2e/rendering/flowchart.spec.js diff --git a/cypress/integration/rendering/gantt.spec.js b/cypress/e2e/rendering/gantt.spec.js similarity index 100% rename from cypress/integration/rendering/gantt.spec.js rename to cypress/e2e/rendering/gantt.spec.js diff --git a/cypress/integration/rendering/gitGraph.spec.js b/cypress/e2e/rendering/gitGraph.spec.js similarity index 100% rename from cypress/integration/rendering/gitGraph.spec.js rename to cypress/e2e/rendering/gitGraph.spec.js diff --git a/cypress/integration/rendering/info.spec.js b/cypress/e2e/rendering/info.spec.js similarity index 100% rename from cypress/integration/rendering/info.spec.js rename to cypress/e2e/rendering/info.spec.js diff --git a/cypress/integration/rendering/journey.spec.js b/cypress/e2e/rendering/journey.spec.js similarity index 100% rename from cypress/integration/rendering/journey.spec.js rename to cypress/e2e/rendering/journey.spec.js diff --git a/cypress/integration/rendering/pie.spec.js b/cypress/e2e/rendering/pie.spec.js similarity index 100% rename from cypress/integration/rendering/pie.spec.js rename to cypress/e2e/rendering/pie.spec.js diff --git a/cypress/integration/rendering/requirement.spec.js b/cypress/e2e/rendering/requirement.spec.js similarity index 100% rename from cypress/integration/rendering/requirement.spec.js rename to cypress/e2e/rendering/requirement.spec.js diff --git a/cypress/integration/rendering/sequencediagram.spec.js b/cypress/e2e/rendering/sequencediagram.spec.js similarity index 100% rename from cypress/integration/rendering/sequencediagram.spec.js rename to cypress/e2e/rendering/sequencediagram.spec.js diff --git a/cypress/integration/rendering/stateDiagram-v2.spec.js b/cypress/e2e/rendering/stateDiagram-v2.spec.js similarity index 100% rename from cypress/integration/rendering/stateDiagram-v2.spec.js rename to cypress/e2e/rendering/stateDiagram-v2.spec.js diff --git a/cypress/integration/rendering/stateDiagram.spec.js b/cypress/e2e/rendering/stateDiagram.spec.js similarity index 100% rename from cypress/integration/rendering/stateDiagram.spec.js rename to cypress/e2e/rendering/stateDiagram.spec.js diff --git a/cypress/integration/rendering/theme.spec.js b/cypress/e2e/rendering/theme.spec.js similarity index 100% rename from cypress/integration/rendering/theme.spec.js rename to cypress/e2e/rendering/theme.spec.js diff --git a/cypress/plugins/index.js b/cypress/plugins/index.js deleted file mode 100644 index 2c98a54ade..0000000000 --- a/cypress/plugins/index.js +++ /dev/null @@ -1,32 +0,0 @@ -// *********************************************************** -// This example plugins/index.js can be used to load plugins -// -// You can change the location of this file or turn off loading -// the plugins file with the 'pluginsFile' configuration option. -// -// You can read more here: -// https://on.cypress.io/plugins-guide -// *********************************************************** - -// This function is called when a project is opened or re-opened (e.g. due to -// the project's config changing) - -// module.exports = (on, config) => { -// // `on` is used to hook into various events Cypress emits -// // `config` is the resolved Cypress config -// } - -const { addMatchImageSnapshotPlugin } = require('cypress-image-snapshot/plugin'); -require('@applitools/eyes-cypress')(module); - -module.exports = (on, config) => { - addMatchImageSnapshotPlugin(on, config); - // copy any needed variables from process.env to config.env - config.env.useAppli = process.env.USE_APPLI ? true : false; - config.env.codeBranch = process.env.APPLI_BRANCH; - - // do not forget to return the changed config object! - return config; -}; - -require('@applitools/eyes-cypress')(module); From 5ea93fb3d24d8b36a09fb6c8b344f71e9eac1dad Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Mon, 20 Jun 2022 11:00:45 +0530 Subject: [PATCH 3/4] Ignore .cache path in jest --- jest.config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/jest.config.js b/jest.config.js index 69abee24ce..9930a513e5 100644 --- a/jest.config.js +++ b/jest.config.js @@ -10,6 +10,7 @@ module.exports = { ], }, transformIgnorePatterns: ['/node_modules/(?!dagre-d3-renderer/lib|khroma).*\\.js'], + testPathIgnorePatterns: ['/node_modules/', '.cache'], moduleNameMapper: { '\\.(css|scss)$': 'identity-obj-proxy', }, From 4c671af7233fc53d798fbbe0baf27838f3a14f93 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Mon, 20 Jun 2022 11:03:42 +0530 Subject: [PATCH 4/4] fix testomatio --- .github/workflows/checks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index dbce0a4417..e4d82e2d19 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -19,6 +19,6 @@ jobs: - uses: testomatio/check-tests@stable with: framework: cypress - tests: "./cypress/integration/**/**.spec.js" + tests: "./cypress/e2e/**/**.spec.js" token: ${{ secrets.GITHUB_TOKEN }} has-tests-label: true