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

Conformance osff 2024 nyc #259

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const constants = {
ShortWait: 1000,
Fdc3Timeout: 500, // The amount of time to wait for the FDC3Ready event during initialisation
TestTimeout: 20000, // Tests that take longer than this (in milliseconds) will fail
ManualTimeout: 100000, // Manual tests that take longer than this (in milliseconds) will fail
WaitTime: 5000, // The amount of time to wait for mock apps to finish processing
WindowCloseWaitTime: 1000, // The amount of time to allow for clean-up of closed windows
NoListenerTimeout: 120000, // the amount of time to allow for a DA to timeout waiting on a context or intent listener
Expand Down
12 changes: 6 additions & 6 deletions src/test/v2.0/advanced/fdc3.findIntent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ export default () =>

it("(2.0-FindIntentAppDMultiple1) Should find intent 'sharedTestingIntent2' belonging to multiple apps (intent-a & intent-b)", async () => {
const appIntent = await fdc3.findIntent(Intent.sharedTestingIntent2);
validateAppIntent(appIntent, 6, { name: Intent.sharedTestingIntent2, displayName: "Shared Testing Intent" }, IntentApp.IntentAppD);
validateAppIntent(appIntent, 6, { name: Intent.sharedTestingIntent2, displayName: "Shared Testing Intent 2" }, IntentApp.IntentAppD);
});

it("(IntentAppDMultiple2) Should find intent 'sharedTestingIntent2' belonging to multiple apps (intent-a & intent-b) filtered by specific context 'testContextY'", async () => {
const appIntent = await fdc3.findIntent(Intent.sharedTestingIntent2, { type: ContextType.testContextY });
validateAppIntent(appIntent, 5, { name: Intent.sharedTestingIntent2, displayName: "Shared Testing Intent" }, IntentApp.IntentAppE);
validateAppIntent(appIntent, 5, { name: Intent.sharedTestingIntent2, displayName: "Shared Testing Intent 2" }, IntentApp.IntentAppE);
});

it("(2.0-FindIntentAppDByResultSingle) Should find intent 'cTestingIntent' belonging only to app intent-c with context 'testContextX' and result type 'testContextZ'", async () => {
Expand All @@ -61,17 +61,17 @@ export default () =>

it("(2.0-FindIntentAppDByResultMultiple) Should find intent 'sharedTestingIntent1' belonging only to app intent-b with context 'testContextX' and result type 'testContextY'", async () => {
const appIntent = await fdc3.findIntent(Intent.sharedTestingIntent1, { type: ContextType.testContextX }, ContextType.testContextY);
validateAppIntent(appIntent, 1, { name: Intent.sharedTestingIntent1, displayName: "Shared Testing Intent" }, IntentApp.IntentAppB);
validateAppIntent(appIntent, 1, { name: Intent.sharedTestingIntent1, displayName: "Shared Testing Intent 1" }, IntentApp.IntentAppB);
});

it("(2.0-FindIntentAppDByResultChannel1) Should find intent 'sharedTestingIntent2' belonging only to apps intent-e and itent-f with context 'testContextY' and result type 'channel", async () => {
const appIntent = await fdc3.findIntent(Intent.sharedTestingIntent2, { type: ContextType.testContextY }, "channel");
validateAppIntent(appIntent, 2, { name: Intent.sharedTestingIntent2, displayName: "Shared Testing Intent" }, IntentApp.IntentAppE);
validateAppIntent(appIntent, 2, { name: Intent.sharedTestingIntent2, displayName: "Shared Testing Intent 2" }, IntentApp.IntentAppE);
});

it("(2.0-FindIntentAppDByResultChannel2) Should find intent 'sharedTestingIntent2' belonging only to app intent-c with context 'testContextY' and result type 'channel<testContextZ>'", async () => {
const appIntent = await fdc3.findIntent(Intent.sharedTestingIntent2, { type: ContextType.testContextY }, "channel<testContextZ>");
validateAppIntent(appIntent, 1, { name: Intent.sharedTestingIntent2, displayName: "Shared Testing Intent" }, IntentApp.IntentAppF);
validateAppIntent(appIntent, 1, { name: Intent.sharedTestingIntent2, displayName: "Shared Testing Intent 2" }, IntentApp.IntentAppF);
});
});

Expand All @@ -93,4 +93,4 @@ function validateAppIntent(appIntent: AppIntent, expectedNumberOfApps: number, e
appsThatNeedValidating.forEach((appId, index) => {
expect(appIntent.apps[index], `AppIntent.apps[${index}] did not have expected property 'appId' ${findIntentDocs}`).to.have.property("appId", appId);
});
}
}
11 changes: 7 additions & 4 deletions src/test/v2.0/advanced/fdc3.raiseIntent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { ChannelError, PrivateChannel, Listener } from "fdc3_2_0";
import { assert, expect } from "chai";
import { RaiseIntentControl2_0, IntentResultType, IntentApp, ContextType, Intent, ControlContextType } from "../support/intent-support-2.0";
import { closeMockAppWindow } from "../fdc3-2_0-utils";
import { wait } from "../../../utils";

const control = new RaiseIntentControl2_0();

Expand Down Expand Up @@ -103,7 +104,7 @@ export default () =>
const PrivateChannelsLifecycleEvents = "(2.0-PrivateChannelsLifecycleEvents) PrivateChannel lifecycle events are triggered when expected";
it(PrivateChannelsLifecycleEvents, async () => {
errorListener = await control.listenForError();
let onUnsubscribeReceiver = control.receiveContext(ControlContextType.onUnsubscribeTriggered);
const onUnsubscribeReceiver = control.receiveContext(ControlContextType.onUnsubscribeTriggered);
const intentResolution = await control.raiseIntent(Intent.kTestingIntent, ContextType.testContextX, {
appId: IntentApp.IntentAppK,
});
Expand All @@ -112,12 +113,14 @@ export default () =>
control.validateIntentResult(result, IntentResultType.PrivateChannel);
let listener = await control.receiveContextStreamFromMockApp(<PrivateChannel>result, 1, 5);
control.unsubscribeListener(listener);

await onUnsubscribeReceiver; //should receive context from privChannel.onUnsubscribe in mock app
let textContextXReceiver = control.receiveContext(ContextType.testContextX);
const textContextXReceiver = control.receiveContext(ContextType.testContextX);
await wait(300) // ADDED DUE TO RACE CONDITION in intent-support-2.0.ts/receiveContext on line 12.
control.privateChannelBroadcast(<PrivateChannel>result, ContextType.testContextX);
await textContextXReceiver;
let onUnsubscribeReceiver2 = control.receiveContext(ControlContextType.onUnsubscribeTriggered);
let onDisconnectReceiver = control.receiveContext(ControlContextType.onDisconnectTriggered);
const onUnsubscribeReceiver2 = control.receiveContext(ControlContextType.onUnsubscribeTriggered);
const onDisconnectReceiver = control.receiveContext(ControlContextType.onDisconnectTriggered);
let listener2 = await control.receiveContextStreamFromMockApp(<PrivateChannel>result, 6, 10);
control.disconnectPrivateChannel(<PrivateChannel>result);

Expand Down
147 changes: 73 additions & 74 deletions src/test/v2.0/manual/fdc3.manual.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { ResolveError, DesktopAgent } from "fdc3_2_0";
import { DesktopAgent } from "fdc3_2_0";

import { closeMockAppWindow } from "../fdc3-2_0-utils";
import { assert, expect } from "chai";
import { APIDocumentation2_0 } from "../apiDocuments-2.0";
import { ContextType, IntentApp, Intent, RaiseIntentControl2_0 } from "../support/intent-support-2.0";
import constants from "../../../constants";
import { wait } from "../../../utils";


Expand All @@ -19,81 +18,81 @@ declare let fdc3: DesktopAgent;
*/

export let fdc3ResolveAmbiguousIntentTarget_2_0 = () => describe("ResolveAmbiguousIntentTarget_2.0", () => {
after(async function after() {
await closeMockAppWindow(this.currentTest.title);
});
const ResolveAmbiguousIntentTarget = "(ResolveAmbiguousIntentTarget) Should be able to raise intent using Intent and Context and manually select an app out of 'E','F','G','H' and 'I'";
it(ResolveAmbiguousIntentTarget, async () => {
try {
const context = {
type: ContextType.testContextY,
};
await fdc3.raiseIntent(Intent.sharedTestingIntent2, context);
} catch (ex) {
assert.fail(raiseIntentDocs + (ex.message ?? ex));
}
});
after(async function after() {
await closeMockAppWindow(this.currentTest.title);
});
const ResolveAmbiguousIntentTarget = "(ResolveAmbiguousIntentTarget) Should be able to raise intent using Intent and Context and manually select an app out of 'E','F','G','H' and 'I'";
it(ResolveAmbiguousIntentTarget, async () => {
try {
const context = {
type: ContextType.testContextY,
};
await fdc3.raiseIntent(Intent.sharedTestingIntent2, context);
} catch (ex) {
assert.fail(raiseIntentDocs + (ex.message ?? ex));
}
});
});

export let fdc3ResolveAmbiguousContextTarget_2_0 = () => describe("ResolveAmbiguousContextTarget_2.0", () => {
after(async function after() {
await closeMockAppWindow(this.currentTest.title);
});
const ResolveAmbiguousIntentTarget = "(ResolveAmbiguousContextTarget) Should be able to raise intent using ContextY and manually select an app out of 'E','F','G','H' and 'I'";
it(ResolveAmbiguousIntentTarget, async () => {
try {
const context = {
type: ContextType.testContextY,
};
await fdc3.raiseIntentForContext(context);
} catch (ex) {
assert.fail(raiseIntentDocs + (ex.message ?? ex));
}
});
});

export let fdc3ResolveAmbiguousContextTarget_2_0 = () => describe("ResolveAmbiguousContextTarget_2.0", () => {
after(async function after() {
await closeMockAppWindow(this.currentTest.title);
});
const ResolveAmbiguousIntentTarget = "(ResolveAmbiguousContextTarget) Should be able to raise intent using ContextY and manually select an app out of 'E','F','G','H' and 'I'";
it(ResolveAmbiguousIntentTarget, async () => {
try {
const context = {
type: ContextType.testContextY,
};
await fdc3.raiseIntentForContext(context);
} catch (ex) {
assert.fail(raiseIntentDocs + (ex.message ?? ex));
}
});
export let fdc3ResolveAmbiguousIntentTargetMultiInstance_2_0 = () => describe("ResolveAmbiguousIntentTargetMultiInstance_2.0", () => {
after(async function after() {
await closeMockAppWindow(this.currentTest.title);
});
const ResolveAmbiguousIntentTargetMultiInstance = "(ResolveAmbiguousIntentTargetMultiInstance) Open 2 instances of App E and AppF respectively and then should be able to raise intent using Intent and Context and manually select an app out of 'E','F','G','H' and 'I'";
it(ResolveAmbiguousIntentTargetMultiInstance, async () => {
try {
const context = {
type: ContextType.testContextY,
};
await control.openIntentApp(IntentApp.IntentAppE);
await control.openIntentApp(IntentApp.IntentAppE);
await control.openIntentApp(IntentApp.IntentAppF);
await control.openIntentApp(IntentApp.IntentAppF);
await wait(100);

export let fdc3ResolveAmbiguousIntentTargetMultiInstance_2_0 = () => describe("ResolveAmbiguousIntentTargetMultiInstance_2.0", () => {
after(async function after() {
await closeMockAppWindow(this.currentTest.title);
});
const ResolveAmbiguousIntentTargetMultiInstance = "(ResolveAmbiguousIntentTargetMultiInstance) Open 2 instances of App E and AppF respectively and then should be able to raise intent using Intent and Context and manually select an app out of 'E','F','G','H' and 'I'";
it(ResolveAmbiguousIntentTargetMultiInstance, async () => {
try {
const context = {
type: ContextType.testContextY,
};
await control.openIntentApp(IntentApp.IntentAppE);
await control.openIntentApp(IntentApp.IntentAppE);
await control.openIntentApp(IntentApp.IntentAppF);
await control.openIntentApp(IntentApp.IntentAppF);
await wait(100);

await fdc3.raiseIntent(Intent.sharedTestingIntent2, context);
} catch (ex) {
assert.fail(raiseIntentDocs + (ex.message ?? ex));
}
});
await fdc3.raiseIntent(Intent.sharedTestingIntent2, context);
} catch (ex) {
assert.fail(raiseIntentDocs + (ex.message ?? ex));
}
});
});

export let fdc3ResolveAmbiguousContextTargetMultiInstance_2_0 = () => describe("ResolveAmbiguousContextTargetMultiInstance_2.0", () => {
after(async function after() {
await closeMockAppWindow(this.currentTest.title);
});
const ResolveAmbiguousContextTargetMultiInstance = "(ResolveAmbiguousContextTargetMultiInstance) Open 2 instances of App E and AppF respectively and then should be able to raise intent using Context and manually select an app out of 'E','F','G','H' and 'I'";
it(ResolveAmbiguousContextTargetMultiInstance, async () => {
try {
const context = {
type: ContextType.testContextY,
};
await control.openIntentApp(IntentApp.IntentAppE);
await control.openIntentApp(IntentApp.IntentAppE);
await control.openIntentApp(IntentApp.IntentAppF);
await control.openIntentApp(IntentApp.IntentAppF);
await wait(100);
await fdc3.raiseIntentForContext(context);
} catch (ex) {
assert.fail(raiseIntentDocs + (ex.message ?? ex));
}
});
});
export let fdc3ResolveAmbiguousContextTargetMultiInstance_2_0 = () => describe("ResolveAmbiguousContextTargetMultiInstance_2.0", () => {
after(async function after() {
await closeMockAppWindow(this.currentTest.title);
});
const ResolveAmbiguousContextTargetMultiInstance = "(ResolveAmbiguousContextTargetMultiInstance) Open 2 instances of App E and AppF respectively and then should be able to raise intent using Context and manually select an app out of 'E','F','G','H' and 'I'";
it(ResolveAmbiguousContextTargetMultiInstance, async () => {
try {
const context = {
type: ContextType.testContextY,
};
await control.openIntentApp(IntentApp.IntentAppE);
await control.openIntentApp(IntentApp.IntentAppE);
await control.openIntentApp(IntentApp.IntentAppF);
await control.openIntentApp(IntentApp.IntentAppF);
await wait(100);

await fdc3.raiseIntentForContext(context);
} catch (ex) {
assert.fail(raiseIntentDocs + (ex.message ?? ex));
}
});
});
2 changes: 1 addition & 1 deletion src/test/v2.0/support/intent-support-2.0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export class RaiseIntentControl2_0 {
const intentResult = intentResolution.getResult();
if (typeof intentResult.then !== "function") {
assert.fail(`intentResolution.getResult() did not return a Promise: ${JSON.stringify(intentResult, null, 2)}`);
}
}
clearTimeout(timeout);
return intentResult;
}
Expand Down
10 changes: 5 additions & 5 deletions src/test/v2.0/testSuite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import fdc3Open_2_0 from "./advanced/fdc3.open";
import fdc3RaiseIntent_2_0 from "./advanced/fdc3.raiseIntent";
import fdc3RaiseIntent_2_0_Result from "./advanced/fdc3.raiseIntent-Result";
import fdc3RaiseIntent_2_0_NoAppsFound from "./advanced/fdc3.raiseIntent-NoAppsFound";
import {fdc3BasicCL1_2_0, fdc3BasicCL2_2_0, fdc3BasicIL1_2_0, fdc3BasicGI1_2_0 , fdc3BasicAC1_2_0 , fdc3BasicUC1_2_0, fdc3BasicJC1_2_0, fdc3BasicRI1_2_0, fdc3BasicRI2_2_0 } from './basic/fdc3.basic';
import {fdc3ResolveAmbiguousIntentTarget_2_0, fdc3ResolveAmbiguousContextTarget_2_0, fdc3ResolveAmbiguousIntentTargetMultiInstance_2_0, fdc3ResolveAmbiguousContextTargetMultiInstance_2_0} from './manual/fdc3.manual';
import { fdc3BasicCL1_2_0, fdc3BasicCL2_2_0, fdc3BasicIL1_2_0, fdc3BasicGI1_2_0, fdc3BasicAC1_2_0, fdc3BasicUC1_2_0, fdc3BasicJC1_2_0, fdc3BasicRI1_2_0, fdc3BasicRI2_2_0 } from './basic/fdc3.basic';
import { fdc3ResolveAmbiguousIntentTarget_2_0, fdc3ResolveAmbiguousContextTarget_2_0, fdc3ResolveAmbiguousIntentTargetMultiInstance_2_0, fdc3ResolveAmbiguousContextTargetMultiInstance_2_0 } from './manual/fdc3.manual';

type testSet = { [key: string]: (() => void)[] };

Expand All @@ -22,7 +22,7 @@ const basicSuite_2_0: testSet = {
"fdc3.basicGI1 2.0": [fdc3BasicGI1_2_0],
"fdc3.basicAC1 2.0": [fdc3BasicAC1_2_0],
"fdc3.basicUC1 2.0": [fdc3BasicUC1_2_0],
"fdc3.basicJC1 2.0": [fdc3BasicJC1_2_0],
"fdc3.basicJC1 2.0": [fdc3BasicJC1_2_0],
"fdc3.basicRI1 2.0": [fdc3BasicRI1_2_0],
"fdc3.basicRI2 2.0": [fdc3BasicRI2_2_0],
};
Expand Down Expand Up @@ -98,8 +98,8 @@ export const executeTestsInBrowser = (pack: string) => {
* in HTML page
*/
export const executeManualTestsInBrowser = (pack: string) => {
console.log('Pack',pack);
(mocha as any).timeout(constants.TestTimeout);
console.log('Pack', pack);
(mocha as any).timeout(constants.ManualTimeout);
const suite = allManualTests[pack];
console.log('************ found suite******', suite)
suite.forEach((s) => s());
Expand Down
Loading