mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-15 06:19:24 +02:00
test(e2e): wait for theme-directives.html
The `theme-directives.html` test currently sometimes takes a screenshot before all of the Mermaid diagrams have completed rendering. We can use the `urlSnapshopTest()` helper function, which waits until a `.rendered` property exists on the page. Co-authored-by: Sidharth Vinod <sidharthv96@gmail.com>
This commit is contained in:
@@ -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', () => {
|
describe('Configuration and directives - nodes should be light blue', () => {
|
||||||
it('No config - use default', () => {
|
it('No config - use default', () => {
|
||||||
@@ -206,8 +206,7 @@ graph TD
|
|||||||
describe('when rendering several diagrams', () => {
|
describe('when rendering several diagrams', () => {
|
||||||
it('diagrams should not taint later diagrams', () => {
|
it('diagrams should not taint later diagrams', () => {
|
||||||
const url = 'http://localhost:9000/theme-directives.html';
|
const url = 'http://localhost:9000/theme-directives.html';
|
||||||
cy.visit(url);
|
urlSnapshotTest(url, {});
|
||||||
cy.matchImageSnapshot('conf-and-directives.spec-when-rendering-several-diagrams-diagram-1');
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -121,7 +121,14 @@
|
|||||||
fontFamily: '"arial", sans-serif',
|
fontFamily: '"arial", sans-serif',
|
||||||
curve: 'cardinal',
|
curve: 'cardinal',
|
||||||
securityLevel: 'strict',
|
securityLevel: 'strict',
|
||||||
|
startOnLoad: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await mermaid.run();
|
||||||
|
|
||||||
|
if (window.Cypress) {
|
||||||
|
window.rendered = true;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Reference in New Issue
Block a user