2022-11-25 04:52:33 -08:00
|
|
|
import { NodeCreator } from '../pages/features/node-creator';
|
2022-12-15 07:39:59 -08:00
|
|
|
import { DEFAULT_USER_EMAIL, DEFAULT_USER_PASSWORD } from '../constants';
|
|
|
|
import { randFirstName, randLastName } from '@ngneat/falso';
|
2023-02-17 06:08:26 -08:00
|
|
|
import { WorkflowPage as WorkflowPageClass } from '../pages/workflow';
|
|
|
|
import { NDV } from '../pages/ndv';
|
2022-11-25 04:52:33 -08:00
|
|
|
|
2022-11-28 09:11:33 -08:00
|
|
|
const email = DEFAULT_USER_EMAIL;
|
|
|
|
const password = DEFAULT_USER_PASSWORD;
|
|
|
|
const firstName = randFirstName();
|
|
|
|
const lastName = randLastName();
|
2022-11-25 04:52:33 -08:00
|
|
|
const nodeCreatorFeature = new NodeCreator();
|
2023-02-17 06:08:26 -08:00
|
|
|
const WorkflowPage = new WorkflowPageClass();
|
|
|
|
const NDVModal = new NDV();
|
2022-11-25 04:52:33 -08:00
|
|
|
|
|
|
|
describe('Node Creator', () => {
|
2022-11-25 08:01:49 -08:00
|
|
|
before(() => {
|
2022-11-28 09:11:33 -08:00
|
|
|
cy.resetAll();
|
|
|
|
cy.setup({ email, firstName, lastName, password });
|
|
|
|
});
|
2022-11-25 08:01:49 -08:00
|
|
|
|
2022-11-25 04:52:33 -08:00
|
|
|
beforeEach(() => {
|
2022-11-28 09:11:33 -08:00
|
|
|
cy.signin({ email, password });
|
|
|
|
|
2022-11-25 04:52:33 -08:00
|
|
|
cy.visit(nodeCreatorFeature.url);
|
2022-12-13 02:55:51 -08:00
|
|
|
cy.waitForLoad();
|
2022-11-25 04:52:33 -08:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should open node creator on trigger tab if no trigger is on canvas', () => {
|
|
|
|
nodeCreatorFeature.getters.canvasAddButton().click();
|
|
|
|
|
2022-12-15 07:39:59 -08:00
|
|
|
nodeCreatorFeature.getters
|
|
|
|
.nodeCreator()
|
2023-02-17 06:08:26 -08:00
|
|
|
.contains('Select a trigger')
|
2022-12-15 07:39:59 -08:00
|
|
|
.should('be.visible');
|
2022-11-25 04:52:33 -08:00
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should navigate subcategory', () => {
|
|
|
|
nodeCreatorFeature.actions.openNodeCreator();
|
2023-02-17 06:08:26 -08:00
|
|
|
nodeCreatorFeature.getters.getCreatorItem('On app event').click();
|
|
|
|
nodeCreatorFeature.getters.activeSubcategory().should('have.text', 'On app event');
|
2022-11-25 04:52:33 -08:00
|
|
|
// Go back
|
2022-12-15 07:39:59 -08:00
|
|
|
nodeCreatorFeature.getters.activeSubcategory().find('button').click();
|
2023-02-17 06:08:26 -08:00
|
|
|
nodeCreatorFeature.getters.activeSubcategory().should('not.have.text', 'On app event');
|
2022-12-15 07:39:59 -08:00
|
|
|
});
|
2022-11-25 04:52:33 -08:00
|
|
|
|
|
|
|
it('should search for nodes', () => {
|
|
|
|
nodeCreatorFeature.actions.openNodeCreator();
|
|
|
|
|
|
|
|
nodeCreatorFeature.getters.searchBar().find('input').type('manual');
|
|
|
|
nodeCreatorFeature.getters.creatorItem().should('have.length', 1);
|
|
|
|
nodeCreatorFeature.getters.searchBar().find('input').clear().type('manual123');
|
|
|
|
nodeCreatorFeature.getters.creatorItem().should('have.length', 0);
|
2022-12-15 07:39:59 -08:00
|
|
|
nodeCreatorFeature.getters
|
|
|
|
.noResults()
|
|
|
|
.should('exist')
|
|
|
|
.should('contain.text', "We didn't make that... yet");
|
2022-11-25 04:52:33 -08:00
|
|
|
|
feat(editor): Node creator actions (#4696)
* WIP: Node Actions List UI
* WIP: Recommended Actions and preseting of fields
* WIP: Resource category
* :art: Moved actions categorisation to the server
* :label: Add missing INodeAction type
* :sparkles: Improve SSR categorisation, fix adding of mixed actions
* :recycle: Refactor CategorizedItems to composition api, style fixes
* WIP: Adding multiple nodes
* :recycle: Refactor rest of the NodeCreator component to composition API, conver globalLinkActions to composable
* :sparkles: Allow actions dragging, fix search and refactor passing of actions to categorized items
* :lipstick: Fix node actions title
* Migrate to the pinia store, add posthog feature and various fixes
* :bug: Fix filtering of trigger actions when not merged
* fix: N8N-5439 — Do not use simple node item when at NodeHelperPanel root
* :bug: Design review fixes
* :bug: Fix disabling of merged actions
* Fix trigger root filtering
* :sparkles: Allow for custom node actions parser, introduce hubspot parser
* :bug: Fix initial node params validation, fix position of second added node
* :bug: Introduce operations category, removed canvas node names overrride, fix API actions display and prevent dragging of action nodes
* :sparkles: Prevent NDV auto-open feature flag
* :bug: Inject recommened action for trigger nodes without actions
* Refactored NodeCreatorNode to Storybook, change filtering of merged nodes for the trigger helper panel, minor fixes
* Improve rendering of app nodes and animation
* Cleanup, any only enable accordion transition on triggerhelperpanel
* Hide node creator scrollbars in Firefox
* Minor styles fixes
* Do not copy the array in rendering method
* Removed unused props
* Fix memory leak
* Fix categorisation of regular nodes with a single resource
* Implement telemetry calls for node actions
* Move categorization to FE
* Fix client side actions categorisation
* Skip custom action show
* Only load tooltip for NodeIcon if necessary
* Fix lodash startCase import
* Remove lodash.startcase
* Cleanup
* Fix node creator autofocus on "tab"
* Prevent posthog getFeatureFlag from crashing
* Debugging preview env search issues
* Remove logs
* Make sure the pre-filled params are update not overwritten
* Get rid of transition in itemiterator
* WIP: Rough version of NodeActions keyboard navigation, replace nodeCreator composable with Pinia store module
* Rewrite to add support for ActionItem to ItemIterator and make CategorizedItems accept items props
* Fix category item counter & cleanup
* Add APIHint to actions search no-result, clean up NodeCreatorNode
* Improve node actions no results message
* Remove logging, fix filtering of recommended placeholder category
* Remove unused NodeActions component and node merging feature falg
* Do not show regular nodes without actions
* Make sure to add manual trigger when adding http node via actions hint
* Fixed api hint footer line height
* Prevent pointer-events od NodeIcon img and remove "this" from template
* Address PR points
* Fix e2e specs
* Make sure canvas ia loaded
* Make sure canvas ia loaded before opening nodeCreator in e2e spec
* Fix flaky workflows tags e2e getter
* Imrpove node creator click outside UX, add manual node to regular nodes added from trigger panel
* Add manual trigger node if dragging regular from trigger panel
2022-12-09 01:56:36 -08:00
|
|
|
nodeCreatorFeature.getters.searchBar().find('input').clear().type('edit image');
|
|
|
|
nodeCreatorFeature.getters.creatorItem().should('have.length', 1);
|
|
|
|
|
2022-12-15 07:39:59 -08:00
|
|
|
nodeCreatorFeature.getters
|
|
|
|
.searchBar()
|
|
|
|
.find('input')
|
|
|
|
.clear()
|
|
|
|
.type('this node totally does not exist');
|
feat(editor): Node creator actions (#4696)
* WIP: Node Actions List UI
* WIP: Recommended Actions and preseting of fields
* WIP: Resource category
* :art: Moved actions categorisation to the server
* :label: Add missing INodeAction type
* :sparkles: Improve SSR categorisation, fix adding of mixed actions
* :recycle: Refactor CategorizedItems to composition api, style fixes
* WIP: Adding multiple nodes
* :recycle: Refactor rest of the NodeCreator component to composition API, conver globalLinkActions to composable
* :sparkles: Allow actions dragging, fix search and refactor passing of actions to categorized items
* :lipstick: Fix node actions title
* Migrate to the pinia store, add posthog feature and various fixes
* :bug: Fix filtering of trigger actions when not merged
* fix: N8N-5439 — Do not use simple node item when at NodeHelperPanel root
* :bug: Design review fixes
* :bug: Fix disabling of merged actions
* Fix trigger root filtering
* :sparkles: Allow for custom node actions parser, introduce hubspot parser
* :bug: Fix initial node params validation, fix position of second added node
* :bug: Introduce operations category, removed canvas node names overrride, fix API actions display and prevent dragging of action nodes
* :sparkles: Prevent NDV auto-open feature flag
* :bug: Inject recommened action for trigger nodes without actions
* Refactored NodeCreatorNode to Storybook, change filtering of merged nodes for the trigger helper panel, minor fixes
* Improve rendering of app nodes and animation
* Cleanup, any only enable accordion transition on triggerhelperpanel
* Hide node creator scrollbars in Firefox
* Minor styles fixes
* Do not copy the array in rendering method
* Removed unused props
* Fix memory leak
* Fix categorisation of regular nodes with a single resource
* Implement telemetry calls for node actions
* Move categorization to FE
* Fix client side actions categorisation
* Skip custom action show
* Only load tooltip for NodeIcon if necessary
* Fix lodash startCase import
* Remove lodash.startcase
* Cleanup
* Fix node creator autofocus on "tab"
* Prevent posthog getFeatureFlag from crashing
* Debugging preview env search issues
* Remove logs
* Make sure the pre-filled params are update not overwritten
* Get rid of transition in itemiterator
* WIP: Rough version of NodeActions keyboard navigation, replace nodeCreator composable with Pinia store module
* Rewrite to add support for ActionItem to ItemIterator and make CategorizedItems accept items props
* Fix category item counter & cleanup
* Add APIHint to actions search no-result, clean up NodeCreatorNode
* Improve node actions no results message
* Remove logging, fix filtering of recommended placeholder category
* Remove unused NodeActions component and node merging feature falg
* Do not show regular nodes without actions
* Make sure to add manual trigger when adding http node via actions hint
* Fixed api hint footer line height
* Prevent pointer-events od NodeIcon img and remove "this" from template
* Address PR points
* Fix e2e specs
* Make sure canvas ia loaded
* Make sure canvas ia loaded before opening nodeCreator in e2e spec
* Fix flaky workflows tags e2e getter
* Imrpove node creator click outside UX, add manual node to regular nodes added from trigger panel
* Add manual trigger node if dragging regular from trigger panel
2022-12-09 01:56:36 -08:00
|
|
|
nodeCreatorFeature.getters.creatorItem().should('have.length', 0);
|
|
|
|
|
2022-12-15 07:39:59 -08:00
|
|
|
nodeCreatorFeature.getters.searchBar().find('input').clear();
|
2023-02-17 06:08:26 -08:00
|
|
|
nodeCreatorFeature.getters.getCreatorItem('On app event').click();
|
feat(editor): Node creator actions (#4696)
* WIP: Node Actions List UI
* WIP: Recommended Actions and preseting of fields
* WIP: Resource category
* :art: Moved actions categorisation to the server
* :label: Add missing INodeAction type
* :sparkles: Improve SSR categorisation, fix adding of mixed actions
* :recycle: Refactor CategorizedItems to composition api, style fixes
* WIP: Adding multiple nodes
* :recycle: Refactor rest of the NodeCreator component to composition API, conver globalLinkActions to composable
* :sparkles: Allow actions dragging, fix search and refactor passing of actions to categorized items
* :lipstick: Fix node actions title
* Migrate to the pinia store, add posthog feature and various fixes
* :bug: Fix filtering of trigger actions when not merged
* fix: N8N-5439 — Do not use simple node item when at NodeHelperPanel root
* :bug: Design review fixes
* :bug: Fix disabling of merged actions
* Fix trigger root filtering
* :sparkles: Allow for custom node actions parser, introduce hubspot parser
* :bug: Fix initial node params validation, fix position of second added node
* :bug: Introduce operations category, removed canvas node names overrride, fix API actions display and prevent dragging of action nodes
* :sparkles: Prevent NDV auto-open feature flag
* :bug: Inject recommened action for trigger nodes without actions
* Refactored NodeCreatorNode to Storybook, change filtering of merged nodes for the trigger helper panel, minor fixes
* Improve rendering of app nodes and animation
* Cleanup, any only enable accordion transition on triggerhelperpanel
* Hide node creator scrollbars in Firefox
* Minor styles fixes
* Do not copy the array in rendering method
* Removed unused props
* Fix memory leak
* Fix categorisation of regular nodes with a single resource
* Implement telemetry calls for node actions
* Move categorization to FE
* Fix client side actions categorisation
* Skip custom action show
* Only load tooltip for NodeIcon if necessary
* Fix lodash startCase import
* Remove lodash.startcase
* Cleanup
* Fix node creator autofocus on "tab"
* Prevent posthog getFeatureFlag from crashing
* Debugging preview env search issues
* Remove logs
* Make sure the pre-filled params are update not overwritten
* Get rid of transition in itemiterator
* WIP: Rough version of NodeActions keyboard navigation, replace nodeCreator composable with Pinia store module
* Rewrite to add support for ActionItem to ItemIterator and make CategorizedItems accept items props
* Fix category item counter & cleanup
* Add APIHint to actions search no-result, clean up NodeCreatorNode
* Improve node actions no results message
* Remove logging, fix filtering of recommended placeholder category
* Remove unused NodeActions component and node merging feature falg
* Do not show regular nodes without actions
* Make sure to add manual trigger when adding http node via actions hint
* Fixed api hint footer line height
* Prevent pointer-events od NodeIcon img and remove "this" from template
* Address PR points
* Fix e2e specs
* Make sure canvas ia loaded
* Make sure canvas ia loaded before opening nodeCreator in e2e spec
* Fix flaky workflows tags e2e getter
* Imrpove node creator click outside UX, add manual node to regular nodes added from trigger panel
* Add manual trigger node if dragging regular from trigger panel
2022-12-09 01:56:36 -08:00
|
|
|
|
2022-11-25 04:52:33 -08:00
|
|
|
nodeCreatorFeature.getters.searchBar().find('input').clear().type('edit image');
|
2023-02-17 06:08:26 -08:00
|
|
|
nodeCreatorFeature.getters.getCreatorItem('Results in other categories (1)').should('exist');
|
|
|
|
nodeCreatorFeature.getters.creatorItem().should('have.length', 2);
|
2022-11-25 04:52:33 -08:00
|
|
|
nodeCreatorFeature.getters.getCreatorItem('Edit Image').should('exist');
|
2023-02-17 06:08:26 -08:00
|
|
|
nodeCreatorFeature.getters.searchBar().find('input').clear().type('edit image123123');
|
|
|
|
nodeCreatorFeature.getters.creatorItem().should('have.length', 0);
|
2022-12-15 07:39:59 -08:00
|
|
|
});
|
2022-11-25 04:52:33 -08:00
|
|
|
|
2023-02-17 06:08:26 -08:00
|
|
|
it('should check correct view panels', () => {
|
2022-11-25 04:52:33 -08:00
|
|
|
nodeCreatorFeature.getters.canvasAddButton().click();
|
2023-02-17 06:08:26 -08:00
|
|
|
WorkflowPage.actions.addNodeToCanvas('Manual', false);
|
2022-11-25 04:52:33 -08:00
|
|
|
|
|
|
|
nodeCreatorFeature.getters.canvasAddButton().should('not.be.visible');
|
|
|
|
nodeCreatorFeature.getters.nodeCreator().should('not.exist');
|
|
|
|
|
|
|
|
// TODO: Replace once we have canvas feature utils
|
2023-02-17 06:08:26 -08:00
|
|
|
cy.get('div').contains('Add first step').should('be.hidden');
|
|
|
|
nodeCreatorFeature.actions.openNodeCreator()
|
|
|
|
nodeCreatorFeature.getters
|
|
|
|
.nodeCreator()
|
|
|
|
.contains('What happens next?')
|
|
|
|
.should('be.visible');
|
2022-11-25 04:52:33 -08:00
|
|
|
|
2023-02-17 06:08:26 -08:00
|
|
|
nodeCreatorFeature.getters.getCreatorItem('Add another trigger').click();
|
|
|
|
nodeCreatorFeature.getters.nodeCreator().contains('Select a trigger').should('be.visible');
|
|
|
|
nodeCreatorFeature.getters.activeSubcategory().find('button').should('exist');
|
|
|
|
nodeCreatorFeature.getters.activeSubcategory().find('button').click();
|
|
|
|
nodeCreatorFeature.getters
|
|
|
|
.nodeCreator()
|
|
|
|
.contains('What happens next?')
|
|
|
|
.should('be.visible');
|
2022-12-15 07:39:59 -08:00
|
|
|
});
|
2022-11-25 04:52:33 -08:00
|
|
|
|
2023-02-17 06:08:26 -08:00
|
|
|
it('should add node to canvas from actions panel', () => {
|
|
|
|
const editImageNode = 'Edit Image';
|
|
|
|
nodeCreatorFeature.actions.openNodeCreator();
|
|
|
|
nodeCreatorFeature.getters.searchBar().find('input').clear().type(editImageNode);
|
|
|
|
nodeCreatorFeature.getters.getCreatorItem(editImageNode).click();
|
|
|
|
nodeCreatorFeature.getters.activeSubcategory().should('have.text', editImageNode);
|
|
|
|
nodeCreatorFeature.getters.getCreatorItem('Crop Image').click();
|
|
|
|
NDVModal.getters.parameterInput('operation').should('contain.text', 'Crop');
|
|
|
|
})
|
|
|
|
|
2023-02-20 06:59:38 -08:00
|
|
|
it('should search through actions and confirm added action', () => {
|
|
|
|
nodeCreatorFeature.actions.openNodeCreator();
|
|
|
|
nodeCreatorFeature.getters.searchBar().find('input').clear().type('ftp');
|
|
|
|
nodeCreatorFeature.getters.searchBar().find('input').realPress('{rightarrow}');
|
|
|
|
nodeCreatorFeature.getters.activeSubcategory().should('have.text', 'FTP');
|
|
|
|
nodeCreatorFeature.getters.searchBar().find('input').clear().type('file');
|
|
|
|
// Navigate to rename action which should be the 4th item
|
|
|
|
nodeCreatorFeature.getters.searchBar().find('input').realPress('{downarrow}');
|
|
|
|
nodeCreatorFeature.getters.searchBar().find('input').realPress('{downarrow}');
|
|
|
|
nodeCreatorFeature.getters.searchBar().find('input').realPress('{downarrow}');
|
|
|
|
nodeCreatorFeature.getters.searchBar().find('input').realPress('{rightarrow}');
|
|
|
|
NDVModal.getters.parameterInput('operation').should('contain.text', 'Rename');
|
|
|
|
})
|
|
|
|
|
2022-11-25 08:01:49 -08:00
|
|
|
it('should render and select community node', () => {
|
2023-02-03 04:14:59 -08:00
|
|
|
cy.intercept('GET', '/types/nodes.json').as('nodesIntercept');
|
2022-11-25 04:52:33 -08:00
|
|
|
cy.wait('@nodesIntercept').then(() => {
|
|
|
|
const customNode = 'E2E Node';
|
|
|
|
|
|
|
|
nodeCreatorFeature.actions.openNodeCreator();
|
2023-02-17 06:08:26 -08:00
|
|
|
nodeCreatorFeature.getters.searchBar().find('input').clear().type(customNode);
|
2022-11-25 04:52:33 -08:00
|
|
|
|
2022-12-15 07:39:59 -08:00
|
|
|
nodeCreatorFeature.getters
|
|
|
|
.getCreatorItem(customNode)
|
|
|
|
.findChildByTestId('node-creator-item-tooltip')
|
|
|
|
.should('exist');
|
2022-11-25 04:52:33 -08:00
|
|
|
nodeCreatorFeature.actions.selectNode(customNode);
|
|
|
|
|
|
|
|
// TODO: Replace once we have canvas feature utils
|
|
|
|
cy.get('.data-display .node-name').contains(customNode).should('exist');
|
|
|
|
|
2022-12-15 07:39:59 -08:00
|
|
|
const nodeParameters = () => cy.getByTestId('node-parameters');
|
2022-11-25 04:52:33 -08:00
|
|
|
const firstParameter = () => nodeParameters().find('.parameter-item').eq(0);
|
|
|
|
const secondParameter = () => nodeParameters().find('.parameter-item').eq(1);
|
|
|
|
|
|
|
|
// Check correct fields are rendered
|
2022-12-15 07:39:59 -08:00
|
|
|
nodeParameters().should('exist');
|
2022-11-25 04:52:33 -08:00
|
|
|
// Test property text input
|
|
|
|
firstParameter().contains('Test property').should('exist');
|
|
|
|
firstParameter().find('input.el-input__inner').should('have.value', 'Some default');
|
|
|
|
// Resource select input
|
|
|
|
secondParameter().find('label').contains('Resource').should('exist');
|
|
|
|
secondParameter().find('input.el-input__inner').should('have.value', 'option2');
|
|
|
|
secondParameter().find('.el-select').click();
|
2022-12-15 07:39:59 -08:00
|
|
|
secondParameter().find('.el-select-dropdown__list').should('exist');
|
2022-11-25 04:52:33 -08:00
|
|
|
// Check if all options are rendered and select the fourth one
|
|
|
|
secondParameter().find('.el-select-dropdown__list').children().should('have.length', 4);
|
2022-12-15 07:39:59 -08:00
|
|
|
secondParameter()
|
|
|
|
.find('.el-select-dropdown__list')
|
|
|
|
.children()
|
|
|
|
.eq(3)
|
|
|
|
.contains('option4')
|
|
|
|
.should('exist')
|
|
|
|
.click();
|
2022-11-25 04:52:33 -08:00
|
|
|
secondParameter().find('input.el-input__inner').should('have.value', 'option4');
|
2022-12-15 07:39:59 -08:00
|
|
|
});
|
|
|
|
});
|
2022-11-25 04:52:33 -08:00
|
|
|
});
|