adds test for journey

Co-authored-by: Pranav Mishra <mishrap@dickinson.edu>
This commit is contained in:
Shahir Ahmed
2025-02-12 19:54:56 -05:00
parent db4ea020ba
commit d618b8398e

View File

@@ -64,7 +64,7 @@ section Checkout from website
); );
}); });
it('should maintain consistent distance between widest legend label and diagram', () => { it('should maintain sufficient space between legend labels and diagram elements', () => {
renderGraph( renderGraph(
`journey `journey
title Web hook life cycle title Web hook life cycle
@@ -83,61 +83,64 @@ section Checkout from website
{ journey: { useMaxWidth: true } } { journey: { useMaxWidth: true } }
); );
let rightEdgeXInitial, let LabelEndX, diagramStartX;
leftEdgeXInitial,
rightEdgeXFinal,
leftEdgeXFinal,
initialDifference,
finalDifference;
// Get right edge of the legend
cy.contains('tspan', 'admin Exjjjnjjjj qwerty').then((textBox) => { cy.contains('tspan', 'admin Exjjjnjjjj qwerty').then((textBox) => {
const bbox = textBox[0].getBBox(); const bbox = textBox[0].getBBox();
const rightEdge = bbox.x + bbox.width; LabelEndX = bbox.x + bbox.width;
console.warn(rightEdge);
}); });
cy.get(':nth-child(14) > switch > foreignobject').then((rect) => { // Get left edge of the diagram
console.warn(rect); cy.contains('foreignobject', 'Make preBuilt').then((rect) => {
//const leftEdgeXInitial = rect.left; diagramStartX = parseFloat(rect.attr('x'));
// cy.log(`Left edge x-coordinate: ${leftEdgeXInitial}`);
// initialDifference = leftEdgeXInitial - rightEdgeXInitial;
// cy.log(`Initial Difference: ${initialDifference}`);
}); });
// renderGraph( // Assert right edge of the diagram is greater than or equal to the right edge of the label
// `journey cy.then(() => {
// title Web hook life cycle expect(diagramStartX).to.be.gte(LabelEndX);
// 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 it('should maintain sufficient space between legend and diagram when legend labels are longer', () => {
// section External Service cy.then(() => {
// set Darkoob slug as hook for an Event : 5 : admin Exjjjnjjjj qwerty renderGraph(
// listen to the events : 5 : External Service `journey
// call darkoob endpoint : 5 : External Service title Web hook life cycle
// section Darkoob section Darkoob
// check for inputs : 5 : DarkoobAPI Make preBuilt:5: Darkoob user
// run the prebuilt job : 5 : DarkoobAPI 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
// { journey: { useMaxWidth: true } } section External Service
// ); set Darkoob slug as hook for an Event : 5 : admin Exjjjnjjjj qwerty
listen to the events : 5 : External Service
// cy.contains('tspan', 'Darkoob userf deliberately increasing the size of this label to check if distance between legend and diagram is maintained') call darkoob endpoint : 5 : External Service
// .invoke('getBBox') section Darkoob
// .then((bbox) => { check for inputs : 5 : DarkoobAPI
// rightEdgeXFinal = bbox.x + bbox.width; run the prebuilt job : 5 : DarkoobAPI
// cy.log(`Right edge x-coordinate final: ${rightEdgeXFinal}`); `,
// }); { journey: { useMaxWidth: true } }
);
// cy.contains('div.label', 'Make preBuilt') });
// .invoke('getBoundingClientRect')
// .then((rect) => { let LabelEndX, diagramStartX;
// leftEdgeXFinal = rect.left;
// cy.log(`Left edge x-coordinate final: ${leftEdgeXFinal}`); // Get right edge of the legend
// finalDifference = leftEdgeXFinal - rightEdgeXFinal; cy.contains('tspan', 'Darkoob userf deliberately increasing the size of this label').then(
// cy.log(`Final Difference: ${finalDifference}`); (textBox) => {
// }); const bbox = textBox[0].getBBox();
LabelEndX = bbox.x + bbox.width;
// expect(initialDifference).toEqual(finalDifference); }
);
// Get left edge of the diagram
cy.contains('foreignobject', 'Make preBuilt').then((rect) => {
diagramStartX = parseFloat(rect.attr('x'));
});
// Assert right edge of the diagram is greater than or equal to the right edge of the label
cy.then(() => {
expect(diagramStartX).to.be.gte(LabelEndX);
});
}); });
}); });