Skip to content

Commit 99c30b6

Browse files
authored
set the time component to zero to remove time zone flakiness (#2261)
1 parent dd38602 commit 99c30b6

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/Frontend/test/preconditions/licensing.ts

+3
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ const getLicenseMockedResponse =
7777
function getCustomDateISOString(daysCount: number, isExpired: boolean) {
7878
const today = new Date();
7979
const customDate = new Date(today);
80+
// Set hours, minutes, seconds, and milliseconds to 00
81+
today.setHours(0, 0, 0, 0);
82+
customDate.setHours(0, 0, 0, 0);
8083

8184
if (isExpired) {
8285
customDate.setDate(today.getDate() - daysCount);

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

+5-5
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ describe("FEATURE: License", () => {
5555
describe("RULE: License expiring soon must be displayed", () => {
5656
test("EXAMPLE: License expiring in 11 days", async ({ driver }) => {
5757
await driver.setUp(precondition.serviceControlWithMonitoring);
58-
await driver.setUp(precondition.hasExpiringLicense(LicenseType.Subscription, 10));
58+
await driver.setUp(precondition.hasExpiringLicense(LicenseType.Subscription, 11));
5959
await driver.goTo("/configuration/license");
6060
await waitFor(async () => {
6161
expect(await licenseExpiryDaysLeft()).toBeVisible();
@@ -64,7 +64,7 @@ describe("FEATURE: License", () => {
6464
});
6565
test("EXAMPLE: License expiring tomorrow", async ({ driver }) => {
6666
await driver.setUp(precondition.serviceControlWithMonitoring);
67-
await driver.setUp(precondition.hasExpiringLicense(LicenseType.Subscription, 0));
67+
await driver.setUp(precondition.hasExpiringLicense(LicenseType.Subscription, 1));
6868
await driver.goTo("/configuration/license");
6969
await waitFor(async () => {
7070
expect(await licenseExpiryDaysLeft()).toBeVisible();
@@ -73,7 +73,7 @@ describe("FEATURE: License", () => {
7373
});
7474
test("EXAMPLE: License expiring today", async ({ driver }) => {
7575
await driver.setUp(precondition.serviceControlWithMonitoring);
76-
await driver.setUp(precondition.hasExpiringLicense(LicenseType.Subscription, -1));
76+
await driver.setUp(precondition.hasExpiringLicense(LicenseType.Subscription, 0));
7777
await driver.goTo("/configuration/license");
7878
await waitFor(async () => {
7979
expect(await licenseExpiryDaysLeft()).toBeVisible();
@@ -85,7 +85,7 @@ describe("FEATURE: License", () => {
8585
describe("RULE: Upgrade Protection license expiring soon must be displayed with a reference to how much time is left and a warning:'Once upgrade protection expires, you'll no longer have access to support or new product versions. '", () => {
8686
test("EXAMPLE: Upgrade Protection license expiring in 11 days", async ({ driver }) => {
8787
await driver.setUp(precondition.serviceControlWithMonitoring);
88-
await driver.setUp(precondition.hasExpiringLicense(LicenseType.UpgradeProtection, 10));
88+
await driver.setUp(precondition.hasExpiringLicense(LicenseType.UpgradeProtection, 11));
8989
await driver.goTo("/configuration/license");
9090
await waitFor(async () => {
9191
expect(await licenseExpiryDaysLeft()).toBeVisible();
@@ -94,7 +94,7 @@ describe("FEATURE: License", () => {
9494
});
9595
test("EXAMPLE: Upgrade Protection license expiring tomorrow", async ({ driver }) => {
9696
await driver.setUp(precondition.serviceControlWithMonitoring);
97-
await driver.setUp(precondition.hasExpiringLicense(LicenseType.UpgradeProtection, 0));
97+
await driver.setUp(precondition.hasExpiringLicense(LicenseType.UpgradeProtection, 1));
9898
await driver.goTo("/configuration/license");
9999
await waitFor(async () => {
100100
expect(await licenseExpiryDaysLeft()).toBeVisible();

0 commit comments

Comments
 (0)