n8n/packages/testing/playwright/composables/DataTablesComposer.ts
Milorad FIlipović 1f187aafa6
test(editor): Add Data Table e2e tests (no-changelog) (#19196)
Co-authored-by: Svetoslav Dekov <svetoslav.dekov@n8n.io>
2025-10-08 11:19:37 +03:00

37 lines
1.2 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.getNewDataTableConfirmButton().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',
) {
await this.n8n.projectComposer.createProject(projectName);
const { projectId } = await this.n8n.projectComposer.createProject();
await this.n8n.page.goto(`projects/${projectId}/datatables`);
await this.n8n.dataTable.clickDataTableProjectTab();
if (source === 'empty-state') {
await this.n8n.dataTable.clickEmptyStateButton();
} else {
await this.n8n.dataTable.clickAddDataTableAction();
}
await this.n8n.dataTableComposer.createNewDataTable(dataTableName);
await this.n8n.page.goto(`projects/${projectId}/datatables`);
}
}