Skip to content

Commit

Permalink
refactor: Format root-level dirs (no-changelog) (#4938)
Browse files Browse the repository at this point in the history
🎨 Format root-level dirs
  • Loading branch information
ivov authored Dec 15, 2022
1 parent d7b3d64 commit 3028ad3
Show file tree
Hide file tree
Showing 32 changed files with 613 additions and 514 deletions.
199 changes: 88 additions & 111 deletions CHANGELOG.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const BASE_URL = 'http://localhost:5678';
module.exports = defineConfig({
retries: {
openMode: 1,
runMode: 3
runMode: 3,
},
e2e: {
baseUrl: BASE_URL,
Expand All @@ -17,7 +17,7 @@ module.exports = defineConfig({

setupNodeEvents(on, config) {
on('task', {
'reset': () => fetch(BASE_URL + '/e2e/db/reset', { method: 'POST' }),
reset: () => fetch(BASE_URL + '/e2e/db/reset', { method: 'POST' }),
'setup-owner': (payload) =>
fetch(BASE_URL + '/e2e/db/setup-owner', {
method: 'POST',
Expand Down
4 changes: 2 additions & 2 deletions cypress/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ export const DEFAULT_USER_PASSWORD = 'CypressTest123';

export const MANUAL_TRIGGER_NODE_NAME = 'Manual Trigger';
export const SCHEDULE_TRIGGER_NODE_NAME = 'Schedule Trigger';
export const CODE_NODE_NAME = 'Code'
export const SET_NODE_NAME = 'Set'
export const CODE_NODE_NAME = 'Code';
export const SET_NODE_NAME = 'Set';
25 changes: 14 additions & 11 deletions cypress/e2e/1-workflows.cy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DEFAULT_USER_EMAIL, DEFAULT_USER_PASSWORD } from "../constants";
import { randFirstName, randLastName } from "@ngneat/falso";
import { DEFAULT_USER_EMAIL, DEFAULT_USER_PASSWORD } from '../constants';
import { randFirstName, randLastName } from '@ngneat/falso';
import { WorkflowsPage as WorkflowsPageClass } from '../pages/workflows';
import { WorkflowPage as WorkflowPageClass } from '../pages/workflow';
import { v4 as uuid } from 'uuid';
Expand All @@ -22,7 +22,7 @@ describe('Workflows', () => {
expect(err.message).to.include('Not logged in');

return false;
})
});

cy.signin({ email, password });
cy.visit(WorkflowsPage.url);
Expand All @@ -36,7 +36,7 @@ describe('Workflows', () => {

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.getters.newWorkflowButtonCard().should('not.exist');
Expand All @@ -46,24 +46,28 @@ describe('Workflows', () => {

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.getters.searchBar().type('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.getters
.workflowCard('Empty State Card Workflow')
.should('contain.text', 'Empty State Card Workflow');

WorkflowsPage.getters.searchBar().clear().type('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
.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');

cy.contains('No workflows found').should('be.visible');
})
});

it('should delete all the workflows', () => {
WorkflowsPage.getters.workflowCards().should('have.length', 2);
Expand All @@ -75,15 +79,14 @@ describe('Workflows', () => {
WorkflowsPage.getters.workflowDeleteButton().click();

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

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

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

});
115 changes: 70 additions & 45 deletions cypress/e2e/10-undo-redo.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,10 @@ describe('Undo/Redo', () => {
it('should undo/redo deleting node using delete button', () => {
WorkflowPage.actions.addNodeToCanvas(SCHEDULE_TRIGGER_NODE_NAME);
WorkflowPage.actions.addNodeToCanvas(CODE_NODE_NAME);
WorkflowPage.getters.canvasNodeByName(CODE_NODE_NAME).
find('[data-test-id=delete-node-button]').click({ force: true });
WorkflowPage.getters
.canvasNodeByName(CODE_NODE_NAME)
.find('[data-test-id=delete-node-button]')
.click({ force: true });
WorkflowPage.getters.canvasNodes().should('have.have.length', 1);
WorkflowPage.getters.nodeConnections().should('have.length', 0);
WorkflowPage.actions.hitUndo();
Expand Down Expand Up @@ -117,11 +119,20 @@ describe('Undo/Redo', () => {
WorkflowPage.actions.addNodeToCanvas(SCHEDULE_TRIGGER_NODE_NAME);
WorkflowPage.actions.addNodeToCanvas(CODE_NODE_NAME);
cy.drag('[data-test-id="canvas-node"].jtk-drag-selected', 50, 150);
WorkflowPage.getters.canvasNodes().last().should('have.attr', 'style', 'left: 740px; top: 360px;');
WorkflowPage.getters
.canvasNodes()
.last()
.should('have.attr', 'style', 'left: 740px; top: 360px;');
WorkflowPage.actions.hitUndo();
WorkflowPage.getters.canvasNodes().last().should('have.attr', 'style', 'left: 640px; top: 260px;');
WorkflowPage.getters
.canvasNodes()
.last()
.should('have.attr', 'style', 'left: 640px; top: 260px;');
WorkflowPage.actions.hitRedo();
WorkflowPage.getters.canvasNodes().last().should('have.attr', 'style', 'left: 740px; top: 360px;');
WorkflowPage.getters
.canvasNodes()
.last()
.should('have.attr', 'style', 'left: 740px; top: 360px;');
});

it('should undo/redo deleting a connection by pressing delete button', () => {
Expand All @@ -144,13 +155,17 @@ describe('Undo/Redo', () => {
WorkflowPage.actions.hitUndo();
WorkflowPage.getters.nodeConnections().should('have.length', 1);
WorkflowPage.actions.hitRedo();
WorkflowPage.getters.nodeConnections().should('have.length', 0)
WorkflowPage.getters.nodeConnections().should('have.length', 0);
});

it('should undo/redo disabling a node using disable button', () => {
WorkflowPage.actions.addNodeToCanvas(SCHEDULE_TRIGGER_NODE_NAME);
WorkflowPage.actions.addNodeToCanvas(CODE_NODE_NAME);
WorkflowPage.getters.canvasNodes().last().find('[data-test-id="disable-node-button"]').click({ force: true });
WorkflowPage.getters
.canvasNodes()
.last()
.find('[data-test-id="disable-node-button"]')
.click({ force: true });
WorkflowPage.getters.disabledNodes().should('have.length', 1);
WorkflowPage.actions.hitUndo();
WorkflowPage.getters.disabledNodes().should('have.length', 0);
Expand Down Expand Up @@ -207,7 +222,7 @@ describe('Undo/Redo', () => {
WorkflowPage.actions.addNodeToCanvas(SCHEDULE_TRIGGER_NODE_NAME);
WorkflowPage.actions.addNodeToCanvas(CODE_NODE_NAME);
WorkflowPage.getters.canvasNodes().last().click();
cy.get('body').trigger("keydown", { key: "F2" });
cy.get('body').trigger('keydown', { key: 'F2' });
cy.get('.rename-prompt').should('be.visible');
cy.get('body').type(CODE_NODE_NEW_NAME);
cy.get('body').type('{enter}');
Expand All @@ -222,15 +237,19 @@ describe('Undo/Redo', () => {
it('should undo/redo duplicating a node', () => {
WorkflowPage.actions.addNodeToCanvas(SCHEDULE_TRIGGER_NODE_NAME);
WorkflowPage.actions.addNodeToCanvas(CODE_NODE_NAME);
WorkflowPage.getters.canvasNodes().last().find('[data-test-id="duplicate-node-button"]').click({ force: true });
WorkflowPage.getters
.canvasNodes()
.last()
.find('[data-test-id="duplicate-node-button"]')
.click({ force: true });
WorkflowPage.actions.hitUndo();
WorkflowPage.getters.canvasNodes().should('have.length', 2);
WorkflowPage.actions.hitRedo();
WorkflowPage.getters.canvasNodes().should('have.length', 3);
});

it('should undo/redo pasting nodes', () => {
cy.fixture('Test_workflow-actions_paste-data.json').then(data => {
cy.fixture('Test_workflow-actions_paste-data.json').then((data) => {
cy.get('body').paste(JSON.stringify(data));
WorkflowPage.actions.zoomToFit();
WorkflowPage.getters.canvasNodes().should('have.have.length', 2);
Expand All @@ -242,42 +261,48 @@ describe('Undo/Redo', () => {
});

it('should undo/redo multiple steps', () => {
WorkflowPage.actions.addNodeToCanvas(SCHEDULE_TRIGGER_NODE_NAME);
WorkflowPage.actions.addNodeToCanvas(CODE_NODE_NAME);
WorkflowPage.actions.addNodeToCanvas(SET_NODE_NAME);
WorkflowPage.actions.addNodeToCanvas(CODE_NODE_NAME);
WorkflowPage.actions.zoomToFit();
WorkflowPage.actions.addNodeToCanvas(SCHEDULE_TRIGGER_NODE_NAME);
WorkflowPage.actions.addNodeToCanvas(CODE_NODE_NAME);
WorkflowPage.actions.addNodeToCanvas(SET_NODE_NAME);
WorkflowPage.actions.addNodeToCanvas(CODE_NODE_NAME);
WorkflowPage.actions.zoomToFit();

// Disable last node
WorkflowPage.getters.canvasNodes().last().click();
WorkflowPage.actions.hitDisableNodeShortcut();
// Move first one
WorkflowPage.getters.canvasNodes().first().click();
cy.drag('[data-test-id="canvas-node"].jtk-drag-selected', 50, 150);
// Delete the set node
WorkflowPage.getters.canvasNodeByName(SET_NODE_NAME).click().click();
cy.get('body').type('{backspace}');
// Disable last node
WorkflowPage.getters.canvasNodes().last().click();
WorkflowPage.actions.hitDisableNodeShortcut();
// Move first one
WorkflowPage.getters.canvasNodes().first().click();
cy.drag('[data-test-id="canvas-node"].jtk-drag-selected', 50, 150);
// Delete the set node
WorkflowPage.getters.canvasNodeByName(SET_NODE_NAME).click().click();
cy.get('body').type('{backspace}');

// First undo: Should return deleted node
WorkflowPage.actions.hitUndo();
WorkflowPage.getters.canvasNodes().should('have.length', 4);
WorkflowPage.getters.nodeConnections().should('have.length', 3);
// Second undo: Should move first node to it's original position
WorkflowPage.actions.hitUndo();
WorkflowPage.getters.canvasNodes().first().should('have.attr', 'style', 'left: 420px; top: 260px;');
// Third undo: Should enable last node
WorkflowPage.actions.hitUndo();
WorkflowPage.getters.disabledNodes().should('have.length', 0);
// First undo: Should return deleted node
WorkflowPage.actions.hitUndo();
WorkflowPage.getters.canvasNodes().should('have.length', 4);
WorkflowPage.getters.nodeConnections().should('have.length', 3);
// Second undo: Should move first node to it's original position
WorkflowPage.actions.hitUndo();
WorkflowPage.getters
.canvasNodes()
.first()
.should('have.attr', 'style', 'left: 420px; top: 260px;');
// Third undo: Should enable last node
WorkflowPage.actions.hitUndo();
WorkflowPage.getters.disabledNodes().should('have.length', 0);

// First redo: Should disable last node
WorkflowPage.actions.hitRedo();
WorkflowPage.getters.disabledNodes().should('have.length', 1);
// Second redo: Should move the first node
WorkflowPage.actions.hitRedo();
WorkflowPage.getters.canvasNodes().first().should('have.attr', 'style', 'left: 540px; top: 400px;');
// Third redo: Should delete the Set node
WorkflowPage.actions.hitRedo();
WorkflowPage.getters.canvasNodes().should('have.length', 3);
WorkflowPage.getters.nodeConnections().should('have.length', 2);
});
// First redo: Should disable last node
WorkflowPage.actions.hitRedo();
WorkflowPage.getters.disabledNodes().should('have.length', 1);
// Second redo: Should move the first node
WorkflowPage.actions.hitRedo();
WorkflowPage.getters
.canvasNodes()
.first()
.should('have.attr', 'style', 'left: 540px; top: 400px;');
// Third redo: Should delete the Set node
WorkflowPage.actions.hitRedo();
WorkflowPage.getters.canvasNodes().should('have.length', 3);
WorkflowPage.getters.nodeConnections().should('have.length', 2);
});
});
6 changes: 3 additions & 3 deletions cypress/e2e/2-credentials.cy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DEFAULT_USER_EMAIL, DEFAULT_USER_PASSWORD } from "../constants";
import { randFirstName, randLastName } from "@ngneat/falso";
import { DEFAULT_USER_EMAIL, DEFAULT_USER_PASSWORD } from '../constants';
import { randFirstName, randLastName } from '@ngneat/falso';
import { CredentialsPage, CredentialsModal } from '../pages';

const email = DEFAULT_USER_EMAIL;
Expand All @@ -20,7 +20,7 @@ describe('Credentials', () => {
expect(err.message).to.include('Not logged in');

return false;
})
});

cy.signin({ email, password });
cy.visit(credentialsPage.url);
Expand Down
19 changes: 13 additions & 6 deletions cypress/e2e/3-default-owner.cy.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
import { randFirstName, randLastName } from '@ngneat/falso';
import { DEFAULT_USER_EMAIL, DEFAULT_USER_PASSWORD } from '../constants';
import { SettingsUsersPage, SignupPage, WorkflowsPage, WorkflowPage, CredentialsPage, CredentialsModal, MessageBox } from '../pages';

import { MainSidebar, SettingsSidebar } from "../pages/sidebar";
import {
SettingsUsersPage,
SignupPage,
WorkflowsPage,
WorkflowPage,
CredentialsPage,
CredentialsModal,
MessageBox,
} from '../pages';

import { MainSidebar, SettingsSidebar } from '../pages/sidebar';

const mainSidebar = new MainSidebar();
const settingsSidebar = new SettingsSidebar();
Expand All @@ -29,7 +37,7 @@ describe('Default owner', () => {
});
beforeEach(() => {
cy.visit('/');
})
});

it('should skip owner setup', () => {
cy.skipSetup();
Expand Down Expand Up @@ -84,7 +92,7 @@ describe('Default owner', () => {
it('should be able to setup instance and migrate workflows and credentials', () => {
cy.setup({ email, firstName, lastName, password });

messageBox.getters.content().should('contain.text', '1 existing workflow and 1 credential')
messageBox.getters.content().should('contain.text', '1 existing workflow and 1 credential');

messageBox.actions.confirm();
cy.url().should('include', settingsUsersPage.url);
Expand All @@ -106,4 +114,3 @@ describe('Default owner', () => {
credentialsPage.getters.credentialCards().should('have.length', 1);
});
});

Loading

0 comments on commit 3028ad3

Please sign in to comment.