Skip to content

Commit

Permalink
Merge branch 'master' into n8n-5477-utils-refactor
Browse files Browse the repository at this point in the history
* master: (35 commits)
  fix: Remove redundant await in node's api request functions without try/catch (#4639)
  fix(core): Fix `$items().length` behavior in `executeOnce` mode (#4694)
  perf(Code Node): Improve n8n item key validation performance (#4669)
  feat: Implement runtine check for enterprise features (no-changelog) (#4676)
  refactor: Consolidate `.prettierignore` patterns (no-changelog) (#4692)
  refactor: Improve error logging/reporting for `cli` (#4691)
  feat(editor): Add workflows list status filter (#4690)
  fix: Expand `nodes-base` formatting validation (no-changelog) (#4689)
  refactor: Improve warnings and error messages to users about sharing (#4687) (no-changelog)
  fix: Update subview switch condition (no-changelog) (#4688)
  refactor: Validate formatting in `nodes-base` (no-changelog) (#4685)
  feat: Show delete button based on workflow permissions (#4686)
  feat: Show toast when saving workflow sharing settings (#4684)
  feat: Add save confirmation modal when leaving sharing modal (#4683)
  fix: Update workflow title in workflowsById as well (no-changelog) (#4682)
  feat: Add share button to workflows list (#4681)
  feat: Add credentials E2E test suite and page object (#4596)
  fix(core): Use CredentialsOverwrites when testing credentials (#4675)
  refactor: Adjust credential endpoints permissions (#4656) (no-changelog)
  fix: Fix settings header text slot  (no-changelog) (#4667)
  ...

# Conflicts:
#	packages/editor-ui/src/components/WorkflowCard.vue
#	packages/editor-ui/src/views/WorkflowsView.vue
  • Loading branch information
MiloradFilipovic committed Nov 23, 2022
2 parents 7e045aa + 67983e8 commit 919af36
Show file tree
Hide file tree
Showing 234 changed files with 10,534 additions and 2,037 deletions.
7 changes: 1 addition & 6 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
coverage
dist
packages/editor-ui
package.json

!packages/nodes-base/src
!packages/nodes-base/test
!packages/nodes-base/nodes

packages/nodes-base/nodes/UProc/Json/Tools.ts
6 changes: 3 additions & 3 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@
"type": "node",
"env": {
// "N8N_PORT": "5679",
},
}
},
{
"name": "Debug CLI tests",
"cwd": "${workspaceFolder}/packages/cli",
"runtimeExecutable": "npm",
"args": [
"run",
"test",
"test"
// "--",
// "ActiveExecutions"
],
"type": "node",
"request": "launch"
},
}
]

/**
Expand Down
744 changes: 313 additions & 431 deletions CHANGELOG.md

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions cypress.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
const { defineConfig } = require("cypress");

const { defineConfig } = require('cypress');

module.exports = defineConfig({
e2e: {
baseUrl: 'http://localhost:5678',
video: false,
screenshotOnRunFailure: false,
screenshotOnRunFailure: true,
experimentalSessionAndOrigin: true,
experimentalInteractiveRunEvents: true,
}
},
});
2 changes: 1 addition & 1 deletion cypress/e2e/0-smoke.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const password = DEFAULT_USER_PASSWORD;
const firstName = randFirstName();
const lastName = randLastName();

describe('Authentication flow', () => {
describe('Authentication', () => {
it('should sign user up', () => {
cy.signup(username, firstName, lastName, password);
});
Expand Down
52 changes: 27 additions & 25 deletions cypress/e2e/1-workflows.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const lastName = randLastName();
const WorkflowsPage = new WorkflowsPageClass();
const WorkflowPage = new WorkflowPageClass();

describe('Workflows flow', () => {
describe('Workflows', () => {
beforeEach(() => {
cy.signup(username, firstName, lastName, password);

Expand All @@ -26,59 +26,61 @@ describe('Workflows flow', () => {
});

it('should create a new workflow using empty state card', () => {
WorkflowsPage.get('newWorkflowButtonCard').should('be.visible');
WorkflowsPage.get('newWorkflowButtonCard').click();
WorkflowsPage.getters.newWorkflowButtonCard().should('be.visible');
WorkflowsPage.getters.newWorkflowButtonCard().click();

cy.createFixtureWorkflow('Test_workflow_1.json', `Empty State Card Workflow ${uuid()}`);

WorkflowPage.get('workflowTags').should('contain.text', 'some-tag-1');
WorkflowPage.get('workflowTags').should('contain.text', 'some-tag-2');
WorkflowPage.getters.workflowTags().should('contain.text', 'some-tag-1');
WorkflowPage.getters.workflowTags().should('contain.text', 'some-tag-2');
})

it('should create a new workflow using add workflow button', () => {
WorkflowsPage.get('newWorkflowButtonCard').should('not.exist');
WorkflowsPage.get('createWorkflowButton').click();
WorkflowsPage.getters.newWorkflowButtonCard().should('not.exist');
WorkflowsPage.getters.createWorkflowButton().click();

cy.createFixtureWorkflow('Test_workflow_2.json', `Add Workflow Button Workflow ${uuid()}`);

WorkflowPage.get('workflowTags').should('contain.text', 'other-tag-1');
WorkflowPage.get('workflowTags').should('contain.text', 'other-tag-2');
WorkflowPage.getters.workflowTags().should('contain.text', 'other-tag-1');
WorkflowPage.getters.workflowTags().should('contain.text', 'other-tag-2');
})

it('should search for a workflow', () => {
WorkflowsPage.get('searchBar').type('Empty State Card Workflow');
WorkflowsPage.getters.searchBar().type('Empty State Card Workflow');

WorkflowsPage.get('workflowCards').should('have.length', 1);
WorkflowsPage.get('workflowCard', 'Empty State Card Workflow').should('contain.text', 'Empty State Card Workflow');
WorkflowsPage.getters.workflowCards().should('have.length', 1);
WorkflowsPage.getters.workflowCard('Empty State Card Workflow').should('contain.text', 'Empty State Card Workflow');

WorkflowsPage.get('searchBar').clear().type('Add Workflow Button Workflow');
WorkflowsPage.getters.searchBar().clear().type('Add Workflow Button Workflow');

WorkflowsPage.get('workflowCards').should('have.length', 1);
WorkflowsPage.get('workflowCard', 'Add Workflow Button Workflow').should('contain.text', 'Add Workflow Button Workflow');
WorkflowsPage.getters.workflowCards().should('have.length', 1);
WorkflowsPage.getters.workflowCard('Add Workflow Button Workflow').should('contain.text', 'Add Workflow Button Workflow');

WorkflowsPage.getters.searchBar().clear().type('Some non-existent workflow');
WorkflowsPage.getters.workflowCards().should('not.exist');

WorkflowsPage.get('searchBar').clear().type('Some non-existent workflow');
WorkflowsPage.get('workflowCards').should('not.exist');
cy.contains('No workflows found').should('be.visible');
})

it('should delete all the workflows', () => {
WorkflowsPage.get('workflowCards').should('have.length', 2);
WorkflowsPage.getters.workflowCards().should('have.length', 2);

WorkflowsPage.get('workflowCards').each(($el) => {
WorkflowsPage.getters.workflowCards().each(($el) => {
const workflowName = $el.find('[data-test-id="workflow-card-name"]').text();

WorkflowsPage.get('workflowCardActions', workflowName).click();
WorkflowsPage.get('workflowDeleteButton').click();
WorkflowsPage.getters.workflowCardActions(workflowName).click();
WorkflowsPage.getters.workflowDeleteButton().click();

cy.get('button').contains('delete').click();
})

WorkflowsPage.get('newWorkflowButtonCard').should('be.visible');
WorkflowsPage.get('newWorkflowTemplateCard').should('be.visible');
WorkflowsPage.getters.newWorkflowButtonCard().should('be.visible');
WorkflowsPage.getters.newWorkflowTemplateCard().should('be.visible');
})

it('should contain empty state cards', () => {
WorkflowsPage.get('newWorkflowButtonCard').should('be.visible');
WorkflowsPage.get('newWorkflowTemplateCard').should('be.visible');
WorkflowsPage.getters.newWorkflowButtonCard().should('be.visible');
WorkflowsPage.getters.newWorkflowTemplateCard().should('be.visible');
});

});
41 changes: 41 additions & 0 deletions cypress/e2e/2-credentials.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { DEFAULT_USER_EMAIL, DEFAULT_USER_PASSWORD } from "../constants";
import { randFirstName, randLastName } from "@ngneat/falso";
import { CredentialsPage, CredentialsModal } from '../pages';
// import { v4 as uuid } from 'uuid';

const username = DEFAULT_USER_EMAIL;
const password = DEFAULT_USER_PASSWORD;
const firstName = randFirstName();
const lastName = randLastName();
const credentialsPage = new CredentialsPage();
const credentialsModal = new CredentialsModal();

describe('Credentials', () => {
beforeEach(() => {
cy.signup(username, firstName, lastName, password);

cy.on('uncaught:exception', (err, runnable) => {
expect(err.message).to.include('Not logged in');

return false;
})

cy.signin(username, password);
cy.visit(credentialsPage.url);
});

it('should create a new credential using empty state', () => {
credentialsPage.getters.emptyListCreateCredentialButton().click();

credentialsModal.getters.newCredentialModal().should('be.visible');
credentialsModal.getters.newCredentialTypeSelect().should('be.visible');
credentialsModal.getters.newCredentialTypeOption('Notion API').click();

credentialsModal.getters.newCredentialTypeButton().click();

credentialsModal.getters.connectionParameter('API Key').type('1234567890');

credentialsModal.actions.setName('My awesome Notion account');
credentialsModal.actions.save();
});
});
126 changes: 59 additions & 67 deletions cypress/fixtures/Test_workflow_1.json
Original file line number Diff line number Diff line change
@@ -1,69 +1,61 @@
{
"name": "Test workflow 1",
"nodes": [
{
"parameters": {},
"id": "a2f85497-260d-4489-a957-2b7d88e2f33d",
"name": "On clicking 'execute'",
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
220,
260
]
},
{
"parameters": {
"jsCode": "// Loop over input items and add a new field\n// called 'myNewField' to the JSON of each one\nfor (const item of $input.all()) {\n item.json.myNewField = 1;\n}\n\nreturn $input.all();"
},
"id": "9493d278-1ede-47c9-bedf-92ac3a737c65",
"name": "Code",
"type": "n8n-nodes-base.code",
"typeVersion": 1,
"position": [
400,
260
]
}
],
"pinData": {},
"connections": {
"On clicking 'execute'": {
"main": [
[
{
"node": "Code",
"type": "main",
"index": 0
}
]
]
},
"Code": {
"main": [
[]
]
}
},
"active": false,
"settings": {},
"hash": "a59c7b1c97b1741597afae0fcd43ebef",
"id": 3,
"meta": {
"instanceId": "a5280676597d00ecd0ea712da7f9cf2ce90174a791a309112731f6e44d162f35"
},
"tags": [
{
"name": "some-tag-1",
"createdAt": "2022-11-10T13:43:34.001Z",
"updatedAt": "2022-11-10T13:43:34.001Z",
"id": "6"
},
{
"name": "some-tag-2",
"createdAt": "2022-11-10T13:43:39.778Z",
"updatedAt": "2022-11-10T13:43:39.778Z",
"id": "7"
}
]
"name": "Test workflow 1",
"nodes": [
{
"parameters": {},
"id": "a2f85497-260d-4489-a957-2b7d88e2f33d",
"name": "On clicking 'execute'",
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [220, 260]
},
{
"parameters": {
"jsCode": "// Loop over input items and add a new field\n// called 'myNewField' to the JSON of each one\nfor (const item of $input.all()) {\n item.json.myNewField = 1;\n}\n\nreturn $input.all();"
},
"id": "9493d278-1ede-47c9-bedf-92ac3a737c65",
"name": "Code",
"type": "n8n-nodes-base.code",
"typeVersion": 1,
"position": [400, 260]
}
],
"pinData": {},
"connections": {
"On clicking 'execute'": {
"main": [
[
{
"node": "Code",
"type": "main",
"index": 0
}
]
]
},
"Code": {
"main": [[]]
}
},
"active": false,
"settings": {},
"hash": "a59c7b1c97b1741597afae0fcd43ebef",
"id": 3,
"meta": {
"instanceId": "a5280676597d00ecd0ea712da7f9cf2ce90174a791a309112731f6e44d162f35"
},
"tags": [
{
"name": "some-tag-1",
"createdAt": "2022-11-10T13:43:34.001Z",
"updatedAt": "2022-11-10T13:43:34.001Z",
"id": "6"
},
{
"name": "some-tag-2",
"createdAt": "2022-11-10T13:43:39.778Z",
"updatedAt": "2022-11-10T13:43:39.778Z",
"id": "7"
}
]
}
Loading

0 comments on commit 919af36

Please sign in to comment.