n8n/cypress/e2e/14-mapping.cy.ts
Mutasem Aldmour db49f052bc
test: Add data mapping test (#5372)
* test: add tests for pinning

* test: add test for value

* test: add pinned data tests

* test: refactor into ndv

* refactor: move to ndv

* refactor: rename node

* test: fix test

* test: fix refactor

* test: remove unused id

* test: update test

* test: chain rename input

* test: refactor invoking text

* test: fix ndv tests

* test: move test id

* test: add tests for mapping

* test: update selectors

* test: add mapping

* test: remove wait

* test: add back line removed by mistake

* test: refactor to support both in/output displays

* test: add display mode switching

* test: fix drop

* chore: clean up change

* refactor: add draganddrop

* fix: fix drag and drop

* test: add mapping test for second value

* test: update text

* test: update param
2023-02-07 07:47:37 +03:00

38 lines
1.4 KiB
TypeScript

import { WorkflowPage, NDV, CanvasNode } from '../pages';
const workflowPage = new WorkflowPage();
const ndv = new NDV();
const canvasNode = new CanvasNode();
describe('Data mapping', () => {
before(() => {
cy.resetAll();
cy.skipSetup();
});
beforeEach(() => {
workflowPage.actions.visit();
});
it('Should be able to map expressions from table header', () => {
cy.fixture('Test_workflow-actions_paste-data.json').then((data) => {
cy.get('body').paste(JSON.stringify(data));
});
canvasNode.actions.openNode('Set');
ndv.actions.executePrevious();
ndv.actions.switchInputMode('Table');
ndv.getters.inputDataContainer().get('table', { timeout: 10000 }).should('exist');
ndv.getters.nodeParameters().find('input[placeholder*="Add Value"]').click();
ndv.getters.nodeParameters().find('.el-select-dropdown__list li:nth-child(3)').should('have.text', 'String').click();
ndv.getters.parameterInput('name').should('have.length', 1).find('input').should('have.value', 'propertyName');
ndv.getters.parameterInput('value').should('have.length', 1).find('input').should('have.value', '');
ndv.actions.mapDataFromHeader(1, 'value');
ndv.getters.inlineExpressionEditorInput().should('have.text', '{{ $json.timestamp }}');
ndv.actions.mapDataFromHeader(2, 'value');
ndv.getters.inlineExpressionEditorInput().should('have.text', '{{ $json.timestamp }} {{ $json["Readable date"] }}');
});
});