Skip to content

Commit

Permalink
test(ListChoice): replace chromatic visual test with playwright
Browse files Browse the repository at this point in the history
  • Loading branch information
mainframev authored and mvidalgarcia committed Feb 7, 2024
1 parent c2f1e09 commit 4624b5a
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 0 deletions.
48 changes: 48 additions & 0 deletions packages/orbit-components/src/ListChoice/ListChoice.ct-story.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import React from "react";

import Button from "../Button";
import Airplane from "../icons/Airplane";
import Boat from "../icons/Boat";
import Bus from "../icons/Bus";
import Train from "../icons/Train";
import Plus from "../icons/Plus";

import ListChoice from ".";

export default function ListChoiceVisualStory() {
return (
<>
<ListChoice title="Selectable no icon" description="Further description" selectable />
<ListChoice title="Title only and disabled, no icon" disabled />
<ListChoice title="Selectable" description="Further description" selectable icon={<Bus />} />
<ListChoice
title="Selected"
description="Further description"
selectable
selected
icon={<Airplane />}
/>
<ListChoice
title="Selected and disabled"
description="Further description"
selectable
selected
disabled
icon={<Train />}
/>
<ListChoice
title="Non-selected and disabled"
description="Further description"
selectable
disabled
icon={<Train />}
/>
<ListChoice
title="Action"
description="Further description"
icon={<Boat />}
action={<Button iconLeft={<Plus />} size="small" type="primarySubtle" />}
/>
</>
);
}
12 changes: 12 additions & 0 deletions packages/orbit-components/src/ListChoice/ListChoice.ct.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import * as React from "react";
import { test, expect } from "@playwright/experimental-ct-react";

import ListChoiceStory from "./ListChoice.ct-story";

test.describe("visual ListChoice", () => {
test("ListChoice", async ({ mount }) => {
const component = await mount(<ListChoiceStory />);

await expect(component).toHaveScreenshot();
});
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4624b5a

Please sign in to comment.