Remove hardcoded width in tests

This commit is contained in:
Sidharth Vinod
2022-12-07 14:01:52 +05:30
parent 69e84b6731
commit f3a209badc
2 changed files with 4 additions and 4 deletions

View File

@@ -225,7 +225,7 @@ describe('Gantt diagram', () => {
const style = svg.attr('style');
expect(style).to.match(/^max-width: [\d.]+px;$/);
const maxWidthValue = parseFloat(style.match(/[\d.]+/g).join(''));
expect(maxWidthValue).to.be.within(984 * 0.95, 984 * 1.05);
expect(maxWidthValue).to.be.within(cy.viewport.width * 0.95, cy.viewport.width * 1.05);
});
});
@@ -269,7 +269,7 @@ describe('Gantt diagram', () => {
const width = parseFloat(svg.attr('width'));
// use within because the absolute value can be slightly different depending on the environment ±5%
// expect(height).to.be.within(484 * 0.95, 484 * 1.05);
expect(width).to.be.within(984 * 0.95, 984 * 1.05);
expect(width).to.be.within(cy.viewport.width * 0.95, cy.viewport.width * 1.05);
expect(svg).to.not.have.attr('style');
});
});