Files
n8n/packages/testing/playwright/composables/NodeDetailsViewComposer.ts
alighasami 3d5eaf9445
Some checks failed
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

67 lines
2.2 KiB
TypeScript

import type { n8nPage } from '../pages/n8nPage';
/**
* A class for user interactions with Node Details View (NDV) that involve multi-step workflows.
*/
export class NodeDetailsViewComposer {
constructor(private readonly n8n: n8nPage) {}
/**
* Selects a workflow from the resource locator list by name
* @param paramName - The parameter name for the resource locator
* @param workflowName - The name of the workflow to select
*/
async selectWorkflowFromList(paramName: string, workflowName: string): Promise<void> {
await this.n8n.ndv.openResourceLocator(paramName);
const items = this.n8n.page.getByTestId('rlc-item');
const targetItem = items.filter({ hasText: workflowName });
await targetItem.first().click();
}
/**
* Filters the resource locator list by search term
* @param paramName - The parameter name for the resource locator
* @param searchTerm - The term to search for
*/
async filterWorkflowList(paramName: string, searchTerm: string): Promise<void> {
await this.n8n.ndv.openResourceLocator(paramName);
await this.n8n.ndv.getResourceLocatorSearch(paramName).fill(searchTerm);
}
/**
* Selects the first workflow item from a filtered list
*/
async selectFirstFilteredWorkflow(): Promise<void> {
const items = this.n8n.page.getByTestId('rlc-item');
await items.first().click();
}
/**
* Switches a resource locator to expression mode
* @param paramName - The parameter name for the resource locator
* @param workflowName - The workflow to select before switching to expression mode
*/
async switchToExpressionMode(paramName: string, workflowName?: string): Promise<void> {
if (workflowName) {
await this.selectWorkflowFromList(paramName, workflowName);
}
// Switch to expression mode
await this.n8n.page.getByTestId('radio-button-expression').nth(1).click();
}
/**
* Clicks add resource option to create a new sub-workflow
* @param paramName - The parameter name for the resource locator
*/
async createNewSubworkflow(paramName: string): Promise<void> {
await this.n8n.ndv.openResourceLocator(paramName);
const addResourceItem = this.n8n.page.getByTestId('rlc-item-add-resource').first();
await addResourceItem.waitFor({ state: 'visible' });
await addResourceItem.click();
}
}