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

Update karma testing approach #663

Merged
merged 2 commits into from
Sep 22, 2023

Conversation

geographika
Copy link
Collaborator

Use Ext.Loader.syncRequire to load required classes in tests and wait for Ext.onReady to run tests.

Any test that uses a variable such as CpsiMapview.controller.grid.Grid will need to ensure it is loaded for the test by adding:

Ext.Loader.syncRequire(['CpsiMapview.controller.grid.Grid']);

Alternatively using Ext.create("CpsiMapview.controller.grid.Grid") can be used to dynamically load the test.

This is an attempt to avoid flaky tests when merging code - see failures at https://github.com/compassinformatics/cpsi-mapview/commits/master
These are mainly due to the test map component being ready causing errors such as TypeError: Cannot read properties of undefined (reading 'map'). Overriding the karma loading process, similar to the approach described at https://stackoverflow.com/a/27390799/179520, only runs the tests once the ExtJS framework is ready.

It also avoids warnings that ExtJS classes have been loaded twice, such as WARN: '[W] [Ext.define] Duplicate class name 'BasiGX.view.form.CoordinateTransform' specified, must be a non-empty string'.

The move to using syncRequire highlighted some discrepancies in class names and missing requires which have been addressed in other pull requests.

…lasses in tests and wait for Ext.onReady to run tests
@geographika geographika merged commit 0445f37 into compassinformatics:master Sep 22, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant