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

61 lines
1.7 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 09:10:27 +01:00
cy.focusTopicByText('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}');
2023-01-15 09:10:27 +01:00
cy.focusTopicById(36);
cy.focusTopicById(37);
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 09:10:27 +01:00
cy.focusTopicById(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}');
2023-02-03 13:00:12 +01:00
cy.focusTopicByText('Mind Mapping rocks!!');
2023-01-15 09:10:27 +01:00
cy.triggerUndo();
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}');
2023-02-03 13:00:12 +01:00
cy.focusTopicByText('Mind Mapping rocks!!');
2023-01-08 06:10:13 +01:00
2023-02-03 13:00:12 +01:00
cy.triggerUndo();
2023-01-15 09:10:27 +01:00
cy.triggerRedo();
2023-02-03 13:00:12 +01:00
cy.focusTopicByText('Mind Mapping rocks!!');
2023-01-07 22:22:33 +01:00
2022-10-31 16:32:51 +01:00
cy.matchImageSnapshot('redoChange');
});
2023-02-03 13:00:12 +01:00
it('save changes', () => {
cy.get('body').type('{ctrl}s');
cy.matchImageSnapshot('saveChagesShortcut');
});
});