fix: Fix mapping paths when appending to empty expression (#5591)
* fix: Fix mapping when appending to empty expression * fix: refactor logic out * test: add tests * test: add tests * fix: fix bug where value does not get updated when mapping * test: add test for bug * test: add test for bug
This commit is contained in:
@@ -262,4 +262,34 @@ describe('Data mapping', () => {
|
||||
.find('input')
|
||||
.should('have.value', 'input[0]["hello.world"]["my count"]');
|
||||
});
|
||||
|
||||
it('maps expressions to updated fields correctly', () => {
|
||||
cy.fixture('Test_workflow_3.json').then((data) => {
|
||||
cy.get('body').paste(JSON.stringify(data));
|
||||
});
|
||||
|
||||
workflowPage.actions.openNode('Set');
|
||||
|
||||
ndv.actions.typeIntoParameterInput('value', 'delete me');
|
||||
ndv.actions.dismissMappingTooltip();
|
||||
|
||||
ndv.actions.typeIntoParameterInput('name', 'test');
|
||||
|
||||
ndv.actions.typeIntoParameterInput('value', 'fun');
|
||||
ndv.actions.clearParameterInput('value'); // keep focus on param
|
||||
|
||||
ndv.getters.inputDataContainer().should('exist').find('span').contains('count').realMouseDown();
|
||||
|
||||
ndv.actions.mapToParameter('value');
|
||||
ndv.getters.inlineExpressionEditorInput().should('have.text', '{{ $json.input[0].count }}');
|
||||
ndv.getters.parameterExpressionPreview('value').should('include.text', '0');
|
||||
|
||||
ndv.getters.inputDataContainer().find('span').contains('input').realMouseDown();
|
||||
|
||||
ndv.actions.mapToParameter('value');
|
||||
ndv.getters
|
||||
.inlineExpressionEditorInput()
|
||||
.should('have.text', '{{ $json.input[0].count }} {{ $json.input }}');
|
||||
ndv.getters.parameterExpressionPreview('value').should('include.text', '0 [object Object]');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -86,6 +86,9 @@ export class NDV extends BasePage {
|
||||
selectOptionInParameterDropdown: (parameterName: string, content: string) => {
|
||||
this.getters.parameterInput(parameterName).find('.option-headline').contains(content).click();
|
||||
},
|
||||
dismissMappingTooltip: () => {
|
||||
cy.getByTestId('dismiss-mapping-tooltip').click();
|
||||
},
|
||||
rename: (newName: string) => {
|
||||
this.getters.nodeNameContainer().click();
|
||||
this.getters.nodeRenameInput().should('be.visible').type('{selectall}').type(newName);
|
||||
|
||||
Reference in New Issue
Block a user