From 45887f7ddcc471e44355a879ea625ccc0b457f08 Mon Sep 17 00:00:00 2001 From: mike cullerton Date: Thu, 15 Dec 2022 17:49:20 -0500 Subject: [PATCH 1/6] fixed a path issue with the breadcrumb --- spiffworkflow-frontend/src/routes/ProcessInstanceList.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/spiffworkflow-frontend/src/routes/ProcessInstanceList.tsx b/spiffworkflow-frontend/src/routes/ProcessInstanceList.tsx index b6c08b213..6b0da6de2 100644 --- a/spiffworkflow-frontend/src/routes/ProcessInstanceList.tsx +++ b/spiffworkflow-frontend/src/routes/ProcessInstanceList.tsx @@ -6,7 +6,7 @@ import 'react-bootstrap-typeahead/css/Typeahead.css'; import 'react-bootstrap-typeahead/css/Typeahead.bs5.css'; import ProcessBreadcrumb from '../components/ProcessBreadcrumb'; import ProcessInstanceListTable from '../components/ProcessInstanceListTable'; -import { getProcessModelFullIdentifierFromSearchParams } from '../helpers'; +import {getProcessModelFullIdentifierFromSearchParams, modifyProcessIdentifierForPathParam} from '../helpers'; export default function ProcessInstanceList() { const [searchParams] = useSearchParams(); @@ -16,6 +16,9 @@ export default function ProcessInstanceList() { if (processModelFullIdentifier === null) { return null; } + const modifiedProcessModelId = modifyProcessIdentifierForPathParam( + processModelFullIdentifier + ); return ( Date: Thu, 15 Dec 2022 17:59:01 -0500 Subject: [PATCH 2/6] fixed process model tests --- .../cypress/e2e/process_models.cy.js | 71 +++++++------------ .../cypress/support/commands.js | 21 +++++- 2 files changed, 43 insertions(+), 49 deletions(-) diff --git a/spiffworkflow-frontend/cypress/e2e/process_models.cy.js b/spiffworkflow-frontend/cypress/e2e/process_models.cy.js index 4fd1b4810..395ee768f 100644 --- a/spiffworkflow-frontend/cypress/e2e/process_models.cy.js +++ b/spiffworkflow-frontend/cypress/e2e/process_models.cy.js @@ -8,16 +8,19 @@ describe('process-models', () => { cy.logout(); }); + const sharedResourceString = 'Shared Resources'; + const groupDisplayName = 'Acceptance Tests Group One'; + const deleteProcessModelButtonId = 'delete-process-model-button'; + it('can perform crud operations', () => { const uuid = () => Cypress._.random(0, 1e6); const id = uuid(); const groupId = 'misc/acceptance-tests-group-one'; - const groupDisplayName = 'Acceptance Tests Group One'; const modelDisplayName = `Test Model 2 ${id}`; const modelId = `test-model-2-${id}`; const newModelDisplayName = `${modelDisplayName} edited`; - cy.contains('99-Shared Resources').click(); - cy.wait(500); + cy.contains(sharedResourceString).click(); + cy.wait(750); cy.contains(groupDisplayName).click(); cy.createModel(groupId, modelId, modelDisplayName); cy.url().should( @@ -33,18 +36,8 @@ describe('process-models', () => { cy.contains('Submit').click(); cy.contains(`Process Model: ${newModelDisplayName}`); - // go back to process model show by clicking on the breadcrumb - cy.contains(modelId).click(); + cy.deleteProcessModelAndConfirm(deleteProcessModelButtonId, groupId); - cy.getBySel('delete-process-model-button').click(); - cy.contains('Are you sure'); - cy.getBySel('delete-process-model-button-modal-confirmation-dialog') - .find('.cds--btn--danger') - .click(); - cy.url().should( - 'include', - `process-groups/${modifyProcessIdentifierForPathParam(groupId)}` - ); cy.contains(modelId).should('not.exist'); }); @@ -52,20 +45,22 @@ describe('process-models', () => { const uuid = () => Cypress._.random(0, 1e6); const id = uuid(); const directParentGroupId = 'acceptance-tests-group-one'; + const directParentGroupName = '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}`; const bpmnFileName = `bpmn_test_file_${id}`; const dmnFileName = `dmn_test_file_${id}`; const jsonFileName = `json_test_file_${id}`; + const decision_acceptance_test_id = `decision_acceptance_test_${id}`; - cy.contains('99-Shared Resources').click(); + cy.contains(sharedResourceString).click(); cy.wait(500); cy.contains(groupDisplayName).click(); cy.createModel(groupId, modelId, modelDisplayName); - cy.contains(directParentGroupId).click(); + cy.contains(directParentGroupName).click(); + cy.wait(500); cy.contains(modelDisplayName).click(); cy.url().should( 'include', @@ -90,7 +85,7 @@ describe('process-models', () => { 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(modelDisplayName).click(); cy.contains(`Process Model: ${modelDisplayName}`); // cy.getBySel('files-accordion').click(); cy.contains(`${bpmnFileName}.bpmn`).should('exist'); @@ -102,13 +97,13 @@ describe('process-models', () => { cy.contains('General').click(); cy.get('#bio-properties-panel-id') .clear() - .type('decision_acceptance_test_1'); + .type(decision_acceptance_test_id); 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(modelDisplayName).click(); cy.contains(`Process Model: ${modelDisplayName}`); // cy.getBySel('files-accordion').click(); cy.contains(`${dmnFileName}.dmn`).should('exist'); @@ -124,20 +119,12 @@ describe('process-models', () => { 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(modelDisplayName).click(); cy.contains(`Process Model: ${modelDisplayName}`); // cy.getBySel('files-accordion').click(); cy.contains(`${jsonFileName}.json`).should('exist'); - cy.getBySel('delete-process-model-button').click(); - cy.contains('Are you sure'); - cy.getBySel('delete-process-model-button-modal-confirmation-dialog') - .find('.cds--btn--danger') - .click(); - cy.url().should( - 'include', - `process-groups/${modifyProcessIdentifierForPathParam(groupId)}` - ); + cy.deleteProcessModelAndConfirm(deleteProcessModelButtonId, groupId); cy.contains(modelId).should('not.exist'); cy.contains(modelDisplayName).should('not.exist'); }); @@ -147,16 +134,15 @@ describe('process-models', () => { const id = uuid(); 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('99-Shared Resources').click(); + cy.contains(sharedResourceString).click(); cy.wait(500); cy.contains(groupDisplayName).click(); cy.createModel(groupId, modelId, modelDisplayName); - cy.contains(`${directParentGroupId}`).click(); + cy.contains(`${groupDisplayName}`).click(); cy.contains('Add a process model'); cy.contains(modelDisplayName).click(); cy.url().should( @@ -188,27 +174,20 @@ describe('process-models', () => { // in breadcrumb cy.contains(modelId).click(); - cy.getBySel('delete-process-model-button').click(); + cy.getBySel(deleteProcessModelButtonId).click(); cy.contains('Are you sure'); cy.getBySel('delete-process-model-button-modal-confirmation-dialog') .find('.cds--btn--danger') .click(); - cy.url().should( - 'include', - `process-groups/${modifyProcessIdentifierForPathParam(groupId)}` - ); + // cy.url().should( + // 'include', + // `process-instances?process_model_identifier=${modifyProcessIdentifierForPathParam(groupId)}` + // ); + // cy.wait(750); cy.contains(modelId).should('not.exist'); cy.contains(modelDisplayName).should('not.exist'); }); - // process models no longer has pagination post-tiles - // it.only('can paginate items', () => { - // cy.contains('99-Shared Resources').click(); - // cy.wait(500); - // 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(); diff --git a/spiffworkflow-frontend/cypress/support/commands.js b/spiffworkflow-frontend/cypress/support/commands.js index f0034168c..0112ea31b 100644 --- a/spiffworkflow-frontend/cypress/support/commands.js +++ b/spiffworkflow-frontend/cypress/support/commands.js @@ -86,15 +86,15 @@ Cypress.Commands.add('createModel', (groupId, modelId, modelDisplayName) => { Cypress.Commands.add( 'runPrimaryBpmnFile', (expectAutoRedirectToHumanTask = false) => { - cy.contains('Run').click(); + cy.contains('Start').click(); if (expectAutoRedirectToHumanTask) { // the url changes immediately, so also make sure we get some content from the next page, "Task:", or else when we try to interact with the page, it'll re-render and we'll get an error with cypress. cy.url().should('include', `/tasks/`); cy.contains('Task: '); } else { - cy.contains(/Process Instance.*kicked off/); + cy.contains(/Process Instance Kicked Off/); cy.reload(true); - cy.contains(/Process Instance.*kicked off/).should('not.exist'); + cy.contains(/Process Instance Kicked Off/).should('not.exist'); } } ); @@ -132,3 +132,18 @@ Cypress.Commands.add('assertAtLeastOneItemInPaginatedResults', () => { Cypress.Commands.add('assertNoItemInPaginatedResults', () => { cy.contains(/\b0–0 of 0 items/); }); + +Cypress.Commands.add( + 'deleteProcessModelAndConfirm', + (buttonId, groupId) => { + cy.getBySel(buttonId).click(); + cy.contains('Are you sure'); + cy.getBySel('delete-process-model-button-modal-confirmation-dialog') + .find('.cds--btn--danger') + .click(); + cy.url().should( + 'include', + `process-groups/${modifyProcessIdentifierForPathParam(groupId)}` + ); + } +); From 10dd81fd2ca828afd723afbd931525cca483df36 Mon Sep 17 00:00:00 2001 From: burnettk Date: Wed, 21 Dec 2022 09:29:54 -0500 Subject: [PATCH 3/6] lint and upgrade cypress --- spiffworkflow-frontend/package-lock.json | 12 ++++++------ .../src/routes/ProcessInstanceList.tsx | 5 +---- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/spiffworkflow-frontend/package-lock.json b/spiffworkflow-frontend/package-lock.json index 4ccea1922..54cf2c890 100644 --- a/spiffworkflow-frontend/package-lock.json +++ b/spiffworkflow-frontend/package-lock.json @@ -9850,9 +9850,9 @@ "integrity": "sha512-NJGVKPS81XejHcLhaLJS7plab0fK3slPh11mESeeDq2W4ZI5kUKK/LRRdVDvjJseojbPB7ZwjnyOybg3Igea/A==" }, "node_modules/cypress": { - "version": "12.1.0", - "resolved": "https://registry.npmjs.org/cypress/-/cypress-12.1.0.tgz", - "integrity": "sha512-7fz8N84uhN1+ePNDsfQvoWEl4P3/VGKKmAg+bJQFY4onhA37Ys+6oBkGbNdwGeC7n2QqibNVPhk8x3YuQLwzfw==", + "version": "12.2.0", + "resolved": "https://registry.npmjs.org/cypress/-/cypress-12.2.0.tgz", + "integrity": "sha512-kvl95ri95KK8mAy++tEU/wUgzAOMiIciZSL97LQvnOinb532m7dGvwN0mDSIGbOd71RREtmT9o4h088RjK5pKw==", "dev": true, "hasInstallScript": true, "dependencies": { @@ -38586,9 +38586,9 @@ "integrity": "sha512-NJGVKPS81XejHcLhaLJS7plab0fK3slPh11mESeeDq2W4ZI5kUKK/LRRdVDvjJseojbPB7ZwjnyOybg3Igea/A==" }, "cypress": { - "version": "12.1.0", - "resolved": "https://registry.npmjs.org/cypress/-/cypress-12.1.0.tgz", - "integrity": "sha512-7fz8N84uhN1+ePNDsfQvoWEl4P3/VGKKmAg+bJQFY4onhA37Ys+6oBkGbNdwGeC7n2QqibNVPhk8x3YuQLwzfw==", + "version": "12.2.0", + "resolved": "https://registry.npmjs.org/cypress/-/cypress-12.2.0.tgz", + "integrity": "sha512-kvl95ri95KK8mAy++tEU/wUgzAOMiIciZSL97LQvnOinb532m7dGvwN0mDSIGbOd71RREtmT9o4h088RjK5pKw==", "dev": true, "requires": { "@cypress/request": "^2.88.10", diff --git a/spiffworkflow-frontend/src/routes/ProcessInstanceList.tsx b/spiffworkflow-frontend/src/routes/ProcessInstanceList.tsx index 29357fe40..51c099815 100644 --- a/spiffworkflow-frontend/src/routes/ProcessInstanceList.tsx +++ b/spiffworkflow-frontend/src/routes/ProcessInstanceList.tsx @@ -9,7 +9,7 @@ import { Tabs, TabList, Tab } from '@carbon/react'; import { Can } from '@casl/react'; import ProcessBreadcrumb from '../components/ProcessBreadcrumb'; import ProcessInstanceListTable from '../components/ProcessInstanceListTable'; -import {getProcessModelFullIdentifierFromSearchParams, modifyProcessIdentifierForPathParam} from '../helpers'; +import { getProcessModelFullIdentifierFromSearchParams } from '../helpers'; import { useUriListForPermissions } from '../hooks/UriListForPermissions'; import { PermissionsToCheck } from '../interfaces'; import { usePermissionFetcher } from '../hooks/PermissionService'; @@ -34,9 +34,6 @@ export default function ProcessInstanceList({ variant }: OwnProps) { if (processModelFullIdentifier === null) { return null; } - const modifiedProcessModelId = modifyProcessIdentifierForPathParam( - processModelFullIdentifier - ); return ( Date: Wed, 4 Jan 2023 21:10:21 -0500 Subject: [PATCH 4/6] restore assertion --- spiffworkflow-frontend/cypress/e2e/process_models.cy.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/spiffworkflow-frontend/cypress/e2e/process_models.cy.js b/spiffworkflow-frontend/cypress/e2e/process_models.cy.js index 6b51ee918..2644c5017 100644 --- a/spiffworkflow-frontend/cypress/e2e/process_models.cy.js +++ b/spiffworkflow-frontend/cypress/e2e/process_models.cy.js @@ -182,11 +182,10 @@ describe('process-models', () => { cy.getBySel('delete-process-model-button-modal-confirmation-dialog') .find('.cds--btn--danger') .click(); - // cy.url().should( - // 'include', - // `process-instances?process_model_identifier=${modifyProcessIdentifierForPathParam(groupId)}` - // ); - // cy.wait(750); + cy.url().should( + 'include', + `process-groups/${modifyProcessIdentifierForPathParam(groupId)}` + ); cy.contains(modelId).should('not.exist'); cy.contains(modelDisplayName).should('not.exist'); }); From a1935d843594e2853438ecb823c00351ff52804f Mon Sep 17 00:00:00 2001 From: burnettk Date: Wed, 4 Jan 2023 21:17:36 -0500 Subject: [PATCH 5/6] remove arbirary waits with no comments --- spiffworkflow-frontend/cypress/e2e/process_models.cy.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/spiffworkflow-frontend/cypress/e2e/process_models.cy.js b/spiffworkflow-frontend/cypress/e2e/process_models.cy.js index 2644c5017..f95d84011 100644 --- a/spiffworkflow-frontend/cypress/e2e/process_models.cy.js +++ b/spiffworkflow-frontend/cypress/e2e/process_models.cy.js @@ -20,7 +20,6 @@ describe('process-models', () => { const modelId = `test-model-2-${id}`; const newModelDisplayName = `${modelDisplayName} edited`; cy.contains(miscDisplayName).click(); - cy.wait(750); cy.contains(groupDisplayName).click(); cy.createModel(groupId, modelId, modelDisplayName); cy.url().should( @@ -57,7 +56,6 @@ describe('process-models', () => { const decision_acceptance_test_id = `decision_acceptance_test_${id}`; cy.contains(miscDisplayName).click(); - cy.wait(500); cy.contains(groupDisplayName).click(); cy.createModel(groupId, modelId, modelDisplayName); cy.contains(groupDisplayName).click(); @@ -141,7 +139,6 @@ describe('process-models', () => { const modelId = `test-model-2-${id}`; cy.contains('Add a process group'); cy.contains(miscDisplayName).click(); - cy.wait(500); cy.contains(groupDisplayName).click(); cy.createModel(groupId, modelId, modelDisplayName); From e3c932d9f5df1cce09b96eec992eaa6c00b5a1fe Mon Sep 17 00:00:00 2001 From: burnettk Date: Wed, 4 Jan 2023 21:22:32 -0500 Subject: [PATCH 6/6] extract some duplicated text into vars to appease eslint --- .../cypress/e2e/process_models.cy.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/spiffworkflow-frontend/cypress/e2e/process_models.cy.js b/spiffworkflow-frontend/cypress/e2e/process_models.cy.js index f95d84011..3a36f710e 100644 --- a/spiffworkflow-frontend/cypress/e2e/process_models.cy.js +++ b/spiffworkflow-frontend/cypress/e2e/process_models.cy.js @@ -11,6 +11,8 @@ describe('process-models', () => { const groupDisplayName = 'Acceptance Tests Group One'; const deleteProcessModelButtonId = 'delete-process-model-button'; + const saveChangesButtonText = 'Save Changes'; + const fileNameInputSelector = 'input[name=file_name]'; it('can perform crud operations', () => { const uuid = () => Cypress._.random(0, 1e6); @@ -80,8 +82,8 @@ describe('process-models', () => { 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.get(fileNameInputSelector).type(bpmnFileName); + cy.contains(saveChangesButtonText).click(); cy.contains(`Process Model File: ${bpmnFileName}`); cy.contains(modelDisplayName).click(); cy.contains(`Process Model: ${modelDisplayName}`); @@ -98,8 +100,8 @@ describe('process-models', () => { .type(decision_acceptance_test_id); cy.contains('General').click(); cy.contains('Save').click(); - cy.get('input[name=file_name]').type(dmnFileName); - cy.contains('Save Changes').click(); + cy.get(fileNameInputSelector).type(dmnFileName); + cy.contains(saveChangesButtonText).click(); cy.contains(`Process Model File: ${dmnFileName}`); cy.contains(modelDisplayName).click(); cy.contains(`Process Model: ${modelDisplayName}`); @@ -112,8 +114,8 @@ describe('process-models', () => { // 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.get(fileNameInputSelector).type(jsonFileName); + cy.contains(saveChangesButtonText).click(); cy.contains(`Process Model File: ${jsonFileName}`); // wait for json to load before clicking away to avoid network errors cy.wait(500);