Compare commits

...

29 Commits

Author SHA1 Message Date
sidharthv96
8acc6c1c53 Update snapshots 2022-12-15 19:14:06 +00:00
sidharthv96
be1656b136 Update snapshots 2022-12-15 19:13:57 +00:00
sidharthv96
33c5ba02e6 Update snapshots 2022-12-15 19:13:47 +00:00
sidharthv96
1015516416 Update snapshots 2022-12-15 19:12:47 +00:00
sidharthv96
d475696534 Update snapshots 2022-12-15 19:09:19 +00:00
sidharthv96
f1634216c4 Update snapshots 2022-12-15 19:09:16 +00:00
Sidharth Vinod
2777ed24f2 Merge branch 'develop' into sidv/e2eCI
* develop: (44 commits)
  Update docs
  Add `workflow_dispatch` to lint.yml
  chore: update docs folder
  lint
  fix typescript error
  fix(docs): build the docs
  fix(docs): remove duplicate section
  chore(deps): update all non-major dependencies
  Update docs/misc/integrations.md
  Add links to github atom add-ons
  remove links from atom.io; add note Atom has been archived
  set svg role to 'graphics-document document'
  common function for a11y; add to renderAsync; + renderAsync spec
  feat: add links to theme listing
  fix cspell
  fix cspell
  fix lint
  refactor theming doc
  remove typeof
  use camelCase
  ...
2022-12-16 00:34:36 +05:30
Sidharth Vinod
579536a151 Pull before commit 2022-12-16 00:32:41 +05:30
sidharthv96
2c4443ec71 Update snapshots 2022-12-08 10:12:47 +00:00
Sidharth Vinod
638607da00 reduce failure threshold 2022-12-08 15:36:07 +05:30
sidharthv96
f3e1479c77 Update snapshots 2022-12-08 09:29:38 +00:00
Sidharth Vinod
bc5b9d3937 fix: CI write permissions 2022-12-08 14:54:03 +05:30
Sidharth Vinod
976585401c Upload ci snapshots 2022-12-08 14:22:48 +05:30
Sidharth Vinod
6694bca803 Add ssim:fast 2022-12-08 14:18:24 +05:30
Sidharth Vinod
2a7dc427ae Use ci snapshots 2022-12-08 14:13:25 +05:30
Sidharth Vinod
a3d8f1f8e4 Remove ssim:fast 2022-12-08 14:05:37 +05:30
Sidharth Vinod
688d671d2e Add pingfang font 2022-12-08 14:04:06 +05:30
Sidharth Vinod
b14b23a6af Use ssim fast algorithm 2022-12-08 13:07:23 +05:30
Sidharth Vinod
aa949b4ff6 Increase blur 2022-12-08 12:54:45 +05:30
Sidharth Vinod
e792bf5239 Add blur 2022-12-08 12:54:28 +05:30
Sidharth Vinod
a0d3b8c1fe Increase threshold 2022-12-07 17:22:57 +05:30
Sidharth Vinod
a86f831b3e Remove courier font 2022-12-07 16:24:09 +05:30
Sidharth Vinod
1c794ce619 Add courier font 2022-12-07 15:50:07 +05:30
Sidharth Vinod
86cab46cf0 Try SSIM 2022-12-07 15:07:08 +05:30
Sidharth Vinod
e6e02a9b70 Fix viewport size 2022-12-07 15:03:42 +05:30
Sidharth Vinod
f3a209badc Remove hardcoded width in tests 2022-12-07 14:01:52 +05:30
Sidharth Vinod
69e84b6731 Fix viewport size 2022-12-07 14:01:35 +05:30
Sidharth Vinod
58dca0afe3 add snapshots to repo 2022-12-07 13:26:33 +05:30
Sidharth Vinod
af1a7bea1f add snapshots to repo 2022-12-07 13:26:08 +05:30
357 changed files with 68 additions and 56 deletions

View File

@@ -3,7 +3,7 @@ name: E2E
on: [push, pull_request]
permissions:
contents: read
contents: write
jobs:
build:
@@ -28,15 +28,28 @@ jobs:
cache: pnpm
node-version: ${{ matrix.node-version }}
# Experiment with this step if we cannot check-in the snapshots to the repo.
# - name: Cache snapshots
# id: cache-snapshot
# uses: actions/cache@v3
# with:
# # npm cache files are stored in `~/.npm` on Linux/macOS
# path: ./cypress/snapshots
# key: ${{ runner.os }}-build-${env.GITHUB_REF}
# restore-keys: |
# ${{ runner.os }}-build-develop
# Install NPM dependencies, cache them correctly
# and run all Cypress tests
- name: Cypress run
id: cypress
uses: cypress-io/github-action@v4
# If CYPRESS_RECORD_KEY is set, run in parallel on all containers
# Otherwise (e.g. if running from fork), we run on a single container only
if: ${{ ( env.CYPRESS_RECORD_KEY != '' ) || ( matrix.containers == 1 ) }}
with:
start: pnpm run dev
browser: chrome
wait-on: 'http://localhost:9000'
# Disable recording if we don't have an API key
# e.g. if this action was run from a fork
@@ -44,3 +57,18 @@ jobs:
parallel: ${{ secrets.CYPRESS_RECORD_KEY != '' }}
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
- name: Upload Artifacts
uses: actions/upload-artifact@v3
if: ${{ failure() && steps.cypress.conclusion == 'failure' }}
with:
name: error-snapshots
path: cypress/snapshots/**/__diff_output__/*
- name: Commit changes
uses: EndBug/add-and-commit@v9
if: ${{ github.event_name == 'push' }}
with:
message: 'Update snapshots'
add: 'cypress/snapshots/*'
pull: '--rebase --autostash'

2
.gitignore vendored
View File

@@ -26,7 +26,7 @@ Gemfile.lock
/.vs
cypress/screenshots/
cypress/snapshots/
cypress/snapshots-dev/
# eslint --cache file
.eslintcache

View File

@@ -52,6 +52,7 @@
"laganeckas",
"lintstagedrc",
"lucida",
"mansalva",
"matthieu",
"mdbook",
"mermerd",
@@ -76,6 +77,7 @@
"shiki",
"sidharth",
"sphinxcontrib",
"ssim",
"statediagram",
"stylis",
"substate",

View File

@@ -5,9 +5,17 @@ const { addMatchImageSnapshotPlugin } = require('cypress-image-snapshot/plugin')
module.exports = defineConfig({
projectId: 'n2sma2',
viewportWidth: 1440,
viewportHeight: 1024,
e2e: {
specPattern: 'cypress/integration/**/*.{js,jsx,ts,tsx}',
setupNodeEvents(on, config) {
on('before:browser:launch', (browser = {}, launchOptions) => {
if (browser.name === 'chrome' && browser.isHeadless) {
launchOptions.args.push('--window-size=1440,1024', '--force-device-scale-factor=1');
}
return launchOptions;
});
addMatchImageSnapshotPlugin(on, config);
// copy any needed variables from process.env to config.env
config.env.useAppli = process.env.USE_APPLI ? true : false;

View File

@@ -136,6 +136,5 @@ export const urlSnapshotTest = (url, _options, api = false, validation) => {
export const renderGraph = (graphStr, options, api) => {
const url = mermaidUrl(graphStr, options, api);
cy.visit(url);
};

View File

@@ -117,7 +117,6 @@ describe('Configuration', () => {
});
it('should not taint the initial configuration when using multiple directives', () => {
const url = 'http://localhost:9000/regression/issue-1874.html';
cy.viewport(1440, 1024);
cy.visit(url);
cy.get('svg');

View File

@@ -1,14 +1,12 @@
describe('Rerendering', () => {
it('should be able to render after an error has occurred', () => {
const url = 'http://localhost:9000/render-after-error.html';
cy.viewport(1440, 1024);
cy.visit(url);
cy.get('#graphDiv').should('exist');
});
it('should be able to render and rerender a graph via API', () => {
const url = 'http://localhost:9000/rerender.html';
cy.viewport(1440, 1024);
cy.visit(url);
cy.get('#graph [id^=flowchart-A]').should('have.text', 'XMas');

View File

@@ -225,7 +225,10 @@ describe('Gantt diagram', () => {
const style = svg.attr('style');
expect(style).to.match(/^max-width: [\d.]+px;$/);
const maxWidthValue = parseFloat(style.match(/[\d.]+/g).join(''));
expect(maxWidthValue).to.be.within(984 * 0.95, 984 * 1.05);
expect(maxWidthValue).to.be.within(
Cypress.config().viewportWidth * 0.95,
Cypress.config().viewportWidth * 1.05
);
});
});
@@ -269,7 +272,10 @@ describe('Gantt diagram', () => {
const width = parseFloat(svg.attr('width'));
// use within because the absolute value can be slightly different depending on the environment ±5%
// expect(height).to.be.within(484 * 0.95, 484 * 1.05);
expect(width).to.be.within(984 * 0.95, 984 * 1.05);
expect(width).to.be.within(
Cypress.config().viewportWidth * 0.95,
Cypress.config().viewportWidth * 1.05
);
expect(svg).to.not.have.attr('style');
});
});

View File

@@ -54,7 +54,10 @@ describe('Pie Chart', () => {
const style = svg.attr('style');
expect(style).to.match(/^max-width: [\d.]+px;$/);
const maxWidthValue = parseFloat(style.match(/[\d.]+/g).join(''));
expect(maxWidthValue).to.eq(984);
expect(maxWidthValue).to.be.within(
Cypress.config().viewportWidth * 0.95,
Cypress.config().viewportWidth * 1.05
);
});
});
it('should render a pie diagram when useMaxWidth is false', () => {
@@ -68,10 +71,11 @@ describe('Pie Chart', () => {
{ pie: { useMaxWidth: false } }
);
cy.get('svg').should((svg) => {
// const height = parseFloat(svg.attr('height'));
const width = parseFloat(svg.attr('width'));
// expect(height).to.eq(450);
expect(width).to.eq(984);
expect(width).to.be.within(
Cypress.config().viewportWidth * 0.95,
Cypress.config().viewportWidth * 1.05
);
expect(svg).to.not.have.attr('style');
});
});

View File

@@ -1,32 +1,8 @@
<html>
<head>
<meta charset="utf-8" />
<!-- <meta charset="iso-8859-15"/> -->
<script src="./viewer.js" type="module"></script>
<!-- <link href="https://fonts.googleapis.com/css?family=Mansalva&display=swap" rel="stylesheet" /> -->
<link
href="https://fonts.googleapis.com/css?family=Noto+Sans+SC&display=swap"
rel="stylesheet"
/>
<style>
body {
/* font-family: 'Mansalva', cursive;*/
/* font-family: 'Mansalva', cursive; */
/* font-family: 'arial'; */
/* font-family: "trebuchet ms", verdana, arial; */
}
/* div {
font-family: 'arial';
} */
/* .mermaid-main-font {
font-family: "trebuchet ms", verdana, arial;
font-family: var(--mermaid-font-family);
} */
/* :root {
--mermaid-font-family: '"trebuchet ms", verdana, arial';
--mermaid-font-family: "Comic Sans MS", "Comic Sans", cursive;
--mermaid-font-family: '"Lucida Console", Monaco, monospace';
} */
svg {
border: 2px solid darkred;
}
@@ -36,21 +12,5 @@
}
</style>
</head>
<body>
<!-- <script src="./mermaid.js"></script> -->
<script>
// Notice startOnLoad=false
// This prevents default handling in mermaid from render before the e2e logic is applied
// mermaid.initialize({
// startOnLoad: false,
// useMaxWidth: true,
// // "themeCSS": ":root { --mermaid-font-family: \"trebuchet ms\", verdana, arial;}",
// // fontFamily: '\"trebuchet ms\", verdana, arial;'
// // fontFamily: '"Comic Sans MS", "Comic Sans", cursive'
// // fontFamily: '"Mansalva", cursive',
// // fontFamily: '"Noto Sans SC", sans-serif'
// fontFamily: '"Noto Sans SC", sans-serif'
// });
</script>
</body>
<body></body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Some files were not shown because too many files have changed in this diff Show More