Merge from develop

This commit is contained in:
Ashish Jain
2024-09-03 11:15:24 +02:00
55 changed files with 809 additions and 4155 deletions

View File

@@ -73,7 +73,7 @@ export const imgSnapshotTest = (
export const urlSnapshotTest = (
url: string,
options: CypressMermaidConfig,
options: CypressMermaidConfig = {},
_api = false,
validation?: any
): void => {

View File

@@ -1,9 +1,9 @@
import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
import { imgSnapshotTest, urlSnapshotTest } from '../../helpers/util.ts';
describe('architecture diagram', () => {
describe.skip('architecture diagram', () => {
it('should render a simple architecture diagram with groups', () => {
imgSnapshotTest(
`architecture
`architecture-beta
group api(cloud)[API]
service db(database)[Database] in api
@@ -21,7 +21,7 @@ describe('architecture diagram', () => {
});
it('should render an architecture diagram with groups within groups', () => {
imgSnapshotTest(
`architecture
`architecture-beta
group api[API]
group public[Public API] in api
group private[Private API] in api
@@ -41,14 +41,14 @@ describe('architecture diagram', () => {
});
it('should render an architecture diagram with the fallback icon', () => {
imgSnapshotTest(
`architecture
`architecture-beta
service unknown(iconnamedoesntexist)[Unknown Icon]
`
);
});
it('should render an architecture diagram with split directioning', () => {
imgSnapshotTest(
`architecture
`architecture-beta
service db(database)[Database]
service s3(disk)[Storage]
service serv1(server)[Server 1]
@@ -64,7 +64,7 @@ describe('architecture diagram', () => {
});
it('should render an architecture diagram with directional arrows', () => {
imgSnapshotTest(
`architecture
`architecture-beta
service servC(server)[Server 1]
service servL(server)[Server 2]
service servR(server)[Server 3]
@@ -85,7 +85,7 @@ describe('architecture diagram', () => {
});
it('should render an architecture diagram with group edges', () => {
imgSnapshotTest(
`architecture
`architecture-beta
group left_group(cloud)[Left]
group right_group(cloud)[Right]
group top_group(cloud)[Top]
@@ -107,7 +107,7 @@ describe('architecture diagram', () => {
});
it('should render an architecture diagram with edge labels', () => {
imgSnapshotTest(
`architecture
`architecture-beta
service servC(server)[Server 1]
service servL(server)[Server 2]
service servR(server)[Server 3]
@@ -128,7 +128,7 @@ describe('architecture diagram', () => {
});
it('should render an architecture diagram with simple junction edges', () => {
imgSnapshotTest(
`architecture
`architecture-beta
service left_disk(disk)[Disk]
service top_disk(disk)[Disk]
service bottom_disk(disk)[Disk]
@@ -148,7 +148,7 @@ describe('architecture diagram', () => {
});
it('should render an architecture diagram with complex junction edges', () => {
imgSnapshotTest(
`architecture
`architecture-beta
group left
group right
service left_disk(disk)[Disk] in left
@@ -172,3 +172,9 @@ describe('architecture diagram', () => {
);
});
});
describe('architecture - external', () => {
it('should allow adding external icons', () => {
urlSnapshotTest('http://localhost:9000/architecture-external.html');
});
});

View File

@@ -0,0 +1,52 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Architecture Mermaid Test Page</title>
<link rel="icon" type="image/png" href="data:image/png;base64,iVBORw0KGgo=" />
<style>
div.mermaid {
/* font-family: 'trebuchet ms', verdana, arial; */
font-family: 'Courier New', Courier, monospace !important;
}
</style>
</head>
<body>
<h2>External Icons Demo</h2>
<pre class="mermaid">
architecture-beta
service s3(logos:aws-s3)[Cloud Store]
service ec2(logos:aws-ec2)[Server]
service api(logos:aws-api-gateway)[Api Gateway]
service fa(fa:image)[Font Awesome Icon]
</pre>
<script type="module">
import mermaid from './mermaid.esm.mjs';
mermaid.initialize({
startOnLoad: false,
logLevel: 0,
});
mermaid.registerIconPacks([
{
name: 'logos',
loader: () =>
fetch('https://unpkg.com/@iconify-json/logos/icons.json').then((res) => res.json()),
},
{
name: 'fa',
loader: () =>
fetch('https://unpkg.com/@iconify-json/fa6-regular/icons.json').then((res) =>
res.json()
),
},
]);
await mermaid.run();
if (window.Cypress) {
window.rendered = true;
}
</script>
</body>
</html>