-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Simulator/screens/GeneratingKeys): create stories
- Loading branch information
1 parent
9a39ec0
commit 34b2322
Showing
2 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
src/components/Simulator/screens/CreateAccount/__stories__/GeneratingKeys.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import type { Meta, StoryObj } from "@storybook/react/*" | ||
import { | ||
expect, | ||
fn, | ||
waitFor, | ||
waitForElementToBeRemoved, | ||
within, | ||
} from "@storybook/test" | ||
|
||
import { BUTTON_DELAY_DURATION } from "../constants" | ||
import { GeneratingKeys } from "../GeneratingKeys" | ||
|
||
const meta = { | ||
title: | ||
"Molecules / Display Content / Simulator / CreateAccount Screen / GeneratingKeys", | ||
component: GeneratingKeys, | ||
args: { | ||
ctaLabel: "Next", | ||
nav: { | ||
openPath: fn(), | ||
progressStepper: fn(), | ||
regressStepper: fn(), | ||
step: 0, | ||
totalSteps: 2, | ||
}, | ||
generateNewWords: fn(), | ||
}, | ||
decorators: [ | ||
(Story) => ( | ||
<div className="relative h-[590px] w-[312px]"> | ||
<Story /> | ||
</div> | ||
), | ||
], | ||
} satisfies Meta<typeof GeneratingKeys> | ||
|
||
export default meta | ||
|
||
type Story = StoryObj<typeof meta> | ||
|
||
export const Loading: Story = {} | ||
|
||
export const LoadingDoneCheck: Story = { | ||
play: async ({ canvasElement }) => { | ||
const canvas = within(canvasElement) | ||
|
||
await waitForElementToBeRemoved(canvas.getByTestId("loading-spinner"), { | ||
timeout: BUTTON_DELAY_DURATION + 1000, | ||
}) | ||
|
||
await waitFor( | ||
() => { | ||
expect(canvas.getByTestId("generating-keys-cta")).toBeInTheDocument() | ||
}, | ||
{ | ||
timeout: 1500, | ||
} | ||
) | ||
}, | ||
} |