61 lines
1.7 KiB
TypeScript
Raw Normal View History

2023-01-07 22:27:01 -08:00
/// <reference types="cypress" />
2023-01-07 21:10:13 -08:00
describe('Node manager', () => {
beforeEach(() => {
cy.visit('/editor.html');
2023-01-07 22:27:01 -08:00
cy.waitEditorLoaded();
2023-01-07 21:10:13 -08:00
// Select root node ...
2023-01-15 00:10:27 -08: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 00:10:27 -08:00
cy.focusTopicById(36);
cy.focusTopicById(37);
cy.matchImageSnapshot('addChildNodeSortcut');
});
it('Delete topic', () => {
2023-01-07 21:10:13 -08:00
cy.get('body').type('{enter}').type('Mind Mapping rocks!!').type('{enter}');
2023-01-15 00:10:27 -08: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-07 21:10:13 -08:00
cy.get('body').type('{enter}').type('Mind Mapping rocks!!').type('{enter}');
2023-02-03 04:00:12 -08:00
cy.focusTopicByText('Mind Mapping rocks!!');
2023-01-15 00:10:27 -08:00
cy.triggerUndo();
cy.matchImageSnapshot('undoChange');
});
2022-10-31 08:32:51 -07:00
it('redo changes', () => {
2023-01-07 21:10:13 -08:00
cy.get('body').type('{enter}').type('Mind Mapping rocks!!').type('{enter}');
2023-02-03 04:00:12 -08:00
cy.focusTopicByText('Mind Mapping rocks!!');
2023-01-07 21:10:13 -08:00
2023-02-03 04:00:12 -08:00
cy.triggerUndo();
2023-01-15 00:10:27 -08:00
cy.triggerRedo();
2023-02-03 04:00:12 -08:00
cy.focusTopicByText('Mind Mapping rocks!!');
2023-01-07 13:22:33 -08:00
2022-10-31 08:32:51 -07:00
cy.matchImageSnapshot('redoChange');
});
2023-02-03 04:00:12 -08:00
it('save changes', () => {
cy.get('body').type('{ctrl}s');
cy.matchImageSnapshot('saveChagesShortcut');
});
});