-
Notifications
You must be signed in to change notification settings - Fork 273
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
[UI5WC 1.24.x / UI5WC4R 1.29.x Upgrade] Cannot read properties of null (reading '_namespaceURI') #10181
Comments
Hi @patrickwang10, In version 1.24.x the feature need to be initialised before all components. We've tried to add support for dynamic imported featured but it wasn't stable and that's why we reverted it. So the features should work the same as 1.23.x, 1.22.x and etc.
I tried to compare what are the changes between 1.23.x and 1.24.13 version of |
Hi @nnaydenow Can you elaborate a bit more on what you mean by the feature needs to be initialized before all components? Is there a guideline on best practices of initializing components before this dynamic import feature? We are trying to upgrade "@ui5/webcomponents" to 1.24.13. When I upgraded "@ui5/webcomponents" from 1.23.3 to 1.24.7, the tests passed On a second look at the code diff this time: v1.24.7...v1.24.8, |
Hi @patrickwang10, you can read more about the feature importing in the documentation here: https://sap.github.io/ui5-webcomponents/docs/advanced/using-features/ I tried reproducing the issue on your repository, but I couldn't. The command npm run jest-debug packages/sap/viz-design-panel/test/ui/feed/VarianceSection runs but it only outputs the following, no test execution starts: ➜ uqm git:(master) ✗ npm run jest-debug packages/sap/viz-design-panel/test/ui/feed/VarianceSection
> @sap/uqm@2022.1.0 jest-debug
> node --expose-gc --inspect-brk node_modules/jest/bin/jest.js --runInBand --config=./jest.config.js packages/sap/viz-design-panel/test/ui/feed/VarianceSection
Debugger listening on ws://127.0.0.1:9229/3d063abd-7941-4fa7-b060-7f68837a1c12
For help, see: https://nodejs.org/en/docs/inspector Could you please provide more details on how to reproduce the issue? Best regards, |
Hi, @patrickwang10, I managed to run the test and did some version comparison. I checkout the repository at the commit before the one that updates the web components to 1.24.8 (commit) and run the tests. The tests passed. Then I updated the version to 1.24.7 and run the tests. The tests passed. Then I updated the version to the latest 1.24.13 and run the tests. The tests still passed. I'm not sure what is the issue you are facing. Best regards, |
Hi @dobrinyonkov, Thanks for looking into this. We have merged our upgrade and disabled our tests temporarily. This will still be an issue while we try to re-enable the failing tests in the coming days. If you have just checked out to that commit (https://github.wdf.sap.corp/orca/uqm/pull/39980/files), you will need to re-enable the tests again (commented out) to reproduce the issue. Thanks, |
Discussed with @nnaydenow offline. Confirmed that the tests passed after the upgrade if 800c188 is reverted. Possible that there are some underlying timing problems before that 800c188 has now exposed into a hard failure. |
Hi Patric, As we talked about offline, this looks like a timing issue with the event loop, not the web components themselves. It seems that Jest’s This means the test wasn’t stable and only passed by chance. In a normal browser, this kind of task wouldn’t run when the browser is closed, so there would be no issue. But in the test environment, the cleanup happens too early, which causes the problem. Here are a few ideas to fix it:
Let me know if you want to discuss these options or explore other solutions. Regards, |
Hi @nnaydenow, The majority of our tests have been updated using approach #2. And as discussed, this is a test only issue, so closing this bug now. Thanks, |
Bug Description
Issue found in test failures from upgrading SAC's version of UI5WC from 1.23.3 => 1.24.13
![testLog](https://private-user-images.githubusercontent.com/160658858/386354469-e56ac778-8c84-49d8-96d2-090292a21d54.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0OTIwNTIsIm5iZiI6MTczOTQ5MTc1MiwicGF0aCI6Ii8xNjA2NTg4NTgvMzg2MzU0NDY5LWU1NmFjNzc4LThjODQtNDlkOC05NmQyLTA5MDI5MmEyMWQ1NC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjE0JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxNFQwMDA5MTJaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT04ZDA3ZmQ5MDkzYmJkMTMzMTM0NjY1YWNmZWFiMTlhYmViMmRkMzcyNGQ5NGRhNzNlYjIxYzQ5MDA2MDZhODNkJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.z9iaRSdjf0fjJn4NW7wW1YnIA1HxDr7DkmuSMS0t_L0)
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
The text was updated successfully, but these errors were encountered: