fix: 修复TypeScript配置错误并更新项目文档
详细说明: - 修复了@n8n/config包的TypeScript配置错误 - 移除了不存在的jest-expect-message类型引用 - 清理了所有TypeScript构建缓存 - 更新了可行性分析文档,添加了技术实施方案 - 更新了Agent prompt文档 - 添加了会展策划工作流文档 - 包含了n8n-chinese-translation子项目 - 添加了exhibition-demo展示系统框架
This commit is contained in:
55
n8n-n8n-1.109.2/packages/testing/playwright/composables/ProjectComposer 2.ts
Executable file
55
n8n-n8n-1.109.2/packages/testing/playwright/composables/ProjectComposer 2.ts
Executable file
@@ -0,0 +1,55 @@
|
||||
import { nanoid } from 'nanoid';
|
||||
|
||||
import type { n8nPage } from '../pages/n8nPage';
|
||||
|
||||
export class ProjectComposer {
|
||||
constructor(private readonly n8n: n8nPage) {}
|
||||
|
||||
/**
|
||||
* Create a project and return the project name and ID. If no project name is provided, a unique name will be generated.
|
||||
* @param projectName - The name of the project to create.
|
||||
* @returns The project name and ID.
|
||||
*/
|
||||
async createProject(projectName?: string) {
|
||||
await this.n8n.page.getByTestId('universal-add').click();
|
||||
await this.n8n.page.getByTestId('navigation-menu-item').filter({ hasText: 'Project' }).click();
|
||||
await this.n8n.notifications.waitForNotificationAndClose('saved successfully');
|
||||
await this.n8n.page.waitForLoadState();
|
||||
const projectNameUnique = projectName ?? `Project ${nanoid(8)}`;
|
||||
await this.n8n.projectSettings.fillProjectName(projectNameUnique);
|
||||
await this.n8n.projectSettings.clickSaveButton();
|
||||
const projectId = this.extractProjectIdFromPage('projects', 'settings');
|
||||
return { projectName: projectNameUnique, projectId };
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new credential to a project.
|
||||
* @param projectName - The name of the project to add the credential to.
|
||||
* @param credentialType - The type of credential to add by visible name e.g 'Notion API'
|
||||
* @param credentialFieldName - The name of the field to add the credential to. e.g. 'apiKey' which would be data-test-id='parameter-input-apiKey'
|
||||
* @param credentialValue - The value of the credential to add.
|
||||
*/
|
||||
async addCredentialToProject(
|
||||
projectName: string,
|
||||
credentialType: string,
|
||||
credentialFieldName: string,
|
||||
credentialValue: string,
|
||||
) {
|
||||
await this.n8n.sideBar.openNewCredentialDialogForProject(projectName);
|
||||
await this.n8n.credentials.openNewCredentialDialogFromCredentialList(credentialType);
|
||||
await this.n8n.credentials.fillCredentialField(credentialFieldName, credentialValue);
|
||||
await this.n8n.credentials.saveCredential();
|
||||
await this.n8n.notifications.waitForNotificationAndClose('Credential successfully created');
|
||||
await this.n8n.credentials.closeCredentialDialog();
|
||||
}
|
||||
|
||||
extractIdFromUrl(url: string, beforeWord: string, afterWord: string): string {
|
||||
const path = url.includes('://') ? new URL(url).pathname : url;
|
||||
const match = path.match(new RegExp(`/${beforeWord}/([^/]+)/${afterWord}`));
|
||||
return match?.[1] ?? '';
|
||||
}
|
||||
|
||||
extractProjectIdFromPage(beforeWord: string, afterWord: string): string {
|
||||
return this.extractIdFromUrl(this.n8n.page.url(), beforeWord, afterWord);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user