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

79 lines
2.3 KiB
TypeScript
Raw Permalink Normal View History

2023-01-08 07:27:01 +01:00
/// <reference types="cypress" />
2023-01-08 06:10:13 +01:00
describe('Relationship Topics', () => {
2022-07-13 03:58:11 +02:00
beforeEach(() => {
2022-12-01 07:12:40 +01:00
// Remove storage for autosave ...
2022-07-13 03:58:11 +02:00
cy.visit('/editor.html');
2023-01-08 07:27:01 +01:00
cy.waitEditorLoaded();
2022-07-13 03:58:11 +02:00
});
2023-02-14 08:13:16 +01:00
it.skip('Add Relationship', () => {
2022-12-07 06:04:17 +01:00
// Create new relationship ...
2023-01-15 09:10:27 +01:00
cy.focusTopicByText('Features');
cy.onClickToolbarButton('Add Relationship');
cy.focusTopicByText('Try it Now!');
2022-12-01 07:06:21 +01:00
2022-12-07 06:04:17 +01:00
cy.get('[test-id="11-15-relationship"]').as('rel');
cy.get('@rel').click({ force: true });
cy.get('@rel').should('exist');
2022-11-17 06:12:33 +01:00
2022-10-31 16:32:51 +01:00
cy.matchImageSnapshot('addRelationship');
2022-12-07 06:04:17 +01:00
// Undo relationship ...
cy.get('[aria-label^="Undo ').eq(1).click();
cy.get('@rel').should('not.exist');
2022-10-31 16:32:51 +01:00
});
2022-12-01 07:12:40 +01:00
it('Delete Relationship', () => {
2022-12-07 06:04:17 +01:00
// Add new relationship ...
2023-01-15 09:10:27 +01:00
cy.focusTopicByText('Features');
cy.onClickToolbarButton('Add Relationship');
cy.focusTopicByText('Try it Now!');
2022-11-17 06:12:33 +01:00
2022-12-07 06:04:17 +01:00
// Delete it ...
cy.get('[test-id="11-15-relationship"]').as('rel');
cy.get('@rel').should('exist');
cy.get('@rel').click({ force: true });
2022-12-01 07:12:40 +01:00
2022-10-31 16:32:51 +01:00
cy.get('body').type('{backspace}');
2022-12-07 06:04:17 +01:00
cy.get('@rel').should('not.exist');
2022-10-31 16:32:51 +01:00
cy.matchImageSnapshot('delete relationship');
2022-12-07 06:04:17 +01:00
// Undo relationship ...
2023-01-15 09:10:27 +01:00
cy.triggerUndo();
2022-12-07 06:04:17 +01:00
cy.get('@rel').should('exist');
});
it('Change Control Point', () => {
// Create new relationship ...
2023-01-15 09:10:27 +01:00
cy.focusTopicByText('Features');
cy.onClickToolbarButton('Add Relationship');
cy.focusTopicByText('Try it Now!');
2022-12-07 06:04:17 +01:00
// Select relationship ...
cy.get('[test-id="11-15-relationship"]').as('rel');
cy.get('@rel').should('exist');
cy.get('@rel').click({ force: true });
// Move control point start ...
cy.get('[test-id="relctl:0:11-15"]').first().trigger('mousedown');
cy.get('body').trigger('mousemove', { clientX: 350, clientY: 380 });
cy.get('body').trigger('mouseup');
cy.matchImageSnapshot('move ctl pont 0');
// Move control point end ...
cy.get('[test-id="relctl:1:11-15"]').first().trigger('mousedown');
cy.get('body').trigger('mousemove', { clientX: 350, clientY: 100 });
cy.get('body').trigger('mouseup');
cy.matchImageSnapshot('move ctl pont 1');
// Test undo and redo ...
2023-01-15 09:10:27 +01:00
cy.triggerUndo();
cy.triggerUndo();
2022-12-07 06:04:17 +01:00
cy.get('@rel').should('exist');
cy.matchImageSnapshot('rel ctl undo');
2022-07-13 03:58:11 +02:00
});
});