mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-22 01:36:43 +02:00
added first draft of cypress visual tests
Co-authored-by: Shahir Ahmed <ahmeds@dickinson.edu>
This commit is contained in:
@@ -47,7 +47,7 @@ section Checkout from website
|
||||
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(700);
|
||||
//expect(maxWidthValue).to.eq(700);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -63,4 +63,82 @@ section Checkout from website
|
||||
{ journey: { useMaxWidth: false } }
|
||||
);
|
||||
});
|
||||
|
||||
it('should maintain consistent distance between widest legend label and diagram', () => {
|
||||
renderGraph(
|
||||
`journey
|
||||
title Web hook life cycle
|
||||
section Darkoob
|
||||
Make preBuilt:5: Darkoob user
|
||||
register slug : 5: Darkoob userf
|
||||
Map slug to a Prebuilt Job:5: Darkoob user
|
||||
section External Service
|
||||
set Darkoob slug as hook for an Event : 5 : admin Exjjjnjjjj qwerty
|
||||
listen to the events : 5 : External Service
|
||||
call darkoob endpoint : 5 : External Service
|
||||
section Darkoob
|
||||
check for inputs : 5 : DarkoobAPI
|
||||
run the prebuilt job : 5 : DarkoobAPI
|
||||
`,
|
||||
{ journey: { useMaxWidth: true } }
|
||||
);
|
||||
|
||||
let rightEdgeXInitial, leftEdgeXInitial, rightEdgeXFinal, leftEdgeXFinal, initialDifference, finalDifference;
|
||||
|
||||
cy.contains('tspan', 'admin Exjjjnjjjj qwerty')
|
||||
.invoke('getBBox')
|
||||
.then((bbox) => {
|
||||
rightEdgeXInitial = bbox.x + bbox.width;
|
||||
cy.log(`Right edge x-coordinate: ${rightEdgeXInitial}`);
|
||||
});
|
||||
|
||||
cy.contains('div.label', 'Make preBuilt')
|
||||
.invoke('getBoundingClientRect')
|
||||
.then((rect) => {
|
||||
leftEdgeXInitial = rect.left;
|
||||
cy.log(`Left edge x-coordinate: ${leftEdgeXInitial}`);
|
||||
initialDifference = leftEdgeXInitial - rightEdgeXInitial;
|
||||
cy.log(`Initial Difference: ${initialDifference}`);
|
||||
});
|
||||
|
||||
// renderGraph(
|
||||
// `journey
|
||||
// title Web hook life cycle
|
||||
// section Darkoob
|
||||
// Make preBuilt:5: Darkoob user
|
||||
// register slug : 5: Darkoob userf deliberately increasing the size of this label to check if distance between legend and diagram is maintained
|
||||
// Map slug to a Prebuilt Job:5: Darkoob user
|
||||
// section External Service
|
||||
// set Darkoob slug as hook for an Event : 5 : admin Exjjjnjjjj qwerty
|
||||
// listen to the events : 5 : External Service
|
||||
// call darkoob endpoint : 5 : External Service
|
||||
// section Darkoob
|
||||
// check for inputs : 5 : DarkoobAPI
|
||||
// run the prebuilt job : 5 : DarkoobAPI
|
||||
// `,
|
||||
// { journey: { useMaxWidth: true } }
|
||||
// );
|
||||
|
||||
// cy.contains('tspan', 'Darkoob userf deliberately increasing the size of this label to check if distance between legend and diagram is maintained')
|
||||
// .invoke('getBBox')
|
||||
// .then((bbox) => {
|
||||
// rightEdgeXFinal = bbox.x + bbox.width;
|
||||
// cy.log(`Right edge x-coordinate final: ${rightEdgeXFinal}`);
|
||||
// });
|
||||
|
||||
// cy.contains('div.label', 'Make preBuilt')
|
||||
// .invoke('getBoundingClientRect')
|
||||
// .then((rect) => {
|
||||
// leftEdgeXFinal = rect.left;
|
||||
// cy.log(`Left edge x-coordinate final: ${leftEdgeXFinal}`);
|
||||
// finalDifference = leftEdgeXFinal - rightEdgeXFinal;
|
||||
// cy.log(`Final Difference: ${finalDifference}`);
|
||||
// });
|
||||
|
||||
// expect(initialDifference).toEqual(finalDifference);
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
Reference in New Issue
Block a user