Skip to content

Commit

Permalink
Merge pull request #1326 from finos/client-testing
Browse files Browse the repository at this point in the history
Client testing
  • Loading branch information
robmoffat authored Aug 30, 2024
2 parents 6f783ca + 04a94ac commit 4b51eeb
Show file tree
Hide file tree
Showing 13 changed files with 81 additions and 118 deletions.
88 changes: 41 additions & 47 deletions fdc3-for-web-implementation/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion fdc3-for-web-implementation/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@kite9/web-fdc3",
"private": true,
"version": "0.0.54",
"version": "0.0.56",
"workspaces": [
"packages/fdc3-common",
"packages/testing",
Expand Down
8 changes: 4 additions & 4 deletions fdc3-for-web-implementation/packages/client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kite9/client",
"version": "0.0.54",
"version": "0.0.56",
"files": [
"dist"
],
Expand All @@ -13,14 +13,14 @@
},
"dependencies": {
"@finos/fdc3": "^2.1.0-beta.6",
"@kite9/da-proxy": "0.0.54",
"@kite9/fdc3-common": "0.0.54",
"@kite9/da-proxy": "0.0.56",
"@kite9/fdc3-common": "0.0.56",
"@types/uuid": "^10.0.0",
"uuid": "^9.0.1"
},
"devDependencies": {
"@cucumber/cucumber": "10.3.1",
"@kite9/da-server": "0.0.54",
"@kite9/da-server": "0.0.56",
"@types/node": "^20.14.11",
"@types/wtfnode": "^0.7.3",
"expect": "^29.7.0",
Expand Down
18 changes: 9 additions & 9 deletions fdc3-for-web-implementation/packages/client/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,15 @@ export const getAgent: getAgentType = (optionsOverride?: GetAgentParams) => {

/**
* Replaces the original fdc3Ready function from FDC3 2.0 with a new one that uses the new getClientAPI function.
*
*
* @param waitForMs Amount of time to wait before failing the promise (20 seconds is the default).
* @returns A DesktopAgent promise.
*/
// export function fdc3Ready(waitForMs = DEFAULT_WAIT_FOR_MS): Promise<DesktopAgent> {
// return getAgent({
// timeout: waitForMs,
// dontSetWindowFdc3: false,
// channelSelector: true,
// intentResolver: true
// })
// }
export function fdc3Ready(waitForMs = DEFAULT_WAIT_FOR_MS): Promise<DesktopAgent> {
return getAgent({
timeout: waitForMs,
dontSetWindowFdc3: false,
channelSelector: true,
intentResolver: true
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const ALLOWED_CSS_ELEMENTS = [
export abstract class AbstractUIComponent implements Connectable {

private container: HTMLDivElement | undefined = undefined
private iframe: Window | undefined = undefined
private iframe: HTMLIFrameElement | undefined = undefined
private url: string
private name: string
port: MessagePort | null = null
Expand Down Expand Up @@ -75,7 +75,7 @@ export abstract class AbstractUIComponent implements Connectable {
return new Promise((resolve, _reject) => {
const ml = (e: MessageEvent) => {
console.log("Received UI Message: " + JSON.stringify(e.data))
if ((e.source == this.iframe) && (e.data.type == 'iframeHello')) {
if ((e.source == this.iframe?.contentWindow) && (e.data.type == 'iframeHello')) {
const port = e.ports[0]
port.start()
globalThis.window.removeEventListener("message", ml)
Expand All @@ -90,14 +90,13 @@ export abstract class AbstractUIComponent implements Connectable {

private openFrame(): void {
this.container = globalThis.document.createElement("div")
const ifrm = globalThis.document.createElement("iframe")
this.iframe = globalThis.document.createElement("iframe")

this.themeContainer(INITIAL_CONTAINER_CSS)
this.themeFrame(ifrm)
this.iframe = ifrm.contentWindow!!
this.themeFrame(this.iframe)

ifrm.setAttribute("src", this.url)
this.container.appendChild(ifrm)
this.iframe.setAttribute("src", this.url)
this.container.appendChild(this.iframe)
document.body.appendChild(this.container)
}

Expand Down
6 changes: 3 additions & 3 deletions fdc3-for-web-implementation/packages/da-proxy/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kite9/da-proxy",
"version": "0.0.54",
"version": "0.0.56",
"files": [
"dist"
],
Expand All @@ -13,7 +13,7 @@
},
"dependencies": {
"@finos/fdc3": "^2.1.0-beta.6",
"@kite9/fdc3-common": "0.0.54"
"@kite9/fdc3-common": "0.0.56"
},
"devDependencies": {
"@cucumber/cucumber": "10.3.1",
Expand All @@ -34,7 +34,7 @@
"is-ci": "2.0.0",
"jsonpath-plus": "^9.0.0",
"nyc": "15.1.0",
"@kite9/testing": "0.0.54",
"@kite9/testing": "0.0.56",
"prettier": "2.2.1",
"rimraf": "^6.0.1",
"ts-node": "^10.9.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,6 @@ import {
} from "@kite9/fdc3-common";
import { FollowingContextListener } from "../listeners/FollowingContextListener";

const NO_OP_CHANNEL_SELECTOR: ChannelSelector = {

updateChannel(_channelId: string | null): void {
// does nothing
},

setChannelChangeCallback(_callback: (channelId: string) => void): void {
// also does nothing
},

connect: function (): Promise<void> {
return Promise.resolve()
},

disconnect: function (): Promise<void> {
return Promise.resolve()
}

}

export class DefaultChannelSupport implements ChannelSupport {

Expand All @@ -43,7 +24,7 @@ export class DefaultChannelSupport implements ChannelSupport {
protected userChannels: Channel[] | null = null
private followingListeners: FollowingContextListener[] = []

constructor(messaging: Messaging, channelSelector: ChannelSelector = NO_OP_CHANNEL_SELECTOR) {
constructor(messaging: Messaging, channelSelector: ChannelSelector) {
this.messaging = messaging;
this.channelSelector = channelSelector
this.channelSelector.setChannelChangeCallback((channelId: string) => {
Expand Down
Loading

0 comments on commit 4b51eeb

Please sign in to comment.