feat(#10675): add e2e tests for UI Extensions (#10762)#11105
Conversation
|
@dianabarsan this is the final PR for UI extensions before we are ready to go do I am planning to send you the PR for Thank you! 🙏 |
dianabarsan
left a comment
There was a problem hiding this comment.
Very lovely. Minor nits inline.
| private registerErrorListener(extensionId: string) { | ||
| this.errorListener = (event: ErrorEvent | PromiseRejectionEvent) => { | ||
| const error = event instanceof PromiseRejectionEvent ? event.reason : event.error ?? event.message; | ||
| console.error(`Error in UI extension: "${extensionId}"`, error); |
There was a problem hiding this comment.
Is it possible that another thing, other than Angular and the UI extension, triggers an error here? It yes, it will get logged and attributed to the ui extension, which could be misleading.
| expect(await customElement.getText()).to.equal('Hello world'); | ||
|
|
||
| const telemetries = await getTelemetry(`ui-extension:header-tab:render`, user.username); | ||
| expect(telemetries).to.have.lengthOf(2); |
There was a problem hiding this comment.
Can you please add assertions about what the telemetries contain? Or at least a comment about why the header-tab has 2 and the sidebar-menu has 1.
| const utils = require('@utils'); | ||
| const commonPage = require('@page-objects/default/common/common.wdio.page'); | ||
| const loginPage = require('@page-objects/default/login/login.wdio.page'); | ||
| const { hamburguerMenuItemByOption, closeReloadModal } = require('@page-objects/default/common/common.wdio.page'); |
There was a problem hiding this comment.
hamburguers are yummy :D :D but nothing to a hamburger
Description
Closes #10675
The main goal of this PR was to add e2e tests. I ended up needing to fix a few more bugs along the way:
.jsfile was modified:app.component.tsto include UI Extension files (since these are not included in the service worker).generate-service-worker.jscode in api to include the properties for all extensions (even the online-only ones) in the hash value for the service worker. I think since the/ui-extensionsendpoint was registered with the service worker glob, the browser was automatically caching the first response from that endpoint even for online users and was not busting the cache on changes to online-only extensions because the service-worker hash was never changing.getResourcefunction) was failing for online users when refreshing the page because the extension loaded before the resource cache was warm.initmethod on the CustomResourceService so the CHTDatasourceService can wait for the cache to be warm.ui-extensions-tab.component.tsto listen for these errors and set them in theconsole.errorwhen they come.AI disclosure
I worked a lot with Claude on this, going back and forth on the different issues, etc. I have carefully pulled apart all of the code and confirmed it works as expected and does exactly what we want. Everything that is left here has either been heavily modified or reviewed by me.
Code review checklist
can_view_old_navigationpermission to see the old design. Test it has appropriate design for RTL languages.License
The software is provided under AGPL-3.0. Contributions to this project are accepted under the same license.