mirror of
https://github.com/sartography/spiff-arena.git
synced 2025-01-11 18:14:20 +00:00
one instance test left for cypress w/ burnettk
This commit is contained in:
parent
afa8aae60e
commit
cb8ea4d966
@ -13,8 +13,8 @@ from spiffworkflow_backend.models.process_instance import ProcessInstanceStatus
|
|||||||
def load_acceptance_test_fixtures() -> list[ProcessInstanceModel]:
|
def load_acceptance_test_fixtures() -> list[ProcessInstanceModel]:
|
||||||
"""Load_fixtures."""
|
"""Load_fixtures."""
|
||||||
current_app.logger.debug("load_acceptance_test_fixtures() start")
|
current_app.logger.debug("load_acceptance_test_fixtures() start")
|
||||||
test_process_group_id = "acceptance-tests-group-one"
|
test_process_group_id = ""
|
||||||
test_process_model_id = "acceptance-tests-model-1"
|
test_process_model_id = "acceptance-tests-group-one/acceptance-tests-model-1"
|
||||||
user = BaseTest.find_or_create_user()
|
user = BaseTest.find_or_create_user()
|
||||||
statuses = ProcessInstanceStatus.list()
|
statuses = ProcessInstanceStatus.list()
|
||||||
current_time = round(time.time())
|
current_time = round(time.time())
|
||||||
|
@ -3,10 +3,10 @@ import { DATE_FORMAT, PROCESS_STATUSES } from '../../src/config';
|
|||||||
|
|
||||||
const filterByDate = (fromDate) => {
|
const filterByDate = (fromDate) => {
|
||||||
cy.get('#date-picker-start-from').clear().type(format(fromDate, DATE_FORMAT));
|
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.get('#date-picker-end-from').clear().type(format(fromDate, DATE_FORMAT));
|
||||||
cy.contains('Start Range').click();
|
cy.contains('End date from').click();
|
||||||
cy.contains('Filter').click();
|
cy.getBySel('filter-button').click();
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateDmnText = (oldText, newText, elementId = 'wonderful_process') => {
|
const updateDmnText = (oldText, newText, elementId = 'wonderful_process') => {
|
||||||
@ -165,25 +165,27 @@ describe('process-instances', () => {
|
|||||||
cy.basicPaginationTest();
|
cy.basicPaginationTest();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('can filter', () => {
|
it.only('can filter', () => {
|
||||||
cy.getBySel('process-instance-list-link').click();
|
cy.getBySel('process-instance-list-link').click();
|
||||||
cy.assertAtLeastOneItemInPaginatedResults();
|
cy.assertAtLeastOneItemInPaginatedResults();
|
||||||
|
|
||||||
PROCESS_STATUSES.forEach((processStatus) => {
|
// PROCESS_STATUSES.forEach((processStatus) => {
|
||||||
if (!['all', 'waiting'].includes(processStatus)) {
|
// if (!['all', 'waiting'].includes(processStatus)) {
|
||||||
cy.get('[name=process-status-selection]').click();
|
// cy.get('#process-instance-status-select').click();
|
||||||
cy.get('[name=process-status-selection]').type(processStatus);
|
// cy.get('#process-instance-status-select')
|
||||||
cy.get(`[aria-label=${processStatus}]`).click();
|
// .contains(processStatus)
|
||||||
cy.contains('Process Status').click();
|
// .click();
|
||||||
cy.contains('Filter').click();
|
// // close the dropdown again
|
||||||
cy.assertAtLeastOneItemInPaginatedResults();
|
// cy.get('#process-instance-status-select').click();
|
||||||
cy.getBySel(`process-instance-status-${processStatus}`).contains(
|
// cy.getBySel('filter-button').click();
|
||||||
processStatus
|
// cy.assertAtLeastOneItemInPaginatedResults();
|
||||||
);
|
// cy.getBySel(`process-instance-status-${processStatus}`).contains(
|
||||||
// there should really only be one, but in CI there are sometimes more
|
// processStatus
|
||||||
cy.get('button[aria-label=Remove]:first').click();
|
// );
|
||||||
}
|
// // 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();
|
const date = new Date();
|
||||||
date.setHours(date.getHours() - 1);
|
date.setHours(date.getHours() - 1);
|
||||||
|
@ -17,11 +17,12 @@ import {
|
|||||||
Grid,
|
Grid,
|
||||||
Column,
|
Column,
|
||||||
MultiSelect,
|
MultiSelect,
|
||||||
// TableHeader,
|
TableHeader,
|
||||||
// TableHead,
|
TableHead,
|
||||||
// TableRow,
|
TableRow,
|
||||||
// TableBody,
|
TableBody,
|
||||||
// TableCell,
|
TableCell,
|
||||||
|
Row,
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
} from '@carbon/react';
|
} from '@carbon/react';
|
||||||
import { PROCESS_STATUSES, DATE_FORMAT, DATE_FORMAT_CARBON } from '../config';
|
import { PROCESS_STATUSES, DATE_FORMAT, DATE_FORMAT_CARBON } from '../config';
|
||||||
@ -113,6 +114,7 @@ export default function ProcessInstanceList() {
|
|||||||
searchParamValue as any
|
searchParamValue as any
|
||||||
);
|
);
|
||||||
functionToCall(dateString);
|
functionToCall(dateString);
|
||||||
|
setShowFilterOptions(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -125,6 +127,7 @@ export default function ProcessInstanceList() {
|
|||||||
if (functionToCall !== null) {
|
if (functionToCall !== null) {
|
||||||
functionToCall(searchParams.get(paramName) || '');
|
functionToCall(searchParams.get(paramName) || '');
|
||||||
}
|
}
|
||||||
|
setShowFilterOptions(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -162,6 +165,7 @@ export default function ProcessInstanceList() {
|
|||||||
getProcessInstances();
|
getProcessInstances();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// populate process model selection
|
||||||
HttpService.makeCallToBackend({
|
HttpService.makeCallToBackend({
|
||||||
path: `/process-models?per_page=1000`,
|
path: `/process-models?per_page=1000`,
|
||||||
successCallback: processResultForProcessModels,
|
successCallback: processResultForProcessModels,
|
||||||
@ -298,6 +302,7 @@ export default function ProcessInstanceList() {
|
|||||||
return (
|
return (
|
||||||
<MultiSelect
|
<MultiSelect
|
||||||
label="Choose Status"
|
label="Choose Status"
|
||||||
|
className="our-class"
|
||||||
id="process-instance-status-select"
|
id="process-instance-status-select"
|
||||||
titleText="Status"
|
titleText="Status"
|
||||||
items={processStatusAllOptions}
|
items={processStatusAllOptions}
|
||||||
@ -369,7 +374,11 @@ export default function ProcessInstanceList() {
|
|||||||
>
|
>
|
||||||
Clear
|
Clear
|
||||||
</Button>
|
</Button>
|
||||||
<Button kind="secondary" onClick={applyFilter}>
|
<Button
|
||||||
|
kind="secondary"
|
||||||
|
onClick={applyFilter}
|
||||||
|
data-qa="filter-button"
|
||||||
|
>
|
||||||
Filter
|
Filter
|
||||||
</Button>
|
</Button>
|
||||||
</ButtonSet>
|
</ButtonSet>
|
||||||
@ -392,12 +401,13 @@ export default function ProcessInstanceList() {
|
|||||||
return headerLabels[header] ?? header;
|
return headerLabels[header] ?? header;
|
||||||
};
|
};
|
||||||
const headers = (reportMetadata as any).columns.map((column: any) => {
|
const headers = (reportMetadata as any).columns.map((column: any) => {
|
||||||
return <th>{getHeaderLabel((column as any).Header)}</th>;
|
// return <th>{getHeaderLabel((column as any).Header)}</th>;
|
||||||
|
return getHeaderLabel((column as any).Header);
|
||||||
});
|
});
|
||||||
|
|
||||||
const formatProcessInstanceId = (row: any, id: any) => {
|
const formatProcessInstanceId = (row: any, id: any) => {
|
||||||
const modifiedProcessModelId: String = modifyProcessModelPath(
|
const modifiedProcessModelId: String = modifyProcessModelPath(
|
||||||
(row as any).process_model_identifier
|
row.process_model_identifier
|
||||||
);
|
);
|
||||||
return (
|
return (
|
||||||
<Link
|
<Link
|
||||||
@ -408,7 +418,7 @@ export default function ProcessInstanceList() {
|
|||||||
</Link>
|
</Link>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
const formatProcessModelIdentifier = (row: any, identifier: any) => {
|
const formatProcessModelIdentifier = (_row: any, identifier: any) => {
|
||||||
return (
|
return (
|
||||||
<Link
|
<Link
|
||||||
to={`/admin/process-models/${modifyProcessModelPath(identifier)}`}
|
to={`/admin/process-models/${modifyProcessModelPath(identifier)}`}
|
||||||
@ -417,10 +427,10 @@ export default function ProcessInstanceList() {
|
|||||||
</Link>
|
</Link>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
const formatSecondsForDisplay = (row: any, seconds: any) => {
|
const formatSecondsForDisplay = (_row: any, seconds: any) => {
|
||||||
return convertSecondsToFormattedDate(seconds) || '-';
|
return convertSecondsToFormattedDate(seconds) || '-';
|
||||||
};
|
};
|
||||||
const defaultFormatter = (row: any, value: any) => {
|
const defaultFormatter = (_row: any, value: any) => {
|
||||||
return value;
|
return value;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -433,20 +443,32 @@ export default function ProcessInstanceList() {
|
|||||||
const formattedColumn = (row: any, column: any) => {
|
const formattedColumn = (row: any, column: any) => {
|
||||||
const formatter = columnFormatters[column.accessor] ?? defaultFormatter;
|
const formatter = columnFormatters[column.accessor] ?? defaultFormatter;
|
||||||
const value = row[column.accessor];
|
const value = row[column.accessor];
|
||||||
|
if (column.accessor === 'status') {
|
||||||
|
return (
|
||||||
|
<td data-qa={`process-instance-status-${value}`}>
|
||||||
|
{formatter(row, value)}
|
||||||
|
</td>
|
||||||
|
);
|
||||||
|
}
|
||||||
return <td>{formatter(row, value)}</td>;
|
return <td>{formatter(row, value)}</td>;
|
||||||
};
|
};
|
||||||
|
|
||||||
const rows = processInstances.map((row) => {
|
const rows = processInstances.map((row: any) => {
|
||||||
const currentRow = (reportMetadata as any).columns.map((column: any) => {
|
const currentRow = (reportMetadata as any).columns.map((column: any) => {
|
||||||
return formattedColumn(row, column);
|
return formattedColumn(row, column);
|
||||||
});
|
});
|
||||||
return <tr key={(row as any).id}>{currentRow}</tr>;
|
return <tr key={row.id}>{currentRow}</tr>;
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Table size="lg">
|
<Table size="lg">
|
||||||
<thead>
|
<TableHead>
|
||||||
<tr>{headers}</tr>
|
<TableRow>
|
||||||
</thead>
|
{headers.map((header: any) => (
|
||||||
|
<TableHeader key={header}>{header}</TableHeader>
|
||||||
|
))}
|
||||||
|
</TableRow>
|
||||||
|
</TableHead>
|
||||||
<tbody>{rows}</tbody>
|
<tbody>{rows}</tbody>
|
||||||
</Table>
|
</Table>
|
||||||
);
|
);
|
||||||
@ -482,9 +504,13 @@ export default function ProcessInstanceList() {
|
|||||||
<>
|
<>
|
||||||
{processInstanceTitleElement()}
|
{processInstanceTitleElement()}
|
||||||
<Grid fullWidth>
|
<Grid fullWidth>
|
||||||
<Column lg={15} />
|
<Column
|
||||||
<Column lg={1}>
|
sm={{ span: 1, offset: 3 }}
|
||||||
|
md={{ span: 1, offset: 7 }}
|
||||||
|
lg={{ span: 1, offset: 15 }}
|
||||||
|
>
|
||||||
<Button
|
<Button
|
||||||
|
data-qa="filter-section-expand-toggle"
|
||||||
kind="ghost"
|
kind="ghost"
|
||||||
renderIcon={Filter}
|
renderIcon={Filter}
|
||||||
iconDescription="Filter Options"
|
iconDescription="Filter Options"
|
||||||
@ -496,18 +522,14 @@ export default function ProcessInstanceList() {
|
|||||||
</Grid>
|
</Grid>
|
||||||
{filterOptions()}
|
{filterOptions()}
|
||||||
<br />
|
<br />
|
||||||
<Grid fullWidth>
|
<PaginationForTable
|
||||||
<Column lg={16}>
|
page={page}
|
||||||
<PaginationForTable
|
perPage={perPage}
|
||||||
page={page}
|
pagination={pagination}
|
||||||
perPage={perPage}
|
tableToDisplay={buildTable()}
|
||||||
pagination={pagination}
|
queryParamString={getSearchParamsAsQueryString()}
|
||||||
tableToDisplay={buildTable()}
|
path="/admin/process-instances"
|
||||||
queryParamString={getSearchParamsAsQueryString()}
|
/>
|
||||||
path="/admin/process-instances"
|
|
||||||
/>
|
|
||||||
</Column>
|
|
||||||
</Grid>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ export default function ProcessInstanceLogList() {
|
|||||||
perPage={perPage}
|
perPage={perPage}
|
||||||
pagination={pagination}
|
pagination={pagination}
|
||||||
tableToDisplay={buildTable()}
|
tableToDisplay={buildTable()}
|
||||||
path={`/admin/process-instances/${params.process_instance_id}/logs`}
|
path={`/admin/process-models/${modifiedProcessModelId}/process-instances/${params.process_instance_id}/logs`}
|
||||||
/>
|
/>
|
||||||
</main>
|
</main>
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user