Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Frontend/src/components/configuration/PlatformLicense.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ const loading = computed(() => {
<b>License expiry date: </b>
<span
role="note"
aria-label="licenseExpiryDate"
aria-label="license-expiry-date"
:class="{
'license-expired': licenseStatus.isPlatformExpired,
}"
>
{{ license.formattedExpirationDate }}
<span role="note" aria-label="licenseExpiryDaysLeft">{{ licenseStatus.subscriptionDaysLeft }}</span>
<span role="note" aria-label="license-days-left">{{ licenseStatus.subscriptionDaysLeft }}</span>
<exclamation-mark :type="convertToWarningLevel(licenseStatus.warningLevel)" />
</span>
<div class="license-expired-text" v-if="licenseStatus.isPlatformExpired">Your license expired. Please update the license to continue using the Particular Service Platform.</div>
<div class="license-expired-text" v-if="licenseStatus.isPlatformExpired" role="note" aria-label="license-expired">Your license expired. Please update the license to continue using the Particular Service Platform.</div>
</div>
</template>
<template v-if="licenseStatus.isTrialLicense">
Expand Down
5 changes: 5 additions & 0 deletions src/Frontend/src/resources/LicenseInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,8 @@ export enum LicenseStatus {
ValidWithExpiringUpgradeProtection = "ValidWithExpiringUpgradeProtection",
ValidWithExpiringSubscription = "ValidWithExpiringSubscription",
}
export enum LicenseType {
Subscription,
Trial,
UpgradeProtection,
}
12 changes: 3 additions & 9 deletions src/Frontend/test/preconditions/hasLicense.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { activeLicenseResponse } from "../mocks/license-response-template";
import { SetupFactoryOptions } from "../driver";
import LicenseInfo, { LicenseStatus } from "@/resources/LicenseInfo";
import LicenseInfo, { LicenseStatus, LicenseType } from "@/resources/LicenseInfo";
import { useLicense } from "@/composables/serviceLicense";

const { license } = useLicense();
Expand All @@ -13,22 +13,16 @@ export const hasActiveLicense = ({ driver }: SetupFactoryOptions) => {
return activeLicenseResponse;
};

export enum LicenseType {
Subscription,
Trial,
UpgradeProtection,
}

export const hasExpiredLicense = (licenseType: LicenseType, licenseExtensionUrl: string = "https://particular.net/extend-your-trial?p=servicepulse") => createLicenseMockedResponse(licenseType, false, licenseExtensionUrl);
export const hasExpiringLicense = (licenseType: LicenseType, licenseExtensionUrl: string = "https://particular.net/extend-your-trial?p=servicepulse") => createLicenseMockedResponse(licenseType, true, licenseExtensionUrl);

const createLicenseMockedResponse =
(liceseType: LicenseType, expiring = false, licenseExtensionUrl: string) =>
(licenseType: LicenseType, expiring = false, licenseExtensionUrl: string) =>
({ driver }: SetupFactoryOptions) => {
const serviceControlInstanceUrl = window.defaultConfig.service_control_url;
let status: LicenseStatus;

switch (liceseType) {
switch (licenseType) {
case LicenseType.Subscription:
status = expiring ? LicenseStatus.ValidWithExpiringSubscription : LicenseStatus.InvalidDueToExpiredSubscription;
break;
Expand Down
1 change: 1 addition & 0 deletions src/Frontend/test/preconditions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export * from "./hasMonitoredEndpointDetails";
export { hasNoHeartbeatsEndpoints, hasHeartbeatsEndpoints } from "../preconditions/hasHeartbeatEndpoints";
export { serviceControlWithMonitoring } from "./serviceControlWithMonitoring";
export * from "./recoverability";
export * from "./licensing";
export { hasLicensingReportAvailable } from "../preconditions/hasLicensingReportAvailable";
export { hasLicensingSettingTest } from "../preconditions/hasLicensingSettingTest";
export { hasLicensingEndpoints } from "../preconditions/hasLicensingEndpoints";
Expand Down
56 changes: 56 additions & 0 deletions src/Frontend/test/preconditions/licensing.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import { SetupFactoryOptions } from "../driver";
import LicenseInfo, { LicenseStatus, LicenseType } from "@/resources/LicenseInfo";

const licenseResponseTemplate = <LicenseInfo>{
registered_to: "ACME Software",
edition: "Enterprise",
expiration_date: "2026-01-23T00:00:00.0000000Z",
upgrade_protection_expiration: "",
license_type: "Commercial",
instance_name: "Particular.ServiceControl",
trial_license: false,
license_status: LicenseStatus.Valid,
status: "valid",
};

export const withExpiredLicense = (licenseType: LicenseType, expiredDays: number) => getLicenseMockedResponse(licenseType, expiredDays, true);
export const withExpiringLicense = (licenseType: LicenseType, expiringInDays: number) => getLicenseMockedResponse(licenseType, expiringInDays, false);

const getLicenseMockedResponse =
(licenseType: LicenseType, expiringInDays: number, isExpired: boolean) =>
({ driver }: SetupFactoryOptions) => {
const serviceControlInstanceUrl = window.defaultConfig.service_control_url;
const customISOString = getCustomDateISOString(expiringInDays, isExpired);

let status: LicenseStatus;
switch (licenseType) {
case LicenseType.Subscription:
status = isExpired ? LicenseStatus.InvalidDueToExpiredSubscription : LicenseStatus.ValidWithExpiringSubscription;
break;
case LicenseType.Trial:
status = isExpired ? LicenseStatus.InvalidDueToExpiredTrial : LicenseStatus.ValidWithExpiringTrial;
break;
case LicenseType.UpgradeProtection:
status = isExpired ? LicenseStatus.InvalidDueToExpiredUpgradeProtection : LicenseStatus.ValidWithExpiringUpgradeProtection;
break;
}
const response = { ...licenseResponseTemplate, license_type: licenseType, expiration_date: customISOString, license_status: status };
driver.mockEndpoint(`${serviceControlInstanceUrl}license`, {
body: response,
});
return response;
};
function getCustomDateISOString(daysCount: number, isExpired: boolean) {
const today = new Date();
const customDate = new Date(today);

if (isExpired) {
customDate.setDate(today.getDate() - daysCount);
} else {
customDate.setDate(today.getDate() + daysCount);
}

const nativeISOString = customDate.toISOString(); // e.g., "2026-02-02T14:23:45.123Z"
const customISOString = nativeISOString.replace(/\.\d+Z$/, (match) => match.slice(0, -1).padEnd(8, "0") + "Z");
return customISOString;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { screen } from "@testing-library/vue";

export async function licenseExpired() {
const licenseExpiredText = await screen.findByRole("note", { name: "license-expired" });
return licenseExpiredText.textContent?.trim();
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { screen } from "@testing-library/vue";

export async function licenseExpiryDate() {
const licenseExpiryDate = await screen.findByRole("note", { name: "licenseExpiryDate" });
console.log(licenseExpiryDate.textContent);
return licenseExpiryDate.textContent;
const licenseExpiryDate = await screen.findByRole("note", { name: "license-expiry-date" });
return licenseExpiryDate.textContent?.trim;
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { screen } from "@testing-library/vue";

export async function licenseExpiryDaysLeft() {
const licenseExpiryDaysLeft = await screen.findByRole("note", { name: "licenseExpiryDaysLeft" });
console.log(licenseExpiryDaysLeft.textContent);
return licenseExpiryDaysLeft.textContent;
const licenseExpiryDaysLeft = await screen.findByRole("note", { name: "license-days-left" });
return licenseExpiryDaysLeft.textContent?.trim;
}
106 changes: 52 additions & 54 deletions src/Frontend/test/specs/configuration/viewing-license.spec.ts
Original file line number Diff line number Diff line change
@@ -1,95 +1,93 @@
import { expect, vi } from "vitest";
import { expect } from "vitest";
import { test, describe } from "../../drivers/vitest/driver";
import * as precondition from "../../preconditions";
import { licenseTypeDetails } from "./questions/licenseTypeDetails";
import { licenseExpiryDate } from "./questions/licenseExpiryDate";
import { licenseExpiryDaysLeft } from "./questions/licenseExpiryDaysLeft";
import { licenseExpired } from "./questions/licenseExpired";
import { waitFor } from "@testing-library/vue";
import { LicenseType } from "@/resources/LicenseInfo";

describe("FEATURE: License", () => {
describe("RULE: Platform license type should be shown shown", () => {
test("EXAMPLE: Valid platform license type should be shown", async ({ driver }) => {
vi.useFakeTimers();
await driver.setUp(precondition.serviceControlWithMonitoring);
await driver.setUp(precondition.hasActiveLicense);
await driver.goTo("/configuration/license");
vi.advanceTimersByTime(5000);
waitFor(async () => {
await waitFor(async () => {
expect(await licenseTypeDetails()).toBe("Commercial, Enterprise");
});
});
});

describe("RULE: License expiry date should be shown", () => {
test("EXAMPLE: Valid license expiry date should be shown", async ({ driver }) => {
await driver.setUp(precondition.serviceControlWithMonitoring);
await driver.setUp(precondition.hasActiveLicense);
await driver.goTo("/configuration/license");
waitFor(async () => {
await waitFor(async () => {
expect(await licenseExpiryDate()).toBeVisible();

Check failure on line 29 in src/Frontend/test/specs/configuration/viewing-license.spec.ts

View workflow job for this annotation

GitHub Actions / Windows

test/specs/configuration/viewing-license.spec.ts > FEATURE: License > RULE: License expiry date should be shown > EXAMPLE: Valid license expiry date should be shown

Error: expect(received).toBeVisible() received value must be an HTMLElement or an SVGElement. Ignored nodes: comments, script, style <html> <head> <title> Connections • ServicePulse </title> </head> <body> <div data-v-app="" id="app" > <nav class="navbar navbar-expand-lg navbar-inverse navbar-dark" data-v-628430e3="" > <div class="container-fluid" data-v-628430e3="" > <div class="navbar-header" data-v-628430e3="" > <a class="navbar-brand" data-v-628430e3="" href="#/dashboard" > <img alt="Service Pulse" data-v-628430e3="" src="/src/assets/logo.svg" /> </a> </div> <div class="navbar navbar-expand-lg" data-v-628430e3="" id="navbar" > <ul class="nav navbar-nav navbar-inverse" data-v-628430e3="" > <li data-v-628430e3="" > <a class="" data-v-628430e3="" data-v-d1b220e4="" href="#/dashboard" > <i class="fa fa-dashboard icon-white" data-v-d1b220e4="" title="Dashboard" /> <span class="navbar-label" data-v-d1b220e4="" > Dashboard </span> </a> </li> <li data-v-628430e3="" > <a class="" data-v-628430e3="" data-v-e714ff03="" href="#/heartbeats" > <i class="fa fa-heartbeat icon-white" data-v-e714ff03="" title="Heartbeats" /> <span class="navbar-label" data-v-e714ff03="" > Heartbeats </span> </a> </li> <li data-v-628430e3="" > <a class="" data-v-628430e3="" data-v-b1c0809e="" href="#/monitoring" > <i class="fa pa-monitoring icon-white" data-v-b1c0809e="" title="Monitoring" /> <span class="navbar-label" data-v-b1c0809e="" > Monitoring </span> </a> </li> <li data-v-628430e3="" > <a class="" data-v-628430e3="" data-v-7acc762f="" href="#/failed-messages" > <i class="fa fa-envelope icon-white" data-v-7acc762f="" title="Failed Messages" /> <span class="navbar-label" data-v-7acc762f="" > Failed Messages </span> </a> </li> <li data-v-628430e3="" > <a class="" data-v-4898b120="" data-v-628430e3="" href="#/custom-checks" > <i class="fa fa-check icon-white" data-v-4898b120=""
});
});
});
describe("RULE: Remaining license period should be displayed", () => {
test.todo("EXAMPLE: An expired license should show 'expired'");
/* SCENARIO
Expired license

Given an expired platform license
Then "expired" is shown
*/

describe("RULE: License expired", () => {
test("EXAMPLE: An expired license should show 'expired'", async ({ driver }) => {
await driver.setUp(precondition.serviceControlWithMonitoring);
await driver.setUp(precondition.withExpiredLicense(LicenseType.Subscription, 5)); //license expired 6 days before
await driver.goTo("/configuration/license");
await waitFor(async () => {
expect(await licenseExpired()).toBe("Your license expired. Please update the license to continue using the Particular Service Platform.");
});
});
});

describe("RULE: License expiring soon must be displayed", () => {
test("EXAMPLE: License expiring with 10 days should show 'expiring in X days'", async ({ driver }) => {
/* SCENARIO
License expiring soon

Given a platform license with an expiry date within 10 days
Then "expiring in X days" is shown
*/
test("EXAMPLE: License expiring with x days should show 'expiring in X days'", async ({ driver }) => {
await driver.setUp(precondition.serviceControlWithMonitoring);
await driver.setUp(precondition.withExpiringLicense(LicenseType.Subscription, 10));
await driver.goTo("/configuration/license");
await waitFor(async () => {
expect(await licenseExpiryDaysLeft()).toBeVisible(); //License expiry date: 2/5/2025 - expiring in 11 days

Check failure on line 51 in src/Frontend/test/specs/configuration/viewing-license.spec.ts

View workflow job for this annotation

GitHub Actions / Windows

test/specs/configuration/viewing-license.spec.ts > FEATURE: License > RULE: License expiring soon must be displayed > EXAMPLE: License expiring with x days should show 'expiring in X days'

Error: expect(received).toBeVisible() received value must be an HTMLElement or an SVGElement. Ignored nodes: comments, script, style <html> <head> <title> Connections • ServicePulse </title> </head> <body> <div data-v-app="" id="app" > <nav class="navbar navbar-expand-lg navbar-inverse navbar-dark" data-v-628430e3="" > <div class="container-fluid" data-v-628430e3="" > <div class="navbar-header" data-v-628430e3="" > <a class="navbar-brand" data-v-628430e3="" href="#/dashboard" > <img alt="Service Pulse" data-v-628430e3="" src="/src/assets/logo.svg" /> </a> </div> <div class="navbar navbar-expand-lg" data-v-628430e3="" id="navbar" > <ul class="nav navbar-nav navbar-inverse" data-v-628430e3="" > <li data-v-628430e3="" > <a class="" data-v-628430e3="" data-v-d1b220e4="" href="#/dashboard" > <i class="fa fa-dashboard icon-white" data-v-d1b220e4="" title="Dashboard" /> <span class="navbar-label" data-v-d1b220e4="" > Dashboard </span> </a> </li> <li data-v-628430e3="" > <a class="" data-v-628430e3="" data-v-e714ff03="" href="#/heartbeats" > <i class="fa fa-heartbeat icon-white" data-v-e714ff03="" title="Heartbeats" /> <span class="navbar-label" data-v-e714ff03="" > Heartbeats </span> </a> </li> <li data-v-628430e3="" > <a class="" data-v-628430e3="" data-v-b1c0809e="" href="#/monitoring" > <i class="fa pa-monitoring icon-white" data-v-b1c0809e="" title="Monitoring" /> <span class="navbar-label" data-v-b1c0809e="" > Monitoring </span> </a> </li> <li data-v-628430e3="" > <a class="" data-v-628430e3="" data-v-7acc762f="" href="#/failed-messages" > <i class="fa fa-envelope icon-white" data-v-7acc762f="" title="Failed Messages" /> <span class="navbar-label" data-v-7acc762f="" > Failed Messages </span> </a> </li> <li data-v-628430e3="" > <a class="" data-v-4898b120="" data-v-628430e3="" href="#/custom-checks" > <i class="fa fa-check icon-white" data-v-4898b120=""
expect(await licenseExpiryDaysLeft()).toContain("expiring in"); //License expiry date: 2/5/2025 - expiring in 11 days
});
});
test("EXAMPLE: License expiring tomorrow should show 'expiring tomorrow'", async ({ driver }) => {
await driver.setUp(precondition.serviceControlWithMonitoring);
const x = precondition.hasExpiringLicense(precondition.LicenseType.Subscription);
console.log(x);
await driver.setUp(precondition.hasExpiringLicense(precondition.LicenseType.Subscription));
await driver.setUp(precondition.withExpiringLicense(LicenseType.Subscription, 0));
await driver.goTo("/configuration/license");
waitFor(async () => {
await waitFor(async () => {
expect(await licenseExpiryDaysLeft()).toBeVisible();

Check failure on line 60 in src/Frontend/test/specs/configuration/viewing-license.spec.ts

View workflow job for this annotation

GitHub Actions / Windows

test/specs/configuration/viewing-license.spec.ts > FEATURE: License > RULE: License expiring soon must be displayed > EXAMPLE: License expiring tomorrow should show 'expiring tomorrow'

Error: expect(received).toBeVisible() received value must be an HTMLElement or an SVGElement. Ignored nodes: comments, script, style <html> <head> <title> Connections • ServicePulse </title> </head> <body> <div data-v-app="" id="app" > <nav class="navbar navbar-expand-lg navbar-inverse navbar-dark" data-v-628430e3="" > <div class="container-fluid" data-v-628430e3="" > <div class="navbar-header" data-v-628430e3="" > <a class="navbar-brand" data-v-628430e3="" href="#/dashboard" > <img alt="Service Pulse" data-v-628430e3="" src="/src/assets/logo.svg" /> </a> </div> <div class="navbar navbar-expand-lg" data-v-628430e3="" id="navbar" > <ul class="nav navbar-nav navbar-inverse" data-v-628430e3="" > <li data-v-628430e3="" > <a class="" data-v-628430e3="" data-v-d1b220e4="" href="#/dashboard" > <i class="fa fa-dashboard icon-white" data-v-d1b220e4="" title="Dashboard" /> <span class="navbar-label" data-v-d1b220e4="" > Dashboard </span> </a> </li> <li data-v-628430e3="" > <a class="" data-v-628430e3="" data-v-e714ff03="" href="#/heartbeats" > <i class="fa fa-heartbeat icon-white" data-v-e714ff03="" title="Heartbeats" /> <span class="navbar-label" data-v-e714ff03="" > Heartbeats </span> </a> </li> <li data-v-628430e3="" > <a class="" data-v-628430e3="" data-v-b1c0809e="" href="#/monitoring" > <i class="fa pa-monitoring icon-white" data-v-b1c0809e="" title="Monitoring" /> <span class="navbar-label" data-v-b1c0809e="" > Monitoring </span> </a> </li> <li data-v-628430e3="" > <a class="" data-v-628430e3="" data-v-7acc762f="" href="#/failed-messages" > <i class="fa fa-envelope icon-white" data-v-7acc762f="" title="Failed Messages" /> <span class="navbar-label" data-v-7acc762f="" > Failed Messages </span> </a> </li> <li data-v-628430e3="" > <a class="" data-v-4898b120="" data-v-628430e3="" href="#/custom-checks" > <i class="fa fa-check icon-white" data-v-4898b120=""
expect(await licenseExpiryDaysLeft()).toContain("expiring tomorrow");
});
});
});
describe("RULE: ABC", () => {
test.todo("EXAMPLE: License expiring tomorrow should show 'expiring tomorrow'");
/* SCENARIO
License expiring tomorrow

Given a platform license which expires tomorrow
Then "expiring tomorrow" is shown
*/
});
describe("RULE: EFG", () => {
test.todo("EXAMPLE: License expiring today should show 'expiring today'");
/* SCENARIO
License expiring today

Given a platform license which expires today
Then "expiring today" is shown
*/
});
describe("RULE: Remaining license period should be displayed", () => {
test("EXAMPLE: License expiring in more than 10 days should show 'X days left", async ({ driver }) => {
/* SCENARIO
License expiring in the future

Given a platform license which expires more than 10 days from now
Then "X days left" is shown
*/
test("EXAMPLE: License expiring today should show 'expiring today'", async ({ driver }) => {
await driver.setUp(precondition.serviceControlWithMonitoring);
await driver.setUp(precondition.hasActiveLicense);
await driver.setUp(precondition.withExpiringLicense(LicenseType.Subscription, -1));
await driver.goTo("/configuration/license");
waitFor(async () => {
expect(await licenseExpiryDaysLeft()).toContain("days left");
await waitFor(async () => {
expect(await licenseExpiryDaysLeft()).toBeVisible();

Check failure on line 69 in src/Frontend/test/specs/configuration/viewing-license.spec.ts

View workflow job for this annotation

GitHub Actions / Windows

test/specs/configuration/viewing-license.spec.ts > FEATURE: License > RULE: License expiring soon must be displayed > EXAMPLE: License expiring today should show 'expiring today'

Error: expect(received).toBeVisible() received value must be an HTMLElement or an SVGElement. Ignored nodes: comments, script, style <html> <head> <title> Connections • ServicePulse </title> </head> <body> <div data-v-app="" id="app" > <nav class="navbar navbar-expand-lg navbar-inverse navbar-dark" data-v-628430e3="" > <div class="container-fluid" data-v-628430e3="" > <div class="navbar-header" data-v-628430e3="" > <a class="navbar-brand" data-v-628430e3="" href="#/dashboard" > <img alt="Service Pulse" data-v-628430e3="" src="/src/assets/logo.svg" /> </a> </div> <div class="navbar navbar-expand-lg" data-v-628430e3="" id="navbar" > <ul class="nav navbar-nav navbar-inverse" data-v-628430e3="" > <li data-v-628430e3="" > <a class="" data-v-628430e3="" data-v-d1b220e4="" href="#/dashboard" > <i class="fa fa-dashboard icon-white" data-v-d1b220e4="" title="Dashboard" /> <span class="navbar-label" data-v-d1b220e4="" > Dashboard </span> </a> </li> <li data-v-628430e3="" > <a class="" data-v-628430e3="" data-v-e714ff03="" href="#/heartbeats" > <i class="fa fa-heartbeat icon-white" data-v-e714ff03="" title="Heartbeats" /> <span class="navbar-label" data-v-e714ff03="" > Heartbeats </span> </a> </li> <li data-v-628430e3="" > <a class="" data-v-628430e3="" data-v-b1c0809e="" href="#/monitoring" > <i class="fa pa-monitoring icon-white" data-v-b1c0809e="" title="Monitoring" /> <span class="navbar-label" data-v-b1c0809e="" > Monitoring </span> </a> </li> <li data-v-628430e3="" > <a class="" data-v-628430e3="" data-v-7acc762f="" href="#/failed-messages" > <i class="fa fa-envelope icon-white" data-v-7acc762f="" title="Failed Messages" /> <span class="navbar-label" data-v-7acc762f="" > Failed Messages </span> </a> </li> <li data-v-628430e3="" > <a class="" data-v-4898b120="" data-v-628430e3="" href="#/custom-checks" > <i class="fa fa-check icon-white" data-v-4898b120=""
expect(await licenseExpiryDaysLeft()).toContain("expiring today");
});
});
});

// describe("RULE: Remaining license period should be displayed", () => {
// test("EXAMPLE: License expiring in more than 10 days should show 'X days left", async ({ driver }) => {
// /* SCENARIO
// License expiring in the future

// Given a platform license which expires more than 10 days from now
// Then "X days left" is shown
// */
// await driver.setUp(precondition.serviceControlWithMonitoring);
// await driver.setUp(precondition.hasActiveLicense);
// await driver.goTo("/configuration/license");
// waitFor(async () => {
// expect(await licenseExpiryDaysLeft()).toContain("days left");
// });
// });
// });
describe("RULE: Non-license options should be hidden if license has expired", () => {
test.todo("EXAMPLE: Only 'LICENSE' tab is visible when license has expired");

Expand Down
13 changes: 7 additions & 6 deletions src/Frontend/test/specs/licensing/license-enforcement.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ import { expiredLicenseMessageWithValue } from "./questions/expiredLicenseMessag
import { viewYourLicenseButton } from "./questions/viewYourLicenseButton";
import { extendYourLicenseButton } from "./questions/extendYourLicenseButton";
import { getAlertNotifications } from "./questions/alertNotifications";
import { LicenseType } from "@/resources/LicenseInfo";

describe("FEATURE: EXPIRING license detection", () => {
describe("RULE: The user should be alerted while using the monitoring endpoint list functionality about an EXPIRING license", () => {
[{ licenseExtensionUrl: "https://particular.net/extend-your-trial?p=servicepulse" }, { licenseExtensionUrl: "http://custom-url?with-parts=value1" }].forEach(({ licenseExtensionUrl }) => {
test(`EXAMPLE: Expiring trial with ${licenseExtensionUrl} as license extension url `, async ({ driver }) => {
//Arrange
await driver.setUp(precondition.serviceControlWithMonitoring);
await driver.setUp(precondition.hasExpiringLicense(precondition.LicenseType.Trial, licenseExtensionUrl));
await driver.setUp(precondition.hasExpiringLicense(LicenseType.Trial, licenseExtensionUrl));

await driver.goTo("monitoring");

Expand All @@ -25,8 +26,8 @@ describe("FEATURE: EXPIRING license detection", () => {
});

[
{ description: "Expiring upgrade protection", licenseType: precondition.LicenseType.UpgradeProtection, textMatch: /once upgrade protection expires, you'll no longer have access to support or new product versions/i },
{ description: "Expiring platform subscription", licenseType: precondition.LicenseType.Subscription, textMatch: /Once the license expires you'll no longer be able to continue using the Particular Service Platform/i },
{ description: "Expiring upgrade protection", licenseType: LicenseType.UpgradeProtection, textMatch: /once upgrade protection expires, you'll no longer have access to support or new product versions/i },
{ description: "Expiring platform subscription", licenseType: LicenseType.Subscription, textMatch: /Once the license expires you'll no longer be able to continue using the Particular Service Platform/i },
].forEach(({ description, licenseType, textMatch }) => {
test(`EXAMPLE: ${description}`, async ({ driver }) => {
//Arrange
Expand All @@ -50,7 +51,7 @@ describe("FEATURE: EXPIRED license detection", () => {
test("EXAMPLE: Expired trial", async ({ driver }) => {
//Arrange
await driver.setUp(precondition.serviceControlWithMonitoring);
await driver.setUp(precondition.hasExpiredLicense(precondition.LicenseType.Trial));
await driver.setUp(precondition.hasExpiredLicense(LicenseType.Trial));

//Act
await driver.goTo("monitoring");
Expand All @@ -69,7 +70,7 @@ describe("FEATURE: EXPIRED license detection", () => {
test("EXAMPLE: Expired platform subscription", async ({ driver }) => {
//Arrange
await driver.setUp(precondition.serviceControlWithMonitoring);
await driver.setUp(precondition.hasExpiredLicense(precondition.LicenseType.Subscription));
await driver.setUp(precondition.hasExpiredLicense(LicenseType.Subscription));

//Act
await driver.goTo("monitoring");
Expand All @@ -88,7 +89,7 @@ describe("FEATURE: EXPIRED license detection", () => {
test("EXAMPLE: Expired upgrade protection", async ({ driver }) => {
//Arrange
await driver.setUp(precondition.serviceControlWithMonitoring);
await driver.setUp(precondition.hasExpiredLicense(precondition.LicenseType.UpgradeProtection));
await driver.setUp(precondition.hasExpiredLicense(LicenseType.UpgradeProtection));

//Act
await driver.goTo("monitoring");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ import { expect } from "vitest";
import { test, describe } from "../../drivers/vitest/driver";
import * as precondition from "../../preconditions";
import { getTrialBar } from "./questions/trialLicenseBar";
import { LicenseType } from "@/resources/LicenseInfo";

describe("FEATURE: Trial license notifications", () => {
describe("RULE: The user should know they are using a trial license at all times", () => {
[{ viewname: "dashboard" }, { viewname: "configuration" }, { viewname: "monitoring" }].forEach(({ viewname }) => {
test(`EXAMPLE: ${viewname}`, async ({ driver }) => {
//Arrange
await driver.setUp(precondition.serviceControlWithMonitoring);
await driver.setUp(precondition.hasExpiringLicense(precondition.LicenseType.Trial));
await driver.setUp(precondition.hasExpiringLicense(LicenseType.Trial));

await driver.goTo(viewname);

Expand All @@ -25,7 +26,7 @@ describe("FEATURE: Trial license notifications", () => {
test(`EXAMPLE: ${viewname}`, async ({ driver }) => {
//Arrange
await driver.setUp(precondition.serviceControlWithMonitoring);
await driver.setUp(precondition.hasExpiringLicense(precondition.LicenseType.Subscription));
await driver.setUp(precondition.hasExpiringLicense(LicenseType.Subscription));

await driver.goTo(viewname);

Expand Down
Loading