Files
alighasami 3d5eaf9445
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
first commit
2026-03-17 16:22:57 +03:30

98 lines
3.2 KiB
TypeScript

import { nanoid } from 'nanoid';
import { test, expect } from '../../../fixtures/base';
test.describe('Credentials', {
annotation: [
{ type: 'owner', description: 'Catalysts' },
],
}, () => {
test('composer: createFromList creates credential', async ({ n8n }) => {
const projectId = await n8n.start.fromNewProject();
const credentialName = `credential-${nanoid()}`;
await n8n.navigate.toCredentials(projectId);
await n8n.credentialsComposer.createFromList(
'Notion API',
{ apiKey: '1234567890' },
{
name: credentialName,
closeDialog: false,
},
);
await expect(n8n.credentials.cards.getCredential(credentialName)).toBeVisible();
});
test('composer: createFromNdv creates credential for node', async ({ n8n }) => {
const name = `credential-${nanoid()}`;
await n8n.start.fromNewProjectBlankCanvas();
await n8n.canvas.addNode('Manual Trigger');
await n8n.canvas.addNode('Notion', { action: 'Append a block' });
await n8n.credentialsComposer.createFromNdv({ apiKey: '1234567890' }, { name });
await expect(n8n.ndv.getCredentialSelect()).toHaveValue(name);
});
test('composer: createFromApi creates credential (then NDV picks it up)', async ({ n8n }) => {
const name = `credential-${nanoid()}`;
const projectId = await n8n.start.fromNewProjectBlankCanvas();
await n8n.credentialsComposer.createFromApi({
name,
type: 'notionApi',
data: { apiKey: '1234567890' },
projectId,
});
await n8n.canvas.addNode('Manual Trigger');
await n8n.canvas.addNode('Notion', { action: 'Append a block' });
await expect(n8n.ndv.getCredentialSelect()).toHaveValue(name);
});
test('create a new credential from empty state using the credential chooser list', async ({
n8n,
}) => {
const projectId = await n8n.start.fromNewProject();
await n8n.navigate.toCredentials(projectId);
await n8n.credentials.emptyListCreateCredentialButton.click();
await n8n.credentials.createCredentialFromCredentialPicker('Notion API', {
apiKey: '1234567890',
});
await expect(n8n.credentials.cards.getCredentials()).toHaveCount(1);
});
test('create a new credential from the NDV', async ({ n8n }) => {
const uniqueCredentialName = `credential-${nanoid()}`;
await n8n.start.fromNewProjectBlankCanvas();
await n8n.canvas.addNode('Manual Trigger');
await n8n.canvas.addNode('Notion', { action: 'Append a block' });
await n8n.ndv.getNodeCredentialsSelect().click();
await n8n.ndv.credentialDropdownCreateNewCredential().click();
await n8n.canvas.credentialModal.addCredential(
{
apiKey: '1234567890',
},
{ name: uniqueCredentialName },
);
await expect(n8n.ndv.getCredentialSelect()).toHaveValue(uniqueCredentialName);
});
test('add an existing credential from the NDV', async ({ n8n }) => {
const uniqueCredentialName = `credential-${nanoid()}`;
const projectId = await n8n.start.fromNewProjectBlankCanvas();
await n8n.api.credentials.createCredential({
name: uniqueCredentialName,
type: 'notionApi',
data: {
apiKey: '1234567890',
},
projectId,
});
await n8n.canvas.addNode('Manual Trigger');
await n8n.canvas.addNode('Notion', { action: 'Append a block' });
await expect(n8n.ndv.getCredentialSelect()).toHaveValue(uniqueCredentialName);
});
});