-
Notifications
You must be signed in to change notification settings - Fork 278
Description
Bug Description
Issue found in test failures from upgrading SAC's version of UI5WC from 1.23.3 => 1.24.13
Upgrade change: https://github.wdf.sap.corp/orca/uqm/pull/39980
Logs:
Reproduction:
Run VarianceSection.test.tsx test in UQM repo with the above change that consumes UI5WC 1.24.13 (npm run jest-debug packages/sap/viz-design-panel/test/ui/feed/VarianceSection)
Investigation:
NPE exception thrown at file:///C:/SAPDevelop/uqm/node_modules/jsdom/lib/jsdom/living/custom-elements/CustomElementRegistry-impl.js -> "candidate._namespaceURI"
NPE is due to Window._document object being undefined.
Window._document object is undefined because it is cleared in the jsdom APIs by the jest framework during clean up steps.
The jest clean up steps are executed at the right time, but the call to CustomElementRegistry is done way too late (after all the test execution steps are completed).
The problem call originates from file:///C:/SAPDevelop/uqm/node_modules/@ui5/webcomponents-base/dist/UI5Element.js -> define() -> customElements.define(tag, this); (further originating from TimePicker)
The define() call in UI5Element for TimePicker is first called before any tests are executed, but by the time it reaches customeElements.define(tag, this), all the tests have been executed and the jest framework tears down everything, resulting in the above NPE. It appears as if there are some async dependency loading issues going on involving TimePicker and/or its dependencies.
I have confirmed that 1.23.8 is the first release version that regressed our tests. I have reason to believe that the offending change is possibly #9573.
Workarounds attempted:
Manually overriding FeaturesRegistry.registerFeature to not add the feature "InputSuggestions" to the feature map appears to resolve the load dependency issue and fixes the test, though doing this doesn't seem like a good idea.
Not known if this is an issue in production or not.
Affected Component
No response
Expected Behaviour
No response
Isolated Example
No response
Steps to Reproduce
...
Log Output, Stack Trace or Screenshots
No response
Priority
None
UI5 Web Components Version
1.24
Browser
Chrome
Operating System
No response
Additional Context
No response
Organization
No response
Declaration
- I’m not disclosing any internal or sensitive information.