2022-11-25 04:09:44 -08:00
|
|
|
import { BasePage } from './base';
|
2022-11-11 00:07:14 -08:00
|
|
|
|
|
|
|
export class WorkflowPage extends BasePage {
|
|
|
|
url = '/workflow/new';
|
2022-11-22 01:37:26 -08:00
|
|
|
getters = {
|
2022-12-05 05:31:14 -08:00
|
|
|
workflowNameInputContainer: () => cy.getByTestId('workflow-name-input', { timeout: 5000 }),
|
2022-11-25 08:10:28 -08:00
|
|
|
workflowNameInput: () => this.getters.workflowNameInputContainer().then(($el) => cy.wrap($el.find('input'))),
|
2022-11-11 00:07:14 -08:00
|
|
|
workflowImportInput: () => cy.getByTestId('workflow-import-input'),
|
|
|
|
workflowTags: () => cy.getByTestId('workflow-tags'),
|
2022-11-25 08:10:28 -08:00
|
|
|
workflowTagsContainer: () => cy.getByTestId('workflow-tags-container'),
|
2022-12-05 05:31:14 -08:00
|
|
|
workflowTagsInput: () => this.getters.workflowTagsContainer().then(($el) => cy.wrap($el.find('input').first())),
|
2022-12-07 09:16:38 -08:00
|
|
|
workflowTagElements: () => cy.get('[data-test-id="workflow-tags-container"] span.tags > span'),
|
2022-12-05 05:31:14 -08:00
|
|
|
workflowTagsDropdown: () => cy.getByTestId('workflow-tags-dropdown'),
|
2022-11-25 08:10:28 -08:00
|
|
|
newTagLink: () => cy.getByTestId('new-tag-link'),
|
2022-11-25 06:32:09 -08:00
|
|
|
saveButton: () => cy.getByTestId('workflow-save-button'),
|
2022-11-25 04:09:44 -08:00
|
|
|
nodeCreatorSearchBar: () => cy.getByTestId('node-creator-search-bar'),
|
|
|
|
nodeCreatorPlusButton: () => cy.getByTestId('node-creator-plus-button'),
|
|
|
|
canvasPlusButton: () => cy.getByTestId('canvas-plus-button'),
|
2022-12-01 00:26:38 -08:00
|
|
|
canvasNodes: () => cy.getByTestId('canvas-node'),
|
|
|
|
canvasNodeByName: (nodeName: string) => this.getters.canvasNodes().filter(`:contains("${nodeName}")`),
|
2022-11-25 04:09:44 -08:00
|
|
|
ndvParameterInput: (parameterName: string) =>
|
|
|
|
cy.getByTestId(`parameter-input-${parameterName}`),
|
|
|
|
ndvOutputPanel: () => cy.getByTestId('output-panel'),
|
2022-11-28 07:54:13 -08:00
|
|
|
ndvRunDataPaneHeader: () => cy.getByTestId('run-data-pane-header'),
|
|
|
|
successToast: () => cy.get('.el-notification__title'),
|
2022-11-25 06:32:09 -08:00
|
|
|
activatorSwitch: () => cy.getByTestId('workflow-activate-switch'),
|
|
|
|
workflowMenu: () => cy.getByTestId('workflow-menu'),
|
|
|
|
firstStepButton: () => cy.getByTestId('canvas-add-button'),
|
2022-11-25 08:10:28 -08:00
|
|
|
isWorkflowSaved: () => this.getters.saveButton().should('match', 'span'), // In Element UI, disabled button turn into spans 🤷♂️
|
|
|
|
isWorkflowActivated: () => this.getters.activatorSwitch().should('have.class', 'is-checked'),
|
2022-12-01 04:26:22 -08:00
|
|
|
expressionModalInput: () => cy.getByTestId('expression-modal-input'),
|
|
|
|
expressionModalOutput: () => cy.getByTestId('expression-modal-output'),
|
2022-12-05 05:31:14 -08:00
|
|
|
|
|
|
|
nodeViewRoot: () => cy.getByTestId('node-view-root'),
|
|
|
|
copyPasteInput: () => cy.getByTestId('hidden-copy-paste'),
|
2022-11-25 04:09:44 -08:00
|
|
|
};
|
|
|
|
actions = {
|
2022-11-25 08:10:28 -08:00
|
|
|
visit: () => {
|
|
|
|
cy.visit(this.url);
|
|
|
|
cy.getByTestId('node-view-loader', { timeout: 5000 }).should('not.exist');
|
|
|
|
cy.get('.el-loading-mask', { timeout: 5000 }).should('not.exist');
|
|
|
|
},
|
2022-11-25 04:09:44 -08:00
|
|
|
addInitialNodeToCanvas: (nodeDisplayName: string) => {
|
|
|
|
this.getters.canvasPlusButton().click();
|
|
|
|
this.getters.nodeCreatorSearchBar().type(nodeDisplayName);
|
|
|
|
this.getters.nodeCreatorSearchBar().type('{enter}{esc}');
|
|
|
|
},
|
|
|
|
addNodeToCanvas: (nodeDisplayName: string) => {
|
|
|
|
this.getters.nodeCreatorPlusButton().click();
|
|
|
|
this.getters.nodeCreatorSearchBar().type(nodeDisplayName);
|
|
|
|
this.getters.nodeCreatorSearchBar().type('{enter}{esc}');
|
|
|
|
},
|
|
|
|
openNodeNdv: (nodeTypeName: string) => {
|
2022-12-01 00:26:38 -08:00
|
|
|
this.getters.canvasNodeByName(nodeTypeName).dblclick();
|
2022-11-25 04:09:44 -08:00
|
|
|
},
|
2022-12-01 04:26:22 -08:00
|
|
|
openExpressionEditor: () => {
|
|
|
|
cy.get('input[value="expression"]').parent('label').click();
|
|
|
|
},
|
2022-11-25 04:09:44 -08:00
|
|
|
typeIntoParameterInput: (parameterName: string, content: string) => {
|
|
|
|
this.getters.ndvParameterInput(parameterName).type(content);
|
|
|
|
},
|
2022-11-28 07:54:13 -08:00
|
|
|
selectOptionInParameterDropdown: (parameterName: string, content: string) => {
|
|
|
|
this.getters
|
|
|
|
.ndvParameterInput(parameterName)
|
|
|
|
.find('.option-headline')
|
|
|
|
.contains(content)
|
|
|
|
.click();
|
|
|
|
},
|
2022-11-25 04:09:44 -08:00
|
|
|
executeNodeFromNdv: () => {
|
|
|
|
cy.contains('Execute node').click();
|
|
|
|
},
|
2022-11-25 06:32:09 -08:00
|
|
|
openWorkflowMenu: () => {
|
|
|
|
this.getters.workflowMenu().click();
|
|
|
|
},
|
|
|
|
saveWorkflowOnButtonClick: () => {
|
|
|
|
this.getters.saveButton().click();
|
|
|
|
},
|
|
|
|
saveWorkflowUsingKeyboardShortcut: () => {
|
|
|
|
cy.get('body').type('{meta}', { release: false }).type('s');
|
|
|
|
},
|
|
|
|
activateWorkflow: () => {
|
|
|
|
this.getters.activatorSwitch().find('input').first().should('be.enabled');
|
|
|
|
this.getters.activatorSwitch().click();
|
|
|
|
cy.get('body').type('{esc}');
|
|
|
|
},
|
|
|
|
renameWorkflow: (newName: string) => {
|
2022-11-25 08:10:28 -08:00
|
|
|
this.getters.workflowNameInputContainer().click();
|
2022-11-25 06:32:09 -08:00
|
|
|
cy.get('body').type('{selectall}');
|
|
|
|
cy.get('body').type(newName);
|
|
|
|
cy.get('body').type('{enter}');
|
|
|
|
},
|
2022-11-25 08:10:28 -08:00
|
|
|
addTags: (tags: string[]) => {
|
|
|
|
tags.forEach(tag => {
|
2022-12-05 05:31:14 -08:00
|
|
|
this.getters.workflowTagsInput().type(tag);
|
|
|
|
this.getters.workflowTagsInput().type('{enter}');
|
2022-11-25 08:10:28 -08:00
|
|
|
});
|
|
|
|
cy.get('body').type('{enter}');
|
|
|
|
},
|
2022-12-01 00:26:38 -08:00
|
|
|
zoomToFit: () => {
|
|
|
|
cy.getByTestId('zoom-to-fit').click();
|
|
|
|
},
|
2022-11-11 00:07:14 -08:00
|
|
|
};
|
|
|
|
}
|