feat: add more e2e tests for MPR and add test mode and extension (#3180)

* tests: add various e2e tests for MPR and measurements

wip

add cypress config

feat: add mode and extension for testing

add hp applied through search params

add MPR tests

apply review comments

add more e2e tests

update yarn lock

* fix unit tests failing
This commit is contained in:
Alireza authored and GitHub committed 2023-02-17 15:04:07 -05:00
1 parent ae4183852f
commit 926290f69e
83 files changed
+6286 -6860

No files matched your search

@@ -35,6 +35,7 @@ export interface ExtensionParams extends ExtensionConstructor {
* have more values than this.
*/
export interface Extension {
id: string;
preRegistration?: (p: ExtensionParams) => void;
}
@@ -160,11 +161,18 @@ export default class ExtensionManager {
// but currently since some extensions need to be registered before
// others, we need to run them sequentially. We need a postInit hook
// to avoid this sequential async registration
for (const extension of extensions) {
for (let i = 0; i < extensions.length; i++) {
const extension = extensions[i];
const hasConfiguration = Array.isArray(extension);
try {
if (hasConfiguration) {
const [ohifExtension, configuration] = extension;
// Important: for some reason in the line below the type
// of extension is not recognized as [ExtensionRegister,
// ExtensionConfiguration] by babel DON"T CHANGE IT
// Same for the for loop above don't use
// for (const extension of extensions)
const ohifExtension = extension[0];
const configuration = extension[1];
await this.registerExtension(
ohifExtension,
configuration,
@@ -185,7 +185,11 @@ class HangingProtocolService {
* @param protocolId - the id of the protocol
* @returns protocol - the protocol with the given id
*/
public getProtocolById(id: string): HangingProtocol.Protocol {
public getProtocolById(id: string): HangingProtocol.Protocol | undefined {
if (!id) {
return;
}
const protocol = this.protocols.get(id);
if (protocol instanceof Function) {
@@ -233,7 +237,7 @@ class HangingProtocolService {
* If active protocols ids is null right now, then the specified
* protocol will become the only active protocol.
*/
public addActiveProtocol(id: string): void {
public addActiveProtocolId(id: string): void {
if (!id) {
return;
}
@@ -247,17 +251,17 @@ class HangingProtocolService {
* Sets the active hanging protocols to use, by name. If the value is empty,
* then resets the active protocols to all the named items.
*/
public setActiveProtocols(hangingProtocol?: string[] | string): void {
if (!hangingProtocol || !hangingProtocol.length) {
public setActiveProtocolIds(protocolId?: string[] | string): void {
if (!protocolId || !protocolId.length) {
this.activeProtocolIds = null;
console.log('No active protocols, setting all to active');
return;
}
if (typeof hangingProtocol === 'string') {
this.setActiveProtocols([hangingProtocol]);
if (typeof protocolId === 'string') {
this.setActiveProtocolIds([protocolId]);
return;
}
this.activeProtocolIds = [...hangingProtocol];
this.activeProtocolIds = [...protocolId];
}
/**
@@ -272,7 +276,6 @@ class HangingProtocolService {
* @param params.displaySets is the list of display sets associated with
* the studies to display in viewports.
* @param protocol is a specific protocol to apply.
* @returns
*/
public run({ studies, displaySets, activeStudy }, protocolId) {
this.studies = [...studies];