79 lines
2.3 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('Relationship Topics', () => {
2022-07-12 18:58:11 -07:00
beforeEach(() => {
2022-11-30 22:12:40 -08:00
// Remove storage for autosave ...
2022-07-12 18:58:11 -07:00
cy.visit('/editor.html');
2023-01-07 22:27:01 -08:00
cy.waitEditorLoaded();
2022-07-12 18:58:11 -07:00
});
2023-02-13 23:13:16 -08:00
it.skip('Add Relationship', () => {
2022-12-06 21:04:17 -08:00
// Create new relationship ...
2023-01-15 00:10:27 -08:00
cy.focusTopicByText('Features');
cy.onClickToolbarButton('Add Relationship');
cy.focusTopicByText('Try it Now!');
2022-11-30 22:06:21 -08:00
2022-12-06 21:04:17 -08:00
cy.get('[test-id="11-15-relationship"]').as('rel');
cy.get('@rel').click({ force: true });
cy.get('@rel').should('exist');
2022-11-16 21:12:33 -08:00
2022-10-31 08:32:51 -07:00
cy.matchImageSnapshot('addRelationship');
2022-12-06 21:04:17 -08:00
// Undo relationship ...
cy.get('[aria-label^="Undo ').eq(1).click();
cy.get('@rel').should('not.exist');
2022-10-31 08:32:51 -07:00
});
2022-11-30 22:12:40 -08:00
it('Delete Relationship', () => {
2022-12-06 21:04:17 -08:00
// Add new relationship ...
2023-01-15 00:10:27 -08:00
cy.focusTopicByText('Features');
cy.onClickToolbarButton('Add Relationship');
cy.focusTopicByText('Try it Now!');
2022-11-16 21:12:33 -08:00
2022-12-06 21:04:17 -08:00
// Delete it ...
cy.get('[test-id="11-15-relationship"]').as('rel');
cy.get('@rel').should('exist');
cy.get('@rel').click({ force: true });
2022-11-30 22:12:40 -08:00
2022-10-31 08:32:51 -07:00
cy.get('body').type('{backspace}');
2022-12-06 21:04:17 -08:00
cy.get('@rel').should('not.exist');
2022-10-31 08:32:51 -07:00
cy.matchImageSnapshot('delete relationship');
2022-12-06 21:04:17 -08:00
// Undo relationship ...
2023-01-15 00:10:27 -08:00
cy.triggerUndo();
2022-12-06 21:04:17 -08:00
cy.get('@rel').should('exist');
});
it('Change Control Point', () => {
// Create new relationship ...
2023-01-15 00:10:27 -08:00
cy.focusTopicByText('Features');
cy.onClickToolbarButton('Add Relationship');
cy.focusTopicByText('Try it Now!');
2022-12-06 21:04:17 -08: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 00:10:27 -08:00
cy.triggerUndo();
cy.triggerUndo();
2022-12-06 21:04:17 -08:00
cy.get('@rel').should('exist');
cy.matchImageSnapshot('rel ctl undo');
2022-07-12 18:58:11 -07:00
});
});