Skip to content

Initial UI tests#4794

Merged
marrobi merged 79 commits into
microsoft:mainfrom
JC-wk:ui-tests
Jan 29, 2026
Merged

Initial UI tests#4794
marrobi merged 79 commits into
microsoft:mainfrom
JC-wk:ui-tests

Conversation

@JC-wk

@JC-wk JC-wk commented Dec 19, 2025

Copy link
Copy Markdown
Collaborator

Resolves #4785 #3869

What is being addressed

There is currently no testing of the TRE UI
Testing showed a couple of ui issues which have also been fixed

How is this addressed

  • Creates Initial UI tests using vitest
  • Fixed components with issues which were reported by the tests.
  • Update documentation
  • Updated CHANGELOG.md
  • Incremented UI version
  • Added github workflows to run vitest and report results as pr comments <-- not able to fully test till it's in main (see comment)
  • added devcontainer extensions
yarn test:coverage
Test Files  27 passed (27)
      Tests  241 passed (241)
   Start at  10:24:37
   Duration  35.72s (transform 9.79s, setup 4.75s, collect 35.84s, tests 31.91s, environment 17.82s, prepare 2.18s)

 % Coverage report from v8
-------------------------------------|---------|----------|---------|---------|----------------------------------
File                                 | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s                
-------------------------------------|---------|----------|---------|---------|----------------------------------
All files                            |   82.13 |    68.15 |   63.52 |   83.87 |                                  
 src                                 |   64.28 |      100 |   28.57 |   62.96 |                                  
  App.scss                           |       0 |        0 |       0 |       0 |                                  
  App.tsx                            |   64.28 |      100 |   28.57 |   62.96 | 59,82-142                        
 src/components/shared               |   91.86 |    80.81 |   81.11 |   91.76 |                                  
  CliCommand.tsx                     |      90 |     87.5 |   83.33 |      90 | 23,33                            
  ComplexItemDisplay.tsx             |    92.3 |      100 |   85.71 |    92.3 | 29                               
  ConfirmCopyUrlToClipboard.tsx      |    92.3 |      100 |      80 |    92.3 | 46                               
  ConfirmDeleteResource.tsx          |     100 |      100 |     100 |     100 |                                  
  ConfirmDisableEnableResource.tsx   |      92 |      100 |   66.66 |      92 | 93-102                           
  ConfirmUpgradeResource.tsx         |   97.05 |     87.5 |      80 |   96.96 | 123                              
  CostsTag.tsx                       |   93.54 |    95.23 |     100 |   93.54 | 58,87                            
  ErrorPanel.tsx                     |     100 |      100 |     100 |     100 |                                  
  ExceptionLayout.tsx                |     100 |    77.77 |     100 |     100 | 20                               
  Footer.tsx                         |   95.23 |       50 |   85.71 |   95.23 | 67                               
  GenericErrorBoundary.tsx           |     100 |      100 |     100 |     100 |                                  
  PowerStateBadge.tsx                |     100 |      100 |     100 |     100 |                                  
  ResourceBody.tsx                   |     100 |       75 |     100 |     100 | 54                               
  ResourceCard.tsx                   |   75.86 |     65.3 |      50 |   75.43 | 59-62,69-75,80-86,266-283        
  ResourceHeader.tsx                 |     100 |       75 |     100 |     100 | 55                               
  SecuredByRole.tsx                  |      95 |    89.47 |   83.33 |      95 | 49                               
  SharedServiceItem.tsx              |   90.47 |      100 |      60 |   90.47 | 31-32                            
  StatusBadge.tsx                    |     100 |    83.33 |     100 |     100 | 65                               
  TopNav.tsx                         |     100 |       50 |     100 |     100 | 23                               
  UserMenu.tsx                       |     100 |      100 |     100 |     100 |                                  
 src/components/shared/notifications |      25 |        0 |       0 |      25 |                                  
  operationsSlice.ts                 |      25 |        0 |       0 |      25 | 19-34                            
 src/contexts                        |     100 |      100 |       0 |     100 |                                  
  AppRolesContext.ts                 |     100 |      100 |       0 |     100 |                                  
  CostsContext.ts                    |     100 |      100 |       0 |     100 |                                  
  CreateUpdateResourceContext.ts     |     100 |      100 |       0 |     100 |                                  
  WorkspaceContext.ts                |     100 |      100 |       0 |     100 |                                  
 src/hooks                           |   72.72 |    56.66 |   81.81 |    73.4 |                                  
  customReduxHooks.ts                |     100 |      100 |     100 |     100 |                                  
  useAuthApiCall.ts                  |   84.84 |    74.35 |     100 |   84.12 | 90-91,130-134,159-161            
  useComponentManager.ts             |   45.16 |     23.8 |   66.66 |   48.27 | 44,47-84                         
 src/models                          |      68 |        0 |      50 |   80.95 |                                  
  apiEndpoints.ts                    |     100 |      100 |     100 |     100 |                                  
  exceptions.ts                      |     100 |      100 |     100 |     100 |                                  
  loadingState.ts                    |     100 |      100 |     100 |     100 |                                  
  operation.ts                       |     100 |      100 |     100 |     100 |                                  
  resource.ts                        |   27.27 |        0 |       0 |   42.85 | 61-64                            
  resourceType.ts                    |     100 |      100 |     100 |     100 |                                  
  roleNames.ts                       |     100 |      100 |     100 |     100 |                                  
 src/test-utils                      |   71.95 |    58.57 |   51.21 |   79.16 |                                  
  common-mocks.tsx                   |   47.36 |     7.14 |      15 |   58.62 | ...5,113-115,144,157-168,188-192 
  fluentui-mocks.tsx                 |   89.28 |    65.21 |   82.35 |   88.88 | 247,410,575                      
  index.tsx                          |     100 |      100 |     100 |     100 |                                  
-------------------------------------|---------|----------|---------|---------|----------------------------------

* Initial UI tests

* Move to shared mocks

* Fix failing tests

* fix costs tag

* fix costs test failures

* fix(ui): resolve test failures in App.test.tsx

- Updated the MSAL mock in `App.test.tsx` to use a class-based mock, resolving the `TypeError: ... is not a constructor` error.
- Wrapped asynchronous operations in `act()` in `ConfirmCopyUrlToClipboard.test.tsx`, `ConfirmDisableEnableResource.test.tsx`, `GenericErrorBoundary.test.tsx`, and `SecuredByRole.test.tsx` to fix warnings and ensure proper state updates.

* fix(ui): resolve test failures in App.test.tsx

- Updated the MSAL mock in `App.test.tsx` to use a class-based mock, resolving the `TypeError: ... is not a constructor` error.
- Wrapped asynchronous operations in `act()` in `ResourceCard.test.tsx` to fix warnings and ensure proper state updates.

* fix(ui): resolve test failures and act warnings

- Updated the MSAL mock in `App.test.tsx` to use a class-based mock, resolving the `TypeError: ... is not a constructor` error.
- Wrapped asynchronous operations in `act()` in `ResourceCard.test.tsx`, `ExceptionLayout.test.tsx`, and `ConfirmDeleteResource.test.tsx` to fix warnings and ensure proper state updates.

* fix tests

* fix warnings

---------

Co-authored-by: Marcus Robinson <marrobi@microsoft.com>
Co-authored-by: James Griffin <me@JamesGriff.in>
Co-authored-by: James Chapman <james.chapman@necsu.onmicrosoft.com>
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
@JC-wk JC-wk requested a review from a team as a code owner December 19, 2025 10:00
@github-actions

github-actions Bot commented Dec 19, 2025

Copy link
Copy Markdown

Unit Test Results

241 tests   241 ✅  26s ⏱️
 27 suites    0 💤
  1 files      0 ❌

Results for commit 91af3fb.

♻️ This comment has been updated with latest results.

@JC-wk JC-wk requested a review from tamirkamara January 21, 2026 16:03
@JC-wk

JC-wk commented Jan 21, 2026

Copy link
Copy Markdown
Collaborator Author

Hi @tamirkamara I've added the fixes for the super-linter issues in to this branch. We could update eslint to flag more stuff like use of "any" as an example if we want to in a separate PR.
see: https://github.com/microsoft/AzureTRE/actions/runs/21216368345/job/61038518710?pr=4794

  2026-01-21 15:59:30 [INFO]   User-provided configuration file (/github/workspace/.github/linters/.tflint.hcl) exists
  2026-01-21 15:59:30 [INFO]   User-provided configuration file (/github/workspace/.github/linters/../../ui/app/eslint.config.js) exists
  2026-01-21 15:59:30 [INFO]   User-provided configuration file (/github/workspace/.github/linters/../../ui/app/eslint.config.js) exists
  2026-01-21 15:59:30 [INFO]   User-provided configuration file (/github/workspace/.github/linters/.yaml-lint.yml) exists

example eslint https://github.com/JC-wk/AzureTRE/blob/eslint/ui/app/eslint.config.js

@marrobi

marrobi commented Jan 28, 2026

Copy link
Copy Markdown
Member

/test-force-approve

UI Tests

@github-actions

Copy link
Copy Markdown

🤖 pr-bot 🤖

✅ Marking tests as complete (for commit 455e4ff)

(in response to this comment from @marrobi)

Comment thread .github/workflows/ui_test_results.yml Outdated
Comment thread Makefile
@marrobi

marrobi commented Jan 29, 2026

Copy link
Copy Markdown
Member

/test-force-approve 9456dba

@github-actions

Copy link
Copy Markdown

🤖 pr-bot 🤖

✅ Marking tests as complete (for commit 9456dba)

(in response to this comment from @marrobi)

@marrobi

marrobi commented Jan 29, 2026

Copy link
Copy Markdown
Member

/test-force-approve 91af3fb

@marrobi marrobi enabled auto-merge (squash) January 29, 2026 12:19
@github-actions

Copy link
Copy Markdown

🤖 pr-bot 🤖

✅ Marking tests as complete (for commit 91af3fb)

(in response to this comment from @marrobi)

@marrobi marrobi merged commit 6b13154 into microsoft:main Jan 29, 2026
11 checks passed
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.

npm test failures (jest is not defined)

5 participants