mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
refactor: Set up Cypress as pnpm workspace (no-changelog) (#6049)
Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import { BasePage } from '../base';
|
||||
import { INodeTypeDescription } from 'n8n-workflow';
|
||||
|
||||
export class NodeCreator extends BasePage {
|
||||
url = '/workflow/new';
|
||||
|
||||
getters = {
|
||||
plusButton: () => cy.getByTestId('node-creator-plus-button'),
|
||||
canvasAddButton: () => cy.getByTestId('canvas-add-button'),
|
||||
@@ -25,6 +25,7 @@ export class NodeCreator extends BasePage {
|
||||
expandedCategories: () =>
|
||||
this.getters.creatorItem().find('>div').filter('.active').invoke('text'),
|
||||
};
|
||||
|
||||
actions = {
|
||||
openNodeCreator: () => {
|
||||
this.getters.plusButton().click();
|
||||
@@ -33,31 +34,5 @@ export class NodeCreator extends BasePage {
|
||||
selectNode: (displayName: string) => {
|
||||
this.getters.getCreatorItem(displayName).click();
|
||||
},
|
||||
toggleCategory: (category: string) => {
|
||||
this.getters.getCreatorItem(category).click();
|
||||
},
|
||||
categorizeNodes: (nodes: INodeTypeDescription[]) => {
|
||||
const categorizedNodes = nodes.reduce((acc, node) => {
|
||||
const categories = (node?.codex?.categories || []).map((category: string) =>
|
||||
category.trim(),
|
||||
);
|
||||
|
||||
categories.forEach((category: { [key: string]: INodeTypeDescription[] }) => {
|
||||
// Node creator should show only the latest version of a node
|
||||
const newerVersion = nodes.find(
|
||||
(n: INodeTypeDescription) =>
|
||||
n.name === node.name && (n.version > node.version || Array.isArray(n.version)),
|
||||
);
|
||||
|
||||
if (acc[category] === undefined) {
|
||||
acc[category] = [];
|
||||
}
|
||||
acc[category].push(newerVersion ?? node);
|
||||
});
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
return categorizedNodes;
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user