2022-06-17 14:28:47 -04:00
|
|
|
describe('process-instances', () => {
|
|
|
|
beforeEach(() => {
|
|
|
|
cy.visit('/');
|
|
|
|
});
|
|
|
|
|
|
|
|
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";
|
|
|
|
|
|
|
|
cy.contains('acceptance-tests-group-one').click();
|
|
|
|
cy.contains('acceptance-tests-model-1').click();
|
|
|
|
|
2022-06-17 17:03:20 -04:00
|
|
|
cy.contains(originalDmnOutputForKevin).should('not.exist');;
|
2022-06-17 14:28:47 -04:00
|
|
|
cy.contains('Run Primary').click();
|
2022-06-17 17:03:20 -04:00
|
|
|
cy.contains(originalDmnOutputForKevin);
|
|
|
|
|
|
|
|
// 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();
|
|
|
|
cy.contains('Run Primary').click();
|
|
|
|
cy.contains(newDmnOutputForKevin);
|
|
|
|
|
|
|
|
cy.contains(dmnFile).click();
|
|
|
|
cy.contains(`Process Model File: ${dmnFile}`);
|
|
|
|
updateDmnText(newDmnOutputForKevin, originalDmnOutputForKevin);
|
|
|
|
cy.contains('acceptance-tests-model-1').click();
|
|
|
|
cy.contains('Run Primary').click();
|
|
|
|
cy.contains(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();
|
|
|
|
cy.contains('Run Primary').click();
|
|
|
|
cy.contains(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();
|
|
|
|
cy.contains('Run Primary').click();
|
|
|
|
cy.contains(originalDmnOutputForKevin);
|
2022-06-17 14:28:47 -04:00
|
|
|
});
|
|
|
|
|
|
|
|
// it('can paginate items', () => {
|
|
|
|
// cy.contains('acceptance-tests-group-one').click();
|
|
|
|
// cy.get("#pagination-page-dropdown")
|
|
|
|
// .type("typing_to_open_dropdown_box....FIXME")
|
|
|
|
// .find('.dropdown-item')
|
|
|
|
// .contains(/^2$/)
|
|
|
|
// .click();
|
|
|
|
//
|
|
|
|
// cy.contains(/^1-2 of \d+$/);
|
|
|
|
// cy.getBySel("pagination-next-button").click();
|
|
|
|
// cy.contains(/^3-4 of \d+$/);
|
|
|
|
// cy.getBySel("pagination-previous-button").click();
|
|
|
|
// cy.contains(/^1-2 of \d+$/);
|
|
|
|
// })
|
|
|
|
})
|
|
|
|
|
|
|
|
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();
|
|
|
|
}
|