spiff-arena/cypress/e2e/process_models.cy.js
burnettk 4b42d6cde6 Squashed 'spiffworkflow-frontend/' changes from 1df0c1a9b2..942256a4ab
942256a4ab theme header
7d02fab545 it would be nice to know which command is failing
cecdb467fa do not chew all memory
d3d94fb307 Merge remote-tracking branch 'origin/main' into feature/carbon_ui
c6d6108fb7 remove garbage css rule
7ec4f725a6 Stack direction to orientation
77731cd7ac fix last modal
0f0962fd1a lint
700f3c4965 fix label and comment artificial slowdown
033d051992 unhardcode
f283cc6302 fix a few tests
43848ea1c0 instances tests are mostly passing, issues with table resizing on the list w/ burnettk
f9b8a161eb process model cypress tests are passing w/ burnettk
e52157fe58 process group cypress tests are passing w/ burnettk
8ce7886326 pyl is passing w/ burnettk
999134fc8f some more updates for group forms w/ burnettk
bba9ed27f1 added search bar on process groups page w/ burnettk
d80e9971cc added login_logout buttons w/ burnettk
6126faaebc finished process instance list filter w/ burnettk
3d2b1ad1d4 add date ranges for process instances search w/ burnettk
2831206f29 a simple date picker w/ burnettk
02d165c52a filter is working for status and process model w/ burnettk
5b118a69e6 process instance list page is mostly set up now w/ burnettk
efd0663ef4 merged in main and resolved conflicts w/ burnettk
6191cfedf3 some more changes... navigation bar is broken due to header container w/ burnettk
877d543b02 many things have been switched to carbon and the home page loads w/ burnettk
c6a5bb081f added carbon react package w/ burnettk

git-subtree-dir: spiffworkflow-frontend
git-subtree-split: 942256a4ab74949d0cba48cd93cc5a70001e0a72
2022-11-06 13:24:57 -05:00

176 lines
6.5 KiB
JavaScript

describe('process-models', () => {
beforeEach(() => {
cy.login();
});
afterEach(() => {
cy.logout();
});
it('can perform crud operations', () => {
const uuid = () => Cypress._.random(0, 1e6);
const id = uuid();
const groupId = 'acceptance-tests-group-one';
const groupDisplayName = 'Acceptance Tests Group One';
const modelDisplayName = `Test Model 2 ${id}`;
const newModelDisplayName = `${modelDisplayName} edited`;
const modelId = `test-model-2-${id}`;
cy.contains(groupDisplayName).click();
cy.createModel(groupId, modelId, modelDisplayName);
cy.contains(`Process Group: ${groupId}`).click();
cy.contains(modelId);
cy.contains(modelId).click();
cy.url().should('include', `process-models/${groupId}/${modelId}`);
cy.contains(`Process Model: ${modelId}`);
cy.contains('Edit process model').click();
cy.get('input[name=display_name]').clear().type(newModelDisplayName);
cy.contains('Submit').click();
cy.contains(`Process Model: ${modelId}`);
cy.contains('Edit process model').click();
cy.get('input[name=display_name]').should(
'have.value',
newModelDisplayName
);
cy.contains('Delete').click();
cy.contains('Are you sure');
cy.contains('OK').click();
cy.url().should('include', `process-groups/${groupId}`);
cy.contains(modelId).should('not.exist');
});
it('can create new bpmn, dmn, and json files', () => {
const uuid = () => Cypress._.random(0, 1e6);
const id = uuid();
const groupId = 'acceptance-tests-group-one';
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}`;
cy.contains(groupDisplayName).click();
cy.createModel(groupId, modelId, modelDisplayName);
cy.contains(`Process Group: ${groupId}`).click();
cy.contains(modelId);
cy.contains(modelId).click();
cy.url().should('include', `process-models/${groupId}/${modelId}`);
cy.contains(`Process Model: ${modelId}`);
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
cy.contains('Add New BPMN File').click();
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}`);
cy.contains(modelId).click();
cy.contains(`Process Model: ${modelId}`);
cy.contains(`${bpmnFileName}.bpmn`).should('exist');
// add new dmn file
cy.contains('Add New DMN File').click();
cy.contains(/^Process Model File$/);
cy.get('g[data-element-id=decision_1]').click().should('exist');
cy.contains('General').click();
cy.contains('Save').click();
cy.get('input[name=file_name]').type(dmnFileName);
cy.contains('Save Changes').click();
cy.contains(`Process Model File: ${dmnFileName}`);
cy.contains(modelId).click();
cy.contains(`Process Model: ${modelId}`);
cy.contains(`${dmnFileName}.dmn`).should('exist');
// add new json file
cy.contains('Add New JSON File').click();
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" }');
cy.getBySel('file-save-button').click();
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);
cy.contains(modelId).click();
cy.contains(`Process Model: ${modelId}`);
cy.contains(`${jsonFileName}.json`).should('exist');
cy.contains('Edit process model').click();
cy.contains('Delete').click();
cy.contains('Are you sure');
cy.contains('OK').click();
cy.url().should('include', `process-groups/${groupId}`);
cy.contains(modelId).should('not.exist');
});
it('can upload and run a bpmn file', () => {
const uuid = () => Cypress._.random(0, 1e6);
const id = uuid();
const groupId = 'acceptance-tests-group-one';
const groupDisplayName = 'Acceptance Tests Group One';
const modelDisplayName = `Test Model 2 ${id}`;
const modelId = `test-model-2-${id}`;
cy.contains('Add a process group');
cy.contains(groupDisplayName).click();
cy.createModel(groupId, modelId, modelDisplayName);
// seeing if getBySel works better, because we are seeing tests fail in CI
// when looking for the "Add a process model" link, so it seems like the
// click on the breadcrumb element must have failed.
cy.getBySel('process-group-breadcrumb-link').click();
// cy.contains(`Process Group: ${groupId}`).click();
cy.contains('Add a process model');
cy.contains(modelId).click();
cy.url().should('include', `process-models/${groupId}/${modelId}`);
cy.contains(`Process Model: ${modelId}`);
cy.get('input[type=file]').selectFile(
'cypress/fixtures/test_bpmn_file_upload.bpmn'
);
cy.contains('Submit').click();
cy.runPrimaryBpmnFile();
cy.getBySel('process-instance-list-link').click();
cy.getBySel('process-instance-show-link').click();
cy.contains('Delete').click();
cy.contains('Are you sure');
cy.contains('OK').click();
cy.contains(`Process Instances for: ${groupId}/${modelId}`);
cy.contains(modelId).click();
cy.contains('Edit process model').click();
cy.contains('Delete').click();
cy.contains('Are you sure');
cy.contains('OK').click();
cy.url().should('include', `process-groups/${groupId}`);
cy.contains(modelId).should('not.exist');
});
it('can paginate items', () => {
cy.contains('Acceptance Tests Group One').click();
cy.basicPaginationTest();
});
it('can allow searching for model', () => {
cy.getBySel('process-model-selection').click().type('model-3');
cy.contains('acceptance-tests-group-one/acceptance-tests-model-3').click();
cy.contains('List').click();
});
});