mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-28 07:03:17 +08:00
fix: Race condition when running suppressError test.
Co-authored-by: Alois Klink <alois@aloisklink.com>
This commit is contained in:
parent
bd1e7a7c13
commit
56d339b8f0
@ -132,7 +132,17 @@ describe('Configuration', () => {
|
||||
const url = 'http://localhost:9000/suppressError.html?suppressErrorRendering=true';
|
||||
cy.viewport(1440, 1024);
|
||||
cy.visit(url);
|
||||
cy.get('#test');
|
||||
cy.window().should('have.property', 'rendered', true);
|
||||
cy.get('#test')
|
||||
.find('svg')
|
||||
.should(($svg) => {
|
||||
expect($svg).to.have.length(2); // all failing diagrams should not appear!
|
||||
$svg.each((_index, svg) => {
|
||||
expect(cy.$$(svg)).to.be.visible();
|
||||
// none of the diagrams should be error diagrams
|
||||
expect($svg).to.not.contain('Syntax error');
|
||||
});
|
||||
});
|
||||
cy.matchImageSnapshot(
|
||||
'configuration.spec-should-not-render-error-diagram-if-suppressErrorRendering-is-set'
|
||||
);
|
||||
@ -142,6 +152,7 @@ describe('Configuration', () => {
|
||||
const url = 'http://localhost:9000/suppressError.html';
|
||||
cy.viewport(1440, 1024);
|
||||
cy.visit(url);
|
||||
cy.window().should('have.property', 'rendered', true);
|
||||
cy.get('#test');
|
||||
cy.matchImageSnapshot(
|
||||
'configuration.spec-should-render-error-diagram-if-suppressErrorRendering-is-not-set'
|
||||
|
@ -46,7 +46,11 @@
|
||||
import mermaid from './mermaid.esm.mjs';
|
||||
const shouldSuppress =
|
||||
new URLSearchParams(window.location.search).get('suppressErrorRendering') === 'true';
|
||||
mermaid.initialize({ startOnLoad: true, suppressErrorRendering: shouldSuppress });
|
||||
mermaid.initialize({ startOnLoad: false, suppressErrorRendering: shouldSuppress });
|
||||
await mermaid.run();
|
||||
if (window.Cypress) {
|
||||
window.rendered = true;
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
x
Reference in New Issue
Block a user