fix(editor): Testing flaky resource mapper feature in e2e tests (#7165)

This commit is contained in:
Milorad FIlipović
2023-09-14 10:54:25 +02:00
committed by GitHub
parent 0c6169ee22
commit aaf87c3edd
7 changed files with 86 additions and 58 deletions

View File

@@ -17,7 +17,7 @@ describe('Resource Mapper', () => {
.resourceMapperFieldsContainer()
.should('be.visible')
.findChildByTestId('parameter-input')
.should('have.length', 2);
.should('have.length', 3);
ndv.actions.setInvalidExpression('fieldId');
@@ -34,7 +34,7 @@ describe('Resource Mapper', () => {
.resourceMapperFieldsContainer()
.should('be.visible')
.findChildByTestId('parameter-input')
.should('have.length', 2);
.should('have.length', 3);
ndv.actions.setInvalidExpression('otherField');
@@ -43,6 +43,53 @@ describe('Resource Mapper', () => {
.resourceMapperFieldsContainer()
.should('be.visible')
.findChildByTestId('parameter-input')
.should('have.length', 2);
.should('have.length', 3);
});
it('should correctly delete single field', () => {
workflowPage.actions.addInitialNodeToCanvas('E2e Test', {
action: 'Resource Mapping Component',
});
ndv.getters.parameterInput('id').type('001');
ndv.getters.parameterInput('name').type('John');
ndv.getters.parameterInput('age').type('30');
ndv.getters.nodeExecuteButton().click();
ndv.getters.outputTableHeaderByText('id').should('exist');
ndv.getters.outputTableHeaderByText('name').should('exist');
ndv.getters.outputTableHeaderByText('age').should('exist');
// Remove the 'name' field
ndv.getters.resourceMapperRemoveFieldButton('name').should('exist').click({ force: true });
ndv.getters.nodeExecuteButton().click();
ndv.getters.parameterInput('id').should('exist');
ndv.getters.outputTableHeaderByText('id').should('exist');
// After removing the field, text field and the output table column for the 'name' should not be there anymore
ndv.getters.parameterInput('age').should('exist');
ndv.getters.outputTableHeaderByText('age').should('exist');
ndv.getters.parameterInput('name').should('not.exist');
ndv.getters.outputTableHeaderByText('name').should('not.exist');
});
it('should correctly delete all fields', () => {
workflowPage.actions.addInitialNodeToCanvas('E2e Test', {
action: 'Resource Mapping Component',
});
ndv.getters.parameterInput('id').type('001');
ndv.getters.parameterInput('name').type('John');
ndv.getters.parameterInput('age').type('30');
ndv.getters.nodeExecuteButton().click();
ndv.getters.outputTableHeaderByText('id').should('exist');
ndv.getters.outputTableHeaderByText('name').should('exist');
ndv.getters.outputTableHeaderByText('age').should('exist');
ndv.getters.resourceMapperColumnsOptionsButton().click();
// Click on the 'Remove All Fields' option
ndv.getters.resourceMapperRemoveAllFieldsOption().should('be.visible').click();
ndv.getters.nodeExecuteButton().click();
ndv.getters.parameterInput('id').should('exist');
ndv.getters.outputTableHeaderByText('id').should('exist');
// After removing the all fields, only required one should be in UI and output table
ndv.getters.parameterInput('name').should('not.exist');
ndv.getters.outputTableHeaderByText('name').should('not.exist');
ndv.getters.parameterInput('age').should('not.exist');
ndv.getters.outputTableHeaderByText('age').should('not.exist');
});
});

View File

@@ -28,6 +28,7 @@ export class NDV extends BasePage {
this.getters.runDataPaneHeader().find('button').filter(':visible').contains('Save'),
outputTableRows: () => this.getters.outputDataContainer().find('table tr'),
outputTableHeaders: () => this.getters.outputDataContainer().find('table thead th'),
outputTableHeaderByText: (text: string) => this.getters.outputTableHeaders().contains(text),
outputTableRow: (row: number) => this.getters.outputTableRows().eq(row),
outputTbodyCell: (row: number, col: number) =>
this.getters.outputTableRow(row).find('td').eq(col),
@@ -71,6 +72,9 @@ export class NDV extends BasePage {
this.getters.resourceLocator(paramName).find('[data-test-id="rlc-mode-selector"]'),
resourceMapperFieldsContainer: () => cy.getByTestId('mapping-fields-container'),
resourceMapperSelectColumn: () => cy.getByTestId('matching-column-select'),
resourceMapperRemoveFieldButton: (fieldName: string) => cy.getByTestId(`remove-field-button-${fieldName}`),
resourceMapperColumnsOptionsButton: () => cy.getByTestId('columns-parameter-input-options-container'),
resourceMapperRemoveAllFieldsOption: () => cy.getByTestId('action-removeAllFields'),
};
actions = {