diff --git a/frontend/src/pages/login/Login.stories.tsx b/frontend/src/pages/login/Login.stories.tsx index fe57483a3..6daaba26b 100644 --- a/frontend/src/pages/login/Login.stories.tsx +++ b/frontend/src/pages/login/Login.stories.tsx @@ -1,7 +1,9 @@ import "@maykin-ui/admin-ui/style"; import type { Meta, StoryObj } from "@storybook/react"; +import { expect, within } from "@storybook/test"; import { ReactRouterDecorator } from "../../../.storybook/decorators"; +import ExtraConfigContext from "../../lib/contexts/ExtraConfigContext"; import { LoginPage } from "./Login"; const meta: Meta = { @@ -18,3 +20,31 @@ export const LoginPageStory: Story = { children: "The quick brown fox jumps over the lazy dog.", }, }; + +export const LoginPageWithOIDC: Story = { + render: (args) => ( + + + + ), + play: async (context) => { + const canvas = within(context.canvasElement); + + const oidcButton: HTMLBaseElement = await canvas.findByRole("link", { + name: "Organisatie login", + }); + + const redirectUrl = new URL(oidcButton.href); + const nextUrl = redirectUrl.searchParams.get("next"); + + expect(nextUrl).not.toBeNull(); + expect(new URL(nextUrl as string).pathname).toEqual("/"); + }, +};