mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-22 04:10:01 +00:00
test: Add core entry points to allow easier test setup (#18597)
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
import { test, expect } from '../../../fixtures/base';
|
||||
|
||||
test.describe('Core UI Patterns - Building Blocks', () => {
|
||||
test.describe('Entry Point: Home Page', () => {
|
||||
test('should navigate from home', async ({ n8n }) => {
|
||||
await n8n.start.fromHome();
|
||||
expect(n8n.page.url()).toContain('/home/workflows');
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('Entry Point: Blank Canvas', () => {
|
||||
test('should navigate from blank canvas', async ({ n8n }) => {
|
||||
await n8n.start.fromBlankCanvas();
|
||||
await expect(n8n.canvas.canvasPane()).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('Entry Point: Basic Workflow Creation', () => {
|
||||
test('should create a new project and workflow', async ({ n8n }) => {
|
||||
await n8n.start.fromNewProject();
|
||||
await expect(n8n.canvas.canvasPane()).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
test.describe('Entry Point: Imported Workflow', () => {
|
||||
test('should import a webhook workflow', async ({ n8n }) => {
|
||||
const workflowImportResult = await n8n.start.fromImportedWorkflow('simple-webhook-test.json');
|
||||
const { webhookPath } = workflowImportResult;
|
||||
|
||||
const testPayload = { message: 'Hello from Playwright test' };
|
||||
|
||||
await n8n.canvas.clickExecuteWorkflowButton();
|
||||
await expect(n8n.canvas.getExecuteWorkflowButton()).toHaveText('Waiting for trigger event');
|
||||
|
||||
const webhookResponse = await n8n.page.request.post(`/webhook-test/${webhookPath}`, {
|
||||
data: testPayload,
|
||||
});
|
||||
|
||||
expect(webhookResponse.ok()).toBe(true);
|
||||
});
|
||||
|
||||
test('should import a workflow', async ({ n8n }) => {
|
||||
await n8n.start.fromImportedWorkflow('manual.json');
|
||||
await n8n.workflowComposer.executeWorkflowAndWaitForNotification('Success');
|
||||
await expect(n8n.canvas.canvasPane()).toBeVisible();
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,23 +1,22 @@
|
||||
import { test, expect } from '../../fixtures/base';
|
||||
import { importAndActivateWebhookWorkflow, triggerWebhook } from '../../services/webhook-helper';
|
||||
|
||||
test.describe('External Webhook Triggering @auth:owner', () => {
|
||||
test.describe('External Webhook Triggering', () => {
|
||||
test('should create workflow via API, activate it, trigger webhook externally, and verify execution', async ({
|
||||
api,
|
||||
}) => {
|
||||
const { webhookPath, workflowId } = await importAndActivateWebhookWorkflow(
|
||||
api,
|
||||
const { webhookPath, workflowId } = await api.workflowApi.importWorkflow(
|
||||
'simple-webhook-test.json',
|
||||
);
|
||||
|
||||
const testPayload = { message: 'Hello from Playwright test' };
|
||||
|
||||
const webhookResponse = await triggerWebhook(api, webhookPath, {
|
||||
const webhookResponse = await api.request.post(`/webhook/${webhookPath}`, {
|
||||
data: testPayload,
|
||||
});
|
||||
|
||||
expect(webhookResponse.ok()).toBe(true);
|
||||
|
||||
const execution = await api.workflowApi.waitForExecution(workflowId, 10000);
|
||||
const execution = await api.workflowApi.waitForExecution(workflowId, 5000);
|
||||
expect(execution.status).toBe('success');
|
||||
|
||||
const executionDetails = await api.workflowApi.getExecution(execution.id);
|
||||
|
||||
Reference in New Issue
Block a user