refactor: Upgrade to Prettier 3 (no-changelog) (#6947)

Supersedes https://github.com/n8n-io/n8n/pull/6937

Excluding fixtures and test workflow JSONs to avoid having to update
tests.
This commit is contained in:
Iván Ovejero
2023-08-16 17:13:57 +02:00
committed by GitHub
parent bb76c18073
commit 7ce5d8fd90
55 changed files with 1314 additions and 1295 deletions

View File

@@ -82,14 +82,10 @@ describe('Canvas Actions', () => {
cy.get('.plus-endpoint').should('be.visible').click();
WorkflowPage.getters.nodeCreatorSearchBar().should('be.visible');
WorkflowPage.getters.nodeCreatorSearchBar().type(CODE_NODE_NAME);
cy.drag(
WorkflowPage.getters.nodeCreatorNodeItems().first(),
[100, 100],
{
realMouse: true,
abs: true
}
);
cy.drag(WorkflowPage.getters.nodeCreatorNodeItems().first(), [100, 100], {
realMouse: true,
abs: true,
});
cy.get('body').type('{esc}');
WorkflowPage.getters.canvasNodes().should('have.length', 2);
WorkflowPage.getters.nodeConnections().should('have.length', 1);
@@ -100,14 +96,10 @@ describe('Canvas Actions', () => {
cy.get('.plus-endpoint').should('be.visible').click();
WorkflowPage.getters.nodeCreatorSearchBar().should('be.visible');
WorkflowPage.getters.nodeCreatorSearchBar().type(CODE_NODE_NAME);
cy.drag(
WorkflowPage.getters.nodeCreatorActionItems().first(),
[100, 100],
{
realMouse: true,
abs: true
}
);
cy.drag(WorkflowPage.getters.nodeCreatorActionItems().first(), [100, 100], {
realMouse: true,
abs: true,
});
WorkflowPage.getters.nodeCreatorCategoryItems().its('length').should('be.gt', 0);
WorkflowPage.getters.canvasNodes().should('have.length', 1);
WorkflowPage.getters.nodeConnections().should('have.length', 0);

View File

@@ -28,14 +28,9 @@ describe('NDV', () => {
ndv.actions.switchOutputMode('Table');
// input to output
ndv.getters
.inputTableRow(1)
.should('exist')
ndv.getters.inputTableRow(1).should('exist');
ndv.getters
.inputTableRow(1)
.invoke('attr', 'data-test-id')
.should('equal', 'hovering-item');
ndv.getters.inputTableRow(1).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
ndv.getters.inputTableRow(1).realHover();
ndv.getters.outputTableRow(4).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
@@ -88,16 +83,11 @@ describe('NDV', () => {
ndv.actions.selectInputNode('Set1');
ndv.getters.backToCanvas().realHover(); // reset to default hover
ndv.getters
.inputTableRow(1)
.should('have.text', '1000')
ndv.getters.inputTableRow(1).should('have.text', '1000');
ndv.getters
.inputTableRow(1)
.invoke('attr', 'data-test-id')
.should('equal', 'hovering-item');
ndv.getters.inputTableRow(1).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
ndv.getters.inputTableRow(1).realHover();
ndv.getters.inputTableRow(1).realHover();
cy.wait(50);
ndv.getters.outputHoveringItem().should('have.text', '1000');
ndv.getters.parameterExpressionPreview('value').should('include.text', '1000');
@@ -106,14 +96,9 @@ describe('NDV', () => {
ndv.actions.changeOutputRunSelector('1 of 2 (6 items)');
ndv.getters.backToCanvas().realHover(); // reset to default hover
ndv.getters
.inputTableRow(1)
.should('have.text', '1111')
ndv.getters.inputTableRow(1).should('have.text', '1111');
ndv.getters
.inputTableRow(1)
.invoke('attr', 'data-test-id')
.should('equal', 'hovering-item');
ndv.getters.inputTableRow(1).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
ndv.getters.inputTableRow(1).realHover();
cy.wait(50);
ndv.getters.outputHoveringItem().should('have.text', '1111');
@@ -146,27 +131,16 @@ describe('NDV', () => {
ndv.getters.inputRunSelector().find('input').should('include.value', '1 of 2 (6 items)');
ndv.getters.outputRunSelector().find('input').should('include.value', '1 of 2 (6 items)');
ndv.getters
.inputTableRow(1)
.should('have.text', '1111')
ndv.getters
.inputTableRow(1)
.invoke('attr', 'data-test-id')
.should('equal', 'hovering-item');
ndv.getters.inputTableRow(1).should('have.text', '1111');
ndv.getters.inputTableRow(1).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
ndv.getters.outputTableRow(1).should('have.text', '1111');
ndv.getters.outputTableRow(1).realHover();
ndv.getters.outputTableRow(3).should('have.text', '4444');
ndv.getters.outputTableRow(3).realHover();
ndv.getters
.inputTableRow(3)
.should('have.text', '4444')
ndv.getters
.inputTableRow(3)
.invoke('attr', 'data-test-id')
.should('equal', 'hovering-item');
ndv.getters.inputTableRow(3).should('have.text', '4444');
ndv.getters.inputTableRow(3).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
ndv.actions.changeOutputRunSelector('2 of 2 (6 items)');
cy.wait(50);
@@ -174,9 +148,7 @@ describe('NDV', () => {
ndv.getters.inputTableRow(1).should('have.text', '1000');
ndv.getters.inputTableRow(1).realHover();
ndv.getters
.outputTableRow(1)
.should('have.text', '1000')
ndv.getters.outputTableRow(1).should('have.text', '1000');
ndv.getters
.outputTableRow(1)
.should('have.text', '1000')
@@ -186,14 +158,9 @@ describe('NDV', () => {
ndv.getters.outputTableRow(3).should('have.text', '2000');
ndv.getters.outputTableRow(3).realHover();
ndv.getters
.inputTableRow(3)
.should('have.text', '2000')
ndv.getters.inputTableRow(3).should('have.text', '2000');
ndv.getters
.inputTableRow(3)
.invoke('attr', 'data-test-id')
.should('equal', 'hovering-item');
ndv.getters.inputTableRow(3).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
});
it('resolves expression with default item when input node is not parent, while still pairing items', () => {
@@ -215,42 +182,27 @@ describe('NDV', () => {
ndv.actions.switchOutputMode('Table');
ndv.getters.backToCanvas().realHover(); // reset to default hover
ndv.getters
.inputTableRow(1)
.should('have.text', '1111')
ndv.getters.inputTableRow(1).should('have.text', '1111');
ndv.getters
.inputTableRow(1)
.invoke('attr', 'data-test-id')
.should('equal', 'hovering-item');
ndv.getters.inputTableRow(1).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
ndv.getters.inputTableRow(1).realHover();
ndv.getters.outputHoveringItem().should('not.exist');
ndv.getters.parameterExpressionPreview('value').should('include.text', '1111');
ndv.actions.selectInputNode('Code1');
ndv.getters.inputTableRow(1).realHover();
ndv.getters
.inputTableRow(1)
.should('have.text', '1000')
ndv.getters.inputTableRow(1).should('have.text', '1000');
ndv.getters
.inputTableRow(1)
.invoke('attr', 'data-test-id')
.should('equal', 'hovering-item');
ndv.getters.inputTableRow(1).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
ndv.getters.outputTableRow(1).should('have.text', '1000');
ndv.getters.parameterExpressionPreview('value').should('include.text', '1000');
ndv.actions.selectInputNode('Code');
ndv.getters.inputTableRow(1).realHover();
ndv.getters
.inputTableRow(1)
.should('have.text', '6666')
ndv.getters.inputTableRow(1).should('have.text', '6666');
ndv.getters
.inputTableRow(1)
.invoke('attr', 'data-test-id')
.should('equal', 'hovering-item');
ndv.getters.inputTableRow(1).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
ndv.getters.outputHoveringItem().should('not.exist');
ndv.getters.parameterExpressionPreview('value').should('include.text', '1000');
@@ -282,26 +234,16 @@ describe('NDV', () => {
ndv.getters.outputTableRow(1).should('have.text', '8888');
ndv.getters.outputTableRow(1).realHover();
ndv.getters
.inputTableRow(5)
.should('have.text', '8888')
ndv.getters.inputTableRow(5).should('have.text', '8888');
ndv.getters
.inputTableRow(5)
.invoke('attr', 'data-test-id')
.should('equal', 'hovering-item');
ndv.getters.inputTableRow(5).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
ndv.getters.outputTableRow(2).should('have.text', '9999');
ndv.getters.outputTableRow(2).realHover();
ndv.getters
.inputTableRow(6)
.should('have.text', '9999')
ndv.getters.inputTableRow(6).should('have.text', '9999');
ndv.getters
.inputTableRow(6)
.invoke('attr', 'data-test-id')
.should('equal', 'hovering-item');
ndv.getters.inputTableRow(6).invoke('attr', 'data-test-id').should('equal', 'hovering-item');
ndv.actions.close();
@@ -309,12 +251,12 @@ describe('NDV', () => {
ndv.actions.switchInputBranch('True Branch');
ndv.actions.changeOutputRunSelector('1 of 2 (2 items)');
ndv.getters.outputTableRow(1).should('have.text', '8888')
ndv.getters.outputTableRow(1).should('have.text', '8888');
ndv.getters.outputTableRow(1).realHover();
cy.wait(100);
ndv.getters.inputHoveringItem().should('not.exist');
ndv.getters.inputTableRow(1).should('have.text', '1111')
ndv.getters.inputTableRow(1).should('have.text', '1111');
ndv.getters.inputTableRow(1).realHover();
cy.wait(100);
ndv.getters.outputHoveringItem().should('not.exist');

View File

@@ -18,7 +18,8 @@ export class CredentialsPage extends BasePage {
credentialDeleteButton: () =>
cy.getByTestId('action-toggle-dropdown').filter(':visible').contains('Delete'),
sort: () => cy.getByTestId('resources-list-sort').first(),
sortOption: (label: string) => cy.getByTestId('resources-list-sort-item').contains(label).first(),
sortOption: (label: string) =>
cy.getByTestId('resources-list-sort-item').contains(label).first(),
filtersTrigger: () => cy.getByTestId('resources-list-filters-trigger'),
filtersDropdown: () => cy.getByTestId('resources-list-filters-dropdown'),
};

View File

@@ -10,10 +10,10 @@ export class MessageBox extends BasePage {
};
actions = {
confirm: () => {
this.getters.confirm().click({ force: true});
this.getters.confirm().click({ force: true });
},
cancel: () => {
this.getters.cancel().click({ force: true});
this.getters.cancel().click({ force: true });
},
};
}

View File

@@ -1,5 +1,5 @@
import { BasePage } from "./base";
import { WorkflowPage } from "./workflow";
import { BasePage } from './base';
import { WorkflowPage } from './workflow';
const workflowPage = new WorkflowPage();
@@ -14,10 +14,14 @@ export class WorkflowExecutionsTab extends BasePage {
failedExecutionListItems: () => cy.get('[data-test-execution-status="error"]'),
executionCard: (executionId: string) => cy.getByTestId(`execution-details-${executionId}`),
executionPreviewDetails: () => cy.get('[data-test-id^="execution-preview-details-"]'),
executionPreviewDetailsById: (executionId: string) => cy.getByTestId(`execution-preview-details-${executionId}`),
executionPreviewTime: () => this.getters.executionPreviewDetails().find('[data-test-id="execution-time"]'),
executionPreviewStatus: () => this.getters.executionPreviewDetails().find('[data-test-id="execution-preview-label"]'),
executionPreviewId: () => this.getters.executionPreviewDetails().find('[data-test-id="execution-preview-id"]'),
executionPreviewDetailsById: (executionId: string) =>
cy.getByTestId(`execution-preview-details-${executionId}`),
executionPreviewTime: () =>
this.getters.executionPreviewDetails().find('[data-test-id="execution-time"]'),
executionPreviewStatus: () =>
this.getters.executionPreviewDetails().find('[data-test-id="execution-preview-label"]'),
executionPreviewId: () =>
this.getters.executionPreviewDetails().find('[data-test-id="execution-preview-id"]'),
};
actions = {
toggleNodeEnabled: (nodeName: string) => {
@@ -25,7 +29,7 @@ export class WorkflowExecutionsTab extends BasePage {
cy.get('body').type('d', { force: true });
},
createManualExecutions: (count: number) => {
for (let i=0; i<count; i++) {
for (let i = 0; i < count; i++) {
cy.intercept('POST', '/rest/workflows/run').as('workflowExecution');
workflowPage.actions.executeWorkflow();
cy.wait('@workflowExecution');
@@ -36,6 +40,6 @@ export class WorkflowExecutionsTab extends BasePage {
},
switchToEditorTab: () => {
workflowPage.getters.editorTabButton().click();
}
},
};
};
}

View File

@@ -221,7 +221,7 @@ export class WorkflowPage extends BasePage {
this.getters.workflowTagsInput().type(tag);
this.getters.workflowTagsInput().type('{enter}');
});
cy.realPress('Tab')
cy.realPress('Tab');
// For a brief moment the Element UI tag component shows the tags as(+X) string
// so we need to wait for it to disappear
this.getters.workflowTagsContainer().should('not.contain', `+${tags.length}`);

File diff suppressed because one or more lines are too long

View File

@@ -111,13 +111,13 @@ Cypress.Commands.add('drag', (selector, pos, options) => {
const newPosition = {
x: options?.abs ? xDiff : originalLocation.right + xDiff,
y: options?.abs ? yDiff : originalLocation.top + yDiff,
}
if(options?.realMouse) {
};
if (options?.realMouse) {
element.realMouseDown();
element.realMouseMove(newPosition.x, newPosition.y);
element.realMouseUp();
} else {
element.trigger('mousedown', {force: true});
element.trigger('mousedown', { force: true });
element.trigger('mousemove', {
which: 1,
pageX: newPosition.x,
@@ -129,7 +129,7 @@ Cypress.Commands.add('drag', (selector, pos, options) => {
// For some reason, mouseup isn't working when moving nodes
cy.get('body').click(newPosition.x, newPosition.y);
} else {
element.trigger('mouseup', {force: true});
element.trigger('mouseup', { force: true });
}
}
});

View File

@@ -31,7 +31,11 @@ declare global {
grantBrowserPermissions(...permissions: string[]): void;
readClipboard(): Chainable<string>;
paste(pastePayload: string): void;
drag(selector: string | Cypress.Chainable<JQuery<HTMLElement>>, target: [number, number], options?: {abs?: boolean, index?: number, realMouse?: boolean}): void;
drag(
selector: string | Cypress.Chainable<JQuery<HTMLElement>>,
target: [number, number],
options?: { abs?: boolean; index?: number; realMouse?: boolean },
): void;
draganddrop(draggableSelector: string, droppableSelector: string): void;
}
}