fix a couple tests

This commit is contained in:
burnettk 2022-11-11 22:12:35 -05:00
parent 4cbdc5f8d9
commit f89b8bdda2
4 changed files with 31 additions and 19 deletions

View File

@ -144,10 +144,11 @@ describe('process-models', () => {
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-show-link').click();
cy.contains('Delete').click(); cy.getBySel('process-instance-delete').click();
cy.contains('Are you sure'); cy.contains('Are you sure');
cy.getBySel('modal-confirmation-dialog').find('.cds--btn--danger').click(); cy.getBySel('modal-confirmation-dialog').find('.cds--btn--danger').click();
cy.contains(`Process Instances for: ${groupId}/${modelId}`);
// in breadcrumb
cy.contains(modelId).click(); cy.contains(modelId).click();
cy.contains('Edit process model').click(); cy.contains('Edit process model').click();

View File

@ -3,6 +3,7 @@ import { useState } from 'react';
import { Button, Modal } from '@carbon/react'; import { Button, Modal } from '@carbon/react';
type OwnProps = { type OwnProps = {
'data-qa'?: string;
description?: string; description?: string;
buttonLabel?: string; buttonLabel?: string;
onConfirmation: (..._args: any[]) => any; onConfirmation: (..._args: any[]) => any;
@ -18,6 +19,7 @@ export default function ButtonWithConfirmation({
description, description,
buttonLabel, buttonLabel,
onConfirmation, onConfirmation,
'data-qa': dataQa,
title = 'Are you sure?', title = 'Are you sure?',
confirmButtonLabel = 'OK', confirmButtonLabel = 'OK',
kind = 'danger', kind = 'danger',
@ -58,6 +60,7 @@ export default function ButtonWithConfirmation({
return ( return (
<> <>
<Button <Button
data-qa={dataQa}
onClick={handleShowConfirmationPrompt} onClick={handleShowConfirmationPrompt}
kind={kind} kind={kind}
renderIcon={renderIcon} renderIcon={renderIcon}

View File

@ -10,7 +10,7 @@ import {
modifyProcessModelPath, modifyProcessModelPath,
unModifyProcessModelPath, unModifyProcessModelPath,
} from '../helpers'; } from '../helpers';
import { ProcessGroup, ProcessModel } from '../interfaces'; import { PaginationObject, ProcessGroup, ProcessModel } from '../interfaces';
export default function ProcessGroupShow() { export default function ProcessGroupShow() {
const params = useParams(); const params = useParams();
@ -19,8 +19,10 @@ export default function ProcessGroupShow() {
const [processGroup, setProcessGroup] = useState<ProcessGroup | null>(null); const [processGroup, setProcessGroup] = useState<ProcessGroup | null>(null);
const [processModels, setProcessModels] = useState([]); const [processModels, setProcessModels] = useState([]);
const [processGroups, setProcessGroups] = useState([]); const [processGroups, setProcessGroups] = useState([]);
const [modelPagination, setModelPagination] = useState(null); const [modelPagination, setModelPagination] =
const [groupPagination, setGroupPagination] = useState(null); useState<PaginationObject | null>(null);
const [groupPagination, setGroupPagination] =
useState<PaginationObject | null>(null);
useEffect(() => { useEffect(() => {
const { page, perPage } = getPageInfoFromSearchParams(searchParams); const { page, perPage } = getPageInfoFromSearchParams(searchParams);
@ -138,6 +140,7 @@ export default function ProcessGroupShow() {
['', `process_group:${processGroup.id}`], ['', `process_group:${processGroup.id}`],
]} ]}
/> />
<h1>Process Group: {processGroup.display_name}</h1>
<ul> <ul>
<Stack orientation="horizontal" gap={3}> <Stack orientation="horizontal" gap={3}>
<Button <Button
@ -160,22 +163,26 @@ export default function ProcessGroupShow() {
</Stack> </Stack>
<br /> <br />
<br /> <br />
<PaginationForTable {modelPagination && modelPagination.total > 0 && (
page={page} <PaginationForTable
perPage={perPage} page={page}
pagination={modelPagination} perPage={perPage}
tableToDisplay={buildModelTable()} pagination={modelPagination}
path={`/admin/process-groups/${processGroup.id}`} tableToDisplay={buildModelTable()}
/> path={`/admin/process-groups/${processGroup.id}`}
/>
)}
<br /> <br />
<br /> <br />
<PaginationForTable {groupPagination && groupPagination.total > 0 && (
page={page} <PaginationForTable
perPage={perPage} page={page}
pagination={groupPagination} perPage={perPage}
tableToDisplay={buildGroupTable()} pagination={groupPagination}
path={`/admin/process-groups/${processGroup.id}`} tableToDisplay={buildGroupTable()}
/> path={`/admin/process-groups/${processGroup.id}`}
/>
)}
</ul> </ul>
</> </>
); );

View File

@ -521,6 +521,7 @@ export default function ProcessInstanceShow() {
elements.push(resumeButton(processInstanceToUse)); elements.push(resumeButton(processInstanceToUse));
elements.push( elements.push(
<ButtonWithConfirmation <ButtonWithConfirmation
data-qa="process-instance-delete"
kind="ghost" kind="ghost"
renderIcon={TrashCan} renderIcon={TrashCan}
iconDescription="Delete" iconDescription="Delete"