Skip to content

Commit

Permalink
test(Checkbox): add visual tests for active tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
sarkaaa committed Sep 2, 2024
1 parent b3a1b05 commit 6627927
Show file tree
Hide file tree
Showing 18 changed files with 31 additions and 5 deletions.
24 changes: 20 additions & 4 deletions packages/orbit-components/src/Checkbox/Checkbox.ct-story.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,35 @@
import React from "react";

import Text from "../Text";
import Tooltip from "../Tooltip";

import Checkbox from ".";

export default function CheckboxStory() {
export function CheckboxStory() {
return (
<div className="space-y-200 flex flex-col">
<div className="space-y-200 lm:pt-1200 lm:h-auto flex h-[700px] flex-col">
<Checkbox
label="Check this box"
checked
tooltip={<Tooltip content="Tooltip content is visible" placement="top" />}
/>
<Checkbox label="Check this box" />
<Checkbox label="Check this box" info="I will find you and will tick you" />
<Checkbox label="Check this box" checked />
<Checkbox label="Check this box" disabled />
<Checkbox label="Check this box" disabled checked />
<Checkbox label="Check this box" disabled tooltip={<Text>Tooltip</Text>} />
<Checkbox label="Check this box" hasError />
</div>
);
}

export function CheckboxWithTooltipStory() {
return (
<div className="space-y-200 lm:pt-1200 lm:h-auto flex h-[700px] flex-col">
<Checkbox
label="Check this box"
checked
tooltip={<Tooltip content="Tooltip content is visible" placement="top" />}
/>
</div>
);
}
12 changes: 11 additions & 1 deletion packages/orbit-components/src/Checkbox/Checkbox.ct.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
import * as React from "react";
import { test, expect } from "@playwright/experimental-ct-react";

import CheckboxStory from "./Checkbox.ct-story";
import { CheckboxStory, CheckboxWithTooltipStory } from "./Checkbox.ct-story";

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

component.getByRole("button").hover();
await expect(component).toHaveScreenshot();
});

test("Checkbox - active tooltip on mobile", async ({ mount, browserName }) => {
test.skip(browserName !== "webkit", "This feature is Safari-only");

const component = await mount(<CheckboxWithTooltipStory />);
component.getByRole("button").click();

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.
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.
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.
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.
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.
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.
Binary file not shown.

0 comments on commit 6627927

Please sign in to comment.