2022-11-23 14:38:45 +00:00
|
|
|
import { modifyProcessIdentifierForPathParam } from '../../src/helpers';
|
2022-12-14 22:09:43 +00:00
|
|
|
import { miscDisplayName } from '../support/helpers';
|
2022-11-21 21:19:55 +00:00
|
|
|
|
2022-10-12 14:21:49 +00:00
|
|
|
describe('process-models', () => {
|
|
|
|
beforeEach(() => {
|
|
|
|
cy.login();
|
|
|
|
});
|
|
|
|
afterEach(() => {
|
|
|
|
cy.logout();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('can perform crud operations', () => {
|
|
|
|
const uuid = () => Cypress._.random(0, 1e6);
|
|
|
|
const id = uuid();
|
2022-11-21 21:19:55 +00:00
|
|
|
const groupId = 'misc/acceptance-tests-group-one';
|
2022-10-12 14:21:49 +00:00
|
|
|
const groupDisplayName = 'Acceptance Tests Group One';
|
|
|
|
const modelDisplayName = `Test Model 2 ${id}`;
|
|
|
|
const modelId = `test-model-2-${id}`;
|
2022-11-21 21:19:55 +00:00
|
|
|
const newModelDisplayName = `${modelDisplayName} edited`;
|
2022-12-14 22:09:43 +00:00
|
|
|
cy.contains(miscDisplayName).click();
|
2022-11-21 21:19:55 +00:00
|
|
|
cy.wait(500);
|
2022-10-12 14:21:49 +00:00
|
|
|
cy.contains(groupDisplayName).click();
|
|
|
|
cy.createModel(groupId, modelId, modelDisplayName);
|
2022-11-21 21:19:55 +00:00
|
|
|
cy.url().should(
|
|
|
|
'include',
|
2022-11-23 14:38:45 +00:00
|
|
|
`process-models/${modifyProcessIdentifierForPathParam(
|
|
|
|
groupId
|
|
|
|
)}:${modelId}`
|
2022-11-21 21:19:55 +00:00
|
|
|
);
|
2022-11-09 15:12:13 +00:00
|
|
|
cy.contains(`Process Model: ${modelDisplayName}`);
|
2022-10-12 14:21:49 +00:00
|
|
|
|
2022-11-23 14:38:45 +00:00
|
|
|
cy.getBySel('edit-process-model-button').click();
|
2022-10-12 14:21:49 +00:00
|
|
|
cy.get('input[name=display_name]').clear().type(newModelDisplayName);
|
|
|
|
cy.contains('Submit').click();
|
2022-11-23 14:38:45 +00:00
|
|
|
cy.contains(`Process Model: ${newModelDisplayName}`);
|
2022-10-12 14:21:49 +00:00
|
|
|
|
2022-11-21 02:28:23 +00:00
|
|
|
// go back to process model show by clicking on the breadcrumb
|
2022-12-14 22:45:31 +00:00
|
|
|
cy.contains(modelDisplayName).click();
|
2022-11-21 02:28:23 +00:00
|
|
|
|
|
|
|
cy.getBySel('delete-process-model-button').click();
|
2022-10-12 14:21:49 +00:00
|
|
|
cy.contains('Are you sure');
|
2022-11-21 21:19:55 +00:00
|
|
|
cy.getBySel('delete-process-model-button-modal-confirmation-dialog')
|
|
|
|
.find('.cds--btn--danger')
|
|
|
|
.click();
|
|
|
|
cy.url().should(
|
|
|
|
'include',
|
2022-11-23 14:38:45 +00:00
|
|
|
`process-groups/${modifyProcessIdentifierForPathParam(groupId)}`
|
2022-11-21 21:19:55 +00:00
|
|
|
);
|
2022-10-12 14:21:49 +00:00
|
|
|
cy.contains(modelId).should('not.exist');
|
2022-12-14 22:45:31 +00:00
|
|
|
cy.contains(modelDisplayName).should('not.exist');
|
2022-10-12 14:21:49 +00:00
|
|
|
});
|
|
|
|
|
2022-11-21 21:19:55 +00:00
|
|
|
it('can create new bpmn, dmn, and json files', () => {
|
2022-10-12 14:21:49 +00:00
|
|
|
const uuid = () => Cypress._.random(0, 1e6);
|
|
|
|
const id = uuid();
|
2022-11-21 21:19:55 +00:00
|
|
|
const directParentGroupId = 'acceptance-tests-group-one';
|
|
|
|
const groupId = `misc/${directParentGroupId}`;
|
2022-10-12 14:21:49 +00:00
|
|
|
const groupDisplayName = 'Acceptance Tests Group One';
|
|
|
|
const modelDisplayName = `Test Model 2 ${id}`;
|
|
|
|
const modelId = `test-model-2-${id}`;
|
|
|
|
|
|
|
|
const bpmnFileName = `bpmn_test_file_${id}`;
|
|
|
|
const dmnFileName = `dmn_test_file_${id}`;
|
|
|
|
const jsonFileName = `json_test_file_${id}`;
|
|
|
|
|
2022-12-14 22:09:43 +00:00
|
|
|
cy.contains(miscDisplayName).click();
|
2022-11-21 21:19:55 +00:00
|
|
|
cy.wait(500);
|
2022-10-12 14:21:49 +00:00
|
|
|
cy.contains(groupDisplayName).click();
|
|
|
|
cy.createModel(groupId, modelId, modelDisplayName);
|
2022-12-14 22:45:31 +00:00
|
|
|
cy.contains(groupDisplayName).click();
|
2022-11-23 14:38:45 +00:00
|
|
|
cy.contains(modelDisplayName).click();
|
2022-11-21 21:19:55 +00:00
|
|
|
cy.url().should(
|
|
|
|
'include',
|
2022-11-23 14:38:45 +00:00
|
|
|
`process-models/${modifyProcessIdentifierForPathParam(
|
|
|
|
groupId
|
|
|
|
)}:${modelId}`
|
2022-11-21 21:19:55 +00:00
|
|
|
);
|
2022-11-09 03:36:39 +00:00
|
|
|
cy.contains(`Process Model: ${modelDisplayName}`);
|
2022-10-12 14:21:49 +00:00
|
|
|
cy.contains(`${bpmnFileName}.bpmn`).should('not.exist');
|
|
|
|
cy.contains(`${dmnFileName}.dmn`).should('not.exist');
|
|
|
|
cy.contains(`${jsonFileName}.json`).should('not.exist');
|
|
|
|
|
|
|
|
// add new bpmn file
|
2022-11-09 03:36:39 +00:00
|
|
|
cy.contains('New BPMN File').click();
|
2022-10-12 14:21:49 +00:00
|
|
|
cy.contains(/^Process Model File$/);
|
|
|
|
cy.get('g[data-element-id=StartEvent_1]').click().should('exist');
|
|
|
|
cy.contains('General').click();
|
|
|
|
cy.get('#bio-properties-panel-name').clear().type('Start Event Name');
|
|
|
|
cy.wait(500);
|
|
|
|
cy.contains('Save').click();
|
|
|
|
cy.contains('Start Event Name');
|
|
|
|
cy.get('input[name=file_name]').type(bpmnFileName);
|
|
|
|
cy.contains('Save Changes').click();
|
|
|
|
cy.contains(`Process Model File: ${bpmnFileName}`);
|
2022-12-14 22:45:31 +00:00
|
|
|
cy.contains(modelDisplayName).click();
|
2022-11-09 03:36:39 +00:00
|
|
|
cy.contains(`Process Model: ${modelDisplayName}`);
|
2022-11-21 02:28:23 +00:00
|
|
|
// cy.getBySel('files-accordion').click();
|
2022-10-12 14:21:49 +00:00
|
|
|
cy.contains(`${bpmnFileName}.bpmn`).should('exist');
|
|
|
|
|
|
|
|
// add new dmn file
|
2022-11-09 03:36:39 +00:00
|
|
|
cy.contains('New DMN File').click();
|
2022-10-12 14:21:49 +00:00
|
|
|
cy.contains(/^Process Model File$/);
|
|
|
|
cy.get('g[data-element-id=decision_1]').click().should('exist');
|
|
|
|
cy.contains('General').click();
|
2022-11-21 15:31:11 +00:00
|
|
|
cy.get('#bio-properties-panel-id')
|
|
|
|
.clear()
|
|
|
|
.type('decision_acceptance_test_1');
|
|
|
|
cy.contains('General').click();
|
2022-10-12 14:21:49 +00:00
|
|
|
cy.contains('Save').click();
|
|
|
|
cy.get('input[name=file_name]').type(dmnFileName);
|
|
|
|
cy.contains('Save Changes').click();
|
|
|
|
cy.contains(`Process Model File: ${dmnFileName}`);
|
2022-12-14 22:45:31 +00:00
|
|
|
cy.contains(modelDisplayName).click();
|
2022-11-09 03:36:39 +00:00
|
|
|
cy.contains(`Process Model: ${modelDisplayName}`);
|
2022-11-21 02:28:23 +00:00
|
|
|
// cy.getBySel('files-accordion').click();
|
2022-10-12 14:21:49 +00:00
|
|
|
cy.contains(`${dmnFileName}.dmn`).should('exist');
|
|
|
|
|
|
|
|
// add new json file
|
2022-11-09 03:36:39 +00:00
|
|
|
cy.contains('New JSON File').click();
|
2022-10-12 14:21:49 +00:00
|
|
|
cy.contains(/^Process Model File$/);
|
|
|
|
// Some reason, cypress evals json strings so we have to escape it it with '{{}'
|
|
|
|
cy.get('.view-line').type('{{} "test_key": "test_value" }');
|
2022-11-04 16:48:05 +00:00
|
|
|
cy.getBySel('file-save-button').click();
|
2022-10-12 14:21:49 +00:00
|
|
|
cy.get('input[name=file_name]').type(jsonFileName);
|
|
|
|
cy.contains('Save Changes').click();
|
|
|
|
cy.contains(`Process Model File: ${jsonFileName}`);
|
|
|
|
// wait for json to load before clicking away to avoid network errors
|
|
|
|
cy.wait(500);
|
2022-12-14 22:45:31 +00:00
|
|
|
cy.contains(modelDisplayName).click();
|
2022-11-09 03:36:39 +00:00
|
|
|
cy.contains(`Process Model: ${modelDisplayName}`);
|
2022-11-21 02:28:23 +00:00
|
|
|
// cy.getBySel('files-accordion').click();
|
2022-10-12 14:21:49 +00:00
|
|
|
cy.contains(`${jsonFileName}.json`).should('exist');
|
|
|
|
|
2022-11-21 02:28:23 +00:00
|
|
|
cy.getBySel('delete-process-model-button').click();
|
2022-10-12 14:21:49 +00:00
|
|
|
cy.contains('Are you sure');
|
2022-11-21 21:19:55 +00:00
|
|
|
cy.getBySel('delete-process-model-button-modal-confirmation-dialog')
|
|
|
|
.find('.cds--btn--danger')
|
|
|
|
.click();
|
2022-11-23 14:38:45 +00:00
|
|
|
cy.url().should(
|
|
|
|
'include',
|
|
|
|
`process-groups/${modifyProcessIdentifierForPathParam(groupId)}`
|
|
|
|
);
|
2022-10-12 14:21:49 +00:00
|
|
|
cy.contains(modelId).should('not.exist');
|
2022-11-23 14:38:45 +00:00
|
|
|
cy.contains(modelDisplayName).should('not.exist');
|
2022-10-12 14:21:49 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('can upload and run a bpmn file', () => {
|
|
|
|
const uuid = () => Cypress._.random(0, 1e6);
|
|
|
|
const id = uuid();
|
2022-11-21 21:19:55 +00:00
|
|
|
const directParentGroupId = 'acceptance-tests-group-one';
|
|
|
|
const groupId = `misc/${directParentGroupId}`;
|
2022-10-12 14:21:49 +00:00
|
|
|
const groupDisplayName = 'Acceptance Tests Group One';
|
|
|
|
const modelDisplayName = `Test Model 2 ${id}`;
|
|
|
|
const modelId = `test-model-2-${id}`;
|
|
|
|
cy.contains('Add a process group');
|
2022-12-14 22:09:43 +00:00
|
|
|
cy.contains(miscDisplayName).click();
|
2022-11-21 21:19:55 +00:00
|
|
|
cy.wait(500);
|
2022-10-12 14:21:49 +00:00
|
|
|
cy.contains(groupDisplayName).click();
|
|
|
|
cy.createModel(groupId, modelId, modelDisplayName);
|
|
|
|
|
2022-12-14 22:45:31 +00:00
|
|
|
cy.contains(`${groupDisplayName}`).click();
|
2022-10-12 14:21:49 +00:00
|
|
|
cy.contains('Add a process model');
|
2022-11-23 14:38:45 +00:00
|
|
|
cy.contains(modelDisplayName).click();
|
2022-11-21 21:19:55 +00:00
|
|
|
cy.url().should(
|
|
|
|
'include',
|
2022-11-23 14:38:45 +00:00
|
|
|
`process-models/${modifyProcessIdentifierForPathParam(
|
|
|
|
groupId
|
|
|
|
)}:${modelId}`
|
2022-11-21 21:19:55 +00:00
|
|
|
);
|
2022-11-09 15:12:13 +00:00
|
|
|
cy.contains(`Process Model: ${modelDisplayName}`);
|
2022-10-12 14:21:49 +00:00
|
|
|
|
2022-11-09 15:12:13 +00:00
|
|
|
cy.getBySel('upload-file-button').click();
|
|
|
|
cy.contains('Add file').selectFile(
|
2022-10-12 14:21:49 +00:00
|
|
|
'cypress/fixtures/test_bpmn_file_upload.bpmn'
|
|
|
|
);
|
2022-11-09 15:12:13 +00:00
|
|
|
cy.getBySel('modal-upload-file-dialog')
|
|
|
|
.find('.cds--btn--primary')
|
|
|
|
.contains('Upload')
|
|
|
|
.click();
|
2022-10-12 14:21:49 +00:00
|
|
|
cy.runPrimaryBpmnFile();
|
|
|
|
|
2022-11-21 02:28:23 +00:00
|
|
|
// cy.getBySel('process-instance-list-link').click();
|
2022-10-12 14:21:49 +00:00
|
|
|
cy.getBySel('process-instance-show-link').click();
|
2022-11-12 03:12:35 +00:00
|
|
|
cy.getBySel('process-instance-delete').click();
|
2022-10-12 14:21:49 +00:00
|
|
|
cy.contains('Are you sure');
|
2022-11-21 21:19:55 +00:00
|
|
|
cy.getBySel('process-instance-delete-modal-confirmation-dialog')
|
|
|
|
.find('.cds--btn--danger')
|
|
|
|
.click();
|
2022-11-12 03:12:35 +00:00
|
|
|
|
|
|
|
// in breadcrumb
|
2022-12-14 22:45:31 +00:00
|
|
|
cy.contains(modelDisplayName).click();
|
2022-10-12 14:21:49 +00:00
|
|
|
|
2022-11-21 02:28:23 +00:00
|
|
|
cy.getBySel('delete-process-model-button').click();
|
2022-10-12 14:21:49 +00:00
|
|
|
cy.contains('Are you sure');
|
2022-11-21 21:19:55 +00:00
|
|
|
cy.getBySel('delete-process-model-button-modal-confirmation-dialog')
|
|
|
|
.find('.cds--btn--danger')
|
|
|
|
.click();
|
|
|
|
cy.url().should(
|
|
|
|
'include',
|
2022-11-23 14:38:45 +00:00
|
|
|
`process-groups/${modifyProcessIdentifierForPathParam(groupId)}`
|
2022-11-21 21:19:55 +00:00
|
|
|
);
|
2022-10-12 14:21:49 +00:00
|
|
|
cy.contains(modelId).should('not.exist');
|
2022-11-23 14:38:45 +00:00
|
|
|
cy.contains(modelDisplayName).should('not.exist');
|
2022-10-12 14:21:49 +00:00
|
|
|
});
|
|
|
|
|
2022-11-23 14:38:45 +00:00
|
|
|
// process models no longer has pagination post-tiles
|
|
|
|
// it.only('can paginate items', () => {
|
2022-12-14 22:09:43 +00:00
|
|
|
// cy.contains(miscDisplayName).click();
|
2022-11-23 14:38:45 +00:00
|
|
|
// cy.wait(500);
|
|
|
|
// cy.contains('Acceptance Tests Group One').click();
|
|
|
|
// cy.basicPaginationTest();
|
|
|
|
// });
|
2022-10-12 14:21:49 +00:00
|
|
|
|
|
|
|
it('can allow searching for model', () => {
|
2022-11-04 16:48:05 +00:00
|
|
|
cy.getBySel('process-model-selection').click().type('model-3');
|
|
|
|
cy.contains('acceptance-tests-group-one/acceptance-tests-model-3').click();
|
2022-11-21 21:19:55 +00:00
|
|
|
cy.contains('Acceptance Tests Model 3');
|
2022-10-12 14:21:49 +00:00
|
|
|
});
|
|
|
|
});
|