From e4e00565815e02673844689fbd28cd4f6e7b79a4 Mon Sep 17 00:00:00 2001 From: burnettk Date: Sat, 10 Dec 2022 23:39:02 -0500 Subject: [PATCH] Squashed 'spiffworkflow-frontend/' changes from 326040b3c..55607af93 55607af93 fixed broken test w/ burnettk 4ea766eb4 mypy w/ burnettk cullerton fd2239b0e added git creds for pushing on publish w/ burnettk cullerton 0281bec01 added new notification component that allows links based on carbons w/ burnettk cullerton 49190128c display URL to open PR *** Need to figure out how to turn this into a link *** 72b15c52c Return message to use on successful publish 4997375c8 Merge branch 'main' into feature/git-integration 39deda4d4 Merge branch 'main' into feature/git-integration 027dae1c6 First pass at git integration db0c8dc29 break process instance log list page into two tabs, simple and detailed d9df1104c get the columsn for the instance list table anytime filter options are displayed if empty 3792dafdb make the frontend uris match the api calls better w/ burnettk 7095e4723 more api cleanup w/ burnettk c514ac656 cleaned up more api routes for permissions w/ burnettk c758216ed updated tasks endpoint to task-data for easier permission setting w/ burnettk 7504e1857 pyl w/ burnettk b7edc501a Merge remote-tracking branch 'origin/main' into new_report 112eed7f3 some updates to fix up saving perspectives w/ burnettk 6da6ebe2d Use the identifier, not the id when locating a process model or dmn table. 51515ea21 using an array for metadata extraction paths now instead of dictionaries w/ burnettk f0b8e7185 added some support to add process model metadata. need to fix frontend w/ burnettk 0777bda31 filtering by metadata works w/ burnettk d82a00018 favor report id over identifier but support both and ui updates to allow setting a condition value on a metadata field, changing the display name, and fixes for saving and updating a report de218ba8e updated column form var w/ burnettk de38dc436 added ability to update the display name for perspective columns w/ burnettk 555360eb6 some updates for process instance reports and metadata w/ burnettk f0f4dcd89 better display for failure causes on message list w/ burnettk c4faf5d55 added correlations to message list table w/ burnettk 65feaeecf Merge remote-tracking branch 'origin/main' into new_report fe9dddc03 Choose new report f20d6ee75 Save dates b55a24a1c Save first status c47c62a6d added script to save process instance metadata and fixed permissions issue w/ burnettk cullerton a0098ebd9 Save selected process model 55ecbe565 Use current columns 6de52904e WIP bacf11bdc Save as report component 472578b99 adding the username to the report tables bef4add43 allow disabling the permission check for the Create New Instance page to improve performance. ab929fcaa Merge branch 'main' of github.com:sartography/spiff-arena into main 603db83cb "Continue" rather than "Submit" when displaying manual tasks. 5db42f0e0 Processes you can start is now: Processes I can start c5c6c0fac lint 6f0c58da8 Auto Reload the Process Lists on the home pages' in-progress, and complete tabs 54e8a4717 update bpmn-js-spiffworkflow with better data-object handling a72daa441 Clean up css for the filter icon c755889ae update wording per harmeet: Tasks for my open processes is now My open instances bda4a6ee3 heading for instances on model show page, move instances below files, add margins 21a3eea47 display name instead of id, margin under table sections, Download xml to Download 1d83e3ac1 do not mislead user about being able to edit and clean up time in words 07380eec7 auto refresh tasks waiting for my groups on homepage 710d2340a time ago in words for in progress tab per harmeet feedback 88c4be1bd put id before process like completed tab and add title text to explain what is happening fb4136892 use process model display name rather than id for completed instances tab 8031fda3a left align files section with Start button per harmeet feedback c339d7dec add fin1, lead1, and Tasks actioned by me to Tasks completed by me 951c21f39 improve wording ed38b57e8 consistency is key e09373027 remove View label next to process instance id 38d20ceab ui feedback 3c0284633 some ui changes w/ burnettk e3711f4fd updated copmleted table text w/ burnettk 0688f5ec1 updated instances table descriptions w/ burnettk e9e9b8e2e added descriptions to task tables w/ burnettk 9b1d61866 updated breadcrumb to use display name w/ burnettk a9895f472 Hide perspectives link in nav bar (#59) 77390519b rename process_groups_list to process_group_list and fix lint 31bb0facd some updates to ui homepage to align more with notion doc 12e719146 fixed cypress tests 476c19f72 fix typo b266273e4 some more perm updates for core user w/ burnettk 05161fbcb Start of system report filters (#57) f0e0732ab fixed editing a process model w/ burnettk b02b5a2e4 filter process models based on user permissions on the backend if specified w/ burnettk 29093932f use tiles for process models w/ burnettk cullerton ab24c28d9 updated recently viewed table to be recently run and added run button w/ burnettk cullerton 9f894a8a9 added link to process model tile w/ burnettk cullerton b7a0743a5 moved delete and edit model and group buttons to icons on show pages w/ burnettk cullerton 21f7fc917 created new users for keycloak and fixed some permissions for core user w/ burnettk cullerton bd5a55c04 renamed modifyProcessModelPath to modifyProcessIdentifierForPathParam w/ burnettk 55a59b5ed modify process group id before submitting w/ burnettk 58bf7e38d Allow switching between user defined reports (#56) ec29be773 added recursive option to process model list to recurse or not and fix some ui components 56ae0afe3 fixed task frontend test 5f8a8dd64 the misc group is now 99-Misc 467e9643c allow longer username 83f6185f1 fix tests and add frontend tests f3b5cb7ca upgrade apscheduler and fix mispelling cfe7172de added a script to add a user to a group w/ burnettk 976ca7320 task cypress tests are passing w/ burnettk cullerton aa1a62505 process model cypress tests are passing w/ burnettk cullerton e36012401 make sure to pass the correct form of process group id when creating a process model w/ burnettk cullerton 97a840d04 process instance cypress tests pass now w/ burnettk cullerton 86fdb302a allow getting all process models, process instances should not save when they are initialized, and fixed some cypress tests w/ burnettk 2b15e66d2 iterating on cypress 1aa72f420 fix cypress tests git-subtree-dir: spiffworkflow-frontend git-subtree-split: 55607af9318775fb3524cc5bb4f6a3c6188efe38 --- .gitignore | 2 +- cypress/e2e/process_groups.cy.js | 21 +- cypress/e2e/process_instances.cy.js | 61 +- cypress/e2e/process_models.cy.js | 127 ++-- cypress/e2e/tasks.cy.js | 37 +- cypress/support/commands.js | 44 +- package-lock.json | 4 +- public/index.html | 1 - src/components/ButtonWithConfirmation.tsx | 2 +- src/components/MiniComponents.tsx | 22 + src/components/MyCompletedInstances.tsx | 2 + src/components/NavigationBar.tsx | 6 +- src/components/Notification.tsx | 48 ++ src/components/PaginationForTable.tsx | 3 + src/components/ProcessBreadcrumb.test.tsx | 14 +- src/components/ProcessBreadcrumb.tsx | 217 ++++--- src/components/ProcessGroupForm.tsx | 36 +- src/components/ProcessGroupListTiles.tsx | 13 +- .../ProcessInstanceListSaveAsReport.tsx | 205 ++++++ src/components/ProcessInstanceListTable.tsx | 596 ++++++++++++++++-- .../ProcessInstanceReportSearch.tsx | 85 +++ src/components/ProcessInstanceRun.tsx | 99 ++- src/components/ProcessModelForm.tsx | 137 +++- src/components/ProcessModelListTiles.tsx | 48 +- src/components/ProcessModelSearch.tsx | 2 +- src/components/ProcessSearch.tsx | 2 +- src/components/ReactDiagramEditor.tsx | 4 +- .../TableCellWithTimeAgoInWords.tsx | 17 + src/components/TasksForMyOpenProcesses.tsx | 118 ++-- src/components/TasksWaitingForMe.tsx | 86 +-- src/components/TasksWaitingForMyGroups.tsx | 120 ++-- src/config.tsx | 1 + src/helpers.tsx | 6 +- src/helpers/timeago.js | 62 ++ src/hooks/PermissionService.tsx | 21 +- src/hooks/UriListForPermissions.tsx | 34 +- src/index.css | 127 ++++ src/interfaces.ts | 78 ++- src/routes/AdminRoutes.tsx | 6 +- src/routes/AuthenticationList.tsx | 2 +- src/routes/CompletedInstances.tsx | 47 +- src/routes/CreateNewInstance.tsx | 3 +- src/routes/GroupedTasks.tsx | 8 +- src/routes/HomePageRoutes.tsx | 16 +- src/routes/JsonSchemaFormBuilder.tsx | 4 +- src/routes/MessageInstanceList.tsx | 140 ++-- src/routes/MyTasks.tsx | 75 ++- src/routes/ProcessGroupEdit.tsx | 9 +- src/routes/ProcessGroupList.tsx | 8 +- src/routes/ProcessGroupNew.tsx | 6 +- src/routes/ProcessGroupShow.tsx | 176 ++++-- src/routes/ProcessInstanceLogList.tsx | 86 ++- src/routes/ProcessInstanceReportList.tsx | 18 +- src/routes/ProcessInstanceReportShow.tsx | 4 +- src/routes/ProcessInstanceShow.tsx | 144 +++-- src/routes/ProcessModelEdit.tsx | 9 +- src/routes/ProcessModelEditDiagram.tsx | 19 +- src/routes/ProcessModelNew.tsx | 14 +- src/routes/ProcessModelShow.tsx | 236 ++++--- src/routes/ReactFormEditor.tsx | 18 +- src/routes/SecretList.tsx | 2 +- src/routes/TaskShow.tsx | 83 ++- src/services/HttpService.ts | 4 +- 63 files changed, 2727 insertions(+), 918 deletions(-) create mode 100644 src/components/MiniComponents.tsx create mode 100644 src/components/Notification.tsx create mode 100644 src/components/ProcessInstanceListSaveAsReport.tsx create mode 100644 src/components/ProcessInstanceReportSearch.tsx create mode 100644 src/components/TableCellWithTimeAgoInWords.tsx create mode 100644 src/helpers/timeago.js diff --git a/.gitignore b/.gitignore index a694da806..8ff3e35ce 100644 --- a/.gitignore +++ b/.gitignore @@ -29,4 +29,4 @@ cypress/screenshots /test*.json # Editors -.idea \ No newline at end of file +.idea diff --git a/cypress/e2e/process_groups.cy.js b/cypress/e2e/process_groups.cy.js index 629b18c67..bef0e5603 100644 --- a/cypress/e2e/process_groups.cy.js +++ b/cypress/e2e/process_groups.cy.js @@ -19,25 +19,22 @@ describe('process-groups', () => { cy.url().should('include', `process-groups/${groupId}`); cy.contains(`Process Group: ${groupDisplayName}`); - cy.contains('Edit process group').click(); + cy.getBySel('edit-process-group-button').click(); cy.get('input[name=display_name]').clear().type(newGroupDisplayName); cy.contains('Submit').click(); cy.contains(`Process Group: ${newGroupDisplayName}`); - cy.contains('Edit process group').click(); - cy.get('input[name=display_name]').should( - 'have.value', - newGroupDisplayName - ); - - cy.contains('Delete').click(); + cy.getBySel('delete-process-group-button').click(); cy.contains('Are you sure'); - cy.getBySel('modal-confirmation-dialog').find('.cds--btn--danger').click(); + cy.getBySel('delete-process-group-button-modal-confirmation-dialog') + .find('.cds--btn--danger') + .click(); cy.url().should('include', `process-groups`); cy.contains(groupId).should('not.exist'); }); - it('can paginate items', () => { - cy.basicPaginationTest(); - }); + // process groups no longer has pagination post-tiles + // it('can paginate items', () => { + // cy.basicPaginationTest(); + // }); }); diff --git a/cypress/e2e/process_instances.cy.js b/cypress/e2e/process_instances.cy.js index 09cad2987..4d33d13f1 100644 --- a/cypress/e2e/process_instances.cy.js +++ b/cypress/e2e/process_instances.cy.js @@ -3,9 +3,9 @@ import { DATE_FORMAT, PROCESS_STATUSES } from '../../src/config'; const filterByDate = (fromDate) => { cy.get('#date-picker-start-from').clear().type(format(fromDate, DATE_FORMAT)); - cy.contains('Start date from').click(); + cy.contains('Start date to').click(); cy.get('#date-picker-end-from').clear().type(format(fromDate, DATE_FORMAT)); - cy.contains('End date from').click(); + cy.contains('End date to').click(); cy.getBySel('filter-button').click(); }; @@ -53,9 +53,9 @@ const updateBpmnPythonScriptWithMonaco = ( cy.get('.monaco-editor textarea:first') .click() .focused() // change subject to currently focused element - // .type('{ctrl}a') // had been doing it this way, but it turns out to be flaky relative to clear() .clear() - .type(pythonScript, { delay: 30 }); + // long delay to ensure cypress isn't competing with monaco auto complete stuff + .type(pythonScript, { delay: 120 }); cy.contains('Close').click(); // wait for a little bit for the xml to get set before saving @@ -119,28 +119,28 @@ describe('process-instances', () => { cy.runPrimaryBpmnFile(); }); - it('can create a new instance and can modify with monaco text editor', () => { - // leave off the ending double quote since manco adds it - const originalPythonScript = 'person = "Kevin'; - const newPythonScript = 'person = "Mike'; - - const bpmnFile = 'process_model_one.bpmn'; - - // Change bpmn - cy.getBySel('files-accordion').click(); - cy.getBySel(`edit-file-${bpmnFile.replace('.', '-')}`).click(); - cy.contains(`Process Model File: ${bpmnFile}`); - updateBpmnPythonScriptWithMonaco(newPythonScript); - cy.contains('acceptance-tests-model-1').click(); - cy.runPrimaryBpmnFile(); - - cy.getBySel('files-accordion').click(); - cy.getBySel(`edit-file-${bpmnFile.replace('.', '-')}`).click(); - cy.contains(`Process Model File: ${bpmnFile}`); - updateBpmnPythonScriptWithMonaco(originalPythonScript); - cy.contains('acceptance-tests-model-1').click(); - cy.runPrimaryBpmnFile(); - }); + // it('can create a new instance and can modify with monaco text editor', () => { + // // leave off the ending double quote since manco adds it + // const originalPythonScript = 'person = "Kevin'; + // const newPythonScript = 'person = "Mike'; + // + // const bpmnFile = 'process_model_one.bpmn'; + // + // // Change bpmn + // cy.getBySel('files-accordion').click(); + // cy.getBySel(`edit-file-${bpmnFile.replace('.', '-')}`).click(); + // cy.contains(`Process Model File: ${bpmnFile}`); + // updateBpmnPythonScriptWithMonaco(newPythonScript); + // cy.contains('acceptance-tests-model-1').click(); + // cy.runPrimaryBpmnFile(); + // + // cy.getBySel('files-accordion').click(); + // cy.getBySel(`edit-file-${bpmnFile.replace('.', '-')}`).click(); + // cy.contains(`Process Model File: ${bpmnFile}`); + // updateBpmnPythonScriptWithMonaco(originalPythonScript); + // cy.contains('acceptance-tests-model-1').click(); + // cy.runPrimaryBpmnFile(); + // }); it('can paginate items', () => { // make sure we have some process instances @@ -174,13 +174,12 @@ describe('process-instances', () => { if (!['all', 'waiting'].includes(processStatus)) { cy.get(statusSelect).click(); cy.get(statusSelect).contains(processStatus).click(); - // close the dropdown again - cy.get(statusSelect).click(); cy.getBySel('filter-button').click(); + // FIXME: wait a little bit for the useEffects to be able to fully set processInstanceFilters + cy.wait(1000); + cy.url().should('include', `status=${processStatus}`); cy.assertAtLeastOneItemInPaginatedResults(); - cy.getBySel(`process-instance-status-${processStatus}`).contains( - processStatus - ); + cy.getBySel(`process-instance-status-${processStatus}`); // there should really only be one, but in CI there are sometimes more cy.get('div[aria-label="Clear all selected items"]:first').click(); } diff --git a/cypress/e2e/process_models.cy.js b/cypress/e2e/process_models.cy.js index 705f6011c..4fd1b4810 100644 --- a/cypress/e2e/process_models.cy.js +++ b/cypress/e2e/process_models.cy.js @@ -1,3 +1,5 @@ +import { modifyProcessIdentifierForPathParam } from '../../src/helpers'; + describe('process-models', () => { beforeEach(() => { cy.login(); @@ -9,37 +11,48 @@ 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('99-Shared Resources').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/${modifyProcessIdentifierForPathParam( + groupId + )}:${modelId}` + ); cy.contains(`Process Model: ${modelDisplayName}`); - cy.contains('Edit process model').click(); + cy.getBySel('edit-process-model-button').click(); cy.get('input[name=display_name]').clear().type(newModelDisplayName); cy.contains('Submit').click(); - cy.contains(`Process Model: ${groupId}/${modelId}`); - cy.contains('Submit').click(); - cy.get('input[name=display_name]').should( - 'have.value', - newModelDisplayName - ); + cy.contains(`Process Model: ${newModelDisplayName}`); - cy.contains('Delete').click(); + // go back to process model show by clicking on the 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/${modifyProcessIdentifierForPathParam(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 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}`; @@ -48,13 +61,19 @@ describe('process-models', () => { const dmnFileName = `dmn_test_file_${id}`; const jsonFileName = `json_test_file_${id}`; + cy.contains('99-Shared Resources').click(); + cy.wait(500); cy.contains(groupDisplayName).click(); cy.createModel(groupId, modelId, modelDisplayName); - cy.contains(groupId).click(); - cy.contains(modelId).click(); - cy.url().should('include', `process-models/${groupId}:${modelId}`); + cy.contains(directParentGroupId).click(); + cy.contains(modelDisplayName).click(); + cy.url().should( + 'include', + `process-models/${modifyProcessIdentifierForPathParam( + groupId + )}:${modelId}` + ); cy.contains(`Process Model: ${modelDisplayName}`); - cy.getBySel('files-accordion').click(); cy.contains(`${bpmnFileName}.bpmn`).should('not.exist'); cy.contains(`${dmnFileName}.dmn`).should('not.exist'); cy.contains(`${jsonFileName}.json`).should('not.exist'); @@ -73,7 +92,7 @@ describe('process-models', () => { cy.contains(`Process Model File: ${bpmnFileName}`); cy.contains(modelId).click(); cy.contains(`Process Model: ${modelDisplayName}`); - cy.getBySel('files-accordion').click(); + // cy.getBySel('files-accordion').click(); cy.contains(`${bpmnFileName}.bpmn`).should('exist'); // add new dmn file @@ -81,13 +100,17 @@ describe('process-models', () => { cy.contains(/^Process Model File$/); cy.get('g[data-element-id=decision_1]').click().should('exist'); cy.contains('General').click(); + cy.get('#bio-properties-panel-id') + .clear() + .type('decision_acceptance_test_1'); + 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: ${modelDisplayName}`); - cy.getBySel('files-accordion').click(); + // cy.getBySel('files-accordion').click(); cy.contains(`${dmnFileName}.dmn`).should('exist'); // add new json file @@ -103,35 +126,47 @@ describe('process-models', () => { cy.wait(500); cy.contains(modelId).click(); cy.contains(`Process Model: ${modelDisplayName}`); - cy.getBySel('files-accordion').click(); + // cy.getBySel('files-accordion').click(); cy.contains(`${jsonFileName}.json`).should('exist'); - cy.contains('Edit process model').click(); - cy.contains('Delete').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/${modifyProcessIdentifierForPathParam(groupId)}` + ); cy.contains(modelId).should('not.exist'); + cy.contains(modelDisplayName).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('99-Shared Resources').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.contains(modelDisplayName).click(); + cy.url().should( + 'include', + `process-models/${modifyProcessIdentifierForPathParam( + groupId + )}:${modelId}` + ); cy.contains(`Process Model: ${modelDisplayName}`); - cy.getBySel('files-accordion').click(); cy.getBySel('upload-file-button').click(); cy.contains('Add file').selectFile( 'cypress/fixtures/test_bpmn_file_upload.bpmn' @@ -142,31 +177,41 @@ describe('process-models', () => { .click(); cy.runPrimaryBpmnFile(); - cy.getBySel('process-instance-list-link').click(); + // cy.getBySel('process-instance-list-link').click(); 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.contains('Edit process model').click(); - cy.contains('Delete').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/${modifyProcessIdentifierForPathParam(groupId)}` + ); cy.contains(modelId).should('not.exist'); + cy.contains(modelDisplayName).should('not.exist'); }); - it('can paginate items', () => { - cy.contains('Acceptance Tests Group One').click(); - cy.basicPaginationTest(); - }); + // 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(); - cy.contains('List').click(); + cy.contains('Acceptance Tests Model 3'); }); }); diff --git a/cypress/e2e/tasks.cy.js b/cypress/e2e/tasks.cy.js index 9d5b836a9..e58566b8c 100644 --- a/cypress/e2e/tasks.cy.js +++ b/cypress/e2e/tasks.cy.js @@ -1,18 +1,27 @@ const submitInputIntoFormField = (taskName, fieldKey, fieldValue) => { - cy.contains(`Task: ${taskName}`); + cy.contains(`Task: ${taskName}`, { timeout: 10000 }); cy.get(fieldKey).clear().type(fieldValue); cy.contains('Submit').click(); }; const checkFormFieldIsReadOnly = (formName, fieldKey) => { cy.contains(`Task: ${formName}`); - cy.get(fieldKey).invoke('attr', 'readonly').should('exist'); + cy.get(fieldKey).invoke('attr', 'disabled').should('exist'); }; const checkTaskHasClass = (taskName, className) => { cy.get(`g[data-element-id=${taskName}]`).should('have.class', className); }; +const kickOffModelWithForm = (modelId, formName) => { + cy.navigateToProcessModel( + 'Acceptance Tests Group One', + 'Acceptance Tests Model 2', + 'acceptance-tests-model-2' + ); + cy.runPrimaryBpmnFile(true); +}; + describe('tasks', () => { beforeEach(() => { cy.login(); @@ -21,7 +30,6 @@ describe('tasks', () => { cy.logout(); }); - // TODO: need to fix the next_task thing to make this pass it('can complete and navigate a form', () => { const groupDisplayName = 'Acceptance Tests Group One'; const modelId = `acceptance-tests-model-2`; @@ -30,11 +38,7 @@ describe('tasks', () => { const activeTaskClassName = 'active-task-highlight'; cy.navigateToProcessModel(groupDisplayName, modelDisplayName, modelId); - - // avoid reloading so we can click on the task link that appears on running the process instance - cy.runPrimaryBpmnFile(false); - - cy.contains('my task').click(); + cy.runPrimaryBpmnFile(true); submitInputIntoFormField( 'get_user_generated_number_one', @@ -59,7 +63,6 @@ describe('tasks', () => { '#root_user_generated_number_1' ); - cy.getBySel('form-nav-form3').should('have.text', 'form3 - Current'); cy.getBySel('form-nav-form3').click(); submitInputIntoFormField( 'get_user_generated_number_three', @@ -111,18 +114,12 @@ describe('tasks', () => { }); it('can paginate items', () => { - cy.navigateToProcessModel( - 'Acceptance Tests Group One', - 'Acceptance Tests Model 2', - 'acceptance-tests-model-2' - ); - // make sure we have some tasks - cy.runPrimaryBpmnFile(); - cy.runPrimaryBpmnFile(); - cy.runPrimaryBpmnFile(); - cy.runPrimaryBpmnFile(); - cy.runPrimaryBpmnFile(); + kickOffModelWithForm(); + kickOffModelWithForm(); + kickOffModelWithForm(); + kickOffModelWithForm(); + kickOffModelWithForm(); cy.navigateToHome(); cy.basicPaginationTest(); diff --git a/cypress/support/commands.js b/cypress/support/commands.js index 40074518d..f0034168c 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -1,4 +1,5 @@ import { string } from 'prop-types'; +import { modifyProcessIdentifierForPathParam } from '../../src/helpers'; // *********************************************** // This example commands.js shows you how to @@ -31,9 +32,8 @@ Cypress.Commands.add('getBySel', (selector, ...args) => { }); Cypress.Commands.add('navigateToHome', () => { - cy.get('button[aria-label="Open menu"]').click(); + cy.getBySel('header-menu-expand-button').click(); cy.getBySel('side-nav-items').contains('Home').click(); - // cy.getBySel('nav-home').click(); }); Cypress.Commands.add('navigateToAdmin', () => { @@ -76,27 +76,39 @@ Cypress.Commands.add('createModel', (groupId, modelId, modelDisplayName) => { cy.get('input[name=id]').should('have.value', modelId); cy.contains('Submit').click(); - cy.url().should('include', `process-models/${groupId}:${modelId}`); + cy.url().should( + 'include', + `process-models/${modifyProcessIdentifierForPathParam(groupId)}:${modelId}` + ); cy.contains(`Process Model: ${modelDisplayName}`); }); -Cypress.Commands.add('runPrimaryBpmnFile', (reload = true) => { - cy.contains('Run').click(); - cy.contains(/Process Instance.*kicked off/); - if (reload) { - cy.reload(true); - cy.contains(/Process Instance.*kicked off/).should('not.exist'); +Cypress.Commands.add( + 'runPrimaryBpmnFile', + (expectAutoRedirectToHumanTask = false) => { + cy.contains('Run').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.reload(true); + cy.contains(/Process Instance.*kicked off/).should('not.exist'); + } } -}); +); Cypress.Commands.add( 'navigateToProcessModel', (groupDisplayName, modelDisplayName, modelIdentifier) => { cy.navigateToAdmin(); + cy.contains('99-Shared Resources').click(); + cy.contains(`Process Group: 99-Shared Resources`, { timeout: 10000 }); cy.contains(groupDisplayName).click(); cy.contains(`Process Group: ${groupDisplayName}`); // https://stackoverflow.com/q/51254946/6090676 - cy.getBySel('process-model-show-link').contains(modelIdentifier).click(); + cy.getBySel('process-model-show-link').contains(modelDisplayName).click(); cy.contains(`Process Model: ${modelDisplayName}`); } ); @@ -120,13 +132,3 @@ Cypress.Commands.add('assertAtLeastOneItemInPaginatedResults', () => { Cypress.Commands.add('assertNoItemInPaginatedResults', () => { cy.contains(/\b0–0 of 0 items/); }); - -Cypress.Commands.add('modifyProcessModelPath', (path) => { - path.replace('/', ':'); - return path; -}); - -Cypress.Commands.add('modifyProcessModelPath', (path) => { - path.replace('/', ':'); - return path; -}); diff --git a/package-lock.json b/package-lock.json index f31017c8c..ba2339983 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7980,7 +7980,7 @@ }, "node_modules/bpmn-js-spiffworkflow": { "version": "0.0.8", - "resolved": "git+ssh://git@github.com/sartography/bpmn-js-spiffworkflow.git#e92f48da7cb4416310af71bb1699caaca87324cd", + "resolved": "git+ssh://git@github.com/sartography/bpmn-js-spiffworkflow.git#aca23dc56e5d37aa1ed0a3cf11acb55f76a36da7", "license": "MIT", "dependencies": { "inherits": "^2.0.4", @@ -37138,7 +37138,7 @@ } }, "bpmn-js-spiffworkflow": { - "version": "git+ssh://git@github.com/sartography/bpmn-js-spiffworkflow.git#e92f48da7cb4416310af71bb1699caaca87324cd", + "version": "git+ssh://git@github.com/sartography/bpmn-js-spiffworkflow.git#aca23dc56e5d37aa1ed0a3cf11acb55f76a36da7", "from": "bpmn-js-spiffworkflow@sartography/bpmn-js-spiffworkflow#main", "requires": { "inherits": "^2.0.4", diff --git a/public/index.html b/public/index.html index 8e5b00b0f..ae3a23076 100644 --- a/public/index.html +++ b/public/index.html @@ -41,4 +41,3 @@ --> - diff --git a/src/components/ButtonWithConfirmation.tsx b/src/components/ButtonWithConfirmation.tsx index af2ec5eba..f8a56b257 100644 --- a/src/components/ButtonWithConfirmation.tsx +++ b/src/components/ButtonWithConfirmation.tsx @@ -46,7 +46,7 @@ export default function ButtonWithConfirmation({ + {processModelDisplayName} + + ); +} diff --git a/src/components/MyCompletedInstances.tsx b/src/components/MyCompletedInstances.tsx index fe6652951..2d0fe26a7 100644 --- a/src/components/MyCompletedInstances.tsx +++ b/src/components/MyCompletedInstances.tsx @@ -8,6 +8,8 @@ export default function MyCompletedInstances() { filtersEnabled={false} paginationQueryParamPrefix={paginationQueryParamPrefix} perPageOptions={[2, 5, 25]} + reportIdentifier="system_report_instances_initiated_by_me" + showReports={false} /> ); } diff --git a/src/components/NavigationBar.tsx b/src/components/NavigationBar.tsx index cc7137fb8..47e0de998 100644 --- a/src/components/NavigationBar.tsx +++ b/src/components/NavigationBar.tsx @@ -74,7 +74,9 @@ export default function NavigationBar() { if (UserService.isLoggedIn()) { return ( <> - {UserService.getUsername()} + + {UserService.getUsername()} + {configurationElement()}