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

61 lines
1.9 KiB
TypeScript
Raw Normal View History

2023-01-08 07:27:01 +01:00
/// <reference types="cypress" />
2023-01-08 06:10:13 +01:00
describe('Node manager', () => {
beforeEach(() => {
cy.visit('/editor.html');
2023-01-08 07:27:01 +01:00
cy.waitEditorLoaded();
2023-01-08 06:10:13 +01:00
// Select root node ...
2023-01-15 08:04:33 +01:00
cy.onFocusTopicByText('Mind Mapping');
});
it('shortcut add sibling node', () => {
cy.get('body').type('{enter}').type('Mind Mapping rocks!!').type('{enter}');
cy.get('[test-id=36] > text > tspan').should('exist');
cy.matchImageSnapshot('editor-shortcut-edit');
});
it('shortcut add child node', () => {
cy.get('body').type('{insert}').type('Child 1 mind Mapping rocks!!').type('{enter}');
cy.get('body').type('{enter}').type('Child 2 mind Mapping rocks!!').type('{enter}');
cy.get('[test-id=36] > text > tspan').should('exist');
cy.get('[test-id=37] > text > tspan').should('exist');
cy.matchImageSnapshot('addChildNodeSortcut');
});
it('Delete topic', () => {
2023-01-08 06:10:13 +01:00
cy.get('body').type('{enter}').type('Mind Mapping rocks!!').type('{enter}');
2023-01-15 08:04:33 +01:00
cy.onFocusTopicById(36);
cy.get('body').type('{del}');
cy.get('[test-id=37]').should('not.exist');
cy.matchImageSnapshot('deleteTopicShortcut');
});
it('undo changes', () => {
2023-01-08 06:10:13 +01:00
cy.get('body').type('{enter}').type('Mind Mapping rocks!!').type('{enter}');
2022-10-31 16:32:51 +01:00
cy.get('[data-testid="UndoOutlinedIcon"]').click();
cy.get('[test-id=36] > text > tspan').should('exist');
cy.matchImageSnapshot('undoChange');
});
2022-10-31 16:32:51 +01:00
it('redo changes', () => {
2023-01-08 06:10:13 +01:00
cy.get('body').type('{enter}').type('Mind Mapping rocks!!').type('{enter}');
cy.get('[data-testid="UndoOutlinedIcon"]').click();
cy.get('[test-id=36] > text > tspan').should('exist');
2022-10-31 16:32:51 +01:00
cy.get('[data-testid="RedoOutlinedIcon"]').click();
cy.get('[test-id=36] > text > tspan').should('exist');
2023-01-07 22:22:33 +01:00
2022-10-31 16:32:51 +01:00
cy.matchImageSnapshot('redoChange');
});
it('Save changes', () => {
cy.get('body').type('{ctrl}s');
cy.matchImageSnapshot('saveChagesShortcut');
});
});