From bf7c6898741ea60eb46c8dc47b58273021aab32c Mon Sep 17 00:00:00 2001 From: jasquat Date: Wed, 9 Nov 2022 12:33:43 -0500 Subject: [PATCH] one instance test left for cypress w/ burnettk --- .../services/acceptance_test_fixtures.py | 4 +- .../cypress/e2e/process_instances.cy.js | 40 ++++----- .../src/routes/ProcessInstanceList.tsx | 82 ++++++++++++------- .../src/routes/ProcessInstanceLogList.tsx | 2 +- 4 files changed, 76 insertions(+), 52 deletions(-) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/acceptance_test_fixtures.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/acceptance_test_fixtures.py index 144c5ef2..c6c1b578 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/acceptance_test_fixtures.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/acceptance_test_fixtures.py @@ -13,8 +13,8 @@ from spiffworkflow_backend.models.process_instance import ProcessInstanceStatus def load_acceptance_test_fixtures() -> list[ProcessInstanceModel]: """Load_fixtures.""" current_app.logger.debug("load_acceptance_test_fixtures() start") - test_process_group_id = "acceptance-tests-group-one" - test_process_model_id = "acceptance-tests-model-1" + test_process_group_id = "" + test_process_model_id = "acceptance-tests-group-one/acceptance-tests-model-1" user = BaseTest.find_or_create_user() statuses = ProcessInstanceStatus.list() current_time = round(time.time()) diff --git a/spiffworkflow-frontend/cypress/e2e/process_instances.cy.js b/spiffworkflow-frontend/cypress/e2e/process_instances.cy.js index 60ec98fa..d25350bc 100644 --- a/spiffworkflow-frontend/cypress/e2e/process_instances.cy.js +++ b/spiffworkflow-frontend/cypress/e2e/process_instances.cy.js @@ -3,10 +3,10 @@ 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 Range').click(); + cy.contains('Start date from').click(); cy.get('#date-picker-end-from').clear().type(format(fromDate, DATE_FORMAT)); - cy.contains('Start Range').click(); - cy.contains('Filter').click(); + cy.contains('End date from').click(); + cy.getBySel('filter-button').click(); }; const updateDmnText = (oldText, newText, elementId = 'wonderful_process') => { @@ -165,25 +165,27 @@ describe('process-instances', () => { cy.basicPaginationTest(); }); - it('can filter', () => { + it.only('can filter', () => { cy.getBySel('process-instance-list-link').click(); cy.assertAtLeastOneItemInPaginatedResults(); - PROCESS_STATUSES.forEach((processStatus) => { - if (!['all', 'waiting'].includes(processStatus)) { - cy.get('[name=process-status-selection]').click(); - cy.get('[name=process-status-selection]').type(processStatus); - cy.get(`[aria-label=${processStatus}]`).click(); - cy.contains('Process Status').click(); - cy.contains('Filter').click(); - cy.assertAtLeastOneItemInPaginatedResults(); - cy.getBySel(`process-instance-status-${processStatus}`).contains( - processStatus - ); - // there should really only be one, but in CI there are sometimes more - cy.get('button[aria-label=Remove]:first').click(); - } - }); + // PROCESS_STATUSES.forEach((processStatus) => { + // if (!['all', 'waiting'].includes(processStatus)) { + // cy.get('#process-instance-status-select').click(); + // cy.get('#process-instance-status-select') + // .contains(processStatus) + // .click(); + // // close the dropdown again + // cy.get('#process-instance-status-select').click(); + // cy.getBySel('filter-button').click(); + // cy.assertAtLeastOneItemInPaginatedResults(); + // cy.getBySel(`process-instance-status-${processStatus}`).contains( + // 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(); + // } + // }); const date = new Date(); date.setHours(date.getHours() - 1); diff --git a/spiffworkflow-frontend/src/routes/ProcessInstanceList.tsx b/spiffworkflow-frontend/src/routes/ProcessInstanceList.tsx index 32b58ac3..ad77f002 100644 --- a/spiffworkflow-frontend/src/routes/ProcessInstanceList.tsx +++ b/spiffworkflow-frontend/src/routes/ProcessInstanceList.tsx @@ -17,11 +17,12 @@ import { Grid, Column, MultiSelect, - // TableHeader, - // TableHead, - // TableRow, - // TableBody, - // TableCell, + TableHeader, + TableHead, + TableRow, + TableBody, + TableCell, + Row, // @ts-ignore } from '@carbon/react'; import { PROCESS_STATUSES, DATE_FORMAT, DATE_FORMAT_CARBON } from '../config'; @@ -113,6 +114,7 @@ export default function ProcessInstanceList() { searchParamValue as any ); functionToCall(dateString); + setShowFilterOptions(true); } }); @@ -125,6 +127,7 @@ export default function ProcessInstanceList() { if (functionToCall !== null) { functionToCall(searchParams.get(paramName) || ''); } + setShowFilterOptions(true); } } ); @@ -162,6 +165,7 @@ export default function ProcessInstanceList() { getProcessInstances(); } + // populate process model selection HttpService.makeCallToBackend({ path: `/process-models?per_page=1000`, successCallback: processResultForProcessModels, @@ -298,6 +302,7 @@ export default function ProcessInstanceList() { return ( Clear - @@ -392,12 +401,13 @@ export default function ProcessInstanceList() { return headerLabels[header] ?? header; }; const headers = (reportMetadata as any).columns.map((column: any) => { - return {getHeaderLabel((column as any).Header)}; + // return {getHeaderLabel((column as any).Header)}; + return getHeaderLabel((column as any).Header); }); const formatProcessInstanceId = (row: any, id: any) => { const modifiedProcessModelId: String = modifyProcessModelPath( - (row as any).process_model_identifier + row.process_model_identifier ); return ( ); }; - const formatProcessModelIdentifier = (row: any, identifier: any) => { + const formatProcessModelIdentifier = (_row: any, identifier: any) => { return ( ); }; - const formatSecondsForDisplay = (row: any, seconds: any) => { + const formatSecondsForDisplay = (_row: any, seconds: any) => { return convertSecondsToFormattedDate(seconds) || '-'; }; - const defaultFormatter = (row: any, value: any) => { + const defaultFormatter = (_row: any, value: any) => { return value; }; @@ -433,20 +443,32 @@ export default function ProcessInstanceList() { const formattedColumn = (row: any, column: any) => { const formatter = columnFormatters[column.accessor] ?? defaultFormatter; const value = row[column.accessor]; + if (column.accessor === 'status') { + return ( + + {formatter(row, value)} + + ); + } return {formatter(row, value)}; }; - const rows = processInstances.map((row) => { + const rows = processInstances.map((row: any) => { const currentRow = (reportMetadata as any).columns.map((column: any) => { return formattedColumn(row, column); }); - return {currentRow}; + return {currentRow}; }); + return ( - - {headers} - + + + {headers.map((header: any) => ( + {header} + ))} + + {rows}
); @@ -482,9 +504,13 @@ export default function ProcessInstanceList() { <> {processInstanceTitleElement()} - - +