Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/n8n-io/n8n into node-2010-…
Browse files Browse the repository at this point in the history
…community-issue-readwrite-files-from-disk-node-fails-to
  • Loading branch information
michael-radency committed Nov 20, 2024
2 parents 96035c5 + 5fa72b0 commit c58b3e6
Show file tree
Hide file tree
Showing 244 changed files with 6,842 additions and 2,448 deletions.
16 changes: 5 additions & 11 deletions .github/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
version: '3.9'

services:
mysql:
image: mysql:5.7
mariadb:
image: mariadb:10.9
environment:
- MYSQL_DATABASE=n8n
- MYSQL_ROOT_PASSWORD=password
- MARIADB_DATABASE=n8n
- MARIADB_ROOT_PASSWORD=password
- MARIADB_MYSQL_LOCALHOST_USER=true
ports:
- 3306:3306
ulimits:
nproc: 65535
nofile:
soft: 26677
hard: 46677

postgres:
image: postgres:16
Expand Down
17 changes: 9 additions & 8 deletions .github/workflows/ci-postgres-mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
paths:
- packages/cli/src/databases/**
- .github/workflows/ci-postgres-mysql.yml
- .github/docker-compose.yml
pull_request_review:
types: [submitted]

Expand Down Expand Up @@ -71,8 +72,8 @@ jobs:
working-directory: packages/cli
run: pnpm jest

mysql:
name: MySQL
mariadb:
name: MariaDB
runs-on: ubuntu-latest
needs: build
timeout-minutes: 20
Expand All @@ -96,16 +97,16 @@ jobs:
path: ./packages/**/dist
key: ${{ github.sha }}:db-tests

- name: Start MySQL
- name: Start MariaDB
uses: isbang/compose-action@v2.0.0
with:
compose-file: ./.github/docker-compose.yml
services: |
mysql
mariadb
- name: Test MySQL
- name: Test MariaDB
working-directory: packages/cli
run: pnpm test:mysql --testTimeout 20000
run: pnpm test:mariadb --testTimeout 20000

postgres:
name: Postgres
Expand Down Expand Up @@ -147,7 +148,7 @@ jobs:
notify-on-failure:
name: Notify Slack on failure
runs-on: ubuntu-latest
needs: [mysql, postgres]
needs: [mariadb, postgres]
steps:
- name: Notify Slack on failure
uses: act10ns/slack@v2.0.0
Expand All @@ -156,4 +157,4 @@ jobs:
status: ${{ job.status }}
channel: '#alerts-build'
webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }}
message: Postgres or MySQL tests failed (${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
message: Postgres or MariaDB tests failed (${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
4 changes: 4 additions & 0 deletions cypress/composables/ndv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ export function getOutputPanelTable() {
return getOutputPanelDataContainer().get('table');
}

export function getRunDataInfoCallout() {
return cy.getByTestId('run-data-callout');
}

export function getOutputPanelItemsCount() {
return getOutputPanel().getByTestId('ndv-items-count');
}
Expand Down
28 changes: 26 additions & 2 deletions cypress/composables/projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,32 @@ const credentialsModal = new CredentialsModal();

export const getHomeButton = () => cy.getByTestId('project-home-menu-item');
export const getMenuItems = () => cy.getByTestId('project-menu-item');
export const getAddProjectButton = () =>
cy.getByTestId('add-project-menu-item').should('contain', 'Add project').should('be.visible');
export const getAddProjectButton = () => {
cy.getByTestId('universal-add').should('be.visible').click();
cy.getByTestId('universal-add')
.find('.el-sub-menu__title')
.as('menuitem')
.should('have.attr', 'aria-describedby');

cy.get('@menuitem')
.invoke('attr', 'aria-describedby')
.then((el) => cy.get(`[id="${el}"]`))
.as('submenu');

cy.get('@submenu').within((submenu) =>
cy
.wrap(submenu)
.getByTestId('navigation-menu-item')
.should('be.visible')
.filter(':contains("Project")')
.as('button'),
);

return cy.get('@button');
};

// export const getAddProjectButton = () =>
// cy.getByTestId('universal-add').should('contain', 'Add project').should('be.visible');
export const getProjectTabs = () => cy.getByTestId('project-tabs').find('a');
export const getProjectTabWorkflows = () => getProjectTabs().filter('a[href$="/workflows"]');
export const getProjectTabCredentials = () => getProjectTabs().filter('a[href$="/credentials"]');
Expand Down
100 changes: 100 additions & 0 deletions cypress/e2e/30-langchain.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import {
clickCreateNewCredential,
clickExecuteNode,
clickGetBackToCanvas,
getRunDataInfoCallout,
getOutputPanelTable,
toggleParameterCheckboxInputByName,
} from '../composables/ndv';
import {
Expand Down Expand Up @@ -418,4 +420,102 @@ describe('Langchain Integration', () => {
assertInputOutputText('Berlin', 'not.exist');
assertInputOutputText('Kyiv', 'not.exist');
});

it('should show tool info notice if no existing tools were used during execution', () => {
addNodeToCanvas(MANUAL_CHAT_TRIGGER_NODE_NAME, true);
addNodeToCanvas(AGENT_NODE_NAME, true);

addLanguageModelNodeToParent(
AI_LANGUAGE_MODEL_OPENAI_CHAT_MODEL_NODE_NAME,
AGENT_NODE_NAME,
true,
);

clickCreateNewCredential();
setCredentialValues({
apiKey: 'sk_test_123',
});
clickGetBackToCanvas();

addToolNodeToParent(AI_TOOL_CALCULATOR_NODE_NAME, AGENT_NODE_NAME);
clickGetBackToCanvas();
openNode(AGENT_NODE_NAME);

const inputMessage = 'Hello!';
const outputMessage = 'Hi there! How can I assist you today?';

clickExecuteNode();

runMockWorkflowExecution({
trigger: () => sendManualChatMessage(inputMessage),
runData: [
createMockNodeExecutionData(AGENT_NODE_NAME, {
jsonData: {
main: { output: outputMessage },
},
metadata: {
subRun: [{ node: AI_LANGUAGE_MODEL_OPENAI_CHAT_MODEL_NODE_NAME, runIndex: 0 }],
},
}),
],
lastNodeExecuted: AGENT_NODE_NAME,
});
closeManualChatModal();
openNode(AGENT_NODE_NAME);

getRunDataInfoCallout().should('exist');
});

it('should not show tool info notice if tools were used during execution', () => {
addNodeToCanvas(MANUAL_CHAT_TRIGGER_NODE_NAME, true);
addNodeToCanvas(AGENT_NODE_NAME, true, true);
getRunDataInfoCallout().should('not.exist');
clickGetBackToCanvas();

addLanguageModelNodeToParent(
AI_LANGUAGE_MODEL_OPENAI_CHAT_MODEL_NODE_NAME,
AGENT_NODE_NAME,
true,
);

clickCreateNewCredential();
setCredentialValues({
apiKey: 'sk_test_123',
});
clickGetBackToCanvas();

addToolNodeToParent(AI_TOOL_CALCULATOR_NODE_NAME, AGENT_NODE_NAME);
clickGetBackToCanvas();
openNode(AGENT_NODE_NAME);

getRunDataInfoCallout().should('not.exist');

const inputMessage = 'Hello!';
const outputMessage = 'Hi there! How can I assist you today?';

clickExecuteNode();

runMockWorkflowExecution({
trigger: () => sendManualChatMessage(inputMessage),
runData: [
createMockNodeExecutionData(AGENT_NODE_NAME, {
jsonData: {
main: { output: outputMessage },
},
metadata: {
subRun: [{ node: AI_LANGUAGE_MODEL_OPENAI_CHAT_MODEL_NODE_NAME, runIndex: 0 }],
},
}),
createMockNodeExecutionData(AI_TOOL_CALCULATOR_NODE_NAME, {}),
],
lastNodeExecuted: AGENT_NODE_NAME,
});

closeManualChatModal();
openNode(AGENT_NODE_NAME);
// This waits to ensure the output panel is rendered
getOutputPanelTable();

getRunDataInfoCallout().should('not.exist');
});
});
6 changes: 3 additions & 3 deletions cypress/e2e/34-template-credentials-setup.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,18 @@ describe('Template credentials setup', () => {
it('can be opened from template collection page', () => {
visitTemplateCollectionPage(testData.ecommerceStarterPack);
templateCredentialsSetupPage.enableTemplateCredentialSetupFeatureFlag();
clickUseWorkflowButtonByTitle('Promote new Shopify products on Twitter and Telegram');
clickUseWorkflowButtonByTitle('Promote new Shopify products');

templateCredentialsSetupPage.getters
.title("Set up 'Promote new Shopify products on Twitter and Telegram' template")
.title("Set up 'Promote new Shopify products' template")
.should('be.visible');
});

it('has all the elements on page', () => {
templateCredentialsSetupPage.visitTemplateCredentialSetupPage(testTemplate.id);

templateCredentialsSetupPage.getters
.title("Set up 'Promote new Shopify products on Twitter and Telegram' template")
.title("Set up 'Promote new Shopify products' template")
.should('be.visible');

templateCredentialsSetupPage.getters
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/42-nps-survey.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { WorkflowPage } from '../pages/workflow';

const workflowPage = new WorkflowPage();

const NOW = 1717771477012;
const NOW = Date.now();
const ONE_DAY = 24 * 60 * 60 * 1000;
const THREE_DAYS = ONE_DAY * 3;
const SEVEN_DAYS = ONE_DAY * 7;
Expand Down
2 changes: 2 additions & 0 deletions cypress/e2e/45-ai-assistant.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,8 @@ describe('General help', () => {
}).as('chatRequest');

aiAssistant.getters.askAssistantFloatingButton().click();
wf.getters.zoomToFitButton().click();

aiAssistant.actions.sendMessage('What is wrong with this workflow?');
cy.wait('@chatRequest');

Expand Down
29 changes: 25 additions & 4 deletions cypress/e2e/45-workflow-selector-parameter.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe('Workflow Selector Parameter', () => {
getVisiblePopper()
.should('have.length', 1)
.findChildByTestId('rlc-item')
.should('have.length', 2);
.should('have.length', 3);
});

it('should show required parameter warning', () => {
Expand All @@ -44,7 +44,8 @@ describe('Workflow Selector Parameter', () => {
getVisiblePopper()
.should('have.length', 1)
.findChildByTestId('rlc-item')
.should('have.length', 1)
.should('have.length', 2)
.eq(1)
.click();

ndv.getters
Expand All @@ -57,7 +58,7 @@ describe('Workflow Selector Parameter', () => {
ndv.getters.resourceLocator('workflowId').should('be.visible');
ndv.getters.resourceLocatorInput('workflowId').click();

getVisiblePopper().findChildByTestId('rlc-item').first().click();
getVisiblePopper().findChildByTestId('rlc-item').eq(1).click();

ndv.getters.resourceLocatorInput('workflowId').find('a').should('exist');
cy.getByTestId('radio-button-expression').eq(1).click();
Expand All @@ -68,7 +69,7 @@ describe('Workflow Selector Parameter', () => {
ndv.getters.resourceLocator('workflowId').should('be.visible');
ndv.getters.resourceLocatorInput('workflowId').click();

getVisiblePopper().findChildByTestId('rlc-item').first().click();
getVisiblePopper().findChildByTestId('rlc-item').eq(1).click();
ndv.getters
.resourceLocatorModeSelector('workflowId')
.find('input')
Expand All @@ -79,4 +80,24 @@ describe('Workflow Selector Parameter', () => {
.find('input')
.should('have.value', 'By ID');
});

it('should render add resource option and redirect to the correct route when clicked', () => {
cy.window().then((win) => {
cy.stub(win, 'open').as('windowOpen');
});

ndv.getters.resourceLocator('workflowId').should('be.visible');
ndv.getters.resourceLocatorInput('workflowId').click();

getVisiblePopper().findChildByTestId('rlc-item').eq(0).should('exist');
getVisiblePopper()
.findChildByTestId('rlc-item')
.eq(0)
.find('span')
.should('have.text', 'Create a new sub-workflow');

getVisiblePopper().findChildByTestId('rlc-item').eq(0).click();

cy.get('@windowOpen').should('be.calledWith', '/workflows/onboarding/0?sampleSubWorkflows=0');
});
});
1,556 changes: 1,555 additions & 1 deletion cypress/fixtures/Ecommerce_starter_pack_template_collection.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion cypress/fixtures/Test_Template_1.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"workflow": {
"id": 1205,
"name": "Promote new Shopify products on Twitter and Telegram",
"name": "Promote new Shopify products",
"views": 478,
"recentViews": 9880,
"totalViews": 478,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1202,7 +1202,7 @@
},
{
"id": 1205,
"name": "Promote New Shopify Products on Social Media (Twitter and Telegram)",
"name": "Promote New Shopify Products",
"totalViews": 219,
"recentViews": 0,
"user": {
Expand Down
Loading

0 comments on commit c58b3e6

Please sign in to comment.