Skip to content

Commit 91fdf30

Browse files
authored
Add Heartbeat acceptance tests (#2208)
* Add heartbeat dashboard item test
1 parent 865280f commit 91fdf30

34 files changed

+697
-89
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- name: Set up Node.js
2525
uses: actions/[email protected]
2626
with:
27-
node-version: 21.6.x
27+
node-version: 22.13.x
2828
- name: Build Frontend
2929
run: .\build.ps1
3030
working-directory: src/ServicePulse.Host

src/Frontend/src/components/DashboardItem.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ const props = defineProps<{
77
</script>
88

99
<template>
10-
<RouterLink class="summary-item" :class="{ 'summary-danger': counter > 0, 'summary-info': counter === 0 || !counter }" :to="url">
10+
<RouterLink aria-label="Dashboard Item" class="summary-item" :class="{ 'summary-danger': counter > 0, 'summary-info': counter === 0 || !counter }" :to="url">
1111
<i class="fa fa-3x" :class="props.iconClass"> </i>
12-
<span v-if="counter > 0" class="badge badge-important">{{ counter }}</span>
12+
<span v-if="counter > 0" aria-label="Alert Count" class="badge badge-important">{{ counter }}</span>
1313
<h4>
1414
<slot></slot>
1515
</h4>

src/Frontend/src/components/NoData.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const props = defineProps<{
1111
<div class="col-sm-12">
1212
<div class="row box-header">
1313
<div class="col-sm-12">
14-
<p class="lead hard-wrap">{{ props.message }}</p>
14+
<p class="lead hard-wrap" role="status">{{ props.message }}</p>
1515
<slot>
1616
<p>&nbsp;</p>
1717
</slot>

src/Frontend/src/components/OnOffSwitch.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const emit = defineEmits<{ toggle: [] }>();
99

1010
<template>
1111
<div class="onoffswitch">
12-
<input type="checkbox" :id="`onoffswitch${id}`" :name="`onoffswitch${id}`" class="onoffswitch-checkbox" @click="emit('toggle')" :checked="value ?? false" />
12+
<input type="checkbox" :id="`onoffswitch${id}`" :name="`onoffswitch${id}`" :aria-label="`onoffswitch${id}`" class="onoffswitch-checkbox" @click="emit('toggle')" :checked="value ?? false" />
1313
<label class="onoffswitch-label" :for="`onoffswitch${id}`">
1414
<span class="onoffswitch-inner"></span>
1515
<span class="onoffswitch-switch"></span>

src/Frontend/src/components/TimeSince.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import moment from "moment";
44
55
const emptyDate = "0001-01-01T00:00:00";
66
7-
const props = withDefaults(defineProps<{ dateUtc?: string; defaultTextOnFailure?: string }>(), { dateUtc: emptyDate, defaultTextOnFailure: "n/a" });
7+
const props = withDefaults(defineProps<{ dateUtc?: string; defaultTextOnFailure?: string; titleValue?: string }>(), { dateUtc: emptyDate, defaultTextOnFailure: "n/a", titleValue: undefined });
88
99
let interval: number | undefined = undefined;
1010
@@ -15,9 +15,10 @@ function updateText() {
1515
if (props.dateUtc != null && props.dateUtc !== emptyDate) {
1616
const m = moment.utc(props.dateUtc);
1717
text.value = m.fromNow();
18-
title.value = m.local().format("LLLL") + " (local)\n" + m.utc().format("LLLL") + " (UTC)";
18+
title.value = props.titleValue ?? m.local().format("LLLL") + " (local)\n" + m.utc().format("LLLL") + " (UTC)";
1919
} else {
20-
text.value = title.value = props.defaultTextOnFailure;
20+
text.value = props.defaultTextOnFailure;
21+
title.value = props.titleValue ?? props.defaultTextOnFailure;
2122
}
2223
}
2324

src/Frontend/src/components/heartbeats/EndpointInstances.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,12 +207,12 @@ async function toggleAlerts(instance: EndpointsView) {
207207
<template #data="{ pageData }">
208208
<div role="rowgroup" aria-label="endpoints">
209209
<div role="row" :aria-label="instance.name" class="row grid-row" v-for="instance in pageData" :key="instance.id">
210-
<div role="cell" aria-label="instance-name" class="col-6 host-name">
210+
<div role="cell" class="col-6 host-name">
211211
<span role="status" class="status-icon">
212212
<i v-if="instance.heartbeat_information?.reported_status !== EndpointStatus.Alive" aria-label="instance dead" class="fa fa-heartbeat text-danger" />
213213
<i v-else aria-label="instance alive" class="fa fa-heartbeat text-success" />
214214
</span>
215-
<span class="lead">{{ instance.host_display_name }}</span>
215+
<span class="lead" aria-label="instance-name">{{ instance.host_display_name }}</span>
216216
</div>
217217
<div role="cell" aria-label="last-heartbeat" class="col-2 last-heartbeat">
218218
<LastHeartbeat :date="instance.heartbeat_information?.last_report_at" tooltip-target="instance" />

src/Frontend/src/components/heartbeats/HealthyEndpoints.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const { healthyEndpoints, filteredHealthyEndpoints } = storeToRefs(store);
1313
<div class="row">
1414
<ResultsCount :displayed="filteredHealthyEndpoints.length" :total="healthyEndpoints.length" />
1515
</div>
16-
<section name="healthy_endpoints">
16+
<section name="healthy_endpoints" aria-label="Healthy Endpoints">
1717
<no-data v-if="healthyEndpoints.length === 0" message="No healthy endpoints"></no-data>
1818
<div v-if="healthyEndpoints.length > 0" class="row">
1919
<div class="col-sm-12 no-side-padding">

src/Frontend/src/components/heartbeats/HeartbeatConfiguration.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ async function toggleDefaultSetting() {
9191
<div class="row">
9292
<ResultsCount :displayed="filteredEndpoints.length" :total="sortedEndpoints.length" />
9393
</div>
94-
<section name="endpoint_configuration">
94+
<section name="endpoint_configuration" aria-label="Endpoint Configuration">
9595
<div class="row">
9696
<div class="col-9 no-side-padding">
9797
<no-data v-if="sortedEndpoints.length === 0" message="Nothing to configure" />

src/Frontend/src/components/heartbeats/HeartbeatsList.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ function endpointHealth(endpoint: LogicalEndpoint) {
8181
</tippy>
8282
</div>
8383
</div>
84-
<div v-if="columns.includes(ColumnNames.InstancesTotal) || columns.includes(ColumnNames.InstancesDown)" role="cell" aria-label="instance-count" class="col-2">
84+
<div v-if="columns.includes(ColumnNames.InstancesTotal) || columns.includes(ColumnNames.InstancesDown)" role="cell" class="col-2">
8585
<tippy :delay="[300, 0]">
8686
<template #content>
8787
<template v-if="endpoint.track_instances">
@@ -96,15 +96,15 @@ function endpointHealth(endpoint: LogicalEndpoint) {
9696
</template>
9797
<i v-if="endpoint.track_instances" class="fa fa-server" :class="endpointHealth(endpoint)"></i>
9898
<i v-else class="fa fa-sellsy" :class="endpointHealth(endpoint)"></i>&nbsp;
99-
<span class="endpoint-count">{{ store.instanceDisplayText(endpoint) }}</span>
99+
<span class="endpoint-count" aria-label="instance-count">{{ store.instanceDisplayText(endpoint) }}</span>
100100
</tippy>
101101
</div>
102102
<div v-if="columns.includes(ColumnNames.LastHeartbeat)" role="cell" aria-label="last-heartbeat" class="col-2 last-heartbeat">
103103
<LastHeartbeat :date="endpoint.heartbeat_information?.last_report_at" tooltip-target="endpoint" />
104104
</div>
105105
<div v-if="columns.includes(ColumnNames.Tracked)" role="cell" aria-label="tracked-instances" class="col-1 centre">
106-
<tippy v-if="endpoint.track_instances" content="Instances are being tracked" :delay="[1000, 0]">
107-
<i class="fa fa-check text-success"></i>
106+
<tippy v-if="endpoint.track_instances" id="tracked-instance-desc" content="Instances are being tracked" :delay="[1000, 0]">
107+
<i class="fa fa-check text-success" aria-title="Instances are being tracked"></i>
108108
</tippy>
109109
</div>
110110
<div v-if="columns.includes(ColumnNames.TrackToggle)" role="cell" aria-label="tracked-instances" class="col-2 centre">
@@ -117,7 +117,7 @@ function endpointHealth(endpoint: LogicalEndpoint) {
117117
<tippy content="All instances have alerts muted" :delay="[300, 0]">
118118
<i class="fa fa-bell-slash text-danger" />
119119
</tippy>
120-
<span class="instances-muted">{{ endpoint.muted_count }}</span>
120+
<span class="instances-muted" aria-label="Muted instance count">{{ endpoint.muted_count }}</span>
121121
</template>
122122
<template v-else-if="endpoint.muted_count > 0">
123123
<tippy :content="`${endpoint.muted_count} instance(s) have alerts muted`" :delay="[300, 0]">

src/Frontend/src/components/heartbeats/HeartbeatsMenuItem.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ const { failedHeartbeatsCount } = storeToRefs(useHeartbeatsStore());
88
</script>
99

1010
<template>
11-
<RouterLink :to="routeLinks.heartbeats.root">
11+
<RouterLink aria-label="Heartbeats Menu Item" :to="routeLinks.heartbeats.root">
1212
<i class="fa fa-heartbeat icon-white" title="Heartbeats"></i>
1313
<span class="navbar-label">Heartbeats</span>
14-
<span v-if="failedHeartbeatsCount > 0" class="badge badge-important">{{ failedHeartbeatsCount }}</span>
14+
<span v-if="failedHeartbeatsCount > 0" class="badge badge-important" aria-label="Alert Count">{{ failedHeartbeatsCount }}</span>
1515
</RouterLink>
1616
</template>
1717

0 commit comments

Comments
 (0)