Skip to content

Clean up state left by backend specs and fix UI test role lookup - #3594

Open
Ekhorn wants to merge 1 commit into
mainfrom
test/clean-up-persisted-test-state
Open

Ekhorn wants to merge 1 commit into
mainfrom
test/clean-up-persisted-test-state

Conversation

@Ekhorn

@Ekhorn Ekhorn commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Description

Clean up state left by backend specs and fix UI test role lookup

Running ./gradlew test locally made the manager app tests fail. The backend specs left files in tmp/, and the app test manager loads them from the same storage dir. CI runs the app tests on a clean checkout, so it didn't catch this.

  • AssetModelTest deletes its CustomAsset type from tmp/asset_model in cleanupSpec. The configuration item tests listed its dynamicMeta item, which the Thing asset dialog doesn't show.
  • MapResourceTest deletes tmp/manager/mapsettings.json and tmp/map/eindhoven.mbtiles in cleanupSpec. Without that, the map tests started without a view or geocoder URL.
  • getClientRoles in the manager test fixture falls back to the admin config. The users page fixture called it without one, got a 403 and got an empty role list, so toHaveAllRoles and the "other roles unselected" check passed without checking anything.

Checklist

  • 1. Acceptance criteria of the linked issue(s) are met
  • 2. Tests are written and all tests pass
  • 3. Changes are manually tested by you and the reviewer
  • 4. Documentation is written or updated

@Ekhorn
Ekhorn requested a review from a team November 19, 2026 16:25
@Ekhorn Ekhorn self-assigned this Nov 19, 2026
AssetModelTest and MapResourceTest left a custom asset type and empty
map settings in tmp/, which the UI app test manager then loaded.
getClientRoles now falls back to the admin config, so the role
assertions in the users page fixture check the realm's roles.
@Ekhorn
Ekhorn force-pushed the test/clean-up-persisted-test-state branch from 80a67aa to df9e402 Compare November 19, 2026 17:02
@sonarqubecloud

Copy link
Copy Markdown

* @param config The axios request config
*/
async getClientRoles(config?: AxiosRequestConfig<any>) {
config ??= await this.adminConfig();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ This comment is AI-assisted ⚠️

Important: this only takes effect where manager.realm is set.
users.test.ts never calls manager.setup(...), so this.realm! is undefined → the request hits user/undefined/openremote/roles → 404 → the error is swallowed → getAllRoles() returns [] → the role assertions in that spec stay vacuous even with this fix.

It does work in test.setup.ts ("Add user called smartcity") and roles.test.ts, where setup() sets the realm. Consider setting this.realm when switching realm via the picker so users.test.ts asserts something too.

This branch has not been deployed

No deployments
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.

2 participants