diff --git a/@xen-orchestra/web-core/lib/components/progress-bar-group-with-states/VtsProgressBarGroupWithStates.vue b/@xen-orchestra/web-core/lib/components/progress-bar-group-with-states/VtsProgressBarGroupWithStates.vue
new file mode 100644
index 0000000000..f3e4b87bcc
--- /dev/null
+++ b/@xen-orchestra/web-core/lib/components/progress-bar-group-with-states/VtsProgressBarGroupWithStates.vue
@@ -0,0 +1,39 @@
+
+
+
+ {{ t('error-no-data') }}
+
+
+ {{ t('no-data-to-calculate') }}
+
+
+
+
+
+
+
+
diff --git a/@xen-orchestra/web/docs/tests/factories.md b/@xen-orchestra/web/docs/tests/factories.md
index 3227d381ec..59f714806d 100644
--- a/@xen-orchestra/web/docs/tests/factories.md
+++ b/@xen-orchestra/web/docs/tests/factories.md
@@ -2,20 +2,21 @@
Domain objects are created through factories in `src/test/`, one per object type:
-| Factory | Builds |
-| ------------------ | ------------------- |
-| `createVm` | `FrontXoVm` |
-| `createHost` | `FrontXoHost` |
-| `createServer` | `FrontXoServer` |
-| `createPool` | `FrontXoPool` |
-| `createSr` | `FrontXoSr` |
-| `createVbd` | `FrontXoVbd` |
-| `createVdi` | `FrontXoVdi` |
-| `createVmSnapshot` | `FrontXoVmSnapshot` |
-| `createPlugin` | `FrontXoPlugin` |
-| `createHostStats` | `XapiHostStats` |
-| `createVmStats` | `XapiVmStats` |
-| `createPoolStats` | `XapiPoolStats` |
+| Factory | Builds |
+| --------------------------------- | ------------------------------------------ |
+| `createVm` | `FrontXoVm` |
+| `createHost` | `FrontXoHost` |
+| `createServer` | `FrontXoServer` |
+| `createPool` | `FrontXoPool` |
+| `createSr` | `FrontXoSr` |
+| `createVbd` | `FrontXoVbd` |
+| `createVdi` | `FrontXoVdi` |
+| `createVmSnapshot` | `FrontXoVmSnapshot` |
+| `createPlugin` | `FrontXoPlugin` |
+| `createHostStats` | `XapiHostStats` |
+| `createVmStats` | `XapiVmStats` |
+| `createPoolStats` | `XapiPoolStats` |
+| `createPoolDashboardTopFiveUsage` | `XoPoolDashboard` (top-five usage section) |
`createPoolStats` composes `createHostStats`, since pool stats are one entry per host: pass a `Partial` per host id, or an `{ error }` entry for a host whose stats the pool could not fetch.
@@ -26,7 +27,13 @@ const poolStats = createPoolStats({
})
```
-Shared _helper_ factories live there too — `mount-composable.ts`, `mount-chart-card.ts`, `create-enhanced-data-helpers.ts`, `global-test-config.ts`, `create-test-router.ts`, `create-job-result.ts` (what a mocked `defineJob` composable returns), `create-action-item.ts` (a menu / button `LeafActionItem`), `create-plugin-actions.ts` (what a mocked `useXoPluginActions` returns), `find-labelled-values.ts`, `find-tags.ts` (the labels of the rendered tags), `find-titles.ts` (the card and section titles), `find-tooltip-content.ts` (the tooltip an element shows on hover), `get-button.ts` (a button by its label), `get-checkbox.ts` (the input of a `UiCheckbox` by its label), `drawer.ts` (submit or cancel a drawer, read its buttons), `select.ts` (open a `VtsSelect`, read or pick its options), `mount-json-schema-form.ts` (a JSON schema form, or a composable run in one of its fields), `json-schema-item-label.ts` (the labels of the items of a JSON schema list), `i18n.ts` and `linear-chart-stub.ts`.
+`createPoolDashboardTopFiveUsage` builds the `hosts` and `vms` top-five usage sections of an `XoPoolDashboard`. Both metrics of a section default to empty, so a card test fills in only the one it exercises:
+
+```typescript
+const dashboard = createPoolDashboardTopFiveUsage({ cpu: [createHostCpuUsage()] }, { cpu: [createVmCpuUsage()] })
+```
+
+Shared _helper_ factories live there too — `mount-composable.ts`, `mount-chart-card.ts`, `create-enhanced-data-helpers.ts`, `global-test-config.ts`, `create-test-router.ts`, `create-job-result.ts` (what a mocked `defineJob` composable returns), `create-action-item.ts` (a menu / button `LeafActionItem`), `create-plugin-actions.ts` (what a mocked `useXoPluginActions` returns), `find-rendered-values.ts`, `find-titles.ts` (the card and section titles), `find-tooltip-content.ts` (the tooltip an element shows on hover), `get-button.ts` (a button by its label), `get-checkbox.ts` (the input of a `UiCheckbox` by its label), `drawer.ts` (submit or cancel a drawer, read its buttons), `select.ts` (open a `VtsSelect`, read or pick its options), `mount-json-schema-form.ts` (a JSON schema form, or a composable run in one of its fields), `json-schema-item-label.ts` (the labels of the items of a JSON schema list), `i18n.ts` and `linear-chart-stub.ts`.
Each factory returns a **fully-populated** object of the real front-end type and accepts a `Partial` of overrides, spread last, so a test only states the fields relevant to its case:
diff --git a/@xen-orchestra/web/docs/tests/testing-components.md b/@xen-orchestra/web/docs/tests/testing-components.md
index fa28929ddc..7d7ca1bb91 100644
--- a/@xen-orchestra/web/docs/tests/testing-components.md
+++ b/@xen-orchestra/web/docs/tests/testing-components.md
@@ -61,7 +61,7 @@ expect(labelledValues).toEqual({ [t('vga')]: t('disabled'), [t('video-ram')]: '8
Prefer this shape: one assertion covering every row a user sees, and it fails loudly when a value lands under the wrong label. Assert against **class names and semantic elements**, never a positional chain of child indexes.
-`src/test/find-labelled-values.ts` does exactly that reduction, so a card test does not re-roll it:
+`src/test/find-rendered-values.ts` does exactly that reduction, so a card test does not re-roll it:
| Helper | Reads |
| ------------------------ | ---------------------------------------------------------- |
@@ -91,6 +91,22 @@ expect(wrapper.findAll('.vts-card-row-key-value').map(row => row.get('.value').t
When a card mixes deterministic values with environment-derived ones (a relative start time, a formatted date), pin the deterministic rows with `toMatchObject` and cover the composition separately by asserting the **list of labels, in order** — the formatted values themselves belong in the test of the composable that derives them.
+Two more readers live in the same file, for output that is not a label/value pair:
+
+| Helper | Reads |
+| --------------- | ----------------------------------------------------------------- |
+| `findTableRows` | the `tbody` of a table, as one array of **cell** texts per row |
+| `findTags` | every `UiTag`, as its text, in the order the component lists them |
+
+```typescript
+expect(findTableRows(wrapper)).toEqual([
+ ['XSAPATCH-1', '1.0'],
+ ['XSAPATCH-2', '2.0'],
+])
+```
+
+`findTableRows` reads cells rather than each row's whole text for the same reason the helpers above split label from value: `row.text()` concatenates the columns, so a patch named `XSAPATCH-1` at version `1.0` and one named `XSAPATCH-11` at version `.0` read identically.
+
### Never spell out a translation
A rendered label or a translated value is wording the component does not own, so [asserting behaviour](./assert-behaviour.md) means naming the **key**, not the English string. `src/test/i18n.ts` exposes the `t` of the very instance `createGlobalTestConfig()` installs:
@@ -159,25 +175,27 @@ Keep it to one representative value: how the formatter handles the whole range,
## Legend cards
-A donut card and a progress-bar card both render their values through `UiLegend`, which keeps the label and the value addressable:
+A donut card and a progress-bar card both render their values through `UiLegend`, which keeps the label and the value addressable. `src/test/find-rendered-values.ts` reads them, so a card test does not re-roll the query:
+
+| Helper | Reads |
+| ----------------------------- | ------------------------------------------------------ |
+| `findLegends` | every `UiLegend`, as ordered `[label, value]` pairs |
+| `findProgressBarGroupLegends` | the same, grouped per `VtsProgressBarGroup` |
+| `findCardNumbers` | every `UiCardNumbers` a card lays out beside its chart |
```typescript
-function findLegends(wrapper: VueWrapper) {
- return wrapper
- .findAll('.ui-legend')
- .map(legend => [legend.get('.label').text(), legend.get('.value-and-unit').text()])
-}
-
expect(findLegends(wrapper)).toEqual([
[t('vm:status:running', 2), '2'],
[t('vm:status:halted', 2), '1'],
])
```
+Pairs rather than a record: a card may legend the same label twice, and the order it lists them in is part of what a user reads.
+
Three things shape those assertions:
- `VtsProgressBarGroup` sorts **descending by default**, so the expected order is the busiest first, not the order the payload listed.
-- A card holding several legend groups — `PoolDashboardStatus` shows one for its hosts and one for its VMs — is queried per group (`wrapper.findAll('.vts-donut-chart-with-legend')`, then the legends inside each). A flat `findAll('.ui-legend')` collapses the groups into one list, and an assertion on it no longer says which group a value landed in.
+- A card holding several legend groups — `PoolDashboardStatus` shows one for its hosts and one for its VMs — is queried per group: `findProgressBarGroupLegends` does that for progress-bar groups, while a donut card goes through `wrapper.findAll('.vts-donut-chart-with-legend')` and the legends inside each. A flat `findLegends` collapses the groups into one list, and an assertion on it no longer says which group a value landed in.
- `VtsStateHero` renders its own wording ahead of the slot: an `all-done` hero reads `'All good!Patches up to date'`. Assert the part the component owns with `toContain`.
## Routing
diff --git a/@xen-orchestra/web/src/modules/backup-job/components/list/panel/card-items/BackupJobRunItem.unit.test.ts b/@xen-orchestra/web/src/modules/backup-job/components/list/panel/card-items/BackupJobRunItem.unit.test.ts
index bf875aea60..86fe2a6e7d 100644
--- a/@xen-orchestra/web/src/modules/backup-job/components/list/panel/card-items/BackupJobRunItem.unit.test.ts
+++ b/@xen-orchestra/web/src/modules/backup-job/components/list/panel/card-items/BackupJobRunItem.unit.test.ts
@@ -7,7 +7,7 @@ import type {
import type { useXoRoutes } from '@/shared/remote-resources/use-xo-routes.ts'
import { createBackupLog, createBackupLogTask } from '@/test/create-backup-log.ts'
import { createSchedule } from '@/test/create-schedule.ts'
-import { findCardLabelledValues } from '@/test/find-labelled-values.ts'
+import { findCardLabelledValues } from '@/test/find-rendered-values.ts'
import { createGlobalTestConfig } from '@/test/global-test-config.ts'
import { t } from '@/test/i18n.ts'
import UiLink from '@core/components/ui/link/UiLink.vue'
diff --git a/@xen-orchestra/web/src/modules/backup-job/components/list/panel/cards/BackupJobBackedUpVmsCard.unit.test.ts b/@xen-orchestra/web/src/modules/backup-job/components/list/panel/cards/BackupJobBackedUpVmsCard.unit.test.ts
index e88a4bf30d..5707132209 100644
--- a/@xen-orchestra/web/src/modules/backup-job/components/list/panel/cards/BackupJobBackedUpVmsCard.unit.test.ts
+++ b/@xen-orchestra/web/src/modules/backup-job/components/list/panel/cards/BackupJobBackedUpVmsCard.unit.test.ts
@@ -4,7 +4,7 @@ import type { FrontXoPool, useXoPoolCollection } from '@/modules/pool/remote-res
import type { FrontXoVm, useXoVmCollection } from '@/modules/vm/remote-resources/use-xo-vm-collection.ts'
import { createPool } from '@/test/create-pool.ts'
import { createVm } from '@/test/create-vm.ts'
-import { findCardLabelledValues } from '@/test/find-labelled-values.ts'
+import { findCardLabelledValues } from '@/test/find-rendered-values.ts'
import { createGlobalTestConfig } from '@/test/global-test-config.ts'
import { t } from '@/test/i18n.ts'
import VtsTag from '@core/components/tag/VtsTag.vue'
diff --git a/@xen-orchestra/web/src/modules/backup-job/components/list/panel/cards/BackupJobInfosCard.unit.test.ts b/@xen-orchestra/web/src/modules/backup-job/components/list/panel/cards/BackupJobInfosCard.unit.test.ts
index 80dce1dd9d..bc756f9655 100644
--- a/@xen-orchestra/web/src/modules/backup-job/components/list/panel/cards/BackupJobInfosCard.unit.test.ts
+++ b/@xen-orchestra/web/src/modules/backup-job/components/list/panel/cards/BackupJobInfosCard.unit.test.ts
@@ -9,7 +9,7 @@ import type {
import type { useXoRoutes } from '@/shared/remote-resources/use-xo-routes.ts'
import { createMetadataBackupJob, createVmBackupJob } from '@/test/create-backup-job.ts'
import { createSr } from '@/test/create-sr.ts'
-import { findCardLabelledValues } from '@/test/find-labelled-values.ts'
+import { findCardLabelledValues } from '@/test/find-rendered-values.ts'
import { createGlobalTestConfig } from '@/test/global-test-config.ts'
import { t } from '@/test/i18n.ts'
import VtsCopyAllMenuItem from '@core/components/copy-all-menu-item/VtsCopyAllMenuItem.vue'
diff --git a/@xen-orchestra/web/src/modules/backup-job/components/list/panel/cards/BackupJobSchedulesCard.unit.test.ts b/@xen-orchestra/web/src/modules/backup-job/components/list/panel/cards/BackupJobSchedulesCard.unit.test.ts
index 8b3fc5172a..51fa9e25cd 100644
--- a/@xen-orchestra/web/src/modules/backup-job/components/list/panel/cards/BackupJobSchedulesCard.unit.test.ts
+++ b/@xen-orchestra/web/src/modules/backup-job/components/list/panel/cards/BackupJobSchedulesCard.unit.test.ts
@@ -3,7 +3,7 @@ import type { FrontXoSchedule } from '@/modules/schedule/remote-resources/use-xo
import { getScheduleNextRun } from '@/modules/schedule/utils/xo-schedule.util.ts'
import type { useXoRoutes } from '@/shared/remote-resources/use-xo-routes.ts'
import { createSchedule } from '@/test/create-schedule.ts'
-import { findCardLabelledValues } from '@/test/find-labelled-values.ts'
+import { findCardLabelledValues } from '@/test/find-rendered-values.ts'
import { createGlobalTestConfig } from '@/test/global-test-config.ts'
import { t } from '@/test/i18n.ts'
import VtsDivider from '@core/components/divider/VtsDivider.vue'
diff --git a/@xen-orchestra/web/src/modules/backup-job/components/list/panel/cards/BackupJobSettingsCard.unit.test.ts b/@xen-orchestra/web/src/modules/backup-job/components/list/panel/cards/BackupJobSettingsCard.unit.test.ts
index 37f6cc1ca3..85e61bc322 100644
--- a/@xen-orchestra/web/src/modules/backup-job/components/list/panel/cards/BackupJobSettingsCard.unit.test.ts
+++ b/@xen-orchestra/web/src/modules/backup-job/components/list/panel/cards/BackupJobSettingsCard.unit.test.ts
@@ -2,7 +2,7 @@ import BackupJobSettingsCard from '@/modules/backup-job/components/list/panel/ca
import type { FrontAnyXoBackupJob } from '@/modules/backup-job/remote-resources/use-xo-backup-job-collection.ts'
import type { FrontXoProxy, useXoProxyCollection } from '@/modules/proxy/remote-resources/use-xo-proxy-collection.ts'
import { createMetadataBackupJob, createMirrorBackupJob, createVmBackupJob } from '@/test/create-backup-job.ts'
-import { findCardLabelledValues } from '@/test/find-labelled-values.ts'
+import { findCardLabelledValues } from '@/test/find-rendered-values.ts'
import { createGlobalTestConfig } from '@/test/global-test-config.ts'
import { t } from '@/test/i18n.ts'
import VtsCopyAllMenuItem from '@core/components/copy-all-menu-item/VtsCopyAllMenuItem.vue'
diff --git a/@xen-orchestra/web/src/modules/backup-log/components/list/panel/cards/BackupLogInfosCard.unit.test.ts b/@xen-orchestra/web/src/modules/backup-log/components/list/panel/cards/BackupLogInfosCard.unit.test.ts
index d94a0fa7a0..81aab40dc2 100644
--- a/@xen-orchestra/web/src/modules/backup-log/components/list/panel/cards/BackupLogInfosCard.unit.test.ts
+++ b/@xen-orchestra/web/src/modules/backup-log/components/list/panel/cards/BackupLogInfosCard.unit.test.ts
@@ -12,7 +12,7 @@ import type { useXoRoutes } from '@/shared/remote-resources/use-xo-routes.ts'
import { createBackupLog, createBackupLogSrTask, createBackupLogVmTask } from '@/test/create-backup-log.ts'
import { createSr } from '@/test/create-sr.ts'
import { createVm } from '@/test/create-vm.ts'
-import { findCardCopiedValues, findCardLabelledValues } from '@/test/find-labelled-values.ts'
+import { findCardCopiedValues, findCardLabelledValues } from '@/test/find-rendered-values.ts'
import { createGlobalTestConfig } from '@/test/global-test-config.ts'
import { t } from '@/test/i18n.ts'
import UiLink from '@core/components/ui/link/UiLink.vue'
diff --git a/@xen-orchestra/web/src/modules/backup-log/components/list/panel/cards/BackupLogSizeAndSpeedCard.unit.test.ts b/@xen-orchestra/web/src/modules/backup-log/components/list/panel/cards/BackupLogSizeAndSpeedCard.unit.test.ts
index 733d5c6570..58e23371f0 100644
--- a/@xen-orchestra/web/src/modules/backup-log/components/list/panel/cards/BackupLogSizeAndSpeedCard.unit.test.ts
+++ b/@xen-orchestra/web/src/modules/backup-log/components/list/panel/cards/BackupLogSizeAndSpeedCard.unit.test.ts
@@ -6,7 +6,7 @@ import {
createBackupLogTransferTask,
createBackupLogVmTask,
} from '@/test/create-backup-log.ts'
-import { findCardCopiedValues, findCardLabelledValues } from '@/test/find-labelled-values.ts'
+import { findCardCopiedValues, findCardLabelledValues } from '@/test/find-rendered-values.ts'
import { createGlobalTestConfig } from '@/test/global-test-config.ts'
import { t } from '@/test/i18n.ts'
import { formatSizeRaw } from '@core/utils/size.util.ts'
diff --git a/@xen-orchestra/web/src/modules/backup-repository/components/detail/BackupRepositoryDetailAzureAzurite.unit.test.ts b/@xen-orchestra/web/src/modules/backup-repository/components/detail/BackupRepositoryDetailAzureAzurite.unit.test.ts
index 623038c624..8ee8c00c6f 100644
--- a/@xen-orchestra/web/src/modules/backup-repository/components/detail/BackupRepositoryDetailAzureAzurite.unit.test.ts
+++ b/@xen-orchestra/web/src/modules/backup-repository/components/detail/BackupRepositoryDetailAzureAzurite.unit.test.ts
@@ -1,6 +1,6 @@
import BackupRepositoryDetailAzureAzurite from '@/modules/backup-repository/components/detail/BackupRepositoryDetailAzureAzurite.vue'
import { MASKED_SECRET } from '@/modules/backup-repository/utils/xo-backup-repository.util.ts'
-import { findLabelledValues } from '@/test/find-labelled-values.ts'
+import { findLabelledValues } from '@/test/find-rendered-values.ts'
import { createGlobalTestConfig } from '@/test/global-test-config.ts'
import { t } from '@/test/i18n.ts'
import { mount } from '@vue/test-utils'
diff --git a/@xen-orchestra/web/src/modules/backup-repository/components/detail/BackupRepositoryDetailGeneralInfo.unit.test.ts b/@xen-orchestra/web/src/modules/backup-repository/components/detail/BackupRepositoryDetailGeneralInfo.unit.test.ts
index 5ca16b9574..48955a220e 100644
--- a/@xen-orchestra/web/src/modules/backup-repository/components/detail/BackupRepositoryDetailGeneralInfo.unit.test.ts
+++ b/@xen-orchestra/web/src/modules/backup-repository/components/detail/BackupRepositoryDetailGeneralInfo.unit.test.ts
@@ -2,7 +2,7 @@ import BackupRepositoryDetailGeneralInfo from '@/modules/backup-repository/compo
import type { FrontXoBackupRepository } from '@/modules/backup-repository/remote-resources/use-xo-backup-repository-collection.ts'
import type { useXoProxyCollection } from '@/modules/proxy/remote-resources/use-xo-proxy-collection.ts'
import { createBr } from '@/test/create-br.ts'
-import { findLabelledValues } from '@/test/find-labelled-values.ts'
+import { findLabelledValues } from '@/test/find-rendered-values.ts'
import { createGlobalTestConfig } from '@/test/global-test-config.ts'
import { t } from '@/test/i18n.ts'
import type { XoProxy } from '@vates/types'
diff --git a/@xen-orchestra/web/src/modules/backup-repository/components/detail/BackupRepositoryDetailLocal.unit.test.ts b/@xen-orchestra/web/src/modules/backup-repository/components/detail/BackupRepositoryDetailLocal.unit.test.ts
index b8fc3abc69..287b5ab1c5 100644
--- a/@xen-orchestra/web/src/modules/backup-repository/components/detail/BackupRepositoryDetailLocal.unit.test.ts
+++ b/@xen-orchestra/web/src/modules/backup-repository/components/detail/BackupRepositoryDetailLocal.unit.test.ts
@@ -1,5 +1,5 @@
import BackupRepositoryDetailLocal from '@/modules/backup-repository/components/detail/BackupRepositoryDetailLocal.vue'
-import { findLabelledValues } from '@/test/find-labelled-values.ts'
+import { findLabelledValues } from '@/test/find-rendered-values.ts'
import { createGlobalTestConfig } from '@/test/global-test-config.ts'
import { t } from '@/test/i18n.ts'
import { mount } from '@vue/test-utils'
diff --git a/@xen-orchestra/web/src/modules/backup-repository/components/detail/BackupRepositoryDetailNfs.unit.test.ts b/@xen-orchestra/web/src/modules/backup-repository/components/detail/BackupRepositoryDetailNfs.unit.test.ts
index 5fde7eb165..f0dc600cd6 100644
--- a/@xen-orchestra/web/src/modules/backup-repository/components/detail/BackupRepositoryDetailNfs.unit.test.ts
+++ b/@xen-orchestra/web/src/modules/backup-repository/components/detail/BackupRepositoryDetailNfs.unit.test.ts
@@ -1,5 +1,5 @@
import BackupRepositoryDetailNfs from '@/modules/backup-repository/components/detail/BackupRepositoryDetailNfs.vue'
-import { findLabelledValues } from '@/test/find-labelled-values.ts'
+import { findLabelledValues } from '@/test/find-rendered-values.ts'
import { createGlobalTestConfig } from '@/test/global-test-config.ts'
import { t } from '@/test/i18n.ts'
import { mount } from '@vue/test-utils'
diff --git a/@xen-orchestra/web/src/modules/backup-repository/components/detail/BackupRepositoryDetailS3.unit.test.ts b/@xen-orchestra/web/src/modules/backup-repository/components/detail/BackupRepositoryDetailS3.unit.test.ts
index 09f5294ce7..ad33887914 100644
--- a/@xen-orchestra/web/src/modules/backup-repository/components/detail/BackupRepositoryDetailS3.unit.test.ts
+++ b/@xen-orchestra/web/src/modules/backup-repository/components/detail/BackupRepositoryDetailS3.unit.test.ts
@@ -1,6 +1,6 @@
import BackupRepositoryDetailS3 from '@/modules/backup-repository/components/detail/BackupRepositoryDetailS3.vue'
import { MASKED_SECRET } from '@/modules/backup-repository/utils/xo-backup-repository.util.ts'
-import { findLabelledValues } from '@/test/find-labelled-values.ts'
+import { findLabelledValues } from '@/test/find-rendered-values.ts'
import { createGlobalTestConfig } from '@/test/global-test-config.ts'
import { t } from '@/test/i18n.ts'
import { mount } from '@vue/test-utils'
diff --git a/@xen-orchestra/web/src/modules/backup-repository/components/detail/BackupRepositoryDetailSmb.unit.test.ts b/@xen-orchestra/web/src/modules/backup-repository/components/detail/BackupRepositoryDetailSmb.unit.test.ts
index bed6805af6..0ec895df9b 100644
--- a/@xen-orchestra/web/src/modules/backup-repository/components/detail/BackupRepositoryDetailSmb.unit.test.ts
+++ b/@xen-orchestra/web/src/modules/backup-repository/components/detail/BackupRepositoryDetailSmb.unit.test.ts
@@ -1,6 +1,6 @@
import BackupRepositoryDetailSmb from '@/modules/backup-repository/components/detail/BackupRepositoryDetailSmb.vue'
import { MASKED_SECRET } from '@/modules/backup-repository/utils/xo-backup-repository.util.ts'
-import { findLabelledValues } from '@/test/find-labelled-values.ts'
+import { findLabelledValues } from '@/test/find-rendered-values.ts'
import { createGlobalTestConfig } from '@/test/global-test-config.ts'
import { t } from '@/test/i18n.ts'
import { mount } from '@vue/test-utils'
diff --git a/@xen-orchestra/web/src/modules/backup-repository/components/detail/BackupRepositoryDetailSpeed.unit.test.ts b/@xen-orchestra/web/src/modules/backup-repository/components/detail/BackupRepositoryDetailSpeed.unit.test.ts
index 532c8dc398..842cc118af 100644
--- a/@xen-orchestra/web/src/modules/backup-repository/components/detail/BackupRepositoryDetailSpeed.unit.test.ts
+++ b/@xen-orchestra/web/src/modules/backup-repository/components/detail/BackupRepositoryDetailSpeed.unit.test.ts
@@ -2,7 +2,7 @@ import BackupRepositoryDetailSpeed from '@/modules/backup-repository/components/
import type { useXoBackupRepositoryBenchmarkJob } from '@/modules/backup-repository/jobs/xo-backup-repository-benchmark.job.ts'
import type { FrontXoBackupRepository } from '@/modules/backup-repository/remote-resources/use-xo-backup-repository-collection.ts'
import { createBr } from '@/test/create-br.ts'
-import { findLabelledValues } from '@/test/find-labelled-values.ts'
+import { findLabelledValues } from '@/test/find-rendered-values.ts'
import { createGlobalTestConfig } from '@/test/global-test-config.ts'
import { t } from '@/test/i18n.ts'
import UiButtonIcon from '@core/components/ui/button-icon/UiButtonIcon.vue'
diff --git a/@xen-orchestra/web/src/modules/backup-repository/components/form/steps/NewBackupRepositoryReviewStep.unit.test.ts b/@xen-orchestra/web/src/modules/backup-repository/components/form/steps/NewBackupRepositoryReviewStep.unit.test.ts
index f9606ae0e0..e1f020a43d 100644
--- a/@xen-orchestra/web/src/modules/backup-repository/components/form/steps/NewBackupRepositoryReviewStep.unit.test.ts
+++ b/@xen-orchestra/web/src/modules/backup-repository/components/form/steps/NewBackupRepositoryReviewStep.unit.test.ts
@@ -6,7 +6,7 @@ import {
} from '@/modules/backup-repository/utils/xo-backup-repository-details-payload.util.ts'
import { MASKED_SECRET } from '@/modules/backup-repository/utils/xo-backup-repository.util.ts'
import type { FrontXoProxy, useXoProxyCollection } from '@/modules/proxy/remote-resources/use-xo-proxy-collection.ts'
-import { findLabelledValues } from '@/test/find-labelled-values.ts'
+import { findLabelledValues } from '@/test/find-rendered-values.ts'
import { createGlobalTestConfig } from '@/test/global-test-config.ts'
import { t } from '@/test/i18n.ts'
import { mountComposable } from '@/test/mount-composable.ts'
diff --git a/@xen-orchestra/web/src/modules/backup-repository/components/list/panel/cards/BackupRepositoryAzureAzuriteCard.unit.test.ts b/@xen-orchestra/web/src/modules/backup-repository/components/list/panel/cards/BackupRepositoryAzureAzuriteCard.unit.test.ts
index 4289250f3a..24f2617708 100644
--- a/@xen-orchestra/web/src/modules/backup-repository/components/list/panel/cards/BackupRepositoryAzureAzuriteCard.unit.test.ts
+++ b/@xen-orchestra/web/src/modules/backup-repository/components/list/panel/cards/BackupRepositoryAzureAzuriteCard.unit.test.ts
@@ -1,6 +1,6 @@
import BackupRepositoryAzureAzuriteCard from '@/modules/backup-repository/components/list/panel/cards/BackupRepositoryAzureAzuriteCard.vue'
import { MASKED_SECRET } from '@/modules/backup-repository/utils/xo-backup-repository.util.ts'
-import { findCardCopiedValues, findCardLabelledValues } from '@/test/find-labelled-values.ts'
+import { findCardCopiedValues, findCardLabelledValues } from '@/test/find-rendered-values.ts'
import { createGlobalTestConfig } from '@/test/global-test-config.ts'
import { t } from '@/test/i18n.ts'
import { mount } from '@vue/test-utils'
diff --git a/@xen-orchestra/web/src/modules/backup-repository/components/list/panel/cards/BackupRepositoryInfosCard.unit.test.ts b/@xen-orchestra/web/src/modules/backup-repository/components/list/panel/cards/BackupRepositoryInfosCard.unit.test.ts
index 683982a99c..12b731f452 100644
--- a/@xen-orchestra/web/src/modules/backup-repository/components/list/panel/cards/BackupRepositoryInfosCard.unit.test.ts
+++ b/@xen-orchestra/web/src/modules/backup-repository/components/list/panel/cards/BackupRepositoryInfosCard.unit.test.ts
@@ -2,7 +2,7 @@ import BackupRepositoryInfosCard from '@/modules/backup-repository/components/li
import type { FrontXoBackupRepository } from '@/modules/backup-repository/remote-resources/use-xo-backup-repository-collection.ts'
import type { useXoProxyCollection } from '@/modules/proxy/remote-resources/use-xo-proxy-collection.ts'
import { createBr } from '@/test/create-br.ts'
-import { findCardCopiedValues, findCardLabelledValues } from '@/test/find-labelled-values.ts'
+import { findCardCopiedValues, findCardLabelledValues } from '@/test/find-rendered-values.ts'
import { createGlobalTestConfig } from '@/test/global-test-config.ts'
import { t } from '@/test/i18n.ts'
import UiLink from '@core/components/ui/link/UiLink.vue'
diff --git a/@xen-orchestra/web/src/modules/backup-repository/components/list/panel/cards/BackupRepositoryLocalCard.unit.test.ts b/@xen-orchestra/web/src/modules/backup-repository/components/list/panel/cards/BackupRepositoryLocalCard.unit.test.ts
index b2413e9262..ca97c50daa 100644
--- a/@xen-orchestra/web/src/modules/backup-repository/components/list/panel/cards/BackupRepositoryLocalCard.unit.test.ts
+++ b/@xen-orchestra/web/src/modules/backup-repository/components/list/panel/cards/BackupRepositoryLocalCard.unit.test.ts
@@ -1,5 +1,5 @@
import BackupRepositoryLocalCard from '@/modules/backup-repository/components/list/panel/cards/BackupRepositoryLocalCard.vue'
-import { findCardCopiedValues, findCardLabelledValues } from '@/test/find-labelled-values.ts'
+import { findCardCopiedValues, findCardLabelledValues } from '@/test/find-rendered-values.ts'
import { createGlobalTestConfig } from '@/test/global-test-config.ts'
import { t } from '@/test/i18n.ts'
import { mount } from '@vue/test-utils'
diff --git a/@xen-orchestra/web/src/modules/backup-repository/components/list/panel/cards/BackupRepositoryNfsCard.unit.test.ts b/@xen-orchestra/web/src/modules/backup-repository/components/list/panel/cards/BackupRepositoryNfsCard.unit.test.ts
index b28bfeaab7..2420084598 100644
--- a/@xen-orchestra/web/src/modules/backup-repository/components/list/panel/cards/BackupRepositoryNfsCard.unit.test.ts
+++ b/@xen-orchestra/web/src/modules/backup-repository/components/list/panel/cards/BackupRepositoryNfsCard.unit.test.ts
@@ -1,5 +1,5 @@
import BackupRepositoryNfsCard from '@/modules/backup-repository/components/list/panel/cards/BackupRepositoryNfsCard.vue'
-import { findCardCopiedValues, findCardLabelledValues } from '@/test/find-labelled-values.ts'
+import { findCardCopiedValues, findCardLabelledValues } from '@/test/find-rendered-values.ts'
import { createGlobalTestConfig } from '@/test/global-test-config.ts'
import { t } from '@/test/i18n.ts'
import { mount } from '@vue/test-utils'
diff --git a/@xen-orchestra/web/src/modules/backup-repository/components/list/panel/cards/BackupRepositoryS3Card.unit.test.ts b/@xen-orchestra/web/src/modules/backup-repository/components/list/panel/cards/BackupRepositoryS3Card.unit.test.ts
index 675cd99c1c..2fae57c70c 100644
--- a/@xen-orchestra/web/src/modules/backup-repository/components/list/panel/cards/BackupRepositoryS3Card.unit.test.ts
+++ b/@xen-orchestra/web/src/modules/backup-repository/components/list/panel/cards/BackupRepositoryS3Card.unit.test.ts
@@ -1,6 +1,6 @@
import BackupRepositoryS3Card from '@/modules/backup-repository/components/list/panel/cards/BackupRepositoryS3Card.vue'
import { MASKED_SECRET } from '@/modules/backup-repository/utils/xo-backup-repository.util.ts'
-import { findCardCopiedValues, findCardLabelledValues } from '@/test/find-labelled-values.ts'
+import { findCardCopiedValues, findCardLabelledValues } from '@/test/find-rendered-values.ts'
import { createGlobalTestConfig } from '@/test/global-test-config.ts'
import { t } from '@/test/i18n.ts'
import { mount } from '@vue/test-utils'
diff --git a/@xen-orchestra/web/src/modules/backup-repository/components/list/panel/cards/BackupRepositorySmbCard.unit.test.ts b/@xen-orchestra/web/src/modules/backup-repository/components/list/panel/cards/BackupRepositorySmbCard.unit.test.ts
index 16606aca43..964b4e9daf 100644
--- a/@xen-orchestra/web/src/modules/backup-repository/components/list/panel/cards/BackupRepositorySmbCard.unit.test.ts
+++ b/@xen-orchestra/web/src/modules/backup-repository/components/list/panel/cards/BackupRepositorySmbCard.unit.test.ts
@@ -1,6 +1,6 @@
import BackupRepositorySmbCard from '@/modules/backup-repository/components/list/panel/cards/BackupRepositorySmbCard.vue'
import { MASKED_SECRET } from '@/modules/backup-repository/utils/xo-backup-repository.util.ts'
-import { findCardCopiedValues, findCardLabelledValues } from '@/test/find-labelled-values.ts'
+import { findCardCopiedValues, findCardLabelledValues } from '@/test/find-rendered-values.ts'
import { createGlobalTestConfig } from '@/test/global-test-config.ts'
import { t } from '@/test/i18n.ts'
import { mount } from '@vue/test-utils'
diff --git a/@xen-orchestra/web/src/modules/backup-repository/components/list/panel/cards/BackupRepositorySpeedCard.unit.test.ts b/@xen-orchestra/web/src/modules/backup-repository/components/list/panel/cards/BackupRepositorySpeedCard.unit.test.ts
index 49ec092654..77bae0e67c 100644
--- a/@xen-orchestra/web/src/modules/backup-repository/components/list/panel/cards/BackupRepositorySpeedCard.unit.test.ts
+++ b/@xen-orchestra/web/src/modules/backup-repository/components/list/panel/cards/BackupRepositorySpeedCard.unit.test.ts
@@ -3,7 +3,7 @@ import type { useXoBackupRepositoryBenchmarkJob } from '@/modules/backup-reposit
import type { FrontXoBackupRepository } from '@/modules/backup-repository/remote-resources/use-xo-backup-repository-collection.ts'
import { createBrBenchmark } from '@/test/create-br-benchmark.ts'
import { createBr } from '@/test/create-br.ts'
-import { findCardCopiedValues, findCardLabelledValues } from '@/test/find-labelled-values.ts'
+import { findCardCopiedValues, findCardLabelledValues } from '@/test/find-rendered-values.ts'
import { createGlobalTestConfig } from '@/test/global-test-config.ts'
import { t } from '@/test/i18n.ts'
import UiButtonIcon from '@core/components/ui/button-icon/UiButtonIcon.vue'
diff --git a/@xen-orchestra/web/src/modules/host/components/dashboard/HostDashboardCpuProvisioning.unit.test.ts b/@xen-orchestra/web/src/modules/host/components/dashboard/HostDashboardCpuProvisioning.unit.test.ts
index e21f12db4d..86f2ac5b26 100644
--- a/@xen-orchestra/web/src/modules/host/components/dashboard/HostDashboardCpuProvisioning.unit.test.ts
+++ b/@xen-orchestra/web/src/modules/host/components/dashboard/HostDashboardCpuProvisioning.unit.test.ts
@@ -3,7 +3,7 @@ import type { FrontXoHost, useXoHostCollection } from '@/modules/host/remote-res
import type { FrontXoVm, useXoVmCollection } from '@/modules/vm/remote-resources/use-xo-vm-collection.ts'
import { createHost } from '@/test/create-host.ts'
import { createVm } from '@/test/create-vm.ts'
-import { findCardNumbers } from '@/test/find-labelled-values.ts'
+import { findCardNumbers, findLegends } from '@/test/find-rendered-values.ts'
import { createGlobalTestConfig } from '@/test/global-test-config.ts'
import { t } from '@/test/i18n.ts'
import { VM_POWER_STATE } from '@vates/types'
@@ -137,7 +137,7 @@ it('labels the progress bar with the share of the cores in use', () => {
const wrapper = mountProvisioning()
- expect(wrapper.get('.ui-legend').text()).toBe(`${t('vcpus')}75%`)
+ expect(findLegends(wrapper)).toEqual([[t('vcpus'), '75%']])
})
it('overprovisions past the cores of the host', () => {
diff --git a/@xen-orchestra/web/src/modules/host/components/dashboard/HostDashboardPatches.unit.test.ts b/@xen-orchestra/web/src/modules/host/components/dashboard/HostDashboardPatches.unit.test.ts
index 32e96bd767..2b3669cdca 100644
--- a/@xen-orchestra/web/src/modules/host/components/dashboard/HostDashboardPatches.unit.test.ts
+++ b/@xen-orchestra/web/src/modules/host/components/dashboard/HostDashboardPatches.unit.test.ts
@@ -5,6 +5,7 @@ import type {
useXoHostMissingPatchesCollection,
} from '@/modules/host/remote-resources/use-xo-host-missing-patches-collection.ts'
import { createHost } from '@/test/create-host.ts'
+import { findTableRows } from '@/test/find-rendered-values.ts'
import { createGlobalTestConfig } from '@/test/global-test-config.ts'
import { t } from '@/test/i18n.ts'
import { mount } from '@vue/test-utils'
@@ -40,10 +41,6 @@ function mountPatches() {
})
}
-function findPatchRows(wrapper: ReturnType) {
- return wrapper.findAll('tbody tr').map(row => row.text())
-}
-
it('renders the card title', () => {
const wrapper = mountPatches()
@@ -75,14 +72,17 @@ it('lists one row per missing patch', () => {
const wrapper = mountPatches()
- expect(findPatchRows(wrapper)).toEqual(['XSAPATCH-11.0', 'XSAPATCH-22.0'])
+ expect(findTableRows(wrapper)).toEqual([
+ ['XSAPATCH-1', '1.0'],
+ ['XSAPATCH-2', '2.0'],
+ ])
})
it('reports the host as up to date when it misses no patch', () => {
const wrapper = mountPatches()
expect(wrapper.get('.vts-state-hero').text()).toContain(t('patches-up-to-date'))
- expect(findPatchRows(wrapper)).toEqual([])
+ expect(findTableRows(wrapper)).toEqual([])
})
it('reports the host as up to date while its patches are still loading', () => {
diff --git a/@xen-orchestra/web/src/modules/host/components/dashboard/HostDashboardQuickInfo.unit.test.ts b/@xen-orchestra/web/src/modules/host/components/dashboard/HostDashboardQuickInfo.unit.test.ts
index a8991af928..b85c8b3621 100644
--- a/@xen-orchestra/web/src/modules/host/components/dashboard/HostDashboardQuickInfo.unit.test.ts
+++ b/@xen-orchestra/web/src/modules/host/components/dashboard/HostDashboardQuickInfo.unit.test.ts
@@ -2,8 +2,7 @@ import HostDashboardQuickInfo from '@/modules/host/components/dashboard/HostDash
import type { FrontXoHost, useXoHostCollection } from '@/modules/host/remote-resources/use-xo-host-collection.ts'
import type { useXoVmCollection } from '@/modules/vm/remote-resources/use-xo-vm-collection.ts'
import { createHost } from '@/test/create-host.ts'
-import { findCopiedValues, findLabelledValues } from '@/test/find-labelled-values.ts'
-import { findTags } from '@/test/find-tags.ts'
+import { findCopiedValues, findLabelledValues, findTags } from '@/test/find-rendered-values.ts'
import { createGlobalTestConfig } from '@/test/global-test-config.ts'
import { t } from '@/test/i18n.ts'
import { HOST_POWER_STATE } from '@vates/types'
diff --git a/@xen-orchestra/web/src/modules/host/components/dashboard/HostDashboardRamProvisioning.unit.test.ts b/@xen-orchestra/web/src/modules/host/components/dashboard/HostDashboardRamProvisioning.unit.test.ts
index 0a48768e99..ed4eb72b16 100644
--- a/@xen-orchestra/web/src/modules/host/components/dashboard/HostDashboardRamProvisioning.unit.test.ts
+++ b/@xen-orchestra/web/src/modules/host/components/dashboard/HostDashboardRamProvisioning.unit.test.ts
@@ -1,7 +1,7 @@
import HostDashboardRamProvisioning from '@/modules/host/components/dashboard/HostDashboardRamProvisioning.vue'
import type { FrontXoHost, useXoHostCollection } from '@/modules/host/remote-resources/use-xo-host-collection.ts'
import { createHost } from '@/test/create-host.ts'
-import { findCardNumbers } from '@/test/find-labelled-values.ts'
+import { findCardNumbers, findLegends } from '@/test/find-rendered-values.ts'
import { createGlobalTestConfig } from '@/test/global-test-config.ts'
import { t } from '@/test/i18n.ts'
import { mount } from '@vue/test-utils'
@@ -60,5 +60,5 @@ it('labels the progress bar with the name of the host', () => {
createHost({ name_label: 'Primary Host', memory: { size: 4294967296, usage: 1073741824 } })
)
- expect(wrapper.get('.ui-legend').text()).toContain('Primary Host')
+ expect(findLegends(wrapper).map(([label]) => label)).toEqual(['Primary Host'])
})
diff --git a/@xen-orchestra/web/src/modules/host/components/dashboard/HostDashboardVmsStatus.unit.test.ts b/@xen-orchestra/web/src/modules/host/components/dashboard/HostDashboardVmsStatus.unit.test.ts
index eb87de7ead..900c7a3ff8 100644
--- a/@xen-orchestra/web/src/modules/host/components/dashboard/HostDashboardVmsStatus.unit.test.ts
+++ b/@xen-orchestra/web/src/modules/host/components/dashboard/HostDashboardVmsStatus.unit.test.ts
@@ -3,7 +3,7 @@ import type { FrontXoHost, useXoHostCollection } from '@/modules/host/remote-res
import type { FrontXoVm, useXoVmCollection } from '@/modules/vm/remote-resources/use-xo-vm-collection.ts'
import { createHost } from '@/test/create-host.ts'
import { createVm } from '@/test/create-vm.ts'
-import { findLegends } from '@/test/find-labelled-values.ts'
+import { findCardNumbers, findLegends } from '@/test/find-rendered-values.ts'
import { createGlobalTestConfig } from '@/test/global-test-config.ts'
import { t } from '@/test/i18n.ts'
import { VM_POWER_STATE } from '@vates/types'
@@ -102,7 +102,7 @@ it('totals the VMs of the host', () => {
const wrapper = mountVmsStatus()
- expect(wrapper.get('.ui-card-numbers').text()).toBe(`${t('total')}2`)
+ expect(findCardNumbers(wrapper)).toEqual([[t('total'), '2']])
})
it('keeps every power state in the legend for a host without VM', () => {
@@ -121,7 +121,7 @@ it('leaves out the VMs running on another host', () => {
const wrapper = mountVmsStatus()
- expect(wrapper.get('.ui-card-numbers').text()).toBe(`${t('total')}0`)
+ expect(findCardNumbers(wrapper)).toEqual([[t('total'), '0']])
})
it('follows the VMs of the host as the collection changes', async () => {
@@ -140,5 +140,5 @@ it('follows the VMs of the host as the collection changes', async () => {
[t('vm:status:suspended', 2), '0'],
[t('vm:status:halted', 2), '1'],
])
- expect(wrapper.get('.ui-card-numbers').text()).toBe(`${t('total')}2`)
+ expect(findCardNumbers(wrapper)).toEqual([[t('total'), '2']])
})
diff --git a/@xen-orchestra/web/src/modules/host/components/list/panel/card/HostHardwareSpecificationsCard.unit.test.ts b/@xen-orchestra/web/src/modules/host/components/list/panel/card/HostHardwareSpecificationsCard.unit.test.ts
index ad2f0db804..529ebeb64f 100644
--- a/@xen-orchestra/web/src/modules/host/components/list/panel/card/HostHardwareSpecificationsCard.unit.test.ts
+++ b/@xen-orchestra/web/src/modules/host/components/list/panel/card/HostHardwareSpecificationsCard.unit.test.ts
@@ -1,7 +1,7 @@
import HostHardwareSpecificationsCard from '@/modules/host/components/list/panel/card/HostHardwareSpecificationsCard.vue'
import type { FrontXoHost } from '@/modules/host/remote-resources/use-xo-host-collection.ts'
import { createHost } from '@/test/create-host.ts'
-import { findCardLabelledValues } from '@/test/find-labelled-values.ts'
+import { findCardLabelledValues } from '@/test/find-rendered-values.ts'
import { createGlobalTestConfig } from '@/test/global-test-config.ts'
import { t } from '@/test/i18n.ts'
import VtsCopyButton from '@core/components/copy-button/VtsCopyButton.vue'
diff --git a/@xen-orchestra/web/src/modules/host/components/system/HostSystemGeneralInformation.unit.test.ts b/@xen-orchestra/web/src/modules/host/components/system/HostSystemGeneralInformation.unit.test.ts
index 45fc9b395d..4aa817f866 100644
--- a/@xen-orchestra/web/src/modules/host/components/system/HostSystemGeneralInformation.unit.test.ts
+++ b/@xen-orchestra/web/src/modules/host/components/system/HostSystemGeneralInformation.unit.test.ts
@@ -2,7 +2,7 @@ import HostSystemGeneralInformation from '@/modules/host/components/system/HostS
import type { FrontXoHost, useXoHostCollection } from '@/modules/host/remote-resources/use-xo-host-collection.ts'
import type { useXoPoolCollection } from '@/modules/pool/remote-resources/use-xo-pool-collection.ts'
import { createHost } from '@/test/create-host.ts'
-import { findCopiedValues } from '@/test/find-labelled-values.ts'
+import { findCopiedValues } from '@/test/find-rendered-values.ts'
import { createGlobalTestConfig } from '@/test/global-test-config.ts'
import { t } from '@/test/i18n.ts'
import { mount } from '@vue/test-utils'
diff --git a/@xen-orchestra/web/src/modules/host/components/system/HostSystemNetworking.unit.test.ts b/@xen-orchestra/web/src/modules/host/components/system/HostSystemNetworking.unit.test.ts
index 62af70401f..b34cdf046f 100644
--- a/@xen-orchestra/web/src/modules/host/components/system/HostSystemNetworking.unit.test.ts
+++ b/@xen-orchestra/web/src/modules/host/components/system/HostSystemNetworking.unit.test.ts
@@ -1,6 +1,6 @@
import HostSystemNetworking from '@/modules/host/components/system/HostSystemNetworking.vue'
import { createHost } from '@/test/create-host.ts'
-import { findCopiedValues } from '@/test/find-labelled-values.ts'
+import { findCopiedValues } from '@/test/find-rendered-values.ts'
import { createGlobalTestConfig } from '@/test/global-test-config.ts'
import { t } from '@/test/i18n.ts'
import { mount } from '@vue/test-utils'
diff --git a/@xen-orchestra/web/src/modules/plugin/components/detail/PluginGeneralInfo.unit.test.ts b/@xen-orchestra/web/src/modules/plugin/components/detail/PluginGeneralInfo.unit.test.ts
index c9eb896865..ddf250641e 100644
--- a/@xen-orchestra/web/src/modules/plugin/components/detail/PluginGeneralInfo.unit.test.ts
+++ b/@xen-orchestra/web/src/modules/plugin/components/detail/PluginGeneralInfo.unit.test.ts
@@ -1,8 +1,7 @@
import PluginGeneralInfo from '@/modules/plugin/components/detail/PluginGeneralInfo.vue'
import type { FrontXoPlugin } from '@/modules/plugin/remote-resources/use-xo-plugin-collection.ts'
import { createPlugin } from '@/test/create-plugin.ts'
-import { findLabelledValues } from '@/test/find-labelled-values.ts'
-import { findTags } from '@/test/find-tags.ts'
+import { findLabelledValues, findTags } from '@/test/find-rendered-values.ts'
import { findTitles } from '@/test/find-titles.ts'
import { createGlobalTestConfig } from '@/test/global-test-config.ts'
import { t } from '@/test/i18n.ts'
diff --git a/@xen-orchestra/web/src/modules/plugin/components/json-schema-form/JsonSchemaValue.unit.test.ts b/@xen-orchestra/web/src/modules/plugin/components/json-schema-form/JsonSchemaValue.unit.test.ts
index 09e16163ff..4b4814d89d 100644
--- a/@xen-orchestra/web/src/modules/plugin/components/json-schema-form/JsonSchemaValue.unit.test.ts
+++ b/@xen-orchestra/web/src/modules/plugin/components/json-schema-form/JsonSchemaValue.unit.test.ts
@@ -2,8 +2,7 @@ import JsonSchemaValue from '@/modules/plugin/components/json-schema-form/JsonSc
import type { useXoObjectOptions } from '@/modules/plugin/composables/use-xo-object-options.composable.ts'
import type { JsonSchema } from '@/modules/plugin/utils/json-schema.util.ts'
import { createTestRouter } from '@/test/create-test-router.ts'
-import { findLabelledValues } from '@/test/find-labelled-values.ts'
-import { findTags } from '@/test/find-tags.ts'
+import { findLabelledValues, findTags } from '@/test/find-rendered-values.ts'
import { createGlobalTestConfig } from '@/test/global-test-config.ts'
import { t } from '@/test/i18n.ts'
import VtsStatus from '@core/components/status/VtsStatus.vue'
diff --git a/@xen-orchestra/web/src/modules/plugin/components/list/panel/cards/PluginInfosCard.unit.test.ts b/@xen-orchestra/web/src/modules/plugin/components/list/panel/cards/PluginInfosCard.unit.test.ts
index e27b594758..34e01bb844 100644
--- a/@xen-orchestra/web/src/modules/plugin/components/list/panel/cards/PluginInfosCard.unit.test.ts
+++ b/@xen-orchestra/web/src/modules/plugin/components/list/panel/cards/PluginInfosCard.unit.test.ts
@@ -1,7 +1,7 @@
import PluginInfosCard from '@/modules/plugin/components/list/panel/cards/PluginInfosCard.vue'
import type { FrontXoPlugin } from '@/modules/plugin/remote-resources/use-xo-plugin-collection.ts'
import { createPlugin, PLUGIN_CONFIGURATION_SCHEMA } from '@/test/create-plugin.ts'
-import { findCardCopiedValues, findCardLabelledValues } from '@/test/find-labelled-values.ts'
+import { findCardCopiedValues, findCardLabelledValues } from '@/test/find-rendered-values.ts'
import { createGlobalTestConfig } from '@/test/global-test-config.ts'
import { t } from '@/test/i18n.ts'
import { mount } from '@vue/test-utils'
diff --git a/@xen-orchestra/web/src/modules/pool/components/dashboard/PoolDashboardCpuProvisioning.unit.test.ts b/@xen-orchestra/web/src/modules/pool/components/dashboard/PoolDashboardCpuProvisioning.unit.test.ts
index e853988eae..3694f9f61f 100644
--- a/@xen-orchestra/web/src/modules/pool/components/dashboard/PoolDashboardCpuProvisioning.unit.test.ts
+++ b/@xen-orchestra/web/src/modules/pool/components/dashboard/PoolDashboardCpuProvisioning.unit.test.ts
@@ -1,6 +1,6 @@
import PoolDashboardCpuProvisioning from '@/modules/pool/components/dashboard/PoolDashboardCpuProvisioning.vue'
import type { XoPoolDashboard } from '@/modules/pool/types/xo-pool-dashboard.type.ts'
-import { findCardNumbers } from '@/test/find-labelled-values.ts'
+import { findCardNumbers, findLegends } from '@/test/find-rendered-values.ts'
import { createGlobalTestConfig } from '@/test/global-test-config.ts'
import { t } from '@/test/i18n.ts'
import { mount } from '@vue/test-utils'
@@ -61,7 +61,7 @@ it('fills the progress bar with the share of the CPUs assigned', () => {
it('labels the progress bar with the share of the CPUs assigned', () => {
const wrapper = mountProvisioning()
- expect(wrapper.get('.ui-legend').text()).toBe(`${t('vcpus')}75%`)
+ expect(findLegends(wrapper)).toEqual([[t('vcpus'), '75%']])
})
it('reports no CPU for a pool provisioning nothing', () => {
diff --git a/@xen-orchestra/web/src/modules/pool/components/dashboard/PoolDashboardCpuUsage.unit.test.ts b/@xen-orchestra/web/src/modules/pool/components/dashboard/PoolDashboardCpuUsage.unit.test.ts
index 5205d5c471..7517754304 100644
--- a/@xen-orchestra/web/src/modules/pool/components/dashboard/PoolDashboardCpuUsage.unit.test.ts
+++ b/@xen-orchestra/web/src/modules/pool/components/dashboard/PoolDashboardCpuUsage.unit.test.ts
@@ -1,20 +1,29 @@
-import HostsCpuUsage from '@/modules/pool/components/dashboard/cpu-usage/HostsCpuUsage.vue'
-import VmsCpuUsage from '@/modules/pool/components/dashboard/cpu-usage/VmsCpuUsage.vue'
import PoolDashboardCpuUsage from '@/modules/pool/components/dashboard/PoolDashboardCpuUsage.vue'
import type { XoPoolDashboard } from '@/modules/pool/types/xo-pool-dashboard.type.ts'
-import { findLegends } from '@/test/find-labelled-values.ts'
+import { createPoolDashboardTopFiveUsage } from '@/test/create-pool-dashboard.ts'
+import { findProgressBarGroupLegends } from '@/test/find-rendered-values.ts'
import { createGlobalTestConfig } from '@/test/global-test-config.ts'
import { t } from '@/test/i18n.ts'
import { mount } from '@vue/test-utils'
-type TopFiveUsage = NonNullable['topFiveUsage']>
+type HostCpuUsage = NonNullable['topFiveUsage']>['cpu'][number]
+
+type VmCpuUsage = NonNullable['topFiveUsage']>['cpu'][number]
+
+function createHostCpuUsage(overrides: Partial = {}): HostCpuUsage {
+ return { id: 'host-1' as HostCpuUsage['id'], name_label: 'Host 1', percent: 30, ...overrides }
+}
+
+function createVmCpuUsage(overrides: Partial = {}): VmCpuUsage {
+ return { id: 'vm-1' as VmCpuUsage['id'], name_label: 'VM 1', percent: 70, ...overrides }
+}
+
+function withTopFiveCpu(hosts: HostCpuUsage[], vms: VmCpuUsage[]): XoPoolDashboard {
+ return createPoolDashboardTopFiveUsage({ cpu: hosts }, { cpu: vms })
+}
function createPoolDashboard(overrides: Partial = {}): XoPoolDashboard {
- return {
- hosts: { topFiveUsage: { cpu: [], ram: [] } as TopFiveUsage },
- vms: { topFiveUsage: { cpu: [], ram: [] } as NonNullable['topFiveUsage']> },
- ...overrides,
- }
+ return { ...withTopFiveCpu([createHostCpuUsage()], [createVmCpuUsage()]), ...overrides }
}
function mountCpuUsage(props: { poolDashboard?: XoPoolDashboard; hasError?: boolean } = {}) {
@@ -39,47 +48,46 @@ it('splits the card between the hosts and the VMs, each capped to the top five',
])
})
+it('plots the usage of the hosts and of the VMs in their own section', () => {
+ const wrapper = mountCpuUsage()
+
+ expect(findProgressBarGroupLegends(wrapper)).toEqual([[['Host 1', '30%']], [['VM 1', '70%']]])
+})
+
it('shows a loader in place of the hosts while their usage has not arrived yet', () => {
const wrapper = mountCpuUsage({ poolDashboard: createPoolDashboard({ hosts: {} }) })
- expect(wrapper.find('.ui-loader').exists()).toBe(true)
- expect(wrapper.findComponent(HostsCpuUsage).exists()).toBe(false)
- expect(wrapper.findComponent(VmsCpuUsage).exists()).toBe(true)
+ expect(wrapper.findAll('.ui-loader')).toHaveLength(1)
+ expect(findProgressBarGroupLegends(wrapper)).toEqual([[['VM 1', '70%']]])
})
it('shows a loader in place of the VMs while their usage has not arrived yet', () => {
const wrapper = mountCpuUsage({ poolDashboard: createPoolDashboard({ vms: {} }) })
- expect(wrapper.find('.ui-loader').exists()).toBe(true)
- expect(wrapper.findComponent(HostsCpuUsage).exists()).toBe(true)
- expect(wrapper.findComponent(VmsCpuUsage).exists()).toBe(false)
+ expect(wrapper.findAll('.ui-loader')).toHaveLength(1)
+ expect(findProgressBarGroupLegends(wrapper)).toEqual([[['Host 1', '30%']]])
})
-it('plots the usage of the hosts and of the VMs in their own section', () => {
+it('measures both sections against the CPU thresholds, which a full CPU has yet to reach', () => {
const wrapper = mountCpuUsage({
- poolDashboard: {
- hosts: {
- topFiveUsage: {
- cpu: [{ id: 'host-1' as never, name_label: 'Host 1', percent: 30 }],
- ram: [],
- } as unknown as TopFiveUsage,
- },
- vms: {
- topFiveUsage: {
- cpu: [{ id: 'vm-1' as never, name_label: 'VM 1', percent: 70 }],
- ram: [],
- } as unknown as NonNullable['topFiveUsage']>,
- },
- },
+ poolDashboard: withTopFiveCpu([createHostCpuUsage({ percent: 85 })], [createVmCpuUsage({ percent: 85 })]),
})
- expect(findLegends(wrapper.findComponent(HostsCpuUsage))).toEqual([['Host 1', '30%']])
- expect(findLegends(wrapper.findComponent(VmsCpuUsage))).toEqual([['VM 1', '70%']])
+ expect(wrapper.findAll('.ui-progress-bar').map(bar => bar.classes('accent--info'))).toEqual([true, true])
+})
+
+it('reports that there is nothing to show in a section without host or VM', () => {
+ const wrapper = mountCpuUsage({ poolDashboard: withTopFiveCpu([], []) })
+
+ expect(wrapper.findAll('.vts-state-hero').map(hero => hero.text())).toEqual([
+ t('no-data-to-calculate'),
+ t('no-data-to-calculate'),
+ ])
+ expect(wrapper.findAll('.ui-progress-bar')).toEqual([])
})
it('passes the fetch error down to both sections', () => {
const wrapper = mountCpuUsage({ hasError: true })
- expect(wrapper.findComponent(HostsCpuUsage).get('.vts-state-hero').text()).toBe(t('error-no-data'))
- expect(wrapper.findComponent(VmsCpuUsage).get('.vts-state-hero').text()).toBe(t('error-no-data'))
+ expect(wrapper.findAll('.vts-state-hero').map(hero => hero.text())).toEqual([t('error-no-data'), t('error-no-data')])
})
diff --git a/@xen-orchestra/web/src/modules/pool/components/dashboard/PoolDashboardCpuUsage.vue b/@xen-orchestra/web/src/modules/pool/components/dashboard/PoolDashboardCpuUsage.vue
index 8f0d37de5e..5502b04d64 100644
--- a/@xen-orchestra/web/src/modules/pool/components/dashboard/PoolDashboardCpuUsage.vue
+++ b/@xen-orchestra/web/src/modules/pool/components/dashboard/PoolDashboardCpuUsage.vue
@@ -9,31 +9,37 @@
{{ t('top-#', 5) }}
-
-
-
-
+
{{ t('vms') }}
{{ t('top-#', 5) }}
-
-
-
-
+
diff --git a/@xen-orchestra/web/src/modules/pool/components/dashboard/PoolDashboardHostsPatches.unit.test.ts b/@xen-orchestra/web/src/modules/pool/components/dashboard/PoolDashboardHostsPatches.unit.test.ts
index 29f1469996..1a38fd2eb8 100644
--- a/@xen-orchestra/web/src/modules/pool/components/dashboard/PoolDashboardHostsPatches.unit.test.ts
+++ b/@xen-orchestra/web/src/modules/pool/components/dashboard/PoolDashboardHostsPatches.unit.test.ts
@@ -1,5 +1,6 @@
import PoolDashboardHostsPatches from '@/modules/pool/components/dashboard/PoolDashboardHostsPatches.vue'
import type { XoPoolDashboard } from '@/modules/pool/types/xo-pool-dashboard.type.ts'
+import { findTableRows } from '@/test/find-rendered-values.ts'
import { createGlobalTestConfig } from '@/test/global-test-config.ts'
import { t } from '@/test/i18n.ts'
import { mount } from '@vue/test-utils'
@@ -24,10 +25,6 @@ function mountPatches(props: { poolDashboard?: XoPoolDashboard; hasError?: boole
})
}
-function findPatchRows(wrapper: ReturnType) {
- return wrapper.findAll('tbody tr').map(row => row.text())
-}
-
it('renders the card title', () => {
const wrapper = mountPatches()
@@ -38,7 +35,7 @@ it('shows a loader while the dashboard has not arrived yet', () => {
const wrapper = mountPatches({ poolDashboard: undefined })
expect(wrapper.find('.ui-loader').exists()).toBe(true)
- expect(findPatchRows(wrapper)).toEqual([])
+ expect(findTableRows(wrapper)).toEqual([])
})
it('shows a loader while the missing patches are missing from the dashboard', () => {
@@ -66,7 +63,10 @@ it('lists one row per missing patch', () => {
]),
})
- expect(findPatchRows(wrapper)).toEqual(['XSAPATCH-11.0', 'XSAPATCH-22.0'])
+ expect(findTableRows(wrapper)).toEqual([
+ ['XSAPATCH-1', '1.0'],
+ ['XSAPATCH-2', '2.0'],
+ ])
})
it('reports the pool as up to date when its hosts miss no patch', () => {
@@ -80,5 +80,5 @@ it('reports the pool as up to date when the patches cannot be listed without a l
const wrapper = mountPatches({ poolDashboard: withMissingPatches({ hasAuthorization: false }) })
expect(wrapper.get('.vts-state-hero').text()).toContain(t('patches-up-to-date'))
- expect(findPatchRows(wrapper)).toEqual([])
+ expect(findTableRows(wrapper)).toEqual([])
})
diff --git a/@xen-orchestra/web/src/modules/pool/components/dashboard/PoolDashboardRamUsage.unit.test.ts b/@xen-orchestra/web/src/modules/pool/components/dashboard/PoolDashboardRamUsage.unit.test.ts
index 4d08fac5b2..a216b7ae7c 100644
--- a/@xen-orchestra/web/src/modules/pool/components/dashboard/PoolDashboardRamUsage.unit.test.ts
+++ b/@xen-orchestra/web/src/modules/pool/components/dashboard/PoolDashboardRamUsage.unit.test.ts
@@ -1,25 +1,43 @@
import PoolDashboardRamUsage from '@/modules/pool/components/dashboard/PoolDashboardRamUsage.vue'
-import HostsRamUsage from '@/modules/pool/components/dashboard/ram-usage/HostsRamUsage.vue'
-import VmsRamUsage from '@/modules/pool/components/dashboard/ram-usage/VmsRamUsage.vue'
import type { XoPoolDashboard } from '@/modules/pool/types/xo-pool-dashboard.type.ts'
-import { findLegends } from '@/test/find-labelled-values.ts'
+import { createPoolDashboardTopFiveUsage } from '@/test/create-pool-dashboard.ts'
+import { findProgressBarGroupLegends } from '@/test/find-rendered-values.ts'
import { createGlobalTestConfig } from '@/test/global-test-config.ts'
import { t } from '@/test/i18n.ts'
import { mount } from '@vue/test-utils'
-type HostsTopFiveUsage = NonNullable['topFiveUsage']>
+type HostRamUsage = NonNullable['topFiveUsage']>['ram'][number]
-type VmsTopFiveUsage = NonNullable['topFiveUsage']>
+type VmRamUsage = NonNullable['topFiveUsage']>['ram'][number]
-function withTopFiveUsage(hosts: HostsTopFiveUsage['ram'], vms: VmsTopFiveUsage['ram']): XoPoolDashboard {
+function createHostRamUsage(overrides: Partial = {}): HostRamUsage {
return {
- hosts: { topFiveUsage: { cpu: [], ram: hosts } },
- vms: { topFiveUsage: { cpu: [], ram: vms } },
+ id: 'host-1' as HostRamUsage['id'],
+ name_label: 'Host 1',
+ percent: 25,
+ size: 4294967296,
+ usage: 1073741824,
+ ...overrides,
}
}
+function createVmRamUsage(overrides: Partial = {}): VmRamUsage {
+ return {
+ id: 'vm-1' as VmRamUsage['id'],
+ name_label: 'VM 1',
+ percent: 75,
+ memory: 4294967296,
+ memoryFree: 1073741824,
+ ...overrides,
+ }
+}
+
+function withTopFiveRam(hosts: HostRamUsage[], vms: VmRamUsage[]): XoPoolDashboard {
+ return createPoolDashboardTopFiveUsage({ ram: hosts }, { ram: vms })
+}
+
function createPoolDashboard(overrides: Partial = {}): XoPoolDashboard {
- return { ...withTopFiveUsage([], []), ...overrides }
+ return { ...withTopFiveRam([createHostRamUsage()], [createVmRamUsage()]), ...overrides }
}
function mountRamUsage(props: { poolDashboard?: XoPoolDashboard; hasError?: boolean } = {}) {
@@ -44,53 +62,38 @@ it('splits the card between the hosts and the VMs, each capped to the top five',
])
})
+it('shows the memory of the hosts and of the VMs in their own section', () => {
+ const wrapper = mountRamUsage()
+
+ expect(findProgressBarGroupLegends(wrapper)).toEqual([[['Host 1', '1 GiB / 4 GiB']], [['VM 1', '3 GiB / 4 GiB']]])
+})
+
it('shows a loader in place of the hosts while their usage has not arrived yet', () => {
const wrapper = mountRamUsage({ poolDashboard: createPoolDashboard({ hosts: {} }) })
- expect(wrapper.find('.ui-loader').exists()).toBe(true)
- expect(wrapper.findComponent(HostsRamUsage).exists()).toBe(false)
- expect(wrapper.findComponent(VmsRamUsage).exists()).toBe(true)
+ expect(wrapper.findAll('.ui-loader')).toHaveLength(1)
+ expect(findProgressBarGroupLegends(wrapper)).toEqual([[['VM 1', '3 GiB / 4 GiB']]])
})
it('shows a loader in place of the VMs while their usage has not arrived yet', () => {
const wrapper = mountRamUsage({ poolDashboard: createPoolDashboard({ vms: {} }) })
- expect(wrapper.find('.ui-loader').exists()).toBe(true)
- expect(wrapper.findComponent(HostsRamUsage).exists()).toBe(true)
- expect(wrapper.findComponent(VmsRamUsage).exists()).toBe(false)
+ expect(wrapper.findAll('.ui-loader')).toHaveLength(1)
+ expect(findProgressBarGroupLegends(wrapper)).toEqual([[['Host 1', '1 GiB / 4 GiB']]])
})
-it('shows the memory of the hosts and of the VMs in their own section', () => {
- const wrapper = mountRamUsage({
- poolDashboard: withTopFiveUsage(
- [
- {
- id: 'host-1' as HostsTopFiveUsage['ram'][number]['id'],
- name_label: 'Host 1',
- percent: 25,
- size: 4294967296,
- usage: 1073741824,
- },
- ],
- [
- {
- id: 'vm-1' as VmsTopFiveUsage['ram'][number]['id'],
- name_label: 'VM 1',
- percent: 75,
- memory: 4294967296,
- memoryFree: 1073741824,
- },
- ]
- ),
- })
+it('reports that there is nothing to show in a section without host or VM', () => {
+ const wrapper = mountRamUsage({ poolDashboard: withTopFiveRam([], []) })
- expect(findLegends(wrapper.findComponent(HostsRamUsage))).toEqual([['Host 1', '1 GiB / 4 GiB']])
- expect(findLegends(wrapper.findComponent(VmsRamUsage))).toEqual([['VM 1', '3 GiB / 4 GiB']])
+ expect(wrapper.findAll('.vts-state-hero').map(hero => hero.text())).toEqual([
+ t('no-data-to-calculate'),
+ t('no-data-to-calculate'),
+ ])
+ expect(wrapper.findAll('.ui-progress-bar')).toEqual([])
})
it('passes the fetch error down to both sections', () => {
const wrapper = mountRamUsage({ hasError: true })
- expect(wrapper.findComponent(HostsRamUsage).get('.vts-state-hero').text()).toBe(t('error-no-data'))
- expect(wrapper.findComponent(VmsRamUsage).get('.vts-state-hero').text()).toBe(t('error-no-data'))
+ expect(wrapper.findAll('.vts-state-hero').map(hero => hero.text())).toEqual([t('error-no-data'), t('error-no-data')])
})
diff --git a/@xen-orchestra/web/src/modules/pool/components/dashboard/PoolDashboardRamUsage.vue b/@xen-orchestra/web/src/modules/pool/components/dashboard/PoolDashboardRamUsage.vue
index d1e5cf9438..88561b2aca 100644
--- a/@xen-orchestra/web/src/modules/pool/components/dashboard/PoolDashboardRamUsage.vue
+++ b/@xen-orchestra/web/src/modules/pool/components/dashboard/PoolDashboardRamUsage.vue
@@ -9,28 +9,31 @@
{{ t('top-#', 5) }}
-
-
-
-
+
{{ t('vms') }}
{{ t('top-#', 5) }}
-
-
-
-
+
diff --git a/@xen-orchestra/web/src/modules/pool/components/dashboard/PoolDashboardStatus.unit.test.ts b/@xen-orchestra/web/src/modules/pool/components/dashboard/PoolDashboardStatus.unit.test.ts
index 59c94a9088..655a5c2ef0 100644
--- a/@xen-orchestra/web/src/modules/pool/components/dashboard/PoolDashboardStatus.unit.test.ts
+++ b/@xen-orchestra/web/src/modules/pool/components/dashboard/PoolDashboardStatus.unit.test.ts
@@ -1,6 +1,6 @@
import PoolDashboardStatus from '@/modules/pool/components/dashboard/PoolDashboardStatus.vue'
import type { XoPoolDashboard } from '@/modules/pool/types/xo-pool-dashboard.type.ts'
-import { findCardNumbers } from '@/test/find-labelled-values.ts'
+import { findCardNumbers, findLegends } from '@/test/find-rendered-values.ts'
import { createGlobalTestConfig } from '@/test/global-test-config.ts'
import { t } from '@/test/i18n.ts'
import { mount } from '@vue/test-utils'
@@ -17,7 +17,7 @@ function createVmsStatus(overrides: Partial = {}): VmsStatus {
return { running: 5, paused: 2, suspended: 1, halted: 2, total: 10, ...overrides }
}
-function createPoolDashboard(overrides: Partial = {}): XoPoolDashboard {
+function createPoolDashboardStatus(overrides: Partial = {}): XoPoolDashboard {
return {
hosts: { status: createHostsStatus() },
vms: { status: createVmsStatus() },
@@ -27,7 +27,7 @@ function createPoolDashboard(overrides: Partial = {}): XoPoolDa
function mountStatus(props: { poolDashboard?: XoPoolDashboard; hasError?: boolean } = {}) {
return mount(PoolDashboardStatus, {
- props: { poolDashboard: createPoolDashboard(), ...props },
+ props: { poolDashboard: createPoolDashboardStatus(), ...props },
global: createGlobalTestConfig(),
})
}
@@ -35,10 +35,7 @@ function mountStatus(props: { poolDashboard?: XoPoolDashboard; hasError?: boolea
function findLegendSections(wrapper: ReturnType) {
return wrapper
.findAll('.vts-donut-chart-with-legend')
- .map(section => [
- section.get('.ui-legend-title').text(),
- section.findAll('.ui-legend').map(legend => [legend.get('.label').text(), legend.get('.value-and-unit').text()]),
- ])
+ .map(section => [section.get('.ui-legend-title').text(), findLegends(section)])
}
it('renders the card title', () => {
@@ -107,7 +104,7 @@ it('totals the hosts and the VMs of the pool', () => {
it('reports that no VM was detected for a pool without VM, and still breaks down the hosts', () => {
const wrapper = mountStatus({
- poolDashboard: createPoolDashboard({
+ poolDashboard: createPoolDashboardStatus({
vms: { status: createVmsStatus({ running: 0, paused: 0, suspended: 0, halted: 0, total: 0 }) },
}),
})
diff --git a/@xen-orchestra/web/src/modules/pool/components/dashboard/PoolDashboardStoragesUsage.unit.test.ts b/@xen-orchestra/web/src/modules/pool/components/dashboard/PoolDashboardStoragesUsage.unit.test.ts
index 8ec44b8ee0..9c57cd9c7e 100644
--- a/@xen-orchestra/web/src/modules/pool/components/dashboard/PoolDashboardStoragesUsage.unit.test.ts
+++ b/@xen-orchestra/web/src/modules/pool/components/dashboard/PoolDashboardStoragesUsage.unit.test.ts
@@ -1,6 +1,6 @@
import PoolDashboardStoragesUsage from '@/modules/pool/components/dashboard/PoolDashboardStoragesUsage.vue'
import type { XoPoolDashboard } from '@/modules/pool/types/xo-pool-dashboard.type.ts'
-import { findCardNumbers } from '@/test/find-labelled-values.ts'
+import { findCardNumbers, findLegends } from '@/test/find-rendered-values.ts'
import { createGlobalTestConfig } from '@/test/global-test-config.ts'
import { t } from '@/test/i18n.ts'
import { mount } from '@vue/test-utils'
@@ -68,7 +68,10 @@ it('shows one progress bar per storage, the fullest first', () => {
]),
})
- expect(wrapper.findAll('.ui-legend').map(legend => legend.text())).toEqual(['Shared storage70%', 'Local storage30%'])
+ expect(findLegends(wrapper)).toEqual([
+ ['Shared storage', '70%'],
+ ['Local storage', '30%'],
+ ])
})
it('sums the usage and the free space across the storages', () => {
diff --git a/@xen-orchestra/web/src/modules/pool/components/dashboard/PoolDashboardStoragesUsage.vue b/@xen-orchestra/web/src/modules/pool/components/dashboard/PoolDashboardStoragesUsage.vue
index fd4615d14d..078ffa271e 100644
--- a/@xen-orchestra/web/src/modules/pool/components/dashboard/PoolDashboardStoragesUsage.vue
+++ b/@xen-orchestra/web/src/modules/pool/components/dashboard/PoolDashboardStoragesUsage.vue
@@ -6,15 +6,12 @@
{{ t('top-#', 5) }}
-
-
- {{ t('error-no-data') }}
-
-
- {{ t('no-data-to-calculate') }}
-
-
-
+
-
+