Skip to content

Commit 2ee8246

Browse files
committed
add test to check the tab visibility when license is expired
1 parent 4a4f398 commit 2ee8246

File tree

3 files changed

+30
-12
lines changed

3 files changed

+30
-12
lines changed

src/Frontend/src/views/ConfigurationView.vue

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,35 +53,37 @@ function preventIfDisabled(e: Event) {
5353
<div class="row">
5454
<div class="col-sm-12">
5555
<div class="nav tabs">
56-
<h5 :class="{ active: isRouteSelected(routeLinks.configuration.license.link), disabled: notConnected }" @click.capture="preventIfDisabled" class="nav-item">
56+
<h5 :class="{ active: isRouteSelected(routeLinks.configuration.license.link), disabled: notConnected }" @click.capture="preventIfDisabled" class="nav-item" role="tab" aria-label="license">
5757
<RouterLink :to="routeLinks.configuration.license.link">License</RouterLink>
5858
<exclamation-mark :type="convertToWarningLevel(licenseStatus.warningLevel)" />
5959
</h5>
6060
<h5
6161
:class="{ active: isRouteSelected(routeLinks.throughput.setup.root) || isRouteSelected(routeLinks.throughput.setup.mask.link) || isRouteSelected(routeLinks.throughput.setup.diagnostics.link), disabled: notConnected }"
6262
@click.capture="preventIfDisabled"
6363
class="nav-item"
64+
role="tab"
65+
aria-label="usage-setup"
6466
>
6567
<RouterLink :to="routeLinks.throughput.setup.root">Usage Setup</RouterLink>
6668
<exclamation-mark :type="WarningLevel.Danger" v-if="hasErrors" />
6769
</h5>
6870
<template v-if="!licenseStatus.isExpired">
69-
<h5 :class="{ active: isRouteSelected(routeLinks.configuration.massTransitConnector.link), disabled: notConnected }" @click.capture="preventIfDisabled" class="nav-item">
71+
<h5 :class="{ active: isRouteSelected(routeLinks.configuration.massTransitConnector.link), disabled: notConnected }" @click.capture="preventIfDisabled" class="nav-item" role="tab" aria-label="mass-transit-connector">
7072
<RouterLink :to="routeLinks.configuration.massTransitConnector.link">MassTransit Connector</RouterLink>
7173
</h5>
72-
<h5 :class="{ active: isRouteSelected(routeLinks.configuration.healthCheckNotifications.link), disabled: notConnected }" @click.capture="preventIfDisabled" class="nav-item">
74+
<h5 :class="{ active: isRouteSelected(routeLinks.configuration.healthCheckNotifications.link), disabled: notConnected }" @click.capture="preventIfDisabled" class="nav-item" role="tab" aria-label="health-check-notifications">
7375
<RouterLink :to="routeLinks.configuration.healthCheckNotifications.link">Health Check Notifications</RouterLink>
7476
</h5>
75-
<h5 :class="{ active: isRouteSelected(routeLinks.configuration.retryRedirects.link), disabled: notConnected }" @click.capture="preventIfDisabled" class="nav-item">
77+
<h5 :class="{ active: isRouteSelected(routeLinks.configuration.retryRedirects.link), disabled: notConnected }" @click.capture="preventIfDisabled" class="nav-item" role="tab" aria-label="retry-redirects">
7678
<RouterLink :to="routeLinks.configuration.retryRedirects.link">Retry Redirects ({{ redirectCount }})</RouterLink>
7779
</h5>
78-
<h5 :class="{ active: isRouteSelected(routeLinks.configuration.connections.link) }" class="nav-item">
80+
<h5 :class="{ active: isRouteSelected(routeLinks.configuration.connections.link) }" class="nav-item" role="tab" aria-label="connections">
7981
<RouterLink :to="routeLinks.configuration.connections.link">
8082
Connections
8183
<exclamation-mark v-if="displayConnectionsWarning" :type="WarningLevel.Danger" />
8284
</RouterLink>
8385
</h5>
84-
<h5 :class="{ active: isRouteSelected(routeLinks.configuration.endpointConnection.link), disabled: notConnected }" @click.capture="preventIfDisabled" class="nav-item">
86+
<h5 :class="{ active: isRouteSelected(routeLinks.configuration.endpointConnection.link), disabled: notConnected }" @click.capture="preventIfDisabled" class="nav-item" role="tab" aria-label="endpoint-connection">
8587
<RouterLink :to="routeLinks.configuration.endpointConnection.link">Endpoint Connection</RouterLink>
8688
</h5>
8789
</template>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { screen } from "@testing-library/vue";
2+
3+
export async function licenseTabList() {
4+
const tabs = await screen.findAllByRole("tab");
5+
return tabs;
6+
}
7+
export async function licenseTabNames() {
8+
const tabs = await screen.findAllByRole("tab");
9+
// Check the names of the tabs
10+
const tabNames = tabs.map((tab) => tab.textContent?.trim());
11+
return tabNames;
12+
}

src/Frontend/test/specs/configuration/viewing-license.spec.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { licenseExpiryDaysLeft } from "./questions/licenseExpiryDaysLeft";
77
import { licenseExpired } from "./questions/licenseExpired";
88
import { waitFor } from "@testing-library/vue";
99
import { LicenseType } from "@/resources/LicenseInfo";
10+
import { licenseTabList, licenseTabNames } from "./questions/licenseTabs";
1011

1112
describe("FEATURE: License", () => {
1213
describe("RULE: Platform license type should be shown shown", () => {
@@ -40,12 +41,15 @@ describe("FEATURE: License", () => {
4041
expect(await licenseExpired()).toBe("Your license expired. Please update the license to continue using the Particular Service Platform.");
4142
});
4243
});
43-
test.todo("EXAMPLE: Only 'LICENSE' tab is visible when license has expired");
44-
45-
/* SCENARIO
46-
Given an expired license
47-
Then "LICENSE" is the only visible tab in the Configuration screen
48-
*/
44+
test("EXAMPLE: An expired license should show only the license and usage setup tabs", async ({ driver }) => {
45+
await driver.setUp(precondition.serviceControlWithMonitoring);
46+
await driver.setUp(precondition.hasExpiredLicense(LicenseType.Subscription, 5)); //license expired 6 days before
47+
await driver.goTo("/configuration/license");
48+
await waitFor(async () => {
49+
expect(await licenseTabList()).toHaveLength(2);
50+
expect(await licenseTabNames()).toEqual(expect.arrayContaining(["License", "Usage Setup"]));
51+
});
52+
});
4953
});
5054

5155
describe("RULE: License expiring soon must be displayed", () => {

0 commit comments

Comments
 (0)