From bd39aec391d607020c2fb3169a1e259f9dc672c8 Mon Sep 17 00:00:00 2001 From: jasquat Date: Mon, 21 Nov 2022 16:19:55 -0500 Subject: [PATCH] process model cypress tests are passing w/ burnettk cullerton --- .../cypress/e2e/process_models.cy.js | 70 ++++++++++++++----- .../cypress/support/commands.js | 9 +-- .../src/components/ButtonWithConfirmation.tsx | 2 +- .../src/routes/ReactFormEditor.tsx | 1 + 4 files changed, 57 insertions(+), 25 deletions(-) diff --git a/spiffworkflow-frontend/cypress/e2e/process_models.cy.js b/spiffworkflow-frontend/cypress/e2e/process_models.cy.js index 444d4d01..4bc75ead 100644 --- a/spiffworkflow-frontend/cypress/e2e/process_models.cy.js +++ b/spiffworkflow-frontend/cypress/e2e/process_models.cy.js @@ -1,3 +1,5 @@ +import { modifyProcessModelPath } from '../../src/helpers'; + describe('process-models', () => { beforeEach(() => { cy.login(); @@ -9,14 +11,19 @@ describe('process-models', () => { it('can perform crud operations', () => { const uuid = () => Cypress._.random(0, 1e6); const id = uuid(); - const groupId = 'acceptance-tests-group-one'; + const groupId = 'misc/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}`; + const newModelDisplayName = `${modelDisplayName} edited`; + cy.contains('Misc').click(); + cy.wait(500); cy.contains(groupDisplayName).click(); cy.createModel(groupId, modelId, modelDisplayName); - cy.url().should('include', `process-models/${groupId}:${modelId}`); + cy.url().should( + 'include', + `process-models/${modifyProcessModelPath(groupId)}:${modelId}` + ); cy.contains(`Process Model: ${modelDisplayName}`); cy.contains('Edit process model').click(); @@ -34,15 +41,21 @@ describe('process-models', () => { cy.getBySel('delete-process-model-button').click(); cy.contains('Are you sure'); - cy.getBySel('modal-confirmation-dialog').find('.cds--btn--danger').click(); - cy.url().should('include', `process-groups/${groupId}`); + cy.getBySel('delete-process-model-button-modal-confirmation-dialog') + .find('.cds--btn--danger') + .click(); + cy.url().should( + 'include', + `process-groups/${modifyProcessModelPath(groupId)}` + ); cy.contains(modelId).should('not.exist'); }); - it.only('can create new bpmn, dmn, and json files', () => { + it('can create new bpmn, dmn, and json files', () => { const uuid = () => Cypress._.random(0, 1e6); const id = uuid(); - const groupId = 'misc/acceptance-tests-group-one'; + const directParentGroupId = 'acceptance-tests-group-one'; + const groupId = `misc/${directParentGroupId}`; const groupDisplayName = 'Acceptance Tests Group One'; const modelDisplayName = `Test Model 2 ${id}`; const modelId = `test-model-2-${id}`; @@ -52,11 +65,15 @@ describe('process-models', () => { const jsonFileName = `json_test_file_${id}`; cy.contains('Misc').click(); + cy.wait(500); cy.contains(groupDisplayName).click(); cy.createModel(groupId, modelId, modelDisplayName); - cy.contains(groupId).click(); + cy.contains(directParentGroupId).click(); cy.contains(modelId).click(); - cy.url().should('include', `process-models/${groupId}:${modelId}`); + cy.url().should( + 'include', + `process-models/${modifyProcessModelPath(groupId)}:${modelId}` + ); cy.contains(`Process Model: ${modelDisplayName}`); cy.contains(`${bpmnFileName}.bpmn`).should('not.exist'); cy.contains(`${dmnFileName}.dmn`).should('not.exist'); @@ -115,26 +132,34 @@ describe('process-models', () => { cy.getBySel('delete-process-model-button').click(); cy.contains('Are you sure'); - cy.getBySel('modal-confirmation-dialog').find('.cds--btn--danger').click(); - cy.url().should('include', `process-groups/${groupId}`); + cy.getBySel('delete-process-model-button-modal-confirmation-dialog') + .find('.cds--btn--danger') + .click(); + cy.url().should('include', `process-groups/${modifyProcessModelPath(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 directParentGroupId = 'acceptance-tests-group-one'; + const groupId = `misc/${directParentGroupId}`; 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('Misc').click(); + cy.wait(500); cy.contains(groupDisplayName).click(); cy.createModel(groupId, modelId, modelDisplayName); - cy.contains(`${groupId}`).click(); + cy.contains(`${directParentGroupId}`).click(); cy.contains('Add a process model'); cy.contains(modelId).click(); - cy.url().should('include', `process-models/${groupId}:${modelId}`); + cy.url().should( + 'include', + `process-models/${modifyProcessModelPath(groupId)}:${modelId}` + ); cy.contains(`Process Model: ${modelDisplayName}`); cy.getBySel('upload-file-button').click(); @@ -151,19 +176,28 @@ describe('process-models', () => { cy.getBySel('process-instance-show-link').click(); cy.getBySel('process-instance-delete').click(); cy.contains('Are you sure'); - cy.getBySel('modal-confirmation-dialog').find('.cds--btn--danger').click(); + cy.getBySel('process-instance-delete-modal-confirmation-dialog') + .find('.cds--btn--danger') + .click(); // in breadcrumb cy.contains(modelId).click(); cy.getBySel('delete-process-model-button').click(); cy.contains('Are you sure'); - cy.getBySel('modal-confirmation-dialog').find('.cds--btn--danger').click(); - cy.url().should('include', `process-groups/${groupId}`); + cy.getBySel('delete-process-model-button-modal-confirmation-dialog') + .find('.cds--btn--danger') + .click(); + cy.url().should( + 'include', + `process-groups/${modifyProcessModelPath(groupId)}` + ); cy.contains(modelId).should('not.exist'); }); it('can paginate items', () => { + cy.contains('Misc').click(); + cy.wait(500); cy.contains('Acceptance Tests Group One').click(); cy.basicPaginationTest(); }); @@ -171,6 +205,6 @@ describe('process-models', () => { 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(); + cy.contains('Acceptance Tests Model 3'); }); }); diff --git a/spiffworkflow-frontend/cypress/support/commands.js b/spiffworkflow-frontend/cypress/support/commands.js index 90174e2f..393fe553 100644 --- a/spiffworkflow-frontend/cypress/support/commands.js +++ b/spiffworkflow-frontend/cypress/support/commands.js @@ -1,4 +1,5 @@ import { string } from 'prop-types'; +import { modifyProcessModelPath } from '../../src/helpers'; // *********************************************** // This example commands.js shows you how to @@ -78,7 +79,8 @@ Cypress.Commands.add('createModel', (groupId, modelId, modelDisplayName) => { cy.url().should( 'include', - `process-models/${cy.modifyProcessModelPath(groupId)}:${modelId}` + `process-models/${modifyProcessModelPath(groupId)}:${modelId}` + // `process-models/${groupId}:${modelId}` ); cy.contains(`Process Model: ${modelDisplayName}`); }); @@ -130,8 +132,3 @@ Cypress.Commands.add('modifyProcessModelPath', (path) => { path.replace('/', ':'); return path; }); - -Cypress.Commands.add('modifyProcessModelPath', (path) => { - path.replace('/', ':'); - return path; -}); diff --git a/spiffworkflow-frontend/src/components/ButtonWithConfirmation.tsx b/spiffworkflow-frontend/src/components/ButtonWithConfirmation.tsx index af2ec5eb..f8a56b25 100644 --- a/spiffworkflow-frontend/src/components/ButtonWithConfirmation.tsx +++ b/spiffworkflow-frontend/src/components/ButtonWithConfirmation.tsx @@ -46,7 +46,7 @@ export default function ButtonWithConfirmation({