2022-12-20 01:33:20 -08:00
|
|
|
import { META_KEY } from '../constants';
|
2022-11-25 04:09:44 -08:00
|
|
|
import { BasePage } from './base';
|
2022-11-11 00:07:14 -08:00
|
|
|
|
|
|
|
export class WorkflowPage extends BasePage {
|
|
|
|
url = '/workflow/new';
|
2022-11-22 01:37:26 -08:00
|
|
|
getters = {
|
2022-12-05 05:31:14 -08:00
|
|
|
workflowNameInputContainer: () => cy.getByTestId('workflow-name-input', { timeout: 5000 }),
|
2022-12-15 07:39:59 -08:00
|
|
|
workflowNameInput: () =>
|
|
|
|
this.getters.workflowNameInputContainer().then(($el) => cy.wrap($el.find('input'))),
|
2022-11-11 00:07:14 -08:00
|
|
|
workflowImportInput: () => cy.getByTestId('workflow-import-input'),
|
|
|
|
workflowTags: () => cy.getByTestId('workflow-tags'),
|
2022-11-25 08:10:28 -08:00
|
|
|
workflowTagsContainer: () => cy.getByTestId('workflow-tags-container'),
|
2022-12-15 07:39:59 -08:00
|
|
|
workflowTagsInput: () =>
|
|
|
|
this.getters.workflowTagsContainer().then(($el) => cy.wrap($el.find('input').first())),
|
2022-12-07 09:16:38 -08:00
|
|
|
workflowTagElements: () => cy.get('[data-test-id="workflow-tags-container"] span.tags > span'),
|
2022-12-15 07:39:59 -08:00
|
|
|
firstWorkflowTagElement: () =>
|
|
|
|
cy.get('[data-test-id="workflow-tags-container"] span.tags > span:nth-child(1)'),
|
2022-12-05 05:31:14 -08:00
|
|
|
workflowTagsDropdown: () => cy.getByTestId('workflow-tags-dropdown'),
|
2022-11-25 08:10:28 -08:00
|
|
|
newTagLink: () => cy.getByTestId('new-tag-link'),
|
2022-11-25 06:32:09 -08:00
|
|
|
saveButton: () => cy.getByTestId('workflow-save-button'),
|
2022-11-25 04:09:44 -08:00
|
|
|
nodeCreatorSearchBar: () => cy.getByTestId('node-creator-search-bar'),
|
|
|
|
nodeCreatorPlusButton: () => cy.getByTestId('node-creator-plus-button'),
|
|
|
|
canvasPlusButton: () => cy.getByTestId('canvas-plus-button'),
|
2022-12-01 00:26:38 -08:00
|
|
|
canvasNodes: () => cy.getByTestId('canvas-node'),
|
2022-12-15 07:39:59 -08:00
|
|
|
canvasNodeByName: (nodeName: string) =>
|
|
|
|
this.getters.canvasNodes().filter(`:contains("${nodeName}")`),
|
2022-12-20 01:33:20 -08:00
|
|
|
successToast: () => cy.get('.el-notification .el-icon-success').parent(),
|
|
|
|
errorToast: () => cy.get('.el-notification .el-icon-error'),
|
2022-11-25 06:32:09 -08:00
|
|
|
activatorSwitch: () => cy.getByTestId('workflow-activate-switch'),
|
|
|
|
workflowMenu: () => cy.getByTestId('workflow-menu'),
|
|
|
|
firstStepButton: () => cy.getByTestId('canvas-add-button'),
|
2022-11-25 08:10:28 -08:00
|
|
|
isWorkflowSaved: () => this.getters.saveButton().should('match', 'span'), // In Element UI, disabled button turn into spans 🤷♂️
|
|
|
|
isWorkflowActivated: () => this.getters.activatorSwitch().should('have.class', 'is-checked'),
|
2022-12-01 04:26:22 -08:00
|
|
|
expressionModalInput: () => cy.getByTestId('expression-modal-input'),
|
|
|
|
expressionModalOutput: () => cy.getByTestId('expression-modal-output'),
|
2022-12-05 05:31:14 -08:00
|
|
|
|
|
|
|
nodeViewRoot: () => cy.getByTestId('node-view-root'),
|
|
|
|
copyPasteInput: () => cy.getByTestId('hidden-copy-paste'),
|
2022-12-14 01:33:44 -08:00
|
|
|
nodeConnections: () => cy.get('.jtk-connector'),
|
|
|
|
zoomToFitButton: () => cy.getByTestId('zoom-to-fit'),
|
|
|
|
nodeEndpoints: () => cy.get('.jtk-endpoint-connected'),
|
|
|
|
disabledNodes: () => cy.get('.node-box.disabled'),
|
2022-12-20 01:33:20 -08:00
|
|
|
selectedNodes: () => this.getters.canvasNodes().filter('.jtk-drag-selected'),
|
2022-12-14 08:13:03 -08:00
|
|
|
// Workflow menu items
|
|
|
|
workflowMenuItemDuplicate: () => cy.getByTestId('workflow-menu-item-duplicate'),
|
|
|
|
workflowMenuItemDownload: () => cy.getByTestId('workflow-menu-item-download'),
|
|
|
|
workflowMenuItemImportFromURLItem: () => cy.getByTestId('workflow-menu-item-import-from-url'),
|
|
|
|
workflowMenuItemImportFromFile: () => cy.getByTestId('workflow-menu-item-import-from-file'),
|
|
|
|
workflowMenuItemSettings: () => cy.getByTestId('workflow-menu-item-settings'),
|
|
|
|
workflowMenuItemDelete: () => cy.getByTestId('workflow-menu-item-delete'),
|
|
|
|
// Workflow settings dialog elements
|
|
|
|
workflowSettingsModal: () => cy.getByTestId('workflow-settings-dialog'),
|
|
|
|
workflowSettingsErrorWorkflowSelect: () => cy.getByTestId('workflow-settings-error-workflow'),
|
|
|
|
workflowSettingsTimezoneSelect: () => cy.getByTestId('workflow-settings-timezone'),
|
2022-12-15 07:39:59 -08:00
|
|
|
workflowSettingsSaveFiledExecutionsSelect: () =>
|
|
|
|
cy.getByTestId('workflow-settings-save-failed-executions'),
|
|
|
|
workflowSettingsSaveSuccessExecutionsSelect: () =>
|
|
|
|
cy.getByTestId('workflow-settings-save-success-executions'),
|
|
|
|
workflowSettingsSaveManualExecutionsSelect: () =>
|
|
|
|
cy.getByTestId('workflow-settings-save-manual-executions'),
|
|
|
|
workflowSettingsSaveExecutionProgressSelect: () =>
|
|
|
|
cy.getByTestId('workflow-settings-save-execution-progress'),
|
|
|
|
workflowSettingsTimeoutWorkflowSwitch: () =>
|
|
|
|
cy.getByTestId('workflow-settings-timeout-workflow'),
|
2022-12-14 08:13:03 -08:00
|
|
|
workflowSettingsTimeoutForm: () => cy.getByTestId('workflow-settings-timeout-form'),
|
2022-12-15 07:39:59 -08:00
|
|
|
workflowSettingsSaveButton: () =>
|
|
|
|
cy.getByTestId('workflow-settings-save-button').find('button'),
|
2022-12-15 06:36:28 -08:00
|
|
|
|
2022-12-20 01:33:20 -08:00
|
|
|
duplicateWorkflowModal: () => cy.getByTestId('duplicate-modal'),
|
|
|
|
nodeViewBackground: () => cy.getByTestId('node-view-background'),
|
|
|
|
nodeView: () => cy.getByTestId('node-view'),
|
2022-12-15 06:36:28 -08:00
|
|
|
inlineExpressionEditorInput: () => cy.getByTestId('inline-expression-editor-input'),
|
|
|
|
inlineExpressionEditorOutput: () => cy.getByTestId('inline-expression-editor-output'),
|
2022-12-20 01:33:20 -08:00
|
|
|
zoomInButton: () => cy.getByTestId('zoom-in-button'),
|
|
|
|
zoomOutButton: () => cy.getByTestId('zoom-out-button'),
|
|
|
|
resetZoomButton: () => cy.getByTestId('reset-zoom-button'),
|
|
|
|
executeWorkflowButton: () => cy.getByTestId('execute-workflow-button'),
|
2022-11-25 04:09:44 -08:00
|
|
|
};
|
|
|
|
actions = {
|
2022-11-25 08:10:28 -08:00
|
|
|
visit: () => {
|
|
|
|
cy.visit(this.url);
|
2022-12-13 02:55:51 -08:00
|
|
|
cy.waitForLoad();
|
2022-11-25 08:10:28 -08:00
|
|
|
},
|
2022-11-25 04:09:44 -08:00
|
|
|
addInitialNodeToCanvas: (nodeDisplayName: string) => {
|
|
|
|
this.getters.canvasPlusButton().click();
|
|
|
|
this.getters.nodeCreatorSearchBar().type(nodeDisplayName);
|
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
|
|
|
this.getters.nodeCreatorSearchBar().type('{enter}');
|
|
|
|
cy.get('body').type('{esc}');
|
2022-11-25 04:09:44 -08:00
|
|
|
},
|
2023-01-16 05:55:58 -08:00
|
|
|
addNodeToCanvas: (nodeDisplayName: string, preventNdvClose?: boolean) => {
|
2022-11-25 04:09:44 -08:00
|
|
|
this.getters.nodeCreatorPlusButton().click();
|
|
|
|
this.getters.nodeCreatorSearchBar().type(nodeDisplayName);
|
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
|
|
|
this.getters.nodeCreatorSearchBar().type('{enter}');
|
2023-01-16 05:55:58 -08:00
|
|
|
|
|
|
|
if (!preventNdvClose) cy.get('body').type('{esc}');
|
2022-11-25 04:09:44 -08:00
|
|
|
},
|
2023-01-18 06:48:36 -08:00
|
|
|
openNode: (nodeTypeName: string) => {
|
2022-12-01 00:26:38 -08:00
|
|
|
this.getters.canvasNodeByName(nodeTypeName).dblclick();
|
2022-11-25 04:09:44 -08:00
|
|
|
},
|
2022-12-15 06:36:28 -08:00
|
|
|
openExpressionEditorModal: () => {
|
2022-12-14 05:43:02 -08:00
|
|
|
cy.contains('Expression').invoke('show').click();
|
|
|
|
cy.getByTestId('expander').invoke('show').click();
|
2022-12-01 04:26:22 -08:00
|
|
|
},
|
2022-12-15 06:36:28 -08:00
|
|
|
openInlineExpressionEditor: () => {
|
|
|
|
cy.contains('Expression').invoke('show').click();
|
|
|
|
this.getters.inlineExpressionEditorInput().click();
|
|
|
|
},
|
2022-11-25 06:32:09 -08:00
|
|
|
openWorkflowMenu: () => {
|
|
|
|
this.getters.workflowMenu().click();
|
|
|
|
},
|
|
|
|
saveWorkflowOnButtonClick: () => {
|
|
|
|
this.getters.saveButton().click();
|
|
|
|
},
|
|
|
|
saveWorkflowUsingKeyboardShortcut: () => {
|
|
|
|
cy.get('body').type('{meta}', { release: false }).type('s');
|
|
|
|
},
|
|
|
|
activateWorkflow: () => {
|
|
|
|
this.getters.activatorSwitch().find('input').first().should('be.enabled');
|
|
|
|
this.getters.activatorSwitch().click();
|
|
|
|
cy.get('body').type('{esc}');
|
|
|
|
},
|
|
|
|
renameWorkflow: (newName: string) => {
|
2022-11-25 08:10:28 -08:00
|
|
|
this.getters.workflowNameInputContainer().click();
|
2022-11-25 06:32:09 -08:00
|
|
|
cy.get('body').type('{selectall}');
|
|
|
|
cy.get('body').type(newName);
|
|
|
|
cy.get('body').type('{enter}');
|
|
|
|
},
|
2022-11-25 08:10:28 -08:00
|
|
|
addTags: (tags: string[]) => {
|
2022-12-15 07:39:59 -08:00
|
|
|
tags.forEach((tag) => {
|
2022-12-05 05:31:14 -08:00
|
|
|
this.getters.workflowTagsInput().type(tag);
|
|
|
|
this.getters.workflowTagsInput().type('{enter}');
|
2022-11-25 08:10:28 -08:00
|
|
|
});
|
|
|
|
cy.get('body').type('{enter}');
|
2022-12-13 02:55:51 -08:00
|
|
|
// For a brief moment the Element UI tag component shows the tags as(+X) string
|
|
|
|
// so we need to wait for it to disappear
|
|
|
|
this.getters.workflowTagsContainer().should('not.contain', `+${tags.length}`);
|
2022-11-25 08:10:28 -08:00
|
|
|
},
|
2022-12-01 00:26:38 -08:00
|
|
|
zoomToFit: () => {
|
|
|
|
cy.getByTestId('zoom-to-fit').click();
|
|
|
|
},
|
2022-12-14 01:33:44 -08:00
|
|
|
hitUndo: () => {
|
2022-12-20 01:33:20 -08:00
|
|
|
cy.get('body').type(META_KEY, { delay: 500, release: false }).type('z');
|
2022-12-14 01:33:44 -08:00
|
|
|
},
|
|
|
|
hitRedo: () => {
|
2022-12-15 07:39:59 -08:00
|
|
|
cy.get('body')
|
2022-12-20 01:33:20 -08:00
|
|
|
.type(META_KEY, { delay: 500, release: false })
|
2022-12-15 07:39:59 -08:00
|
|
|
.type('{shift}', { release: false })
|
|
|
|
.type('z');
|
2022-12-14 01:33:44 -08:00
|
|
|
},
|
|
|
|
selectAll: () => {
|
2022-12-20 01:33:20 -08:00
|
|
|
cy.get('body').type(META_KEY, { delay: 500, release: false }).type('a');
|
2022-12-14 01:33:44 -08:00
|
|
|
},
|
|
|
|
hitDisableNodeShortcut: () => {
|
2022-12-20 01:33:20 -08:00
|
|
|
cy.get('body').type(META_KEY, { delay: 500, release: false }).type('d');
|
|
|
|
},
|
|
|
|
hitCopy: () => {
|
|
|
|
cy.get('body').type(META_KEY, { delay: 500, release: false }).type('c');
|
|
|
|
},
|
|
|
|
hitPaste: () => {
|
|
|
|
cy.get('body').type(META_KEY, { delay: 500, release: false }).type('P');
|
2022-12-14 01:33:44 -08:00
|
|
|
},
|
2023-01-18 06:48:36 -08:00
|
|
|
executeWorkflow: () => {
|
|
|
|
this.getters.executeWorkflowButton().click();
|
|
|
|
},
|
2022-11-11 00:07:14 -08:00
|
|
|
};
|
|
|
|
}
|