mirror of
https://github.com/n8n-io/n8n.git
synced 2026-08-02 14:05:33 +02:00
chore: Route AI builder/assistant test selectors through page objects (#33145)
Some checks are pending
CI: Master (Build, Test, Lint) / Build for Github Cache (push) Waiting to run
CI: Master (Build, Test, Lint) / Unit tests (22.22.3) (push) Waiting to run
CI: Master (Build, Test, Lint) / Unit tests (24.16.0) (push) Waiting to run
CI: Master (Build, Test, Lint) / Lint (push) Waiting to run
CI: Master (Build, Test, Lint) / Performance (push) Waiting to run
CI: Master (Build, Test, Lint) / Notify Slack on failure (push) Blocked by required conditions
Some checks are pending
CI: Master (Build, Test, Lint) / Build for Github Cache (push) Waiting to run
CI: Master (Build, Test, Lint) / Unit tests (22.22.3) (push) Waiting to run
CI: Master (Build, Test, Lint) / Unit tests (24.16.0) (push) Waiting to run
CI: Master (Build, Test, Lint) / Lint (push) Waiting to run
CI: Master (Build, Test, Lint) / Performance (push) Waiting to run
CI: Master (Build, Test, Lint) / Notify Slack on failure (push) Blocked by required conditions
Co-authored-by: n8n-cat-bot[bot] <n8n-cat-bot[bot]@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
f0164ebc5e
commit
229adbb2fe
|
|
@ -106,7 +106,7 @@ export class AIAssistantPage extends BasePage {
|
|||
}
|
||||
|
||||
getCredentialEditAssistantButton() {
|
||||
return this.page.getByTestId('credential-edit-ask-assistant-button');
|
||||
return this.page.getByTestId('credential-edit-ask-assistant-button').locator('button');
|
||||
}
|
||||
|
||||
getCodeSnippet() {
|
||||
|
|
|
|||
|
|
@ -653,6 +653,12 @@ export class CanvasPage extends BasePage {
|
|||
);
|
||||
}
|
||||
|
||||
getAddConnectionButtonBetweenNodes(sourceNodeName: string, targetNodeName: string): Locator {
|
||||
return this.connectionToolbarBetweenNodes(sourceNodeName, targetNodeName).getByTestId(
|
||||
'add-connection-button',
|
||||
);
|
||||
}
|
||||
|
||||
// Canvas action helpers
|
||||
async addNodeBetweenNodes(
|
||||
sourceNodeName: string,
|
||||
|
|
|
|||
|
|
@ -35,6 +35,14 @@ export class AIBuilderPage {
|
|||
return this.page.getByTestId('canvas-build-with-ai-button');
|
||||
}
|
||||
|
||||
getExecuteAndRefineButton() {
|
||||
return this.page.getByRole('button', { name: 'Execute and refine' });
|
||||
}
|
||||
|
||||
getTaskAbortedMessage() {
|
||||
return this.page.getByText('Task aborted');
|
||||
}
|
||||
|
||||
// #endregion
|
||||
|
||||
// #region Actions
|
||||
|
|
|
|||
|
|
@ -31,9 +31,7 @@ test.describe(
|
|||
|
||||
await expect(n8n.canvas.credentialModal.getModal()).toBeVisible();
|
||||
|
||||
const assistantButton = n8n.aiAssistant
|
||||
.getCredentialEditAssistantButton()
|
||||
.locator('button');
|
||||
const assistantButton = n8n.aiAssistant.getCredentialEditAssistantButton();
|
||||
await expect(assistantButton).toBeVisible();
|
||||
await assistantButton.click();
|
||||
|
||||
|
|
@ -58,9 +56,7 @@ test.describe(
|
|||
await n8n.workflows.addResource.credential();
|
||||
await n8n.credentials.selectCredentialType('Notion API');
|
||||
|
||||
const assistantButton = n8n.aiAssistant
|
||||
.getCredentialEditAssistantButton()
|
||||
.locator('button');
|
||||
const assistantButton = n8n.aiAssistant.getCredentialEditAssistantButton();
|
||||
await expect(assistantButton).toBeVisible();
|
||||
await assistantButton.click();
|
||||
|
||||
|
|
|
|||
|
|
@ -85,7 +85,10 @@ test.describe(
|
|||
// eslint-disable-next-line playwright/no-force-option
|
||||
await specificConnection.hover({ force: true });
|
||||
|
||||
const addNodeButton = n8n.page.getByTestId('add-connection-button');
|
||||
const addNodeButton = n8n.canvas.getAddConnectionButtonBetweenNodes(
|
||||
AI_TOOL_CODE_NODE_NAME,
|
||||
AGENT_NODE_NAME,
|
||||
);
|
||||
await expect(addNodeButton).toBeVisible();
|
||||
await addNodeButton.click();
|
||||
await n8n.canvas.clickNodeCreatorItemName(MANUAL_CHAT_TRIGGER_NODE_NAME);
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ test.describe(
|
|||
expect(nodeCount).toBeGreaterThan(0);
|
||||
|
||||
// Verify "Execute and refine" button appears after workflow is built
|
||||
await expect(n8n.page.getByRole('button', { name: 'Execute and refine' })).toBeVisible();
|
||||
await expect(n8n.aiBuilder.getExecuteAndRefineButton()).toBeVisible();
|
||||
});
|
||||
|
||||
// suffers from the same issue as test above
|
||||
|
|
@ -114,7 +114,7 @@ test.describe(
|
|||
await stopButton.click();
|
||||
|
||||
// Verify "Task aborted" message appears (search by text, not test-id)
|
||||
await expect(n8n.page.getByText('Task aborted')).toBeVisible();
|
||||
await expect(n8n.aiBuilder.getTaskAbortedMessage()).toBeVisible();
|
||||
|
||||
// Verify canvas returns to default state (no nodes added)
|
||||
const nodeCount = await n8n.canvas.getCanvasNodes().count();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user