Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation Page E2E Tests #324

Merged
merged 26 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
6748b9b
Added e2e tests for the documentation page
jjoderis Jul 1, 2024
252d583
Fixed: some tests don't clean up the created processes correctly
jjoderis Jul 3, 2024
4b3589d
Generalized version creation in the process modeler for tests and use…
jjoderis Jul 3, 2024
e4cde9c
Merge branch 'main' into ms2/new-documentation-page-e2e
OhKai Jul 21, 2024
ab7d370
Merge branch 'main' into ms2/new-documentation-page-e2e
OhKai Sep 10, 2024
6ddce00
Merged main into ms2/new-documentation-page-e2e
jjoderis Nov 6, 2024
19e6e26
split up the documentation page test from one big one into multiple s…
jjoderis Nov 6, 2024
6ee73bd
Merge branch 'main' of github.com:PROCEED-Labs/proceed into ms2/new-d…
jjoderis Nov 6, 2024
6d47329
Fixed: Undid some changes that broke tests from main
jjoderis Nov 7, 2024
59b4e01
Extended the timeout for a long running test
jjoderis Nov 11, 2024
10212ea
Merge branch 'main' into ms2/new-documentation-page-e2e
OhKai Nov 15, 2024
f1cc051
Split a long test into two and replaced waitForHydration helper funct…
jjoderis Nov 17, 2024
954ddb1
Merge branch 'ms2/new-documentation-page-e2e' of github.com:PROCEED-L…
jjoderis Nov 17, 2024
8defd30
Fixed: documentation page e2e tests don't click the correct position …
jjoderis Nov 18, 2024
ce90020
Merge branch 'main' of github.com:PROCEED-Labs/proceed into ms2/new-d…
jjoderis Nov 18, 2024
039bf11
Merge branch 'main' of github.com:PROCEED-Labs/proceed into ms2/new-d…
jjoderis Nov 18, 2024
dc6b0de
Replaced unchecking of checkboxes in tests with a simple click in an …
jjoderis Nov 18, 2024
421d42a
Merged remote main into ms2/new-documentation-page-e2e
jjoderis Dec 5, 2024
454b1a7
Fixed: E2E tests are not correctly working with the changes from the …
jjoderis Dec 5, 2024
c8ef593
Merged origin main into ms2/new-documentation-page-e2e
jjoderis Dec 5, 2024
c473c96
Marked tests that have to import multiple processes as slow
jjoderis Dec 7, 2024
2db936b
Merged remote main into ms2/new-documentation-page-e2e
jjoderis Dec 7, 2024
b76974e
Trying to make a test work by extending its timeout
jjoderis Dec 7, 2024
2f4adb5
Merged remote main into local ms2/new-documenation-page-e2e
jjoderis Dec 9, 2024
908a1f8
Merged remote main into local ms2/new-documentation-page-e2e
jjoderis Dec 11, 2024
8abea8a
Adjusted test for importing a process into your workspace from the do…
jjoderis Dec 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -182,23 +182,23 @@ export async function getElementSVG(
} else if (isType(el, 'bpmn:CallActivity')) {
// check if the call activity references another process which this user can access
let importDefinitionId: string | undefined;
let version: string | undefined;
let versionId: string | undefined;
try {
({ definitionId: importDefinitionId, versionId: version } =
({ definitionId: importDefinitionId, versionId } =
getTargetDefinitionsAndProcessIdForCallActivityByObject(getRootFromElement(el), el.id));
} catch (err) {}

if (
importDefinitionId &&
version &&
versionId &&
availableImports[importDefinitionId] &&
availableImports[importDefinitionId][version]
availableImports[importDefinitionId][versionId]
) {
// remember the bpmn currently loaded into the viewer so we can return to it after getting the svg for the elements in the imported process
({ xml: oldBpmn } = await bpmnViewer.saveXML());

// get the bpmn for the import and load it into the viewer
const importBpmn = availableImports[importDefinitionId][version];
const importBpmn = availableImports[importDefinitionId][versionId];

await bpmnViewer.importXML(importBpmn);

Expand All @@ -216,7 +216,7 @@ export async function getElementSVG(
name: `Imported Process: ${definitions.name}`,
...getMetaDataFromBpmnElement(el, mdEditor),
planeSvg: await getSVGFromBPMN(bpmnViewer),
version,
versionId,
versionName,
versionDescription,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ const BPMNSharedViewer = ({
currentRootId?: string, // the layer the current element is in (e.g. the root process/collaboration or a collapsed sub-process)
): Promise<ElementInfo> {
let svg;
const name = getTitle(el);

let nestedSubprocess;
let importedProcess;
Expand Down Expand Up @@ -140,7 +141,7 @@ const BPMNSharedViewer = ({
return {
svg,
id: el.id,
name: getTitle(el),
name,
description,
meta,
milestones,
Expand All @@ -158,9 +159,11 @@ const BPMNSharedViewer = ({
const root = canvas.getRootElement();

const definitions = getRootFromElement(root.businessObject);
getDefinitionsVersionInformation(definitions).then(({ versionId, name, description }) =>
setVersionInfo({ id: versionId, name, description }),
);

const { versionId, name, description, versionCreatedOn } =
await getDefinitionsVersionInformation(definitions);

setVersionInfo({ id: versionId, name, description, versionCreatedOn });

const hierarchy = await transform(
viewer,
Expand Down
28 changes: 22 additions & 6 deletions src/management-system-v2/app/shared-viewer/process-document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ import { useEnvironment } from '@/components/auth-can';
import { EntityType } from '@/lib/helpers/fileManagerHelpers';
import { useFileManager } from '@/lib/useFileManager';
import { enableUseFileManager } from 'FeatureFlags';
import { fromCustomUTCString } from '@/lib/helpers/timeHelper';

export type VersionInfo = {
id?: string;
name?: string;
description?: string;
versionCreatedOn?: string;
};

type ProcessDocumentProps = {
Expand Down Expand Up @@ -64,7 +66,6 @@ const ProcessDocument: React.FC<ProcessDocumentProps> = ({
!hierarchyElement.image &&
!hierarchyElement.children?.length
) {
setProcessPages(currentPages);
return;
}

Expand Down Expand Up @@ -224,20 +225,30 @@ const ProcessDocument: React.FC<ProcessDocumentProps> = ({
(settings.nestedSubprocesses || !hierarchyElement.nestedSubprocess) &&
(settings.importedProcesses || !hierarchyElement.importedProcess)
) {
hierarchyElement.children?.forEach((child) => getContent(child, currentPages));
if (hierarchyElement.children) {
for (const child of hierarchyElement.children) {
await getContent(child, currentPages);
}
}
}
}

// transform the document data into the respective pages of the document
useEffect(() => {
processHierarchy && getContent(processHierarchy, processPages);
}, [processHierarchy]);
const updateProcessPages = async () => {
const newProcessPages: React.JSX.Element[] = [];
processHierarchy && (await getContent(processHierarchy, newProcessPages));
setProcessPages(newProcessPages);
};

updateProcessPages();
}, [processHierarchy, settings]);

return (
<>
<div className={styles.ProcessDocument}>
{!processHierarchy ? (
<Spin tip="Loading" size="large" style={{ top: '50px' }}>
<Spin tip="Loading process data" size="large" style={{ top: '50px' }}>
<div></div>
</Spin>
) : (
Expand Down Expand Up @@ -268,7 +279,12 @@ const ProcessDocument: React.FC<ProcessDocumentProps> = ({
<div>Version: Latest</div>
)}
{version.id ? (
<div>Creation Time: {new Date(version.id).toUTCString()}</div>
<div>
Creation Time:{' '}
{version.versionCreatedOn
? fromCustomUTCString(version.versionCreatedOn).toUTCString()
: 'Unknown'}
</div>
) : (
<div>Last Edit: {processData.lastEditedOn.toUTCString()}</div>
)}
Expand Down
17 changes: 14 additions & 3 deletions src/management-system-v2/lib/schema.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -250,13 +250,13 @@ export const schema = {
],
},
{
name: 'version',
name: 'versionId',
extends: ['bpmn:Definitions', 'bpmn:Import'],
properties: [
{
name: 'version',
name: 'versionId',
isAttr: true,
type: 'Number',
type: 'string',
},
],
},
Expand Down Expand Up @@ -293,6 +293,17 @@ export const schema = {
},
],
},
{
name: 'versionCreatedOn',
extends: ['bpmn:Definitions'],
properties: [
{
name: 'versionCreatedOn',
isAttr: true,
type: 'String',
},
],
},
{
name: 'creatorEnvironmentId',
extends: ['bpmn:Definitions'],
Expand Down
Loading
Loading