fix: Add Exact Match Option for NDV (no-changelog) (#15787)

Co-authored-by: Eugene Molodkin <eugene@n8n.io>
This commit is contained in:
shortstacked
2025-05-28 13:34:06 +01:00
committed by GitHub
parent 8ebfe794e1
commit b0b674e85a
6 changed files with 73 additions and 35 deletions

View File

@@ -36,6 +36,10 @@ export function getInputSelect() {
return cy.getByTestId('ndv-input-select').find('input');
}
export function getInputLinkRun() {
return getInputPanel().findChildByTestId('link-run');
}
export function getMainPanel() {
return cy.getByTestId('node-parameters');
}
@@ -68,6 +72,14 @@ export function getInputTbodyCell(row: number, col: number) {
return getInputTableRows().eq(row).find('td').eq(col);
}
export function getInputRunSelector() {
return getInputPanel().findChildByTestId('run-selector');
}
export function getInputPanelItemsCount() {
return getInputPanel().getByTestId('ndv-items-count');
}
export function getOutputPanelDataContainer() {
return getOutputPanel().findChildByTestId('ndv-data-container');
}
@@ -329,3 +341,7 @@ export function resetHoverState() {
export function setInputDisplayMode(mode: 'Schema' | 'Table' | 'JSON' | 'Binary') {
getInputPanel().findChildByTestId('ndv-run-data-display-mode').contains(mode).click();
}
export function toggleInputRunLinking() {
getInputLinkRun().click();
}

View File

@@ -179,35 +179,52 @@ export function executeWorkflowAndWait(waitForSuccessBannerToDisappear = true) {
}
}
/**
* @param nodeDisplayName - The name of the node to add to the canvas
* @param plusButtonClick - Whether to click the plus button to open the node creator
* @param preventNdvClose - Whether to prevent the Ndv from closing
* @param action - The action to select in the node creator
* @param useExactMatch - Whether to use an exact match for the node name will use selector instead of enter key
*/
export function addNodeToCanvas(
nodeDisplayName: string,
plusButtonClick = true,
preventNdvClose?: boolean,
action?: string,
useExactMatch = false,
) {
if (plusButtonClick) {
getNodeCreatorPlusButton().click();
}
getNodeCreatorSearchBar().type(nodeDisplayName);
getNodeCreatorSearchBar().type('{enter}');
if (useExactMatch) {
cy.getByTestId('node-creator-item-name').contains(nodeDisplayName).click();
} else {
getNodeCreatorSearchBar().type('{enter}');
}
cy.wait(500);
cy.get('body').then((body) => {
if (body.find('[data-test-id=node-creator]').length > 0) {
if (action) {
cy.contains(action).click();
} else {
// Select the first action
cy.get('[data-keyboard-nav-type="action"]').eq(0).click();
}
}
});
if (!preventNdvClose) cy.get('body').type('{esc}');
if (!preventNdvClose) {
cy.get('body').type('{esc}');
}
}
export function navigateToNewWorkflowPage(preventNodeViewUnload = true) {
cy.visit(ROUTES.NEW_WORKFLOW_PAGE);
cy.getByTestId('node-creator-plus-button').should('be.visible');
cy.waitForLoad();
cy.window().then((win) => {
win.preventNodeViewBeforeUnload = preventNodeViewUnload;