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

83 lines
2.6 KiB
TypeScript
Raw Permalink Normal View History

2023-01-08 07:27:01 +01:00
/// <reference types="cypress" />
2023-01-15 09:10:27 +01:00
describe('Topic Font Suite', () => {
2022-12-01 07:12:40 +01:00
beforeEach(() => {
// Remove storage for autosave ...
cy.visit('/editor.html');
2023-01-08 07:27:01 +01:00
cy.waitEditorLoaded();
2023-01-15 09:10:27 +01:00
cy.focusTopicById(1);
2022-12-01 07:12:40 +01:00
});
2023-01-08 07:27:01 +01:00
it('Open Font Shape Panel', () => {
2023-01-15 09:10:27 +01:00
cy.onMouseOverToolbarButton('Font Style');
2023-01-08 07:27:01 +01:00
cy.matchImageSnapshot('fontShapePanel');
});
2022-12-01 07:12:40 +01:00
it('Change Main Topic Text', () => {
cy.get('body').type('New Title Main Topic{enter}');
cy.get('[test-id=1] > text > tspan').should('have.text', 'New Title Main Topic');
2023-01-15 09:10:27 +01:00
cy.focusTopicByText('Mind Mapping');
2022-12-01 07:12:40 +01:00
cy.matchImageSnapshot('changeMainTopicText');
});
it('Change Font Size', () => {
// Go to the minimal size.
2023-01-15 09:10:27 +01:00
cy.onMouseOverToolbarButton('Font Style');
2022-12-07 06:04:17 +01:00
cy.get('[aria-label="Smaller"]').as('smaller');
cy.get('@smaller').eq(1).click();
cy.get('@smaller').eq(1).click();
2022-12-01 07:12:40 +01:00
cy.get('[test-id=1] > text').invoke('attr', 'font-size').should('eq', '8.1');
cy.matchImageSnapshot('changeFontSizeSmall');
2022-12-07 06:04:17 +01:00
cy.get('[aria-label="Bigger"]').as('bigger');
cy.get('@bigger').eq(1).click();
2022-12-01 07:12:40 +01:00
cy.matchImageSnapshot('changeFontSizeNormal');
2022-12-07 06:04:17 +01:00
cy.get('@bigger').eq(1).click();
2022-12-01 07:12:40 +01:00
cy.get('[test-id=1] > text').invoke('attr', 'font-size').should('eq', '13.4');
cy.matchImageSnapshot('changeFontSizeLarge');
2022-12-07 06:04:17 +01:00
cy.get('@bigger').eq(1).click();
2022-12-01 07:12:40 +01:00
cy.get('[test-id=1] > text').invoke('attr', 'font-size').should('eq', '20.2');
cy.matchImageSnapshot('changeFontSizeHuge');
2022-12-07 06:04:17 +01:00
cy.get('@bigger').eq(1).click();
2022-12-01 07:12:40 +01:00
cy.get('[test-id=1] > text').invoke('attr', 'font-size').should('eq', '20.2');
2023-01-07 22:22:33 +01:00
2022-12-01 07:12:40 +01:00
cy.matchImageSnapshot('changeFontSizeHuge');
});
2022-12-07 06:04:17 +01:00
it('Change Font To Italic', () => {
2023-01-15 09:10:27 +01:00
cy.onMouseOverToolbarButton('Font Style');
2022-12-07 06:04:17 +01:00
cy.get('[aria-label^="Italic ').first().click();
2022-12-01 07:12:40 +01:00
2022-12-07 06:04:17 +01:00
cy.get('[test-id=1] > text').invoke('attr', 'font-style').should('eq', 'italic');
2023-01-08 07:27:01 +01:00
cy.contains('Mind Mapping').click({ force: true });
2022-12-07 06:04:17 +01:00
cy.matchImageSnapshot('changeFontItalic');
2022-12-01 07:12:40 +01:00
});
2022-12-07 06:04:17 +01:00
it('Change Font to Bold', () => {
2023-01-15 09:10:27 +01:00
cy.onMouseOverToolbarButton('Font Style');
2022-12-07 06:04:17 +01:00
cy.get('[aria-label^="Bold ').first().click();
2022-12-01 07:12:40 +01:00
2022-12-07 06:04:17 +01:00
cy.get('[test-id=1] > text').invoke('attr', 'font-weight').should('eq', 'normal');
2022-12-01 07:12:40 +01:00
2023-01-08 07:27:01 +01:00
cy.contains('Mind Mapping').click({ force: true });
2022-12-07 06:04:17 +01:00
cy.matchImageSnapshot('changeFontBold');
2022-12-01 07:12:40 +01:00
});
2022-12-07 06:04:17 +01:00
it('Change Font Color', () => {
2023-01-15 09:10:27 +01:00
cy.onMouseOverToolbarButton('Font Style');
2022-12-07 06:04:17 +01:00
cy.get('[aria-label="Color"]').eq(1).click();
cy.get('[title="#cc0000"]').click({ force: true });
2022-12-01 07:12:40 +01:00
2022-12-07 06:04:17 +01:00
cy.get('[test-id=1] > text').invoke('attr', 'fill').should('eq', '#cc0000');
2022-12-01 07:12:40 +01:00
2023-01-15 09:10:27 +01:00
cy.focusTopicByText('Mind Mapping');
2022-12-01 07:12:40 +01:00
cy.matchImageSnapshot('changeFontColor');
});
});