Squashed 'spiffworkflow-frontend/' changes from 2149f03f5..45854fa9a

45854fa9a merged in and recsovled conflicts of frontend tree w/ burnettk
baa5f37ae Merge branch 'main' of github.com:sartography/spiff-arena
3cb6a9c77 process instance cypress tests pass now w/ burnettk

git-subtree-dir: spiffworkflow-frontend
git-subtree-split: 45854fa9aea1cc8b48b39afd5680e525a745188d
This commit is contained in:
Jon Herron 2022-11-09 15:44:11 -05:00
parent 0a0bb2281a
commit 18371cb2f5
4 changed files with 33 additions and 21 deletions

View File

@ -169,30 +169,30 @@ describe('process-instances', () => {
cy.getBySel('process-instance-list-link').click();
cy.assertAtLeastOneItemInPaginatedResults();
// 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();
// }
// });
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);
filterByDate(date);
cy.assertAtLeastOneItemInPaginatedResults();
date.setHours(date.getHours() + 2);
date.setHours(date.getHours() + 26);
filterByDate(date);
cy.assertNoItemInPaginatedResults();
});

View File

@ -118,7 +118,12 @@ Cypress.Commands.add('assertAtLeastOneItemInPaginatedResults', () => {
});
Cypress.Commands.add('assertNoItemInPaginatedResults', () => {
cy.getBySel('total-paginated-items').contains('0');
cy.contains(/\b00 of 0 items/);
});
Cypress.Commands.add('modifyProcessModelPath', (path) => {
path.replace('/', ':');
return path;
});
Cypress.Commands.add('modifyProcessModelPath', (path) => {

View File

@ -1,7 +1,12 @@
import { slugifyString } from './helpers';
import { convertSecondsToFormattedDate, slugifyString } from './helpers';
test('it can slugify a string', () => {
expect(slugifyString('hello---world_ and then Some such-')).toEqual(
'hello-world-and-then-some-such'
);
});
test('it can keep the correct date when converting seconds to date', () => {
const dateString = convertSecondsToFormattedDate(1666325400);
expect(dateString).toEqual('2022-10-21');
});

View File

@ -44,7 +44,9 @@ export const convertDateToSeconds = (
export const convertStringToDate = (dateString: string) => {
if (dateString) {
return new Date(dateString);
// add midnight time to the date so it c uses the correct date
// after converting to timezone
return new Date(`${dateString}T00:10:00`);
}
return null;
};