test: Add core entry points to allow easier test setup (#18597)

This commit is contained in:
shortstacked
2025-08-20 16:17:57 +01:00
committed by GitHub
parent cf76165457
commit 413b14b286
15 changed files with 311 additions and 197 deletions

View File

@@ -3,10 +3,6 @@ import type { Locator } from '@playwright/test';
import { BasePage } from './BasePage';
export class WorkflowsPage extends BasePage {
async clickNewWorkflowCard() {
await this.clickByTestId('new-workflow-card');
}
async clickAddFirstProjectButton() {
await this.clickByTestId('add-first-project-button');
}
@@ -15,10 +11,20 @@ export class WorkflowsPage extends BasePage {
await this.clickByTestId('project-plus-button');
}
/**
* This is the add workflow button on the workflows page, visible when there are already workflows.
*/
async clickAddWorkflowButton() {
await this.clickByTestId('add-resource-workflow');
}
/**
* This is the new workflow button on the workflows page, visible when there are no workflows.
*/
async clickNewWorkflowCard() {
await this.clickByTestId('new-workflow-card');
}
getNewWorkflowCard() {
return this.page.getByTestId('new-workflow-card');
}

View File

@@ -19,11 +19,14 @@ import { WorkflowSharingModal } from './WorkflowSharingModal';
import { WorkflowsPage } from './WorkflowsPage';
import { CanvasComposer } from '../composables/CanvasComposer';
import { ProjectComposer } from '../composables/ProjectComposer';
import { TestEntryComposer } from '../composables/TestEntryComposer';
import { WorkflowComposer } from '../composables/WorkflowComposer';
import type { ApiHelpers } from '../services/api-helper';
// eslint-disable-next-line @typescript-eslint/naming-convention
export class n8nPage {
readonly page: Page;
readonly api: ApiHelpers;
// Pages
readonly aiAssistant: AIAssistantPage;
@@ -51,9 +54,11 @@ export class n8nPage {
readonly workflowComposer: WorkflowComposer;
readonly projectComposer: ProjectComposer;
readonly canvasComposer: CanvasComposer;
readonly start: TestEntryComposer;
constructor(page: Page) {
constructor(page: Page, api: ApiHelpers) {
this.page = page;
this.api = api;
// Pages
this.aiAssistant = new AIAssistantPage(page);
@@ -81,6 +86,7 @@ export class n8nPage {
this.workflowComposer = new WorkflowComposer(this);
this.projectComposer = new ProjectComposer(this);
this.canvasComposer = new CanvasComposer(this);
this.start = new TestEntryComposer(this);
}
async goHome() {