Add Warnings for Missing Interfaces in Device Introspection#486
Add Warnings for Missing Interfaces in Device Introspection#486AmerMesanovic wants to merge 2 commits intoastarte-platform:masterfrom
Conversation
Pavinati
left a comment
There was a problem hiding this comment.
You'll also have to change cypress tests regarding this page to catch the additional call to the installed interfaces
4521dd4 to
5cef66e
Compare
60f7903 to
cb7ab5a
Compare
| const isInterfaceInstalled = interfacesData.some( | ||
| (interfaceData) => interfaceData.name === iface.name, | ||
| ); |
There was a problem hiding this comment.
We should verify whether the exact interface is installed, so we should check for .major and .minor besides just .name.
cypress/e2e/device_page.cy.js
Outdated
| }); | ||
| }); | ||
|
|
||
| it.only('displays a warning when the device introspection contains an uninstalled interface', function () { |
There was a problem hiding this comment.
Let's not use it.only, otherwise the test runner will only run this test.
cypress/support/e2e.js
Outdated
| Cypress.Commands.add('checkInterfaceWarning', (interfaceName, interfacesData) => { | ||
| const interfaceNameString = typeof interfaceName === 'object' ? JSON.stringify(interfaceName) : interfaceName; | ||
| const isInterfaceInInterfaces = interfacesData.some(i => i.name.trim().toLowerCase() === interfaceNameString.trim().toLowerCase()); | ||
| cy.contains(interfaceNameString) | ||
| .parent() | ||
| .find('span.d-inline-flex') | ||
| .then(($badge) => { | ||
| if (isInterfaceInInterfaces) { | ||
| cy.wrap($badge).should('not.contain', '!'); | ||
| } else { | ||
| cy.wrap($badge).should('exist'); | ||
| cy.wrap($badge).should('contain', '!'); | ||
| } | ||
| }); | ||
| }); |
There was a problem hiding this comment.
Defining a new Cypress command can be useful for generic and reusable logic, however here you have a piece of code that is really targeting a specific test. I think it would be better to just write these few lines within the test directly, so it's easier to follow the logic within the same context.
Specifically, since in the test we want to verify a specific condition (that a warning is displayed when the interface is not installed), I suggest being explicit and test just that.
Right now it's not straightforward which interface should generate a warning and which not (if any).
We could setup the fixtures with just not existing interfaces, and then verify only the condition that a warning is shown.
Added a warning indicator for interfaces not installed in the realm. Links are removed for such interfaces. Signed-off-by: AmerMesanovic <amer.mesanovic@secomind.com>
a7dd8a9 to
ec7bd50
Compare
fd11d8a to
73d85f9
Compare
Introduced a test to verify that a warning is displayed when a device's introspection includes an interface that is not installed. Signed-off-by: AmerMesanovic <amer.mesanovic@secomind.com>
73d85f9 to
0c4ceaa
Compare
Added a warning indicator for interfaces not installed in the realm. Links are removed for such interfaces.
Screens:

