Files
n8n/packages/testing/playwright/composables/DataTablesComposer.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

43 lines
1.4 KiB
TypeScript

import type { n8nPage } from '../pages/n8nPage';
export class DataTableComposer {
constructor(private readonly n8n: n8nPage) {}
async createNewDataTable(name: string) {
const nameInput = this.n8n.dataTable.getNewDataTableNameInput();
await nameInput.fill(name);
await this.n8n.dataTable.getFromScratchOption().click();
await this.n8n.dataTable.getProceedFromSelectButton().click();
}
/**
* Creates project and data table inside it, navigating to project 'Data Table' tab
* @param projectName
* @param dataTableName
* @param source - from where the creation is initiated (empty state or header dropdown)
*/
async createDataTableInNewProject(
projectName: string,
dataTableName: string,
source: 'empty-state' | 'header-dropdown',
fromDataTableTab: boolean = true,
) {
await this.n8n.projectComposer.createProject(projectName);
const { projectId } = await this.n8n.projectComposer.createProject();
if (fromDataTableTab) {
await this.n8n.page.goto(`projects/${projectId}/datatables`);
} else {
await this.n8n.page.goto(`projects/${projectId}`);
}
if (source === 'empty-state') {
await this.n8n.dataTable.clickEmptyStateButton();
} else {
await this.n8n.dataTable.clickAddDataTableAction(fromDataTableTab);
}
await this.n8n.dataTableComposer.createNewDataTable(dataTableName);
await this.n8n.page.goto(`projects/${projectId}/datatables`);
}
}