Skip to content

Commit

Permalink
Revert "test(editor): Add canvas actions E2E tests" (#6736)
Browse files Browse the repository at this point in the history
Revert "test(editor): Add canvas actions E2E tests (#6723)"

This reverts commit 052d82b.
  • Loading branch information
OlegIvaniv committed Aug 3, 2023
1 parent 1198d8b commit c2d00b4
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 66 deletions.
36 changes: 0 additions & 36 deletions cypress/e2e/12-canvas-actions.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,42 +78,6 @@ describe('Canvas Actions', () => {
WorkflowPage.getters.nodeConnections().should('have.length', 1);
});

it('should add a connected node dragging from node creator', () => {
WorkflowPage.actions.addNodeToCanvas(MANUAL_TRIGGER_NODE_NAME);
cy.get('.plus-endpoint').should('be.visible').click();
WorkflowPage.getters.nodeCreatorSearchBar().should('be.visible');
WorkflowPage.getters.nodeCreatorSearchBar().type(CODE_NODE_NAME);
cy.drag(
WorkflowPage.getters.nodeCreatorNodeItems().first(),
[100, 100],
{
realMouse: true,
abs: true
}
);
cy.get('body').type('{esc}');
WorkflowPage.getters.canvasNodes().should('have.length', 2);
WorkflowPage.getters.nodeConnections().should('have.length', 1);
});

it('should open a category when trying to drag and drop it on the canvas', () => {
WorkflowPage.actions.addNodeToCanvas(MANUAL_TRIGGER_NODE_NAME);
cy.get('.plus-endpoint').should('be.visible').click();
WorkflowPage.getters.nodeCreatorSearchBar().should('be.visible');
WorkflowPage.getters.nodeCreatorSearchBar().type(CODE_NODE_NAME);
cy.drag(
WorkflowPage.getters.nodeCreatorActionItems().first(),
[100, 100],
{
realMouse: true,
abs: true
}
);
WorkflowPage.getters.nodeCreatorCategoryItems().its('length').should('be.gt', 0);
WorkflowPage.getters.canvasNodes().should('have.length', 1);
WorkflowPage.getters.nodeConnections().should('have.length', 0);
});

it('should add disconnected node if nothing is selected', () => {
WorkflowPage.actions.addNodeToCanvas(MANUAL_TRIGGER_NODE_NAME);
// Deselect nodes
Expand Down
3 changes: 0 additions & 3 deletions cypress/pages/workflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,6 @@ export class WorkflowPage extends BasePage {
nodeCredentialsSelect: () => cy.getByTestId('node-credentials-select'),
nodeCredentialsEditButton: () => cy.getByTestId('credential-edit-button'),
nodeCreatorItems: () => cy.getByTestId('item-iterator-item'),
nodeCreatorNodeItems: () => cy.getByTestId('node-creator-node-item'),
nodeCreatorActionItems: () => cy.getByTestId('node-creator-action-item'),
nodeCreatorCategoryItems: () => cy.getByTestId('node-creator-category-item'),
ndvParameters: () => cy.getByTestId('parameter-item'),
nodeCredentialsLabel: () => cy.getByTestId('credentials-label'),
getConnectionBetweenNodes: (sourceNodeName: string, targetNodeName: string) =>
Expand Down
32 changes: 10 additions & 22 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,31 +103,19 @@ Cypress.Commands.add('paste', { prevSubject: true }, (selector, pastePayload) =>
Cypress.Commands.add('drag', (selector, pos, options) => {
const index = options?.index || 0;
const [xDiff, yDiff] = pos;
const element = typeof selector === 'string' ? cy.get(selector).eq(index) : selector;
const element = cy.get(selector).eq(index);
element.should('exist');

element.then(([$el]) => {
const originalLocation = $el.getBoundingClientRect();
const newPosition = {
x: options?.abs ? xDiff : originalLocation.x + xDiff,
y: options?.abs ? yDiff : originalLocation.y + yDiff,
}

if(options?.realMouse) {
element.realMouseDown();
element.realMouseMove(newPosition.x, newPosition.y);
element.realMouseUp();
} else {
element.trigger('mousedown', {force: true});
element.trigger('mousemove', {
which: 1,
pageX: newPosition.x,
pageY: newPosition.y,
force: true,
});
element.trigger('mouseup', {force: true});
}
const originalLocation = Cypress.$(selector)[index].getBoundingClientRect();

element.trigger('mousedown', { force: true });
element.trigger('mousemove', {
which: 1,
pageX: options?.abs ? xDiff : originalLocation.right + xDiff,
pageY: options?.abs ? yDiff : originalLocation.top + yDiff,
force: true,
});
element.trigger('mouseup', { force: true });
});

Cypress.Commands.add('draganddrop', (draggableSelector, droppableSelector) => {
Expand Down
2 changes: 1 addition & 1 deletion cypress/support/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ declare global {
grantBrowserPermissions(...permissions: string[]): void;
readClipboard(): Chainable<string>;
paste(pastePayload: string): void;
drag(selector: string | Cypress.Chainable<JQuery<HTMLElement>>, target: [number, number], options?: {abs?: boolean, index?: number, realMouse?: boolean}): void;
drag(selector: string, target: [number, number], options?: {abs?: true, index?: number}): void;
draganddrop(draggableSelector: string, droppableSelector: string): void;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
:title="displayName"
:show-action-arrow="showActionArrow"
:is-trigger="isTrigger"
:data-test-id="dataTestId"
>
<template #icon>
<node-icon :nodeType="nodeType" />
Expand Down Expand Up @@ -75,9 +74,6 @@ const description = computed<string>(() => {
}) as string;
});
const showActionArrow = computed(() => hasActions.value);
const dataTestId = computed(() =>
hasActions.value ? 'node-creator-action-item' : 'node-creator-node-item',
);
const hasActions = computed(() => {
return nodeActions.value.length > 1;
Expand Down

0 comments on commit c2d00b4

Please sign in to comment.