Skip to content

Commit

Permalink
test(Collapse): add visual tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sarkaaa committed Jan 9, 2025
1 parent 2d95bc1 commit 3ce3c14
Show file tree
Hide file tree
Showing 26 changed files with 18 additions and 2 deletions.
8 changes: 7 additions & 1 deletion packages/orbit-components/src/Collapse/Collapse.ct-story.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,15 @@ export default function CollapseStory() {
>
<p>Collapsed content</p>
</Collapse>
<Collapse label="Expanded" initialExpanded>
<Collapse label="Initial expanded" initialExpanded>
<p>Initial expanded content</p>
</Collapse>
<Collapse label="Expanded" expanded>
<p>Expanded content</p>
</Collapse>
<Collapse label="Collapsed">
<p>Content</p>
</Collapse>
</>
);
}
12 changes: 11 additions & 1 deletion packages/orbit-components/src/Collapse/Collapse.ct.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,19 @@ import { test, expect } from "@playwright/experimental-ct-react";
import CollapseStory from "./Collapse.ct-story";

test.describe("visual Collapse", () => {
test("Collapse", async ({ mount }) => {
test("Default collapse", async ({ mount }) => {
const component = await mount(<CollapseStory />);

await expect(component).toHaveScreenshot();
});

test("First Collapse opens on label click and last Collapse opens on arrow button click", async ({
mount,
}) => {
const component = await mount(<CollapseStory />);

await component.getByRole("button").first().click();
await component.getByRole("button").last().click();
await expect(component).toHaveScreenshot();
});
});
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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.
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 3ce3c14

Please sign in to comment.