refactor: Format root-level dirs (no-changelog) (#4938)
🎨 Format root-level dirs
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { IE2ETestPage, IE2ETestPageElement } from "../types";
|
||||
import { IE2ETestPage, IE2ETestPageElement } from '../types';
|
||||
|
||||
export class BasePage implements IE2ETestPage {
|
||||
getters: Record<string, IE2ETestPageElement> = {};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BasePage } from "./base";
|
||||
import { BasePage } from './base';
|
||||
|
||||
export class CredentialsPage extends BasePage {
|
||||
url = '/credentials';
|
||||
@@ -8,12 +8,15 @@ export class CredentialsPage extends BasePage {
|
||||
searchInput: () => cy.getByTestId('resources-list-search'),
|
||||
emptyList: () => cy.getByTestId('resources-list-empty'),
|
||||
credentialCards: () => cy.getByTestId('resources-list-item'),
|
||||
credentialCard: (credentialName: string) => this.getters.credentialCards()
|
||||
.contains(credentialName)
|
||||
.parents('[data-test-id="resources-list-item"]'),
|
||||
credentialCardActions: (credentialName: string) => this.getters.credentialCard(credentialName)
|
||||
.findChildByTestId('credential-card-actions'),
|
||||
credentialDeleteButton: () => cy.getByTestId('action-toggle-dropdown').filter(':visible').contains('Delete'),
|
||||
credentialCard: (credentialName: string) =>
|
||||
this.getters
|
||||
.credentialCards()
|
||||
.contains(credentialName)
|
||||
.parents('[data-test-id="resources-list-item"]'),
|
||||
credentialCardActions: (credentialName: string) =>
|
||||
this.getters.credentialCard(credentialName).findChildByTestId('credential-card-actions'),
|
||||
credentialDeleteButton: () =>
|
||||
cy.getByTestId('action-toggle-dropdown').filter(':visible').contains('Delete'),
|
||||
sort: () => cy.getByTestId('resources-list-sort'),
|
||||
sortOption: (label: string) => this.getters.sort().contains(label).first(),
|
||||
filtersTrigger: () => cy.getByTestId('resources-list-filters-trigger'),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BasePage } from "../base";
|
||||
import { BasePage } from '../base';
|
||||
import { INodeTypeDescription } from '../../packages/workflow';
|
||||
|
||||
export class NodeCreator extends BasePage {
|
||||
@@ -7,7 +7,8 @@ export class NodeCreator extends BasePage {
|
||||
plusButton: () => cy.getByTestId('node-creator-plus-button'),
|
||||
canvasAddButton: () => cy.getByTestId('canvas-add-button'),
|
||||
searchBar: () => cy.getByTestId('search-bar'),
|
||||
getCreatorItem: (label: string) => this.getters.creatorItem().contains(label).parents('[data-test-id="item-iterator-item"]'),
|
||||
getCreatorItem: (label: string) =>
|
||||
this.getters.creatorItem().contains(label).parents('[data-test-id="item-iterator-item"]'),
|
||||
getNthCreatorItem: (n: number) => this.getters.creatorItem().eq(n),
|
||||
nodeCreator: () => cy.getByTestId('node-creator'),
|
||||
nodeCreatorTabs: () => cy.getByTestId('node-creator-type-selector'),
|
||||
@@ -18,13 +19,14 @@ export class NodeCreator extends BasePage {
|
||||
noResults: () => cy.getByTestId('categorized-no-results'),
|
||||
nodeItemName: () => cy.getByTestId('node-creator-item-name'),
|
||||
activeSubcategory: () => cy.getByTestId('categorized-items-subcategory'),
|
||||
expandedCategories: () => this.getters.creatorItem().find('>div').filter('.active').invoke('text'),
|
||||
expandedCategories: () =>
|
||||
this.getters.creatorItem().find('>div').filter('.active').invoke('text'),
|
||||
};
|
||||
actions = {
|
||||
openNodeCreator: () => {
|
||||
cy.waitForLoad();
|
||||
this.getters.plusButton().click();
|
||||
this.getters.nodeCreator().should('be.visible')
|
||||
this.getters.nodeCreator().should('be.visible');
|
||||
},
|
||||
selectNode: (displayName: string) => {
|
||||
this.getters.getCreatorItem(displayName).click();
|
||||
@@ -33,15 +35,20 @@ export class NodeCreator extends BasePage {
|
||||
this.getters.nodeCreatorTabs().contains(tab).click();
|
||||
},
|
||||
toggleCategory: (category: string) => {
|
||||
this.getters.getCreatorItem(category).click()
|
||||
this.getters.getCreatorItem(category).click();
|
||||
},
|
||||
categorizeNodes: (nodes: INodeTypeDescription[]) => {
|
||||
const categorizedNodes = nodes.reduce((acc, node) => {
|
||||
const categories = (node?.codex?.categories || []).map((category: string) => category.trim());
|
||||
const categories = (node?.codex?.categories || []).map((category: string) =>
|
||||
category.trim(),
|
||||
);
|
||||
|
||||
categories.forEach((category: {[key: string]: INodeTypeDescription[]}) => {
|
||||
categories.forEach((category: { [key: string]: INodeTypeDescription[] }) => {
|
||||
// Node creator should show only the latest version of a node
|
||||
const newerVersion = nodes.find((n: INodeTypeDescription) => n.name === node.name && (n.version > node.version || Array.isArray(n.version)));
|
||||
const newerVersion = nodes.find(
|
||||
(n: INodeTypeDescription) =>
|
||||
n.name === node.name && (n.version > node.version || Array.isArray(n.version)),
|
||||
);
|
||||
|
||||
if (acc[category] === undefined) {
|
||||
acc[category] = [];
|
||||
@@ -49,9 +56,9 @@ export class NodeCreator extends BasePage {
|
||||
acc[category].push(newerVersion ?? node);
|
||||
});
|
||||
return acc;
|
||||
}, {})
|
||||
}, {});
|
||||
|
||||
return categorizedNodes;
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,16 +1,20 @@
|
||||
import { BasePage } from "../base";
|
||||
import { BasePage } from '../base';
|
||||
|
||||
export class CredentialsModal extends BasePage {
|
||||
getters = {
|
||||
newCredentialModal: () => cy.getByTestId('selectCredential-modal', { timeout: 5000 }),
|
||||
editCredentialModal: () => cy.getByTestId('editCredential-modal', { timeout: 5000 }),
|
||||
newCredentialTypeSelect: () => cy.getByTestId('new-credential-type-select'),
|
||||
newCredentialTypeOption: (credentialType: string) => cy.getByTestId('new-credential-type-select-option').contains(credentialType),
|
||||
newCredentialTypeOption: (credentialType: string) =>
|
||||
cy.getByTestId('new-credential-type-select-option').contains(credentialType),
|
||||
newCredentialTypeButton: () => cy.getByTestId('new-credential-type-button'),
|
||||
connectionParameters: () => cy.getByTestId('credential-connection-parameter'),
|
||||
connectionParameter: (fieldName: string) => this.getters.connectionParameters().contains(fieldName)
|
||||
.parents('[data-test-id="credential-connection-parameter"]')
|
||||
.find('.n8n-input input'),
|
||||
connectionParameter: (fieldName: string) =>
|
||||
this.getters
|
||||
.connectionParameters()
|
||||
.contains(fieldName)
|
||||
.parents('[data-test-id="credential-connection-parameter"]')
|
||||
.find('.n8n-input input'),
|
||||
name: () => cy.getByTestId('credential-name'),
|
||||
nameInput: () => cy.getByTestId('credential-name').find('input'),
|
||||
// Saving of the credentials takes a while on the CI so we need to increase the timeout
|
||||
@@ -24,14 +28,14 @@ export class CredentialsModal extends BasePage {
|
||||
},
|
||||
save: (test = false) => {
|
||||
cy.intercept('POST', '/rest/credentials').as('saveCredential');
|
||||
if(test) {
|
||||
if (test) {
|
||||
cy.intercept('POST', '/rest/credentials/test').as('testCredential');
|
||||
}
|
||||
|
||||
this.getters.saveButton().click();
|
||||
|
||||
cy.wait('@saveCredential');
|
||||
if(test) cy.wait('@testCredential')
|
||||
if (test) cy.wait('@testCredential');
|
||||
this.getters.saveButton().should('contain.text', 'Saved');
|
||||
},
|
||||
close: () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BasePage } from "../base";
|
||||
import { BasePage } from '../base';
|
||||
|
||||
export class MessageBox extends BasePage {
|
||||
getters = {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BasePage } from "./base";
|
||||
import { BasePage } from './base';
|
||||
|
||||
export class NDV extends BasePage {
|
||||
getters = {
|
||||
@@ -12,5 +12,5 @@ export class NDV extends BasePage {
|
||||
dataContainer: () => cy.getByTestId('ndv-data-container'),
|
||||
runDataDisplayMode: () => cy.getByTestId('ndv-run-data-display-mode'),
|
||||
digital: () => cy.getByTestId('ndv-run-data-display-mode'),
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { BasePage } from "./base";
|
||||
import { BasePage } from './base';
|
||||
|
||||
export class SettingsUsersPage extends BasePage {
|
||||
url = '/settings/users';
|
||||
getters = {
|
||||
setUpOwnerButton: () => cy.getByTestId('action-box').find('button'),
|
||||
}
|
||||
};
|
||||
actions = {
|
||||
goToOwnerSetup: () => this.getters.setUpOwnerButton().click(),
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { BasePage } from "../base";
|
||||
import { BasePage } from '../base';
|
||||
|
||||
export class MainSidebar extends BasePage {
|
||||
getters = {
|
||||
menuItem: (menuLabel: string) => cy.getByTestId('menu-item').filter(`:contains("${menuLabel}")`),
|
||||
menuItem: (menuLabel: string) =>
|
||||
cy.getByTestId('menu-item').filter(`:contains("${menuLabel}")`),
|
||||
settings: () => this.getters.menuItem('Settings'),
|
||||
templates: () => this.getters.menuItem('Templates'),
|
||||
workflows: () => this.getters.menuItem('Workflows'),
|
||||
@@ -19,7 +20,7 @@ export class MainSidebar extends BasePage {
|
||||
goToCredentials: () => {
|
||||
this.getters.credentials().should('be.visible');
|
||||
cy.get('[data-old-overflow]').should('not.exist');
|
||||
this.getters.credentials().click()
|
||||
this.getters.credentials().click();
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BasePage } from "../base";
|
||||
import { BasePage } from '../base';
|
||||
|
||||
export class SettingsSidebar extends BasePage {
|
||||
getters = {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BasePage } from "./base";
|
||||
import { BasePage } from './base';
|
||||
|
||||
export class SigninPage extends BasePage {
|
||||
url = '/signin';
|
||||
@@ -7,5 +7,5 @@ export class SigninPage extends BasePage {
|
||||
email: () => cy.getByTestId('email'),
|
||||
password: () => cy.getByTestId('password'),
|
||||
submit: () => cy.get('button'),
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BasePage } from "./base";
|
||||
import { BasePage } from './base';
|
||||
|
||||
// todo rename to setup
|
||||
export class SignupPage extends BasePage {
|
||||
@@ -11,5 +11,5 @@ export class SignupPage extends BasePage {
|
||||
password: () => cy.getByTestId('password'),
|
||||
submit: () => cy.get('button'),
|
||||
skip: () => cy.get('a'),
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -4,13 +4,16 @@ export class WorkflowPage extends BasePage {
|
||||
url = '/workflow/new';
|
||||
getters = {
|
||||
workflowNameInputContainer: () => cy.getByTestId('workflow-name-input', { timeout: 5000 }),
|
||||
workflowNameInput: () => this.getters.workflowNameInputContainer().then(($el) => cy.wrap($el.find('input'))),
|
||||
workflowNameInput: () =>
|
||||
this.getters.workflowNameInputContainer().then(($el) => cy.wrap($el.find('input'))),
|
||||
workflowImportInput: () => cy.getByTestId('workflow-import-input'),
|
||||
workflowTags: () => cy.getByTestId('workflow-tags'),
|
||||
workflowTagsContainer: () => cy.getByTestId('workflow-tags-container'),
|
||||
workflowTagsInput: () => this.getters.workflowTagsContainer().then(($el) => cy.wrap($el.find('input').first())),
|
||||
workflowTagsInput: () =>
|
||||
this.getters.workflowTagsContainer().then(($el) => cy.wrap($el.find('input').first())),
|
||||
workflowTagElements: () => cy.get('[data-test-id="workflow-tags-container"] span.tags > span'),
|
||||
firstWorkflowTagElement: () => cy.get('[data-test-id="workflow-tags-container"] span.tags > span:nth-child(1)'),
|
||||
firstWorkflowTagElement: () =>
|
||||
cy.get('[data-test-id="workflow-tags-container"] span.tags > span:nth-child(1)'),
|
||||
workflowTagsDropdown: () => cy.getByTestId('workflow-tags-dropdown'),
|
||||
newTagLink: () => cy.getByTestId('new-tag-link'),
|
||||
saveButton: () => cy.getByTestId('workflow-save-button'),
|
||||
@@ -18,7 +21,8 @@ export class WorkflowPage extends BasePage {
|
||||
nodeCreatorPlusButton: () => cy.getByTestId('node-creator-plus-button'),
|
||||
canvasPlusButton: () => cy.getByTestId('canvas-plus-button'),
|
||||
canvasNodes: () => cy.getByTestId('canvas-node'),
|
||||
canvasNodeByName: (nodeName: string) => this.getters.canvasNodes().filter(`:contains("${nodeName}")`),
|
||||
canvasNodeByName: (nodeName: string) =>
|
||||
this.getters.canvasNodes().filter(`:contains("${nodeName}")`),
|
||||
ndvParameterInput: (parameterName: string) =>
|
||||
cy.getByTestId(`parameter-input-${parameterName}`),
|
||||
ndvOutputPanel: () => cy.getByTestId('output-panel'),
|
||||
@@ -51,13 +55,19 @@ export class WorkflowPage extends BasePage {
|
||||
workflowSettingsModal: () => cy.getByTestId('workflow-settings-dialog'),
|
||||
workflowSettingsErrorWorkflowSelect: () => cy.getByTestId('workflow-settings-error-workflow'),
|
||||
workflowSettingsTimezoneSelect: () => cy.getByTestId('workflow-settings-timezone'),
|
||||
workflowSettingsSaveFiledExecutionsSelect: () => cy.getByTestId('workflow-settings-save-failed-executions'),
|
||||
workflowSettingsSaveSuccessExecutionsSelect: () => cy.getByTestId('workflow-settings-save-success-executions'),
|
||||
workflowSettingsSaveManualExecutionsSelect: () => cy.getByTestId('workflow-settings-save-manual-executions'),
|
||||
workflowSettingsSaveExecutionProgressSelect: () => cy.getByTestId('workflow-settings-save-execution-progress'),
|
||||
workflowSettingsTimeoutWorkflowSwitch: () => cy.getByTestId('workflow-settings-timeout-workflow'),
|
||||
workflowSettingsSaveFiledExecutionsSelect: () =>
|
||||
cy.getByTestId('workflow-settings-save-failed-executions'),
|
||||
workflowSettingsSaveSuccessExecutionsSelect: () =>
|
||||
cy.getByTestId('workflow-settings-save-success-executions'),
|
||||
workflowSettingsSaveManualExecutionsSelect: () =>
|
||||
cy.getByTestId('workflow-settings-save-manual-executions'),
|
||||
workflowSettingsSaveExecutionProgressSelect: () =>
|
||||
cy.getByTestId('workflow-settings-save-execution-progress'),
|
||||
workflowSettingsTimeoutWorkflowSwitch: () =>
|
||||
cy.getByTestId('workflow-settings-timeout-workflow'),
|
||||
workflowSettingsTimeoutForm: () => cy.getByTestId('workflow-settings-timeout-form'),
|
||||
workflowSettingsSaveButton: () => cy.getByTestId('workflow-settings-save-button').find('button'),
|
||||
workflowSettingsSaveButton: () =>
|
||||
cy.getByTestId('workflow-settings-save-button').find('button'),
|
||||
|
||||
inlineExpressionEditorInput: () => cy.getByTestId('inline-expression-editor-input'),
|
||||
inlineExpressionEditorOutput: () => cy.getByTestId('inline-expression-editor-output'),
|
||||
@@ -124,7 +134,7 @@ export class WorkflowPage extends BasePage {
|
||||
cy.get('body').type('{enter}');
|
||||
},
|
||||
addTags: (tags: string[]) => {
|
||||
tags.forEach(tag => {
|
||||
tags.forEach((tag) => {
|
||||
this.getters.workflowTagsInput().type(tag);
|
||||
this.getters.workflowTagsInput().type('{enter}');
|
||||
});
|
||||
@@ -142,10 +152,10 @@ export class WorkflowPage extends BasePage {
|
||||
},
|
||||
hitRedo: () => {
|
||||
const metaKey = Cypress.platform === 'darwin' ? '{meta}' : '{ctrl}';
|
||||
cy.get('body').
|
||||
type(metaKey, { delay: 500, release: false }).
|
||||
type('{shift}', { release: false }).
|
||||
type('z');
|
||||
cy.get('body')
|
||||
.type(metaKey, { delay: 500, release: false })
|
||||
.type('{shift}', { release: false })
|
||||
.type('z');
|
||||
},
|
||||
selectAll: () => {
|
||||
const metaKey = Cypress.platform === 'darwin' ? '{meta}' : '{ctrl}';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BasePage } from "./base";
|
||||
import { BasePage } from './base';
|
||||
|
||||
export class WorkflowsPage extends BasePage {
|
||||
url = '/workflows';
|
||||
@@ -8,18 +8,21 @@ export class WorkflowsPage extends BasePage {
|
||||
searchBar: () => cy.getByTestId('resources-list-search'),
|
||||
createWorkflowButton: () => cy.getByTestId('resources-list-add'),
|
||||
workflowCards: () => cy.getByTestId('resources-list-item'),
|
||||
workflowCard: (workflowName: string) => this.getters.workflowCards()
|
||||
.contains(workflowName)
|
||||
.parents('[data-test-id="resources-list-item"]'),
|
||||
workflowTags: (workflowName: string) => this.getters.workflowCard(workflowName)
|
||||
.findChildByTestId('workflow-card-tags'),
|
||||
workflowActivator: (workflowName: string) => this.getters.workflowCard(workflowName)
|
||||
.findChildByTestId('workflow-card-activator'),
|
||||
workflowActivatorStatus: (workflowName: string) => this.getters.workflowActivator(workflowName)
|
||||
.findChildByTestId('workflow-activator-status'),
|
||||
workflowCardActions: (workflowName: string) => this.getters.workflowCard(workflowName)
|
||||
.findChildByTestId('workflow-card-actions'),
|
||||
workflowDeleteButton: () => cy.getByTestId('action-toggle-dropdown').filter(':visible').contains('Delete')
|
||||
workflowCard: (workflowName: string) =>
|
||||
this.getters
|
||||
.workflowCards()
|
||||
.contains(workflowName)
|
||||
.parents('[data-test-id="resources-list-item"]'),
|
||||
workflowTags: (workflowName: string) =>
|
||||
this.getters.workflowCard(workflowName).findChildByTestId('workflow-card-tags'),
|
||||
workflowActivator: (workflowName: string) =>
|
||||
this.getters.workflowCard(workflowName).findChildByTestId('workflow-card-activator'),
|
||||
workflowActivatorStatus: (workflowName: string) =>
|
||||
this.getters.workflowActivator(workflowName).findChildByTestId('workflow-activator-status'),
|
||||
workflowCardActions: (workflowName: string) =>
|
||||
this.getters.workflowCard(workflowName).findChildByTestId('workflow-card-actions'),
|
||||
workflowDeleteButton: () =>
|
||||
cy.getByTestId('action-toggle-dropdown').filter(':visible').contains('Delete'),
|
||||
// Not yet implemented
|
||||
// myWorkflows: () => cy.getByTestId('my-workflows'),
|
||||
// allWorkflows: () => cy.getByTestId('all-workflows'),
|
||||
@@ -35,6 +38,6 @@ export class WorkflowsPage extends BasePage {
|
||||
this.getters.workflowDeleteButton().click();
|
||||
|
||||
cy.get('button').contains('delete').click();
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user