fix: Load remote resources even if expressions in non requried parameters resolve (#6987)

Github issue / Community forum post (link here to close automatically):
This commit is contained in:
Mutasem Aldmour
2023-08-31 16:40:20 +02:00
committed by GitHub
parent 8cd4db0ab7
commit 8a8d4e8bb3
18 changed files with 478 additions and 25 deletions

View File

@@ -1,5 +1,5 @@
import { WorkflowPage, NDV, CredentialsModal } from '../pages';
import { getVisibleSelect } from '../utils';
import { getPopper, getVisiblePopper, getVisibleSelect } from '../utils';
const workflowPage = new WorkflowPage();
const ndv = new NDV();
@@ -51,4 +51,19 @@ describe('Resource Locator', () => {
ndv.actions.setRLCValue('documentId', '321');
ndv.getters.resourceLocatorInput('sheetName').should('have.value', '');
});
// unlike RMC and remote options, RLC does not support loadOptionDependsOn
it('should retrieve list options when other params throw errors', () => {
workflowPage.actions.addInitialNodeToCanvas('E2e Test', {action: 'Resource Locator'});
ndv.getters.resourceLocatorInput('rlc').click();
getVisiblePopper().should('have.length', 1).findChildByTestId('rlc-item').should('have.length', 5);
ndv.actions.setInvalidExpression('fieldId');
ndv.getters.container().click(); // remove focus from input, hide expression preview
ndv.getters.resourceLocatorInput('rlc').click();
getVisiblePopper().should('have.length', 1).findChildByTestId('rlc-item').should('have.length', 5);
});
});

View File

@@ -0,0 +1,32 @@
import { WorkflowPage, NDV } from '../pages';
const workflowPage = new WorkflowPage();
const ndv = new NDV();
describe('Resource Mapper', () => {
beforeEach(() => {
workflowPage.actions.visit();
});
it('should not retrieve list options when required params throw errors', () => {
workflowPage.actions.addInitialNodeToCanvas('E2e Test', {action: 'Resource Mapping Component'});
ndv.getters.resourceMapperFieldsContainer().should('be.visible').findChildByTestId('parameter-input').should('have.length', 2);
ndv.actions.setInvalidExpression('fieldId');
ndv.actions.refreshResourceMapperColumns();
ndv.getters.resourceMapperFieldsContainer().should('not.exist');
});
it('should retrieve list options when optional params throw errors', () => {
workflowPage.actions.addInitialNodeToCanvas('E2e Test', {action: 'Resource Mapping Component'});
ndv.getters.resourceMapperFieldsContainer().should('be.visible').findChildByTestId('parameter-input').should('have.length', 2);
ndv.actions.setInvalidExpression('otherField');
ndv.actions.refreshResourceMapperColumns();
ndv.getters.resourceMapperFieldsContainer().should('be.visible').findChildByTestId('parameter-input').should('have.length', 2);
});
});

View File

@@ -1,5 +1,6 @@
import { WorkflowPage, NDV } from '../pages';
import { v4 as uuid } from 'uuid';
import { getPopper, getVisiblePopper, getVisibleSelect } from '../utils';
const workflowPage = new WorkflowPage();
const ndv = new NDV();
@@ -289,6 +290,38 @@ describe('NDV', () => {
});
});
it('should not retrieve remote options when required params throw errors', () => {
workflowPage.actions.addInitialNodeToCanvas('E2e Test', {action: 'Remote Options'});
ndv.getters.parameterInput('remoteOptions').click();
getVisibleSelect().find('.el-select-dropdown__item').should('have.length', 3);
ndv.actions.setInvalidExpression('fieldId');
ndv.getters.container().click(); // remove focus from input, hide expression preview
ndv.getters.parameterInput('remoteOptions').click();
getPopper().should('not.be.visible');
ndv.getters.parameterInputIssues('remoteOptions').realHover();
getVisiblePopper().should('include.text', `node doesn't exist`);
});
it('should retrieve remote options when non-required params throw errors', () => {
workflowPage.actions.addInitialNodeToCanvas('E2e Test', {action: 'Remote Options'});
ndv.getters.parameterInput('remoteOptions').click();
getVisibleSelect().find('.el-select-dropdown__item').should('have.length', 3);
ndv.getters.parameterInput('remoteOptions').click();
ndv.actions.setInvalidExpression('otherField');
ndv.getters.container().click(); // remove focus from input, hide expression preview
ndv.getters.parameterInput('remoteOptions').click();
getVisibleSelect().find('.el-select-dropdown__item').should('have.length', 3);
});
it('should flag issues as soon as params are set', () => {
workflowPage.actions.addInitialNodeToCanvas('Webhook');
workflowPage.getters.canvasNodes().first().dblclick();