2022-12-15 07:39:59 -08:00
|
|
|
import { BasePage } from './base';
|
2022-12-01 00:26:38 -08:00
|
|
|
|
|
|
|
export class NDV extends BasePage {
|
|
|
|
getters = {
|
|
|
|
container: () => cy.getByTestId('ndv'),
|
|
|
|
backToCanvas: () => cy.getByTestId('back-to-canvas'),
|
|
|
|
copyInput: () => cy.getByTestId('copy-input'),
|
2023-02-14 06:13:00 -08:00
|
|
|
credentialInput: (eq = 0) => cy.getByTestId('node-credentials-select').eq(eq),
|
2022-12-01 00:26:38 -08:00
|
|
|
nodeExecuteButton: () => cy.getByTestId('node-execute-button'),
|
|
|
|
inputSelect: () => cy.getByTestId('ndv-input-select'),
|
|
|
|
inputOption: () => cy.getByTestId('ndv-input-option'),
|
|
|
|
inputPanel: () => cy.getByTestId('ndv-input-panel'),
|
2023-01-18 06:48:36 -08:00
|
|
|
outputPanel: () => cy.getByTestId('output-panel'),
|
2023-02-09 06:59:01 -08:00
|
|
|
executingLoader: () => cy.getByTestId('ndv-executing'),
|
2023-01-18 06:48:36 -08:00
|
|
|
inputDataContainer: () => this.getters.inputPanel().findChildByTestId('ndv-data-container'),
|
2023-06-15 05:30:05 -07:00
|
|
|
inputDisplayMode: () =>
|
|
|
|
this.getters.inputPanel().findChildByTestId('ndv-run-data-display-mode').first(),
|
2023-01-18 06:48:36 -08:00
|
|
|
outputDataContainer: () => this.getters.outputPanel().findChildByTestId('ndv-data-container'),
|
2023-06-15 05:30:05 -07:00
|
|
|
outputDisplayMode: () =>
|
|
|
|
this.getters.outputPanel().findChildByTestId('ndv-run-data-display-mode').first(),
|
2023-01-18 06:48:36 -08:00
|
|
|
pinDataButton: () => cy.getByTestId('ndv-pin-data'),
|
|
|
|
editPinnedDataButton: () => cy.getByTestId('ndv-edit-pinned-data'),
|
2023-04-25 07:57:21 -07:00
|
|
|
pinnedDataEditor: () => this.getters.outputPanel().find('.cm-editor .cm-scroller'),
|
2023-01-18 06:48:36 -08:00
|
|
|
runDataPaneHeader: () => cy.getByTestId('run-data-pane-header'),
|
2023-06-15 05:30:05 -07:00
|
|
|
savePinnedDataButton: () =>
|
|
|
|
this.getters.runDataPaneHeader().find('button').filter(':visible').contains('Save'),
|
2023-01-18 06:48:36 -08:00
|
|
|
outputTableRows: () => this.getters.outputDataContainer().find('table tr'),
|
|
|
|
outputTableHeaders: () => this.getters.outputDataContainer().find('table thead th'),
|
|
|
|
outputTableRow: (row: number) => this.getters.outputTableRows().eq(row),
|
2023-02-14 06:13:00 -08:00
|
|
|
outputTbodyCell: (row: number, col: number) =>
|
|
|
|
this.getters.outputTableRow(row).find('td').eq(col),
|
2023-02-09 06:59:01 -08:00
|
|
|
inputTableRows: () => this.getters.inputDataContainer().find('table tr'),
|
|
|
|
inputTableHeaders: () => this.getters.inputDataContainer().find('table thead th'),
|
|
|
|
inputTableRow: (row: number) => this.getters.inputTableRows().eq(row),
|
2023-02-14 06:13:00 -08:00
|
|
|
inputTbodyCell: (row: number, col: number) =>
|
|
|
|
this.getters.inputTableRow(row).find('td').eq(col),
|
2023-02-06 20:47:37 -08:00
|
|
|
inlineExpressionEditorInput: () => cy.getByTestId('inline-expression-editor-input'),
|
|
|
|
nodeParameters: () => cy.getByTestId('node-parameters'),
|
2023-01-18 06:48:36 -08:00
|
|
|
parameterInput: (parameterName: string) => cy.getByTestId(`parameter-input-${parameterName}`),
|
2023-02-14 06:13:00 -08:00
|
|
|
parameterExpressionPreview: (parameterName: string) =>
|
|
|
|
this.getters
|
|
|
|
.nodeParameters()
|
|
|
|
.find(
|
|
|
|
`[data-test-id="parameter-input-${parameterName}"] + [data-test-id="parameter-expression-preview"]`,
|
|
|
|
),
|
2023-01-18 06:48:36 -08:00
|
|
|
nodeNameContainer: () => cy.getByTestId('node-title-container'),
|
|
|
|
nodeRenameInput: () => cy.getByTestId('node-rename-input'),
|
2023-02-06 20:47:37 -08:00
|
|
|
executePrevious: () => cy.getByTestId('execute-previous-node'),
|
2023-02-03 04:14:59 -08:00
|
|
|
httpRequestNotice: () => cy.getByTestId('node-parameters-http-notice'),
|
2023-02-08 01:41:36 -08:00
|
|
|
nthParam: (n: number) => cy.getByTestId('node-parameters').find('.parameter-item').eq(n),
|
2023-04-21 05:08:51 -07:00
|
|
|
inputRunSelector: () => this.getters.inputPanel().findChildByTestId('run-selector'),
|
|
|
|
outputRunSelector: () => this.getters.outputPanel().findChildByTestId('run-selector'),
|
|
|
|
outputHoveringItem: () => this.getters.outputPanel().findChildByTestId('hovering-item'),
|
|
|
|
inputHoveringItem: () => this.getters.inputPanel().findChildByTestId('hovering-item'),
|
|
|
|
outputBranches: () => this.getters.outputPanel().findChildByTestId('branches'),
|
|
|
|
inputBranches: () => this.getters.inputPanel().findChildByTestId('branches'),
|
2023-04-28 03:14:31 -07:00
|
|
|
resourceLocator: (paramName: string) => cy.getByTestId(`resource-locator-${paramName}`),
|
2023-06-15 05:30:05 -07:00
|
|
|
resourceLocatorInput: (paramName: string) =>
|
|
|
|
this.getters.resourceLocator(paramName).find('[data-test-id="rlc-input-container"]'),
|
|
|
|
resourceLocatorDropdown: (paramName: string) =>
|
|
|
|
this.getters.resourceLocator(paramName).find('[data-test-id="resource-locator-dropdown"]'),
|
2023-04-28 03:14:31 -07:00
|
|
|
resourceLocatorErrorMessage: () => cy.getByTestId('rlc-error-container'),
|
2023-06-15 05:30:05 -07:00
|
|
|
resourceLocatorModeSelector: (paramName: string) =>
|
|
|
|
this.getters.resourceLocator(paramName).find('[data-test-id="rlc-mode-selector"]'),
|
2023-01-18 06:48:36 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
actions = {
|
|
|
|
pinData: () => {
|
|
|
|
this.getters.pinDataButton().click();
|
|
|
|
},
|
|
|
|
editPinnedData: () => {
|
|
|
|
this.getters.editPinnedDataButton().click();
|
|
|
|
},
|
2023-02-09 06:59:01 -08:00
|
|
|
savePinnedData: () => {
|
|
|
|
this.getters.savePinnedDataButton().click();
|
|
|
|
},
|
2023-01-18 06:48:36 -08:00
|
|
|
execute: () => {
|
|
|
|
this.getters.nodeExecuteButton().first().click();
|
|
|
|
},
|
|
|
|
close: () => {
|
|
|
|
this.getters.backToCanvas().click();
|
|
|
|
},
|
2023-02-08 01:41:36 -08:00
|
|
|
openInlineExpressionEditor: () => {
|
|
|
|
cy.contains('Expression').invoke('show').click();
|
|
|
|
this.getters.inlineExpressionEditorInput().click();
|
|
|
|
},
|
2023-01-18 06:48:36 -08:00
|
|
|
setPinnedData: (data: object) => {
|
|
|
|
this.getters.editPinnedDataButton().click();
|
|
|
|
|
2023-02-17 06:08:26 -08:00
|
|
|
this.getters.pinnedDataEditor().click();
|
2023-06-15 05:30:05 -07:00
|
|
|
this.getters
|
|
|
|
.pinnedDataEditor()
|
|
|
|
.type(`{selectall}{backspace}${JSON.stringify(data).replace(new RegExp('{', 'g'), '{{}')}`);
|
2023-01-18 06:48:36 -08:00
|
|
|
|
2023-02-09 06:59:01 -08:00
|
|
|
this.actions.savePinnedData();
|
|
|
|
},
|
|
|
|
clearParameterInput: (parameterName: string) => {
|
|
|
|
this.getters.parameterInput(parameterName).type(`{selectall}{backspace}`);
|
2023-01-18 06:48:36 -08:00
|
|
|
},
|
|
|
|
typeIntoParameterInput: (parameterName: string, content: string) => {
|
|
|
|
this.getters.parameterInput(parameterName).type(content);
|
|
|
|
},
|
|
|
|
selectOptionInParameterDropdown: (parameterName: string, content: string) => {
|
2023-02-14 06:13:00 -08:00
|
|
|
this.getters.parameterInput(parameterName).find('.option-headline').contains(content).click();
|
2023-01-18 06:48:36 -08:00
|
|
|
},
|
2023-03-02 04:02:29 -08:00
|
|
|
dismissMappingTooltip: () => {
|
|
|
|
cy.getByTestId('dismiss-mapping-tooltip').click();
|
|
|
|
},
|
2023-01-18 06:48:36 -08:00
|
|
|
rename: (newName: string) => {
|
|
|
|
this.getters.nodeNameContainer().click();
|
2023-02-14 06:13:00 -08:00
|
|
|
this.getters.nodeRenameInput().should('be.visible').type('{selectall}').type(newName);
|
2023-01-18 06:48:36 -08:00
|
|
|
cy.get('body').type('{enter}');
|
|
|
|
},
|
2023-02-06 20:47:37 -08:00
|
|
|
executePrevious: () => {
|
|
|
|
this.getters.executePrevious().click();
|
|
|
|
},
|
|
|
|
mapDataFromHeader: (col: number, parameterName: string) => {
|
|
|
|
const draggable = `[data-test-id="ndv-input-panel"] [data-test-id="ndv-data-container"] table th:nth-child(${col})`;
|
|
|
|
const droppable = `[data-test-id="parameter-input-${parameterName}"]`;
|
|
|
|
cy.draganddrop(draggable, droppable);
|
|
|
|
},
|
2023-02-09 06:59:01 -08:00
|
|
|
mapToParameter: (parameterName: string) => {
|
|
|
|
const droppable = `[data-test-id="parameter-input-${parameterName}"]`;
|
|
|
|
cy.draganddrop('', droppable);
|
|
|
|
},
|
2023-02-06 20:47:37 -08:00
|
|
|
switchInputMode: (type: 'Schema' | 'Table' | 'JSON' | 'Binary') => {
|
2023-02-14 06:13:00 -08:00
|
|
|
this.getters.inputDisplayMode().find('label').contains(type).click({ force: true });
|
2023-02-06 20:47:37 -08:00
|
|
|
},
|
|
|
|
switchOutputMode: (type: 'Schema' | 'Table' | 'JSON' | 'Binary') => {
|
2023-02-14 06:13:00 -08:00
|
|
|
this.getters.outputDisplayMode().find('label').contains(type).click({ force: true });
|
2023-02-09 06:59:01 -08:00
|
|
|
},
|
|
|
|
selectInputNode: (nodeName: string) => {
|
|
|
|
this.getters.inputSelect().find('.el-select').click();
|
|
|
|
this.getters.inputOption().contains(nodeName).click();
|
|
|
|
},
|
|
|
|
addDefaultPinnedData: () => {
|
|
|
|
this.actions.editPinnedData();
|
|
|
|
this.actions.savePinnedData();
|
2023-02-06 20:47:37 -08:00
|
|
|
},
|
2023-04-21 05:08:51 -07:00
|
|
|
changeInputRunSelector: (runName: string) => {
|
|
|
|
this.getters.inputRunSelector().click();
|
2023-06-15 05:30:05 -07:00
|
|
|
cy.get('.el-select-dropdown:visible .el-select-dropdown__item').contains(runName).click();
|
2023-04-21 05:08:51 -07:00
|
|
|
},
|
|
|
|
changeOutputRunSelector: (runName: string) => {
|
|
|
|
this.getters.outputRunSelector().click();
|
2023-06-15 05:30:05 -07:00
|
|
|
cy.get('.el-select-dropdown:visible .el-select-dropdown__item').contains(runName).click();
|
2023-04-21 05:08:51 -07:00
|
|
|
},
|
|
|
|
toggleOutputRunLinking: () => {
|
|
|
|
this.getters.outputRunSelector().find('button').click();
|
|
|
|
},
|
|
|
|
toggleInputRunLinking: () => {
|
|
|
|
this.getters.inputRunSelector().find('button').click();
|
|
|
|
},
|
|
|
|
switchOutputBranch: (name: string) => {
|
|
|
|
this.getters.outputBranches().get('span').contains(name).click();
|
|
|
|
},
|
2023-06-19 10:32:11 -07:00
|
|
|
switchInputBranch: (name: string) => {
|
2023-04-21 05:08:51 -07:00
|
|
|
this.getters.inputBranches().get('span').contains(name).click();
|
|
|
|
},
|
2023-04-28 03:14:31 -07:00
|
|
|
setRLCValue: (paramName: string, value: string) => {
|
|
|
|
this.getters.resourceLocatorModeSelector(paramName).click();
|
|
|
|
this.getters.resourceLocatorModeSelector(paramName).find('li').last().click();
|
|
|
|
this.getters.resourceLocatorInput(paramName).type(value);
|
2023-05-10 01:32:09 -07:00
|
|
|
},
|
|
|
|
validateExpressionPreview: (paramName: string, value: string) => {
|
2023-06-15 05:30:05 -07:00
|
|
|
this.getters
|
|
|
|
.parameterExpressionPreview(paramName)
|
|
|
|
.find('span')
|
|
|
|
.should('include.html', asEncodedHTML(value));
|
2023-05-10 01:32:09 -07:00
|
|
|
},
|
2022-12-15 07:39:59 -08:00
|
|
|
};
|
2022-12-01 00:26:38 -08:00
|
|
|
}
|
2023-05-10 01:32:09 -07:00
|
|
|
|
|
|
|
function asEncodedHTML(str: string): string {
|
|
|
|
return String(str)
|
|
|
|
.replace(/&/g, '&')
|
|
|
|
.replace(/</g, '<')
|
|
|
|
.replace(/>/g, '>')
|
|
|
|
.replace(/"/g, '"')
|
|
|
|
.replace(/ /g, ' ');
|
|
|
|
}
|