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

76 lines
2.8 KiB
JavaScript
Raw Normal View History

2022-01-26 20:25:11 +01:00
context('Edit Topic', () => {
// TODO: review why click({force: true}) is needed in these tests
// also, why is the element outside the viewport in screenshots?
beforeEach(() => {
cy.visit('/editor.html');
cy.reload();
cy.get('[test-id=1]').click();
});
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');
cy.matchImageSnapshot('changeMainTopicText');
});
it('Change Font Size', () => {
2022-10-31 16:32:51 +01:00
// Go to the minimal size.
2022-11-01 01:49:16 +01:00
cy.get(`[aria-label="Font Style"]`).first().trigger('mouseover');
cy.get(`[aria-label="Smaller"]`).first().click();
cy.get(`[aria-label="Smaller"]`).first().click();
2022-01-26 20:25:11 +01:00
2022-11-01 00:24:07 +01:00
// cy.get('[test-id=1] > text').invoke('attr', 'font-size').should('eq', '8.1');
2022-10-31 16:32:51 +01:00
cy.matchImageSnapshot('changeFontSizeSmall');
2022-01-26 20:25:11 +01:00
2022-11-01 01:49:16 +01:00
cy.get(`[aria-label="Font Style"]`).first().trigger('mouseover');
cy.get(`[aria-label="Bigger"]`).first().click();
2022-11-01 00:24:07 +01:00
// cy.get('[test-id=1] > text').invoke('attr', 'font-size').should('eq', '10.8');
2022-10-31 16:32:51 +01:00
cy.matchImageSnapshot('changeFontSizeNormal');
2022-01-26 20:25:11 +01:00
2022-11-01 01:49:16 +01:00
cy.get(`[aria-label="Font Style"]`).first().trigger('mouseover');
cy.get(`[aria-label="Bigger"]`).first().click();
2022-11-01 00:24:07 +01:00
// cy.get('[test-id=1] > text').invoke('attr', 'font-size').should('eq', '13.4');
2022-01-26 20:25:11 +01:00
cy.matchImageSnapshot('changeFontSizeLarge');
2022-11-01 01:49:16 +01:00
cy.get(`[aria-label="Font Style"]`).first().trigger('mouseover');
cy.get(`[aria-label="Bigger"]`).first().click();
2022-01-26 20:25:11 +01:00
2022-11-01 00:24:07 +01:00
// cy.get('[test-id=1] > text').invoke('attr', 'font-size').should('eq', '20.2');
2022-01-26 20:25:11 +01:00
cy.matchImageSnapshot('changeFontSizeHuge');
2022-10-31 16:32:51 +01:00
// Can not scale it more.
2022-11-01 01:49:16 +01:00
cy.get(`[aria-label="Bigger"]`).first().click();
2022-11-01 00:24:07 +01:00
// cy.get('[test-id=1] > text').invoke('attr', 'font-size').should('eq', '20.2');
2022-10-31 16:32:51 +01:00
cy.matchImageSnapshot('changeFontSizeHuge');
2022-01-26 20:25:11 +01:00
});
2022-10-31 16:32:51 +01:00
// it('Change Font To Italic', () => {
// cy.get(`[aria-label="Font Style"]`).trigger('mouseover');
// cy.contains(`[data-test-id="FormactItalicIcon"]`).click();
2022-01-26 20:25:11 +01:00
2022-10-31 16:32:51 +01:00
// cy.get('[test-id=1] > text').invoke('attr', 'font-family').should('eq', 'Times');
// cy.matchImageSnapshot('changeFontType');
// });
2022-01-26 20:25:11 +01:00
2022-10-31 16:32:51 +01:00
// it('Change Font Italic', () => {
// cy.get(`[aria-label="Font Style"]`).trigger('mouseover');
// cy.contains('[data-testid="FormatItalicIcon"]').click();
2022-01-26 20:25:11 +01:00
2022-10-31 16:32:51 +01:00
// cy.get('[test-id=1] > text').invoke('attr', 'font-style').should('eq', 'italic');
2022-01-26 20:25:11 +01:00
2022-10-31 16:32:51 +01:00
// cy.matchImageSnapshot('changeFontItalic');
// });
2022-01-26 20:25:11 +01:00
2022-10-31 16:32:51 +01:00
// it('Change Font color', () => {
// cy.get('#fontColorTip').click();
// cy.get('[title="RGB (153, 0, 255)"]').click({ force: true });
// cy.get('[test-id=1] > text').invoke('attr', 'fill').should('eq', 'rgb(153, 0, 255)');
// cy.matchImageSnapshot('changeFontColor');
// });
2022-01-26 20:25:11 +01:00
});