-
Notifications
You must be signed in to change notification settings - Fork 137
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
FDC3 Compliance Check - First Iteration #615
Conversation
… to yarn (to match rest of repo)
First iteration
A few fixes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems a reasonable start on the conformance project. At present, the tests only check if functions are callable and not any of their behavior (which presumably we'll see some of in a future update). I've made some comments about checking responses in these initial checks however as I think you could do some confirmation that the app(s) are set-up correctly for the rest of the tests.
A correction is needed in the fdc3.joinChannel
test as indicated.
Readme could be expanded to cover more of the set-up for the test - including customisation to the manifest that will be required. Could also eventually include 1.2 manifests for the major containers (vendors to supply) - thankfully 2.0 will support multiple manifests and (if possible) some more vendor agnostic fields making them less necessary.
toolbox/fdc3-compliance/README.md
Outdated
|
||
## Application Definition | ||
|
||
A basic FDC3 application definition, as defined in the [application directory specification](https://fdc3.finos.org/schemas/1.2/app-directory#tag/Application), is supplied in the file `appDefinition.json`. This may be useful when adding the conformance tests to an application directory. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The getting started section could be expanded upon:
- add a link to the app definition file
- in 1.2 the definition must be expanded on with a manifest for the container to start it
- if the desktop agent doesn't connect to an appD / has other configuration steps they'll need to be taken
Then, once the application definition has been added:
- Do you just launch it to start the test?
- What should they then expect to happen?
- etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can definitely bulk up the README in this area. For this version, the tests run automatically on load, so we will make that clear.
As far as configuration goes, we are avoiding putting anything vendor-specific in the documentation, but we will make it clear that there may be additional configuration required (the current file works as-is with the existing inline manifest with Glue42).
try { | ||
await window.fdc3.findIntent("ViewChart"); | ||
} catch (ex) { | ||
if (ex !== ResolveError.NoAppsFound) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about ResolveError.ResolverTimeout
and ResolveError.ResolverUnavailable
? They are both valid errors but probably mean the test can't continue - while NoAppsFound
might be valid IF they don't have another app that handles that.
To actually test handling of intents with no apps that support them (i.e. that the correct error is returned), use some long gobbledegook intent name.
This is also a good place to check the setup (including your custom intent) was completed correctly (e.g. your custom intent was registered) and to provide good error messaging if not.
Also (unsupported) other errors - should fail out the test with a different message (as those are not a valid response).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed - those are all things on the TODO list for the next iteration. For this version, anything other than the expected responses will cause a test failure.
Address PR feedback: - Clean up resources, i.e. unsubscribe listeners and leave channels - Use first system channel in joinChannel test - Use non-existent intent names for consistency - Remove unnecessary top-level async from tests - README improvements
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the revisit, @dbutt-scottlogic ! We are almost there.
Address additional PR feedback
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First off, apologies for the delay (big product release and a vacation got in the way 😬 ). As penance I've tried to add full suggestions you can commit for proposed changes.
Overall it LGTM, however, I spotted one possible issue with error handling. Technically, the FDC3 spec says that Error
objects should be thrown with the strings from the error enumerations, where the tests are assuming the strings themselves will be thrown (its annoying that javascript allows this IMHO, it perhaps should have upgraded strings to errors). E.g.
If the resolution fails, the promise will return an
Error
with a string from the ResolveError enumeration.
Finsemble appears to be throwing the strings, rather than Errors, which may have steered you wrong on this... The suggestions I've put in would handle it either way - however we should probably have a discussion on this (in the Standards Working Group) as it makes error handling more complex.
Also the test framework is not happy with strings being thrown on failures (Finsemble is throwing the wrong error string for fdc3.open
), resulting in:
|
||
## Application Definition | ||
|
||
A basic FDC3 application definition, as defined in the [application directory specification](https://fdc3.finos.org/schemas/1.2/app-directory#tag/Application), is supplied in the [file](./src/appDefinition.json) `appDefinition.json`. This may be useful when adding the conformance tests to an application directory. This file may need to be updated with additional manifest information, depending on the desktop agent. Consult the host environment documentation for information on configuring new applications. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor comment, but I'd move the appD file out of the src dir and into the root of the project (I missed the link and went looking for it)
@@ -0,0 +1,5 @@ | |||
describe("fdc3.getOrCreateChannel", () => { | |||
it("Method is callable", async () => { | |||
await window.fdc3.getOrCreateChannel("FDC3Conformance"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume this case will be expanded in the next version to check a Channel object was actually returned.
@@ -0,0 +1,5 @@ | |||
describe("fdc3.getSystemChannels", () => { | |||
it("Method is callable", async () => { | |||
await window.fdc3.getSystemChannels(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again I expect this will be expanded in the next iteration to check that the expected response was received, particularly as the joinChannel test relies on it doing so
it("Method is callable", async () => { | ||
try { | ||
await window.fdc3.open("ThisAppDoesNotExist"); | ||
throw ExpectedErrorNotThrownError; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
throw ExpectedErrorNotThrownError; | |
throw new Error(ExpectedErrorNotThrownError); |
await window.fdc3.findIntent("ThisIntentDoesNotExist"); | ||
throw ExpectedErrorNotThrownError; | ||
} catch (ex) { | ||
if (ex !== ResolveError.NoAppsFound) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comparison might not be correct if an Error object was thrown rather than just the string message, which is best practice in JS and is technically whats described in the API docs:
If the resolution fails, the promise will return an Error with a string from the ResolveError enumeration.
if (ex !== ResolveError.NoAppsFound) { | |
if ((ex.message ?? ex) !== ResolveError.NoAppsFound) { |
if (ex !== ResolveError.NoAppsFound) { | ||
throw ex; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comparison might not be correct if an Error object was thrown rather than just the string message, which is best practice in JS and is technically whats described in the API docs:
If the resolution fails, the promise will return an Error with a string from the ResolveError enumeration.
if (ex !== ResolveError.NoAppsFound) { | |
throw ex; | |
if ((ex.message ?? ex) !== ResolveError.NoAppsFound) { | |
throw new Error(ExpectedErrorNotThrownError + "\nException thrown: " + (ex.message ?? ex)); |
if (ex !== OpenError.AppNotFound) { | ||
throw ex; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comparison might not be correct if an Error object was thrown rather than just the string message, which is best practice in JS and is technically whats described in the API docs:
...it returns an Error with a string from the OpenError enumeration.
The re-thrown exception should probably be a variant of ExpectedErrorNotThrownError
if (ex !== OpenError.AppNotFound) { | |
throw ex; | |
if ((ex.message ?? ex) !== OpenError.AppNotFound) { | |
throw new Error(ExpectedErrorNotThrownError + "\nException thrown: " + (ex.message ?? ex)); |
if (ex !== ResolveError.NoAppsFound) { | ||
throw ex; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (ex !== ResolveError.NoAppsFound) { | |
throw ex; | |
if ((ex.message ?? ex) !== ResolveError.NoAppsFound) { | |
throw new Error(ExpectedErrorNotThrownError + "\nException thrown: " + (ex.message ?? ex)); |
|
||
try { | ||
await window.fdc3.raiseIntentForContext(context); | ||
throw ExpectedErrorNotThrownError; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
throw ExpectedErrorNotThrownError; | |
throw new Error (ExpectedErrorNotThrownError); |
if (ex !== ResolveError.NoAppsFound) { | ||
throw ex; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (ex !== ResolveError.NoAppsFound) { | |
throw ex; | |
if ((ex.message ?? ex) !== ResolveError.NoAppsFound) { | |
throw new Error(ExpectedErrorNotThrownError + "\nException thrown: " + (ex.message ?? ex)); |
"publisher": "FINOS", | ||
"icons": [ | ||
{ | ||
"icon": "https://fdc3.finos.org/img/fdc3-logo-2019.png" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logo doesn't work well as an icon, i'd suggest swapping out for http://fdc3.finos.org/toolbox/fdc3-workbench/fdc3-icon-256.png
(which you can copy into this project)
Move appDefinition.json to root of project and improve error handling
|
@kriswest I've added @AidanZealley to the CLA, can you please re-run the checks? |
/easycla |
1 similar comment
/easycla |
@ColinEberhardt submitted a LF support request as I don't see the checks being re-run, pretty sure I'm doing that correctly |
@ColinEberhardt support says:
When you've got that done, comment |
/easycla |
Closing as this project has moved to it own repo and will merge back a finalized build instead |
A simple first iteration of compliance tests that verifies the existence of desktop API methods.