fix tests and start looking at showing recent process models

This commit is contained in:
burnettk 2022-09-29 17:20:49 -04:00
parent 2e39142d43
commit 6a86308c11
7 changed files with 47 additions and 8 deletions

View File

@ -85,8 +85,8 @@ describe('tasks', () => {
checkTaskHasClass('form4', activeTaskClassName);
cy.get('.modal .btn-close').click();
cy.navigateToTasks();
cy.url().should('include', '/tasks');
cy.navigateToHome();
cy.contains('Tasks').should('exist');
// FIXME: this will probably need a better way to link to the proper form that we want
cy.contains('Complete Task').click();
@ -121,7 +121,7 @@ describe('tasks', () => {
cy.runPrimaryBpmnFile();
cy.runPrimaryBpmnFile();
cy.navigateToTasks();
cy.navigateToHome();
cy.basicPaginationTest();
});
});

View File

@ -30,12 +30,12 @@ Cypress.Commands.add('getBySel', (selector, ...args) => {
return cy.get(`[data-qa=${selector}]`, ...args);
});
Cypress.Commands.add('navigateToTasks', () => {
cy.getBySel('nav-item-tasks').click();
Cypress.Commands.add('navigateToHome', () => {
cy.getBySel('nav-home').click();
});
Cypress.Commands.add('navigateToAdmin', () => {
cy.getBySel('nav-item-admin').click();
cy.getBySel('spiffworkflow-logo').click();
});
Cypress.Commands.add('login', (selector, ...args) => {

View File

@ -39,6 +39,7 @@ export default function App() {
<main style={{ padding: '1rem 0' }}>
<Routes>
<Route path="/" element={<HomePage />} />
<Route path="/tasks" element={<HomePage />} />
<Route path="/admin/*" element={<AdminRoutes />} />
<Route
path="/tasks/:process_instance_id/:task_id"

View File

@ -79,7 +79,7 @@ export default function NavigationBar() {
return (
<Navbar bg="dark" expand="lg" variant="dark">
<Container>
<Navbar.Brand href="/admin">
<Navbar.Brand data-qa="spiffworkflow-logo" href="/admin">
<img src={logo} className="app-logo" alt="logo" />
</Navbar.Brand>
<Navbar.Toggle aria-controls="basic-navbar-nav" />

View File

@ -25,7 +25,7 @@ export default function SubNavigation() {
if (activeKey) {
return (
<Nav variant="tabs" activeKey={activeKey}>
<Nav.Item>
<Nav.Item data-qa="nav-home">
<Nav.Link href="/">Home</Nav.Link>
</Nav.Item>
<Nav.Item>

View File

@ -74,6 +74,8 @@ export default function HomePage() {
);
};
const relevantProcessModelSection = null;
if (pagination) {
const { page, perPage } = getPageInfoFromSearchParams(searchParams);
return (
@ -86,6 +88,7 @@ export default function HomePage() {
tableToDisplay={buildTable()}
path="/tasks"
/>
{relevantProcessModelSection}
</>
);
}

View File

@ -14,6 +14,41 @@ export default function ProcessModelShow() {
const [processInstanceResult, setProcessInstanceResult] = useState(null);
const [reloadModel, setReloadModel] = useState(false);
// useEffect(() => {
// // All values stored in localStorage are strings.
// // Grab our recentProcessModels string from localStorage.
// const stringFromLocalStorage = window.localStorage.getItem(
// 'recentProcessModels'
// );
//
// // Then parse that string into an actual value.
// const parsedValueFromString = JSON.parse(stringFromLocalStorage);
//
// // If that value is null (meaning that we've never saved anything to that spot in localStorage before), use an empty array as our array. Otherwise, just stick with the value we've just parsed out.
// const array = parsedValueFromString || [];
//
// // Here's the value we want to add
// const value = {
// processGroupIdentifier: params.process_group_id,
// processModelIdentifier: params.process_model_id,
// };
//
// // If our parsed/empty array doesn't already have this value in it...
// if (array.indexOf(value) == -1) {
// // add the value to the array
// array.push(value);
//
// // turn the array WITH THE NEW VALUE IN IT into a string to prepare it to be stored in localStorage
// const stringRepresentingArray = JSON.stringify(array);
//
// // and store it in localStorage as "recentProcessModels"
// window.localStorage.setItem(
// 'recentProcessModels',
// stringRepresentingArray
// );
// }
// }, []);
useEffect(() => {
const processResult = (result: object) => {
setProcessModel(result);