wisemapping-frontend/packages/editor/cypress/e2e/topicShape.cy.ts

77 lines
2.1 KiB
TypeScript
Raw Normal View History

2022-01-26 20:25:11 +01:00
context('Change Topic shape', () => {
beforeEach(() => {
cy.visit('/editor.html');
cy.reload();
cy.contains('Try it Now!').click();
});
it('change to square shape', () => {
2022-11-01 01:49:16 +01:00
cy.get(`[aria-label="Topic Style"]`).first().trigger('mouseover');
cy.get(`[aria-label="Rectangle shape"]`).first().click();
2022-01-26 20:25:11 +01:00
2022-12-01 07:12:40 +01:00
cy.get('[test-id=11] > rect')
.eq(1)
.invoke('attr', 'rx')
.then(parseInt)
.should('be.a', 'number')
.should('eq', 0);
2022-01-26 20:25:11 +01:00
cy.matchImageSnapshot('changeToSquareShape');
});
2022-10-31 16:32:51 +01:00
it('change to rounded rectangle', () => {
cy.contains('Mind Mapping').click();
2022-01-26 20:25:11 +01:00
2022-11-01 01:49:16 +01:00
cy.get(`[aria-label="Topic Style"]`).first().trigger('mouseover');
cy.get(`[aria-label="Rounded shape"]`).first().click();
2022-01-26 20:25:11 +01:00
2022-10-31 21:23:49 +01:00
// Todo: Check how to validate this. Difference when it run in docker vs test:integration
2022-12-01 07:12:40 +01:00
cy.get('[test-id=6] > rect')
.eq(1)
.invoke('attr', 'rx')
.then(parseInt)
.should('be.a', 'number')
.should('be.gte', 4);
cy.get('[test-id=6] > rect')
.eq(1)
.invoke('attr', 'rx')
.then(parseInt)
.should('be.a', 'number')
.should('be.lt', 5);
2022-10-31 16:32:51 +01:00
cy.matchImageSnapshot('changeToRoundedRectangle');
2022-01-26 20:25:11 +01:00
});
it('change to line', () => {
2022-10-31 16:32:51 +01:00
cy.contains('Try it Now!').click();
2022-10-31 21:23:49 +01:00
2022-11-01 01:49:16 +01:00
cy.get(`[aria-label="Topic Style"]`).first().trigger('mouseover');
cy.get(`[aria-label="Line shape"]`).first().click();
2022-01-26 20:25:11 +01:00
cy.matchImageSnapshot('changeToLine');
});
2022-10-31 16:32:51 +01:00
it('change to ellipse shape', () => {
cy.contains('Productivity').click();
2022-11-01 01:49:16 +01:00
cy.get(`[aria-label="Topic Style"]`).first().trigger('mouseover');
cy.get(`[aria-label="Ellipse shape"]`).first().click();
2022-01-26 20:25:11 +01:00
2022-10-31 21:23:49 +01:00
// Todo: Check how to validate this. Difference when it run in docker vs test:integration
2022-12-01 07:12:40 +01:00
cy.get('[test-id=2] > rect')
.eq(1)
.invoke('attr', 'rx')
.then(parseInt)
.should('be.a', 'number')
.should('be.gte', 12);
cy.get('[test-id=2] > rect')
.eq(1)
.invoke('attr', 'rx')
.then(parseInt)
.should('be.a', 'number')
.should('be.lt', 15);
2022-01-26 20:25:11 +01:00
2022-10-31 16:32:51 +01:00
cy.matchImageSnapshot('changeToEllipseShape');
2022-01-26 20:25:11 +01:00
});
});