Files
alighasami 3d5eaf9445
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
first commit
2026-03-17 16:22:57 +03:30

53 lines
2.0 KiB
TypeScript

import { IF_NODE_NAME } from '../../../config/constants';
import { test, expect } from '../../../fixtures/base';
const FILTER_PARAM_NAME = 'conditions';
test.describe('If Node (filter component)', {
annotation: [
{ type: 'owner', description: 'NODES' },
],
}, () => {
test.beforeEach(async ({ n8n }) => {
await n8n.start.fromBlankCanvas();
});
test('should be able to create and delete multiple conditions', async ({ n8n }) => {
await n8n.canvas.addNode(IF_NODE_NAME, { closeNDV: false });
// Default state
await expect(n8n.ndv.getFilterComponent(FILTER_PARAM_NAME)).toBeVisible();
await expect(n8n.ndv.getFilterConditions(FILTER_PARAM_NAME)).toHaveCount(1);
await expect(n8n.ndv.getFilterConditionOperator(FILTER_PARAM_NAME)).toHaveText('is equal to');
// Add
await n8n.ndv.addFilterCondition(FILTER_PARAM_NAME);
await n8n.ndv.getFilterConditionLeft(FILTER_PARAM_NAME, 0).locator('input').fill('first left');
await n8n.ndv.getFilterConditionLeft(FILTER_PARAM_NAME, 1).locator('input').fill('second left');
await n8n.ndv.addFilterCondition(FILTER_PARAM_NAME);
await expect(n8n.ndv.getFilterConditions(FILTER_PARAM_NAME)).toHaveCount(3);
// Delete
await n8n.ndv.removeFilterCondition(FILTER_PARAM_NAME, 0);
await expect(n8n.ndv.getFilterConditions(FILTER_PARAM_NAME)).toHaveCount(2);
await expect(n8n.ndv.getFilterConditionLeft(FILTER_PARAM_NAME, 0).locator('input')).toHaveValue(
'second left',
);
await n8n.ndv.removeFilterCondition(FILTER_PARAM_NAME, 1);
await expect(n8n.ndv.getFilterConditions(FILTER_PARAM_NAME)).toHaveCount(1);
});
test('should correctly evaluate conditions', async ({ n8n }) => {
await n8n.start.fromImportedWorkflow('Test_workflow_filter.json');
await n8n.canvas.clickExecuteWorkflowButton();
await n8n.canvas.openNode('Then');
await expect(n8n.ndv.outputPanel.get()).toContainText('3 items');
await n8n.ndv.close();
await n8n.canvas.openNode('Else');
await expect(n8n.ndv.outputPanel.get()).toContainText('1 item');
});
});