2023-01-08 07:27:01 +01:00
|
|
|
/// <reference types="cypress" />
|
|
|
|
|
|
|
|
import { css } from 'cypress/types/jquery';
|
|
|
|
|
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
|
|
|
});
|
2022-01-25 21:57:29 +01:00
|
|
|
|
2022-10-31 16:32:51 +01:00
|
|
|
it('Add Relationship', () => {
|
2022-12-07 06:04:17 +01:00
|
|
|
// Create new relationship ...
|
2022-12-07 03:05:25 +01:00
|
|
|
cy.contains('Features').click({ force: true });
|
|
|
|
cy.get(`[aria-label="Add Relationship"]`).click({ multiple: true });
|
2023-01-15 08:04:33 +01:00
|
|
|
cy.onFocusTopicByText('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 ...
|
2022-12-07 03:05:25 +01:00
|
|
|
cy.contains('Features').first().click({ force: true });
|
2022-11-17 06:12:33 +01:00
|
|
|
cy.get(`[aria-label="Add Relationship"]`).first().click();
|
|
|
|
cy.contains('Try it Now!').first().click();
|
|
|
|
|
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-01-25 21:57:29 +01:00
|
|
|
|
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 ...
|
|
|
|
cy.get('[aria-label^="Undo ').eq(1).click();
|
|
|
|
cy.get('@rel').should('exist');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('Change Control Point', () => {
|
|
|
|
// Create new relationship ...
|
2023-01-15 08:04:33 +01:00
|
|
|
cy.onFocusTopicByText('Features');
|
2022-12-07 06:04:17 +01:00
|
|
|
cy.get(`[aria-label="Add Relationship"]`).click({ multiple: true });
|
|
|
|
cy.contains('Try it Now!').click();
|
|
|
|
|
|
|
|
// 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 ...
|
|
|
|
cy.get('[aria-label^="Undo ').eq(1).click();
|
|
|
|
cy.get('[aria-label^="Undo ').eq(1).click();
|
|
|
|
cy.get('@rel').should('exist');
|
|
|
|
cy.matchImageSnapshot('rel ctl undo');
|
2022-07-13 03:58:11 +02:00
|
|
|
});
|
2022-01-25 21:57:29 +01:00
|
|
|
});
|