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-02-06 20:47:37 -08:00
|
|
|
inputDisplayMode: () => this.getters.inputPanel().getByTestId('ndv-run-data-display-mode'),
|
2023-01-18 06:48:36 -08:00
|
|
|
outputDataContainer: () => this.getters.outputPanel().findChildByTestId('ndv-data-container'),
|
2023-02-06 20:47:37 -08:00
|
|
|
outputDisplayMode: () => this.getters.outputPanel().getByTestId('ndv-run-data-display-mode'),
|
2022-12-01 00:26:38 -08:00
|
|
|
digital: () => cy.getByTestId('ndv-run-data-display-mode'),
|
2023-01-18 06:48:36 -08:00
|
|
|
pinDataButton: () => cy.getByTestId('ndv-pin-data'),
|
|
|
|
editPinnedDataButton: () => cy.getByTestId('ndv-edit-pinned-data'),
|
|
|
|
pinnedDataEditor: () => this.getters.outputPanel().find('.monaco-editor'),
|
|
|
|
runDataPaneHeader: () => cy.getByTestId('run-data-pane-header'),
|
|
|
|
savePinnedDataButton: () => this.getters.runDataPaneHeader().find('button').contains('Save'),
|
|
|
|
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-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-01-27 01:18:15 -08:00
|
|
|
const editor = this.getters.pinnedDataEditor();
|
2023-01-18 06:48:36 -08:00
|
|
|
editor.click();
|
|
|
|
editor.type(`{selectall}{backspace}`);
|
2023-01-27 01:18:15 -08:00
|
|
|
editor.type(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
|
|
|
},
|
|
|
|
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
|
|
|
},
|
2022-12-15 07:39:59 -08:00
|
|
|
};
|
2022-12-01 00:26:38 -08:00
|
|
|
}
|