52 lines
1.9 KiB
JavaScript
Raw Normal View History

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