From 4b6c72ec2a5104340c2c0ec2caa017d9d3abcaa1 Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Fri, 13 Nov 2026 14:40:36 +0100 Subject: [PATCH] Pin the Manual Rotation Due story to the story clock (#24746) The story built its due date from the real clock and the component reads Date.now() for the due age, so Chromatic flagged it on every build. --- .../rotation-config-edit.component.stories.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bitwarden_license/bit-web/src/app/pam/rotation/managed-credentials/rotation-config-edit.component.stories.ts b/bitwarden_license/bit-web/src/app/pam/rotation/managed-credentials/rotation-config-edit.component.stories.ts index 40255036d14..f5dce31c5be 100644 --- a/bitwarden_license/bit-web/src/app/pam/rotation/managed-credentials/rotation-config-edit.component.stories.ts +++ b/bitwarden_license/bit-web/src/app/pam/rotation/managed-credentials/rotation-config-edit.component.stories.ts @@ -18,6 +18,7 @@ import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.servi import { CipherType } from "@bitwarden/common/vault/enums/cipher-type"; import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view"; import { DialogService, ToastService } from "@bitwarden/components"; +import { DAY, fromNow, startClockAtStoryNow } from "@bitwarden/storybook"; import { PreloadedEnglishI18nModule } from "@bitwarden/web-vault/app/core/tests"; import type { AccessConnector, RotationConfigDetailView } from "../rotation"; @@ -143,6 +144,8 @@ export default { title: "Web/PAM/Rotation/Config Edit", component: RotationConfigEditComponent, render: () => ({ template: `` }), + // The due callout's age is relative to `Date.now()`, so the clock starts where the dates do. + beforeEach: startClockAtStoryNow, decorators: [ componentWrapperDecorator((story) => `
${story}
`), moduleMetadata({ imports: [RouterOutlet] }), @@ -289,7 +292,7 @@ export const ManualRotationDue: Story = editStory( withConfig({ targetSystemMethod: "manual", awaitingManualRotation: true, - nextRotationAt: new Date(Date.now() - 3 * 86_400_000).toISOString(), + nextRotationAt: fromNow(-3 * DAY), }), [], rotationConfigActions({ canRotateNow: false, canRecordManual: true, canPause: false }),