feat(web): Gesture Recognizer unit testing 🐵#6970
feat(web): Gesture Recognizer unit testing 🐵#6970jahorton merged 37 commits intofeat/web/gesture-recognizer-mainfrom
Conversation
User Test ResultsTest specification and instructions User tests are not required Test Artifacts
|
ea5331e to
3763f3f
Compare
| 'desktopRoamAndReturn', | ||
| 'mobileSafeZoneCancel', | ||
| 'mobileProximityApproach', | ||
| 'embeddedBorderCancel', | ||
| 'hardBorderCancel', | ||
| 'popupLongRoamingEnd', | ||
| 'popupShimCancel', | ||
| 'popupSafePersistence', | ||
| 'basicMultitouch' |
There was a problem hiding this comment.
Each of these corresponds to a user test defined on #6878; they're listed in order of their definitions on that PR.
I opted to give them more meaningful/descriptive names as unit tests.
Note that 'popupSafePersistence' (#6878's TEST_4_3_2_SAFE_ZONE) is slightly tweaked from its original version on that PR, as its written form there was a little different from the intended test.
| @@ -0,0 +1,163 @@ | |||
| { | |||
There was a problem hiding this comment.
Note that it is ill-advisable to spend much time reviewing the recorded-sequence .json files found in this folder.
I've pretty-printed them so that they may be easily read and edited manually if necessary... but all of this is largely auto-generated. These files account for all but about 850 lines of changes at the time of this comment.
…o feat/web/recognizer-input-unit-testing-2
…o feat/web/recognizer-input-unit-testing-2
…o feat/web/recognizer-input-unit-testing-2
…o feat/web/recognizer-input-unit-testing-2
…o feat/web/recognizer-input-unit-testing-2
…o feat/web/recognizer-input-unit-testing-2
…/web/recognizer-input-unit-testing-2
Major updates to base branch, including dependency update
common/web/gesture-recognizer/src/tools/unit-test-resources/src/inputSequenceSimulator.ts
Show resolved
Hide resolved
common/web/gesture-recognizer/src/tools/unit-test-resources/src/inputSequenceSimulator.ts
Show resolved
Hide resolved
IMO, I think we want to be testing against stable, known versions. Currently we don't maintain the browser versions on build agents and probably best we don't start now. Also in my experience browsers don't always shut down correctly and that would create a maintenance burden on the agents.
This is only for tests, right, not for KeymanWeb itself? |
It's only tests that are using |

Continuing from the work seen in #6952, this PR establishes the unit-testing toolchain (karma, mocha, chai, etc) needed for gesture-recognizer unit tests to ensure robustness down the road.
After looking at the possible approaches we can take for unit testing the module, to ensure good code coverage, I believe we'll need two separate layers for unit tests.
Timestamp emulation is possible due to a feature in https://github.com/sinonjs/fake-timers we haven't been using before (as found within SinonJS). I did decide to update our dev-dependency version for the containing package, as it was missing a rather helpful method for implementing the desired unit tests -
runAllAsyncwasn't supported in the old version.At this point, we can only address point 1 above; there is no gesture segmentation or synthesis code written yet.
One big question worth asking:
Unlike with Keyman Engine for Web, we don't need to worry much about browser-specific keymappings here, let alone use of touch-alias elements, rotation, or the like. I could see worry about the shifting layout of the keyboard that results from rotation, but fortunately, the design addresses that almost inherently... and there's little issue with writing a unit test or two to ensure that shifts in important layout / configuration elements don't cause issues.
For now, I've provided a BrowserStack-based configuration (for CI) for the browser-based unit tests, but in my opinion, we should be safe to forego use of their service for this module if we could guarantee consistently-available browser(s) for use on all our build agents. ... which is probably why we're using BrowserStack, true. I don't think we need as extensive browser-coverage here, at the least.
@keymanapp-test-bot skip
All the previously-defined user tests are now unit tests!