2022-06-17 14:28:47 -04:00
|
|
|
describe('process-instances', () => {
|
|
|
|
beforeEach(() => {
|
|
|
|
cy.visit('/');
|
2022-06-20 14:45:15 -04:00
|
|
|
cy.contains('acceptance-tests-group-one').click();
|
|
|
|
cy.contains('acceptance-tests-model-1').click();
|
2022-06-17 14:28:47 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
it('can create a new instance and can modify', () => {
|
2022-06-17 17:03:20 -04:00
|
|
|
const originalDmnOutputForKevin = "Very wonderful";
|
|
|
|
const newDmnOutputForKevin = "The new wonderful";
|
|
|
|
const dmnOutputForDan = "pretty wonderful";
|
|
|
|
|
|
|
|
const originalPythonScript = 'person = "Kevin"';
|
|
|
|
const newPythonScript = 'person = "Dan"';
|
|
|
|
|
2022-06-17 14:28:47 -04:00
|
|
|
const dmnFile = "awesome_decision.dmn";
|
|
|
|
const bpmnFile = "process_model_one.bpmn";
|
|
|
|
|
2022-06-17 17:03:20 -04:00
|
|
|
cy.contains(originalDmnOutputForKevin).should('not.exist');;
|
2022-06-20 14:45:15 -04:00
|
|
|
runPrimaryBpmnFile(originalDmnOutputForKevin);
|
2022-06-17 17:03:20 -04:00
|
|
|
|
|
|
|
// Change dmn
|
|
|
|
cy.contains(dmnFile).click();
|
|
|
|
cy.contains(`Process Model File: ${dmnFile}`);
|
|
|
|
updateDmnText(originalDmnOutputForKevin, newDmnOutputForKevin);
|
2022-06-17 14:28:47 -04:00
|
|
|
|
2022-06-17 17:03:20 -04:00
|
|
|
cy.contains('acceptance-tests-model-1').click();
|
2022-06-20 14:45:15 -04:00
|
|
|
runPrimaryBpmnFile(newDmnOutputForKevin);
|
2022-06-17 17:03:20 -04:00
|
|
|
|
|
|
|
cy.contains(dmnFile).click();
|
|
|
|
cy.contains(`Process Model File: ${dmnFile}`);
|
|
|
|
updateDmnText(newDmnOutputForKevin, originalDmnOutputForKevin);
|
|
|
|
cy.contains('acceptance-tests-model-1').click();
|
2022-06-20 14:45:15 -04:00
|
|
|
runPrimaryBpmnFile(originalDmnOutputForKevin);
|
2022-06-17 14:28:47 -04:00
|
|
|
|
|
|
|
// Change bpmn
|
|
|
|
cy.contains(bpmnFile).click();
|
|
|
|
cy.contains(`Process Model File: ${bpmnFile}`);
|
2022-06-17 17:03:20 -04:00
|
|
|
updateBpmnPythonScript(newPythonScript, bpmnFile);
|
|
|
|
cy.contains('acceptance-tests-model-1').click();
|
2022-06-20 14:45:15 -04:00
|
|
|
runPrimaryBpmnFile(dmnOutputForDan);
|
2022-06-17 14:28:47 -04:00
|
|
|
|
2022-06-17 17:03:20 -04:00
|
|
|
cy.contains(bpmnFile).click();
|
|
|
|
cy.contains(`Process Model File: ${bpmnFile}`);
|
|
|
|
updateBpmnPythonScript(originalPythonScript, bpmnFile);
|
|
|
|
cy.contains('acceptance-tests-model-1').click();
|
2022-06-20 14:45:15 -04:00
|
|
|
runPrimaryBpmnFile(originalDmnOutputForKevin);
|
2022-06-17 14:28:47 -04:00
|
|
|
});
|
|
|
|
|
2022-06-20 14:45:15 -04:00
|
|
|
it('can create a new instance and can modify with monaco text editor', () => {
|
|
|
|
const dmnOutputForKevin = "Very wonderful";
|
|
|
|
const dmnOutputForMike = "Powerful wonderful";
|
|
|
|
const originalPythonScript = 'person = "Kevin"';
|
|
|
|
const newPythonScript = 'person = "Mike"';
|
|
|
|
const bpmnFile = "process_model_one.bpmn";
|
|
|
|
|
|
|
|
// Change bpmn
|
|
|
|
cy.contains(bpmnFile).click();
|
|
|
|
cy.contains(`Process Model File: ${bpmnFile}`);
|
|
|
|
updateBpmnPythonScriptWithMonaco(newPythonScript, bpmnFile);
|
|
|
|
cy.contains('acceptance-tests-model-1').click();
|
|
|
|
runPrimaryBpmnFile(dmnOutputForMike);
|
|
|
|
|
|
|
|
cy.contains(bpmnFile).click();
|
|
|
|
cy.contains(`Process Model File: ${bpmnFile}`);
|
|
|
|
updateBpmnPythonScriptWithMonaco(originalPythonScript, bpmnFile);
|
|
|
|
cy.contains('acceptance-tests-model-1').click();
|
|
|
|
runPrimaryBpmnFile(dmnOutputForKevin);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('can paginate items', () => {
|
|
|
|
// make sure we have some process instances
|
|
|
|
runPrimaryBpmnFile('Very wonderful');
|
|
|
|
runPrimaryBpmnFile('Very wonderful');
|
|
|
|
runPrimaryBpmnFile('Very wonderful');
|
|
|
|
runPrimaryBpmnFile('Very wonderful');
|
|
|
|
runPrimaryBpmnFile('Very wonderful');
|
|
|
|
|
|
|
|
cy.contains('Process Instances').click();
|
|
|
|
cy.basicPaginationTest();
|
|
|
|
})
|
2022-06-17 14:28:47 -04:00
|
|
|
})
|
|
|
|
|
|
|
|
function updateDmnText(oldText, newText, elementId="wonderful_process", dmnFile="awesome_decision.dmn") {
|
|
|
|
// this will break if there are more elements added to the drd
|
2022-06-17 17:03:20 -04:00
|
|
|
cy.get(`g[data-element-id=${elementId}]`).click().should('exist');
|
2022-06-17 14:28:47 -04:00
|
|
|
cy.get('.dmn-icon-decision-table').click();
|
|
|
|
cy.contains(oldText).clear().type(`"${newText}"`);
|
|
|
|
|
2022-06-20 10:57:08 -04:00
|
|
|
// wait for a little bit for the xml to get set before saving
|
|
|
|
cy.wait(500);
|
2022-06-17 14:28:47 -04:00
|
|
|
cy.contains('Save').click();
|
2022-06-20 09:21:35 -04:00
|
|
|
|
2022-06-17 14:28:47 -04:00
|
|
|
}
|
2022-06-17 17:03:20 -04:00
|
|
|
|
|
|
|
function updateBpmnPythonScript(pythonScript, bpmnFile, elementId="process_script") {
|
|
|
|
cy.get(`g[data-element-id=${elementId}]`).click().should('exist');
|
|
|
|
cy.contains('SpiffWorkflow Properties').click();
|
|
|
|
cy.get('#bio-properties-panel-pythonScript').clear().type(pythonScript);
|
2022-06-20 10:57:08 -04:00
|
|
|
|
|
|
|
// wait for a little bit for the xml to get set before saving
|
|
|
|
cy.wait(500);
|
2022-06-17 17:03:20 -04:00
|
|
|
cy.contains('Save').click();
|
|
|
|
}
|
2022-06-20 14:45:15 -04:00
|
|
|
|
|
|
|
function updateBpmnPythonScriptWithMonaco(pythonScript, bpmnFile, elementId="process_script") {
|
|
|
|
cy.get(`g[data-element-id=${elementId}]`).click().should('exist');
|
|
|
|
cy.contains('SpiffWorkflow Properties').click();
|
|
|
|
cy.contains('Launch Editor').click();
|
|
|
|
cy.contains("Loading...").should('not.exist');
|
|
|
|
cy.get('.monaco-editor textarea:first')
|
|
|
|
.click()
|
|
|
|
.focused() // change subject to currently focused element
|
|
|
|
.type('{ctrl}a')
|
|
|
|
.type(pythonScript)
|
|
|
|
|
|
|
|
cy.contains('Close').click();
|
|
|
|
// wait for a little bit for the xml to get set before saving
|
|
|
|
cy.wait(500);
|
|
|
|
cy.contains('Save').click();
|
|
|
|
}
|
|
|
|
|
|
|
|
function runPrimaryBpmnFile(expectedText) {
|
|
|
|
cy.contains('Run Primary').click();
|
|
|
|
cy.contains(expectedText);
|
|
|
|
}
|