Skip to content

Commit

Permalink
feat: Update NPS Value Survey (#9638)
Browse files Browse the repository at this point in the history
Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
Co-authored-by: Tomi Turtiainen <10324676+tomi@users.noreply.github.com>
  • Loading branch information
3 people authored Jun 11, 2024
1 parent aaa7843 commit 50bd5b9
Show file tree
Hide file tree
Showing 58 changed files with 1,416 additions and 497 deletions.
9 changes: 5 additions & 4 deletions cypress/e2e/12-canvas-actions.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { WorkflowPage as WorkflowPageClass } from '../pages/workflow';
import { successToast } from '../pages/notifications';
import {
MANUAL_TRIGGER_NODE_NAME,
MANUAL_TRIGGER_NODE_DISPLAY_NAME,
Expand Down Expand Up @@ -166,8 +167,8 @@ describe('Canvas Actions', () => {
.findChildByTestId('execute-node-button')
.click({ force: true });
WorkflowPage.actions.executeNode(CODE_NODE_NAME);
WorkflowPage.getters.successToast().should('have.length', 2);
WorkflowPage.getters.successToast().should('contain.text', 'Node executed successfully');
successToast().should('have.length', 2);
successToast().should('contain.text', 'Node executed successfully');
});

it('should disable and enable node', () => {
Expand Down Expand Up @@ -201,10 +202,10 @@ describe('Canvas Actions', () => {
WorkflowPage.actions.selectAll();

WorkflowPage.actions.hitCopy();
WorkflowPage.getters.successToast().should('contain', 'Copied!');
successToast().should('contain', 'Copied!');

WorkflowPage.actions.copyNode(CODE_NODE_NAME);
WorkflowPage.getters.successToast().should('contain', 'Copied!');
successToast().should('contain', 'Copied!');
});

it('should select/deselect all nodes', () => {
Expand Down
7 changes: 3 additions & 4 deletions cypress/e2e/13-pinning.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
BACKEND_BASE_URL,
} from '../constants';
import { WorkflowPage, NDV } from '../pages';
import { errorToast } from '../pages/notifications';

const workflowPage = new WorkflowPage();
const ndv = new NDV();
Expand Down Expand Up @@ -139,9 +140,7 @@ describe('Data pinning', () => {
test: '1'.repeat(Cypress.env('MAX_PINNED_DATA_SIZE') as number),
},
]);
workflowPage.getters
.errorToast()
.should('contain', 'Workflow has reached the maximum allowed pinned data size');
errorToast().should('contain', 'Workflow has reached the maximum allowed pinned data size');
});

it('Should show an error when pin data JSON in invalid', () => {
Expand All @@ -152,7 +151,7 @@ describe('Data pinning', () => {
ndv.getters.editPinnedDataButton().should('be.visible');

ndv.actions.setPinnedData('[ { "name": "First item", "code": 2dsa }]');
workflowPage.getters.errorToast().should('contain', 'Unable to save due to invalid JSON');
errorToast().should('contain', 'Unable to save due to invalid JSON');
});

it('Should be able to reference paired items in a node located before pinned data', () => {
Expand Down
3 changes: 2 additions & 1 deletion cypress/e2e/1338-ADO-ndv-missing-input-panel.cy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { v4 as uuid } from 'uuid';
import { NDV, WorkflowPage as WorkflowPageClass } from '../pages';
import { successToast } from '../pages/notifications';

const workflowPage = new WorkflowPageClass();
const ndv = new NDV();
Expand All @@ -16,7 +17,7 @@ describe('ADO-1338-ndv-missing-input-panel', () => {
workflowPage.getters.zoomToFitButton().click();
workflowPage.getters.executeWorkflowButton().click();
// Check success toast (works because Cypress waits enough for the element to show after the http request node has finished)
workflowPage.getters.successToast().should('be.visible');
successToast().should('be.visible');

workflowPage.actions.openNode('Discourse1');
ndv.getters.inputPanel().should('be.visible');
Expand Down
19 changes: 8 additions & 11 deletions cypress/e2e/18-user-management.cy.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { INSTANCE_MEMBERS, INSTANCE_OWNER, INSTANCE_ADMIN } from '../constants';
import { MainSidebar, SettingsSidebar, SettingsUsersPage, WorkflowPage } from '../pages';
import { MainSidebar, SettingsSidebar, SettingsUsersPage } from '../pages';
import { PersonalSettingsPage } from '../pages/settings-personal';
import { getVisibleSelect } from '../utils';
import { errorToast, successToast } from '../pages/notifications';

/**
* User A - Instance owner
Expand All @@ -24,7 +25,6 @@ const updatedPersonalData = {
};

const usersSettingsPage = new SettingsUsersPage();
const workflowPage = new WorkflowPage();
const personalSettingsPage = new PersonalSettingsPage();
const settingsSidebar = new SettingsSidebar();
const mainSidebar = new MainSidebar();
Expand Down Expand Up @@ -174,7 +174,7 @@ describe('User Management', { disableAutoLogin: true }, () => {
usersSettingsPage.getters.deleteDataRadioButton().click();
usersSettingsPage.getters.deleteDataInput().type('delete all data');
usersSettingsPage.getters.deleteUserButton().click();
workflowPage.getters.successToast().should('contain', 'User deleted');
successToast().should('contain', 'User deleted');
});

it('should delete user and transfer their data', () => {
Expand All @@ -184,7 +184,7 @@ describe('User Management', { disableAutoLogin: true }, () => {
usersSettingsPage.getters.userSelectDropDown().click();
usersSettingsPage.getters.userSelectOptions().first().click();
usersSettingsPage.getters.deleteUserButton().click();
workflowPage.getters.successToast().should('contain', 'User deleted');
successToast().should('contain', 'User deleted');
});

it('should allow user to change their personal data', () => {
Expand All @@ -196,7 +196,7 @@ describe('User Management', { disableAutoLogin: true }, () => {
personalSettingsPage.getters
.currentUserName()
.should('contain', `${updatedPersonalData.newFirstName} ${updatedPersonalData.newLastName}`);
workflowPage.getters.successToast().should('contain', 'Personal details updated');
successToast().should('contain', 'Personal details updated');
});

it("shouldn't allow user to set weak password", () => {
Expand All @@ -211,10 +211,7 @@ describe('User Management', { disableAutoLogin: true }, () => {
personalSettingsPage.actions.loginAndVisit(INSTANCE_OWNER.email, INSTANCE_OWNER.password);
personalSettingsPage.getters.changePasswordLink().click();
personalSettingsPage.actions.updatePassword('iCannotRemember', updatedPersonalData.newPassword);
workflowPage.getters
.errorToast()
.closest('div')
.should('contain', 'Provided current password is incorrect.');
errorToast().closest('div').should('contain', 'Provided current password is incorrect.');
});

it('should change current user password', () => {
Expand All @@ -224,7 +221,7 @@ describe('User Management', { disableAutoLogin: true }, () => {
INSTANCE_OWNER.password,
updatedPersonalData.newPassword,
);
workflowPage.getters.successToast().should('contain', 'Password updated');
successToast().should('contain', 'Password updated');
personalSettingsPage.actions.loginWithNewData(
INSTANCE_OWNER.email,
updatedPersonalData.newPassword,
Expand All @@ -248,7 +245,7 @@ describe('User Management', { disableAutoLogin: true }, () => {
updatedPersonalData.newPassword,
);
personalSettingsPage.actions.updateEmail(updatedPersonalData.newEmail);
workflowPage.getters.successToast().should('contain', 'Personal details updated');
successToast().should('contain', 'Personal details updated');
personalSettingsPage.actions.loginWithNewData(
updatedPersonalData.newEmail,
updatedPersonalData.newPassword,
Expand Down
15 changes: 8 additions & 7 deletions cypress/e2e/19-execution.cy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { v4 as uuid } from 'uuid';
import { NDV, WorkflowExecutionsTab, WorkflowPage as WorkflowPageClass } from '../pages';
import { SCHEDULE_TRIGGER_NODE_NAME, EDIT_FIELDS_SET_NODE_NAME } from '../constants';
import { errorToast, successToast } from '../pages/notifications';

const workflowPage = new WorkflowPageClass();
const executionsTab = new WorkflowExecutionsTab();
Expand Down Expand Up @@ -68,7 +69,7 @@ describe('Execution', () => {
workflowPage.getters.clearExecutionDataButton().should('not.exist');

// Check success toast (works because Cypress waits enough for the element to show after the http request node has finished)
workflowPage.getters.successToast().should('be.visible');
successToast().should('be.visible');
});

it('should test manual workflow stop', () => {
Expand Down Expand Up @@ -127,7 +128,7 @@ describe('Execution', () => {
workflowPage.getters.clearExecutionDataButton().should('not.exist');

// Check success toast (works because Cypress waits enough for the element to show after the http request node has finished)
workflowPage.getters.successToast().should('be.visible');
successToast().should('be.visible');
});

it('should test webhook workflow', () => {
Expand Down Expand Up @@ -200,7 +201,7 @@ describe('Execution', () => {
workflowPage.getters.clearExecutionDataButton().should('not.exist');

// Check success toast (works because Cypress waits enough for the element to show after the http request node has finished)
workflowPage.getters.successToast().should('be.visible');
successToast().should('be.visible');
});

it('should test webhook workflow stop', () => {
Expand Down Expand Up @@ -274,7 +275,7 @@ describe('Execution', () => {
workflowPage.getters.clearExecutionDataButton().should('not.exist');

// Check success toast (works because Cypress waits enough for the element to show after the http request node has finished)
workflowPage.getters.successToast().should('be.visible');
successToast().should('be.visible');
});

describe('execution preview', () => {
Expand All @@ -286,7 +287,7 @@ describe('Execution', () => {
executionsTab.actions.deleteExecutionInPreview();

executionsTab.getters.successfulExecutionListItems().should('have.length', 0);
workflowPage.getters.successToast().contains('Execution deleted');
successToast().contains('Execution deleted');
});
});

Expand Down Expand Up @@ -587,7 +588,7 @@ describe('Execution', () => {
cy.wait('@workflowRun');
// Wait again for the websocket message to arrive and the UI to update.
cy.wait(100);
workflowPage.getters.errorToast({ timeout: 1 }).should('not.exist');
errorToast({ timeout: 1 }).should('not.exist');
});

it('should execute workflow partially up to the node that has issues', () => {
Expand All @@ -614,6 +615,6 @@ describe('Execution', () => {
.within(() => cy.get('.fa-check'))
.should('exist');

workflowPage.getters.errorToast().should('contain', 'Problem in node ‘Telegram‘');
errorToast().should('contain', 'Problem in node ‘Telegram‘');
});
});
3 changes: 2 additions & 1 deletion cypress/e2e/2-credentials.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
TRELLO_NODE_NAME,
} from '../constants';
import { CredentialsModal, CredentialsPage, NDV, WorkflowPage } from '../pages';
import { successToast } from '../pages/notifications';
import { getVisibleSelect } from '../utils';

const credentialsPage = new CredentialsPage();
Expand Down Expand Up @@ -153,7 +154,7 @@ describe('Credentials', () => {
credentialsModal.getters.credentialsEditModal().should('be.visible');
credentialsModal.getters.deleteButton().click();
cy.get('.el-message-box').find('button').contains('Yes').click();
workflowPage.getters.successToast().contains('Credential deleted');
successToast().contains('Credential deleted');
workflowPage.getters
.nodeCredentialsSelect()
.find('input')
Expand Down
11 changes: 3 additions & 8 deletions cypress/e2e/2230-ADO-ndv-reset-data-pagination.cy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { NDV, WorkflowPage } from '../pages';
import { clearNotifications } from '../pages/notifications';

const workflowPage = new WorkflowPage();
const ndv = new NDV();
Expand All @@ -12,10 +13,7 @@ describe('ADO-2230 NDV Pagination Reset', () => {

// execute node outputting 10 pages, check output of first page
ndv.actions.execute();
workflowPage.getters
.successToast()
.find('.el-notification__closeBtn')
.click({ multiple: true });
clearNotifications();
ndv.getters.outputTbodyCell(1, 1).invoke('text').should('eq', 'Terry.Dach@hotmail.com');

// open 4th page, check output
Expand All @@ -27,10 +25,7 @@ describe('ADO-2230 NDV Pagination Reset', () => {
// output a lot less data
ndv.getters.parameterInput('randomDataCount').find('input').clear().type('20');
ndv.actions.execute();
workflowPage.getters
.successToast()
.find('.el-notification__closeBtn')
.click({ multiple: true });
clearNotifications();

// check we are back to second page now
ndv.getters.pagination().find('li.number').should('have.length', 2);
Expand Down
14 changes: 5 additions & 9 deletions cypress/e2e/33-settings-personal.cy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { WorkflowPage } from '../pages';

const workflowPage = new WorkflowPage();
import { errorToast, successToast } from '../pages/notifications';

const INVALID_NAMES = [
'https://n8n.io',
Expand Down Expand Up @@ -33,8 +31,8 @@ describe('Personal Settings', () => {
cy.getByTestId('personal-data-form').find('input[name="firstName"]').clear().type(name[0]);
cy.getByTestId('personal-data-form').find('input[name="lastName"]').clear().type(name[1]);
cy.getByTestId('save-settings-button').click();
workflowPage.getters.successToast().should('contain', 'Personal details updated');
workflowPage.getters.successToast().find('.el-notification__closeBtn').click();
successToast().should('contain', 'Personal details updated');
successToast().find('.el-notification__closeBtn').click();
});
});
it('not allow malicious values for personal data', () => {
Expand All @@ -43,10 +41,8 @@ describe('Personal Settings', () => {
cy.getByTestId('personal-data-form').find('input[name="firstName"]').clear().type(name);
cy.getByTestId('personal-data-form').find('input[name="lastName"]').clear().type(name);
cy.getByTestId('save-settings-button').click();
workflowPage.getters
.errorToast()
.should('contain', 'Malicious firstName | Malicious lastName');
workflowPage.getters.errorToast().find('.el-notification__closeBtn').click();
errorToast().should('contain', 'Malicious firstName | Malicious lastName');
errorToast().find('.el-notification__closeBtn').click();
});
});
});
9 changes: 5 additions & 4 deletions cypress/e2e/39-import-workflow.cy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { WorkflowPage } from '../pages';
import { MessageBox as MessageBoxClass } from '../pages/modals/message-box';
import { errorToast, successToast } from '../pages/notifications';

const workflowPage = new WorkflowPage();
const messageBox = new MessageBoxClass();
Expand Down Expand Up @@ -29,9 +30,9 @@ describe('Import workflow', () => {

workflowPage.getters.canvasNodes().should('have.length', 4);

workflowPage.getters.errorToast().should('not.exist');
errorToast().should('not.exist');

workflowPage.getters.successToast().should('not.exist');
successToast().should('not.exist');
});

it('clicking outside modal should not show error toast', () => {
Expand All @@ -42,7 +43,7 @@ describe('Import workflow', () => {

cy.get('body').click(0, 0);

workflowPage.getters.errorToast().should('not.exist');
errorToast().should('not.exist');
});

it('canceling modal should not show error toast', () => {
Expand All @@ -52,7 +53,7 @@ describe('Import workflow', () => {
workflowPage.getters.workflowMenuItemImportFromURLItem().click();
messageBox.getters.cancel().click();

workflowPage.getters.errorToast().should('not.exist');
errorToast().should('not.exist');
});
});

Expand Down
Loading

0 comments on commit 50bd5b9

Please sign in to comment.