mirror of
https://github.com/n8n-io/n8n.git
synced 2026-10-19 16:55:02 +02:00
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com> Co-authored-by: Cursor <cursoragent@cursor.com>
38 lines
1.2 KiB
TypeScript
38 lines
1.2 KiB
TypeScript
import type { Locator, Page } from '@playwright/test';
|
|
|
|
import { BasePage } from './BasePage';
|
|
|
|
export class AgentBuilderPage extends BasePage {
|
|
constructor(page: Page) {
|
|
super(page);
|
|
}
|
|
|
|
async goto(projectId: string, agentId: string): Promise<void> {
|
|
await this.page.goto(`/projects/${projectId}/agents/${agentId}`);
|
|
}
|
|
|
|
getHeader(): Locator {
|
|
// The agents feature uses `data-testid`, not the `data-test-id` attribute
|
|
// configured for `getByTestId`, so target the attribute directly.
|
|
return this.page.locator('[data-testid="agent-builder-header"]');
|
|
}
|
|
|
|
getCollaborationBanner(): Locator {
|
|
return this.page.getByTestId('agent-collaboration-banner');
|
|
}
|
|
|
|
getCollaborationTakeOverButton(): Locator {
|
|
return this.page.getByTestId('agent-collaboration-take-over');
|
|
}
|
|
|
|
/** Triggers a config edit by changing the agent name, which acquires the
|
|
* write lock under the lazy-acquisition pattern. */
|
|
async editAgentName(name: string): Promise<void> {
|
|
const edit = this.page.locator('[data-testid="agent-name-inline-edit"]');
|
|
await edit.click();
|
|
await edit.locator('input, textarea').fill(name);
|
|
// Blur to trigger the update event
|
|
await edit.locator('input, textarea').press('Enter');
|
|
}
|
|
}
|