Skip to content

Commit

Permalink
Merge pull request #4846 from aloisklink/test/fix-theme-directives-e2…
Browse files Browse the repository at this point in the history
…e-test

Wait for `theme-directives.html` E2E test to render before taking a screenshot
  • Loading branch information
sidharthv96 authored Sep 19, 2023
2 parents d6f1c11 + 17f5052 commit e8347ce
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 24 deletions.
5 changes: 2 additions & 3 deletions cypress/integration/rendering/conf-and-directives.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { imgSnapshotTest } from '../../helpers/util.ts';
import { imgSnapshotTest, urlSnapshotTest } from '../../helpers/util.ts';

describe('Configuration and directives - nodes should be light blue', () => {
it('No config - use default', () => {
Expand Down Expand Up @@ -206,8 +206,7 @@ graph TD
describe('when rendering several diagrams', () => {
it('diagrams should not taint later diagrams', () => {
const url = 'http://localhost:9000/theme-directives.html';
cy.visit(url);
cy.matchImageSnapshot('conf-and-directives.spec-when-rendering-several-diagrams-diagram-1');
urlSnapshotTest(url, {});
});
});
});
28 changes: 7 additions & 21 deletions cypress/platform/theme-directives.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
<html>
<head>
<link href="https://fonts.googleapis.com/css?family=Montserrat&display=swap" rel="stylesheet" />
<link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet" />
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"
/>
<link
href="https://fonts.googleapis.com/css?family=Noto+Sans+SC&display=swap"
rel="stylesheet"
/>
<style>
body {
/* background: rgb(221, 208, 208); */
Expand Down Expand Up @@ -122,26 +113,21 @@ <h1>Nothing set, should be Default</h1>

<script type="module">
import mermaid from './mermaid.esm.mjs';
mermaid.parseError = function (err, hash) {
// console.error('Mermaid error: ', err);
};

mermaid.initialize({
// theme: 'dark',
// theme: 'dark',
// arrowMarkerAbsolute: true,
// themeCSS: '.edgePath .path {stroke: red;} .arrowheadPath {fill: red;}',
logLevel: 0,
// flowchart: { useMaxWidth: true },
graph: { curve: 'cardinal', htmlLabels: false },
// gantt: { axisFormat: '%m/%d/%Y' },
sequence: { actorMargin: 50, showSequenceNumbers: true },
// sequenceDiagram: { actorMargin: 300 } // deprecated
fontFamily: '"arial", sans-serif',
curve: 'cardinal',
securityLevel: 'strict',
startOnLoad: false,
});
function callback() {
alert('It worked');

await mermaid.run();

if (window.Cypress) {
window.rendered = true;
}
</script>
</body>
Expand Down

0 comments on commit e8347ce

Please sign in to comment.