process model cypress tests are passing
This commit is contained in:
parent
34ec5b894a
commit
afa8aae60e
|
@ -16,20 +16,14 @@ describe('process-models', () => {
|
||||||
const modelId = `test-model-2-${id}`;
|
const modelId = `test-model-2-${id}`;
|
||||||
cy.contains(groupDisplayName).click();
|
cy.contains(groupDisplayName).click();
|
||||||
cy.createModel(groupId, modelId, modelDisplayName);
|
cy.createModel(groupId, modelId, modelDisplayName);
|
||||||
cy.contains(`Process Group: ${groupId}`).click();
|
cy.url().should('include', `process-models/${groupId}:${modelId}`);
|
||||||
cy.contains(modelId);
|
cy.contains(`Process Model: ${modelDisplayName}`);
|
||||||
|
|
||||||
cy.contains(modelId).click();
|
|
||||||
cy.url().should('include', `process-models/${groupId}/${modelId}`);
|
|
||||||
cy.contains(`Process Model: ${modelId}`);
|
|
||||||
|
|
||||||
cy.contains('Edit process model').click();
|
cy.contains('Edit process model').click();
|
||||||
cy.get('input[name=display_name]').clear().type(newModelDisplayName);
|
cy.get('input[name=display_name]').clear().type(newModelDisplayName);
|
||||||
cy.contains('Submit').click();
|
cy.contains('Submit').click();
|
||||||
const modifiedModelId = cy.modifyProcessModelPath(modelId);
|
cy.contains(`Process Model: ${groupId}/${modelId}`);
|
||||||
cy.contains(`Process Model: ${modifiedModelId}`);
|
cy.contains('Submit').click();
|
||||||
|
|
||||||
cy.contains('Edit process model').click();
|
|
||||||
cy.get('input[name=display_name]').should(
|
cy.get('input[name=display_name]').should(
|
||||||
'have.value',
|
'have.value',
|
||||||
newModelDisplayName
|
newModelDisplayName
|
||||||
|
@ -37,7 +31,7 @@ describe('process-models', () => {
|
||||||
|
|
||||||
cy.contains('Delete').click();
|
cy.contains('Delete').click();
|
||||||
cy.contains('Are you sure');
|
cy.contains('Are you sure');
|
||||||
cy.contains('OK').click();
|
cy.getBySel('modal-confirmation-dialog').find('.cds--btn--danger').click();
|
||||||
cy.url().should('include', `process-groups/${groupId}`);
|
cy.url().should('include', `process-groups/${groupId}`);
|
||||||
cy.contains(modelId).should('not.exist');
|
cy.contains(modelId).should('not.exist');
|
||||||
});
|
});
|
||||||
|
@ -57,8 +51,6 @@ describe('process-models', () => {
|
||||||
cy.contains(groupDisplayName).click();
|
cy.contains(groupDisplayName).click();
|
||||||
cy.createModel(groupId, modelId, modelDisplayName);
|
cy.createModel(groupId, modelId, modelDisplayName);
|
||||||
cy.contains(groupId).click();
|
cy.contains(groupId).click();
|
||||||
cy.contains(modelId);
|
|
||||||
|
|
||||||
cy.contains(modelId).click();
|
cy.contains(modelId).click();
|
||||||
cy.url().should('include', `process-models/${groupId}:${modelId}`);
|
cy.url().should('include', `process-models/${groupId}:${modelId}`);
|
||||||
cy.contains(`Process Model: ${modelDisplayName}`);
|
cy.contains(`Process Model: ${modelDisplayName}`);
|
||||||
|
@ -117,7 +109,7 @@ describe('process-models', () => {
|
||||||
cy.contains('Edit process model').click();
|
cy.contains('Edit process model').click();
|
||||||
cy.contains('Delete').click();
|
cy.contains('Delete').click();
|
||||||
cy.contains('Are you sure');
|
cy.contains('Are you sure');
|
||||||
cy.contains('OK').click();
|
cy.getBySel('modal-confirmation-dialog').find('.cds--btn--danger').click();
|
||||||
cy.url().should('include', `process-groups/${groupId}`);
|
cy.url().should('include', `process-groups/${groupId}`);
|
||||||
cy.contains(modelId).should('not.exist');
|
cy.contains(modelId).should('not.exist');
|
||||||
});
|
});
|
||||||
|
@ -133,36 +125,35 @@ describe('process-models', () => {
|
||||||
cy.contains(groupDisplayName).click();
|
cy.contains(groupDisplayName).click();
|
||||||
cy.createModel(groupId, modelId, modelDisplayName);
|
cy.createModel(groupId, modelId, modelDisplayName);
|
||||||
|
|
||||||
// seeing if getBySel works better, because we are seeing tests fail in CI
|
cy.contains(`${groupId}`).click();
|
||||||
// when looking for the "Add a process model" link, so it seems like the
|
|
||||||
// click on the breadcrumb element must have failed.
|
|
||||||
cy.getBySel('process-group-breadcrumb-link').click();
|
|
||||||
// cy.contains(`Process Group: ${groupId}`).click();
|
|
||||||
|
|
||||||
cy.contains('Add a process model');
|
cy.contains('Add a process model');
|
||||||
|
|
||||||
cy.contains(modelId).click();
|
cy.contains(modelId).click();
|
||||||
cy.url().should('include', `process-models/${groupId}/${modelId}`);
|
cy.url().should('include', `process-models/${groupId}:${modelId}`);
|
||||||
cy.contains(`Process Model: ${modelId}`);
|
cy.contains(`Process Model: ${modelDisplayName}`);
|
||||||
|
|
||||||
cy.get('input[type=file]').selectFile(
|
cy.getBySel('files-accordion').click();
|
||||||
|
cy.getBySel('upload-file-button').click();
|
||||||
|
cy.contains('Add file').selectFile(
|
||||||
'cypress/fixtures/test_bpmn_file_upload.bpmn'
|
'cypress/fixtures/test_bpmn_file_upload.bpmn'
|
||||||
);
|
);
|
||||||
cy.contains('Submit').click();
|
cy.getBySel('modal-upload-file-dialog')
|
||||||
|
.find('.cds--btn--primary')
|
||||||
|
.contains('Upload')
|
||||||
|
.click();
|
||||||
cy.runPrimaryBpmnFile();
|
cy.runPrimaryBpmnFile();
|
||||||
|
|
||||||
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.contains('Delete').click();
|
||||||
cy.contains('Are you sure');
|
cy.contains('Are you sure');
|
||||||
cy.contains('OK').click();
|
cy.getBySel('modal-confirmation-dialog').find('.cds--btn--danger').click();
|
||||||
cy.contains(`Process Instances for: ${groupId}/${modelId}`);
|
cy.contains(`Process Instances for: ${groupId}/${modelId}`);
|
||||||
cy.contains(modelId).click();
|
cy.contains(modelId).click();
|
||||||
|
|
||||||
cy.contains('Edit process model').click();
|
cy.contains('Edit process model').click();
|
||||||
cy.contains('Delete').click();
|
cy.contains('Delete').click();
|
||||||
cy.contains('Are you sure');
|
cy.contains('Are you sure');
|
||||||
cy.contains('OK').click();
|
cy.getBySel('modal-confirmation-dialog').find('.cds--btn--danger').click();
|
||||||
cy.url().should('include', `process-groups/${groupId}`);
|
cy.url().should('include', `process-groups/${groupId}`);
|
||||||
cy.contains(modelId).should('not.exist');
|
cy.contains(modelId).should('not.exist');
|
||||||
});
|
});
|
||||||
|
|
|
@ -122,5 +122,6 @@ Cypress.Commands.add('assertNoItemInPaginatedResults', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
Cypress.Commands.add('modifyProcessModelPath', (path) => {
|
Cypress.Commands.add('modifyProcessModelPath', (path) => {
|
||||||
return path.replace('/', ':') || '';
|
path.replace('/', ':');
|
||||||
|
return path;
|
||||||
});
|
});
|
||||||
|
|
|
@ -95,13 +95,10 @@ export const getProcessModelFullIdentifierFromSearchParams = (
|
||||||
searchParams: any
|
searchParams: any
|
||||||
) => {
|
) => {
|
||||||
let processModelFullIdentifier = null;
|
let processModelFullIdentifier = null;
|
||||||
if (
|
if (searchParams.get('process_model_identifier')) {
|
||||||
searchParams.get('process_model_identifier') &&
|
|
||||||
searchParams.get('process_group_identifier')
|
|
||||||
) {
|
|
||||||
processModelFullIdentifier = `${searchParams.get(
|
processModelFullIdentifier = `${searchParams.get(
|
||||||
'process_group_identifier'
|
'process_model_identifier'
|
||||||
)}/${searchParams.get('process_model_identifier')}`;
|
)}`;
|
||||||
}
|
}
|
||||||
return processModelFullIdentifier;
|
return processModelFullIdentifier;
|
||||||
};
|
};
|
||||||
|
@ -116,19 +113,19 @@ export const truncateString = (text: string, len: number) => {
|
||||||
|
|
||||||
// Because of limitations in the way openapi defines parameters, we have to modify process models ids
|
// Because of limitations in the way openapi defines parameters, we have to modify process models ids
|
||||||
// which are basically paths to the models
|
// which are basically paths to the models
|
||||||
export const modifyProcessModelPath = (path: String) => {
|
export const modifyProcessModelPath = (path: string) => {
|
||||||
return path.replace('/', ':') || '';
|
return path.replace('/', ':') || '';
|
||||||
};
|
};
|
||||||
|
|
||||||
export const unModifyProcessModelPath = (path: String) => {
|
export const unModifyProcessModelPath = (path: string) => {
|
||||||
return path.replace(':', '/') || '';
|
return path.replace(':', '/') || '';
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getGroupFromModifiedModelId = (modifiedId: String) => {
|
export const getGroupFromModifiedModelId = (modifiedId: string) => {
|
||||||
const finalSplitIndex = modifiedId.lastIndexOf(':');
|
const finalSplitIndex = modifiedId.lastIndexOf(':');
|
||||||
return modifiedId.slice(0, finalSplitIndex);
|
return modifiedId.slice(0, finalSplitIndex);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const splitProcessModelId = (processModelId: String) => {
|
export const splitProcessModelId = (processModelId: string) => {
|
||||||
return processModelId.split('/');
|
return processModelId.split('/');
|
||||||
};
|
};
|
||||||
|
|
|
@ -461,7 +461,11 @@ export default function ProcessInstanceList() {
|
||||||
return (
|
return (
|
||||||
<h2>
|
<h2>
|
||||||
Process Instances for:{' '}
|
Process Instances for:{' '}
|
||||||
<Link to={`/admin/process-models/${processModelFullIdentifier}`}>
|
<Link
|
||||||
|
to={`/admin/process-models/${modifyProcessModelPath(
|
||||||
|
processModelFullIdentifier
|
||||||
|
)}`}
|
||||||
|
>
|
||||||
{processModelFullIdentifier}
|
{processModelFullIdentifier}
|
||||||
</Link>
|
</Link>
|
||||||
</h2>
|
</h2>
|
||||||
|
|
|
@ -776,9 +776,7 @@ export default function ProcessModelEditDiagram() {
|
||||||
|
|
||||||
// if a file name is not given then this is a new model and the ReactDiagramEditor component will handle it
|
// if a file name is not given then this is a new model and the ReactDiagramEditor component will handle it
|
||||||
if ((bpmnXmlForDiagramRendering || !params.file_name) && processModel) {
|
if ((bpmnXmlForDiagramRendering || !params.file_name) && processModel) {
|
||||||
const processModelFileName = processModelFile
|
const processModelFileName = processModelFile ? processModelFile.name : '';
|
||||||
? `: ${processModelFile.name}`
|
|
||||||
: '';
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ProcessBreadcrumb
|
<ProcessBreadcrumb
|
||||||
|
@ -792,7 +790,7 @@ export default function ProcessModelEditDiagram() {
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
<h2>
|
<h2>
|
||||||
Process Model File
|
Process Model File{processModelFile ? ': ' : ''}
|
||||||
{processModelFileName}
|
{processModelFileName}
|
||||||
</h2>
|
</h2>
|
||||||
{appropriateEditor()}
|
{appropriateEditor()}
|
||||||
|
|
|
@ -400,13 +400,14 @@ export default function ProcessModelShow() {
|
||||||
httpMethod: 'POST',
|
httpMethod: 'POST',
|
||||||
postBody: formData,
|
postBody: formData,
|
||||||
});
|
});
|
||||||
setShowFileUploadModal(false);
|
|
||||||
}
|
}
|
||||||
|
setShowFileUploadModal(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
const fileUploadModal = () => {
|
const fileUploadModal = () => {
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
|
data-qa="modal-upload-file-dialog"
|
||||||
open={showFileUploadModal}
|
open={showFileUploadModal}
|
||||||
modalHeading="Upload File"
|
modalHeading="Upload File"
|
||||||
primaryButtonText="Upload"
|
primaryButtonText="Upload"
|
||||||
|
@ -455,6 +456,7 @@ export default function ProcessModelShow() {
|
||||||
<ButtonSet>
|
<ButtonSet>
|
||||||
<Button
|
<Button
|
||||||
renderIcon={Upload}
|
renderIcon={Upload}
|
||||||
|
data-qa="upload-file-button"
|
||||||
onClick={() => setShowFileUploadModal(true)}
|
onClick={() => setShowFileUploadModal(true)}
|
||||||
size="sm"
|
size="sm"
|
||||||
kind=""
|
kind=""
|
||||||
|
|
|
@ -6,7 +6,8 @@ import { Button, Modal } from '@carbon/react';
|
||||||
import ProcessBreadcrumb from '../components/ProcessBreadcrumb';
|
import ProcessBreadcrumb from '../components/ProcessBreadcrumb';
|
||||||
import HttpService from '../services/HttpService';
|
import HttpService from '../services/HttpService';
|
||||||
import ButtonWithConfirmation from '../components/ButtonWithConfirmation';
|
import ButtonWithConfirmation from '../components/ButtonWithConfirmation';
|
||||||
import { modifyProcessModelPath } from '../helpers';
|
import { modifyProcessModelPath, unModifyProcessModelPath } from '../helpers';
|
||||||
|
import { ProcessFile } from '../interfaces';
|
||||||
|
|
||||||
// NOTE: This is mostly the same as ProcessModelEditDiagram and if we go this route could
|
// NOTE: This is mostly the same as ProcessModelEditDiagram and if we go this route could
|
||||||
// possibly be merged into it. I'm leaving as a separate file now in case it does
|
// possibly be merged into it. I'm leaving as a separate file now in case it does
|
||||||
|
@ -19,7 +20,9 @@ export default function ReactFormEditor() {
|
||||||
const handleShowFileNameEditor = () => setShowFileNameEditor(true);
|
const handleShowFileNameEditor = () => setShowFileNameEditor(true);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const [processModelFile, setProcessModelFile] = useState(null);
|
const [processModelFile, setProcessModelFile] = useState<ProcessFile | null>(
|
||||||
|
null
|
||||||
|
);
|
||||||
const [processModelFileContents, setProcessModelFileContents] = useState('');
|
const [processModelFileContents, setProcessModelFileContents] = useState('');
|
||||||
|
|
||||||
const fileExtension = (() => {
|
const fileExtension = (() => {
|
||||||
|
@ -145,10 +148,8 @@ export default function ReactFormEditor() {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const processModelFilePossibleNameString = processModelFile
|
|
||||||
? (processModelFile as any).name
|
|
||||||
: '';
|
|
||||||
if (processModelFile || !params.file_name) {
|
if (processModelFile || !params.file_name) {
|
||||||
|
const processModelFileName = processModelFile ? processModelFile.name : '';
|
||||||
return (
|
return (
|
||||||
<main>
|
<main>
|
||||||
<ProcessBreadcrumb
|
<ProcessBreadcrumb
|
||||||
|
@ -158,15 +159,19 @@ export default function ReactFormEditor() {
|
||||||
hotCrumbs={[
|
hotCrumbs={[
|
||||||
['Process Groups', '/admin'],
|
['Process Groups', '/admin'],
|
||||||
[
|
[
|
||||||
`Process Model: ${params.process_model_id}`,
|
`Process Model: ${unModifyProcessModelPath(
|
||||||
`process_model:${params.process_model_id}:link`,
|
params.process_model_id || ''
|
||||||
|
)}`,
|
||||||
|
`process_model:${unModifyProcessModelPath(
|
||||||
|
params.process_model_id || ''
|
||||||
|
)}:link`,
|
||||||
],
|
],
|
||||||
[processModelFilePossibleNameString],
|
[processModelFileName],
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
<h2>
|
<h2>
|
||||||
Process Model File
|
Process Model File{processModelFile ? ': ' : ''}
|
||||||
{processModelFile ? `: ${(processModelFile as any).name}` : ''}
|
{processModelFileName}
|
||||||
</h2>
|
</h2>
|
||||||
{newFileNameBox()}
|
{newFileNameBox()}
|
||||||
<Button onClick={saveFile} variant="danger" data-qa="file-save-button">
|
<Button onClick={saveFile} variant="danger" data-qa="file-save-button">
|
||||||
|
|
Loading…
Reference in New Issue