-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(Popover): add visual screenshots
test(Popover): add linux screenshots
- Loading branch information
1 parent
3d59d4d
commit 5a6eaa9
Showing
43 changed files
with
152 additions
and
6 deletions.
There are no files selected for viewing
82 changes: 82 additions & 0 deletions
82
packages/orbit-components/src/Popover/Popover.ct-story.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,82 @@ | ||
import React from "react"; | ||
import type { Placement } from "@popperjs/core/lib/enums"; | ||
|
||
import Text from "../Text"; | ||
import Button from "../Button"; | ||
import Stepper from "../Stepper"; | ||
import Stack from "../Stack"; | ||
|
||
import Popover from "."; | ||
|
||
const content = <Text>Popover content</Text>; | ||
|
||
const selects = ( | ||
<Stack direction="column"> | ||
<Stack flex shrink align="center" justify="between"> | ||
<Stack flex direction="column" spacing="none"> | ||
<Text>Adult</Text> | ||
<Text type="secondary">11+</Text> | ||
</Stack> | ||
<Stepper minValue={0} /> | ||
</Stack> | ||
<Stack flex shrink align="center" justify="between"> | ||
<Stack flex direction="column" spacing="none"> | ||
<Text>Child</Text> | ||
<Text type="secondary">2-11</Text> | ||
</Stack> | ||
<Stepper minValue={0} /> | ||
</Stack> | ||
</Stack> | ||
); | ||
|
||
export function DefaultPopover() { | ||
return ( | ||
<div className="flex h-screen items-center justify-center"> | ||
<Popover opened content={content}> | ||
<Button>open popover</Button> | ||
</Popover> | ||
</div> | ||
); | ||
} | ||
|
||
export function PopoverWithCustomWidth() { | ||
return ( | ||
<div className="flex h-screen items-center justify-center"> | ||
<Popover opened content={content} width="400px"> | ||
<Button>open popover</Button> | ||
</Popover> | ||
</div> | ||
); | ||
} | ||
|
||
export const PopoverPlacements = ({ placement }: { placement: Placement }) => ( | ||
<div className="flex h-screen items-center justify-center"> | ||
<Popover opened content={content} placement={placement}> | ||
<Button>open popover</Button> | ||
</Popover> | ||
</div> | ||
); | ||
|
||
export const PopoverWithFixedPosition = () => ( | ||
<div className="flex h-screen items-center justify-center"> | ||
<Popover opened content={content} fixed> | ||
<Button>open popover</Button> | ||
</Popover> | ||
</div> | ||
); | ||
|
||
export const PopoverOverlapped = () => ( | ||
<div className="flex h-screen items-center justify-center"> | ||
<Popover opened content={content} overlapped> | ||
<Button>open popover</Button> | ||
</Popover> | ||
</div> | ||
); | ||
|
||
export const PopoverLongContent = () => ( | ||
<div className="flex h-screen items-center justify-center"> | ||
<Popover opened content={<Stack>{Array.from({ length: 8 }).map(() => selects)}</Stack>}> | ||
<Button>open popover</Button> | ||
</Popover> | ||
</div> | ||
); |
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,64 @@ | ||
import * as React from "react"; | ||
import { test, expect } from "@playwright/experimental-ct-react"; | ||
|
||
import { | ||
DefaultPopover, | ||
PopoverWithCustomWidth, | ||
PopoverWithFixedPosition, | ||
PopoverPlacements, | ||
PopoverOverlapped, | ||
PopoverLongContent, | ||
} from "./Popover.ct-story"; | ||
import { PLACEMENTS } from "../common/consts"; | ||
|
||
test.describe("visual Popover", () => { | ||
test(`screenshot for default`, async ({ mount }, { project }) => { | ||
if (project.name === "Desktop") { | ||
const component = await mount(<DefaultPopover />); | ||
|
||
await expect(component).toHaveScreenshot(); | ||
} | ||
}); | ||
|
||
Object.values(PLACEMENTS).forEach(placement => { | ||
test(`screenshot for placement ${placement}`, async ({ mount }, { project }) => { | ||
if (project.name === "Desktop") { | ||
const component = await mount(<PopoverPlacements placement={placement} />); | ||
|
||
await expect(component).toHaveScreenshot(); | ||
} | ||
}); | ||
}); | ||
|
||
test(`screenshot for custom width`, async ({ mount }, { project }) => { | ||
if (project.name === "Desktop") { | ||
const component = await mount(<PopoverWithCustomWidth />); | ||
|
||
await expect(component).toHaveScreenshot(); | ||
} | ||
}); | ||
|
||
test(`screenshot for fixed position`, async ({ mount }, { project }) => { | ||
if (project.name === "Desktop") { | ||
const component = await mount(<PopoverWithFixedPosition />); | ||
|
||
await expect(component).toHaveScreenshot(); | ||
} | ||
}); | ||
|
||
test(`screenshot for overlapped`, async ({ mount }, { project }) => { | ||
if (project.name === "Desktop") { | ||
const component = await mount(<PopoverOverlapped />); | ||
|
||
await expect(component).toHaveScreenshot(); | ||
} | ||
}); | ||
|
||
test(`screenshot for long content`, async ({ mount }, { project }) => { | ||
if (project.name === "Desktop") { | ||
const component = await mount(<PopoverLongContent />); | ||
|
||
await expect(component).toHaveScreenshot(); | ||
} | ||
}); | ||
}); |
Binary file added
BIN
+13.8 KB
...t.tsx-snapshots/visual-Popover-screenshot-for-custom-width-1-Desktop-darwin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.9 KB
...ct.tsx-snapshots/visual-Popover-screenshot-for-custom-width-1-Desktop-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+13.6 KB
...ver.ct.tsx-snapshots/visual-Popover-screenshot-for-default-1-Desktop-darwin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.9 KB
...over.ct.tsx-snapshots/visual-Popover-screenshot-for-default-1-Desktop-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+13.2 KB
...tsx-snapshots/visual-Popover-screenshot-for-fixed-position-1-Desktop-darwin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.7 KB
....tsx-snapshots/visual-Popover-screenshot-for-fixed-position-1-Desktop-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+16.9 KB
...t.tsx-snapshots/visual-Popover-screenshot-for-long-content-1-Desktop-darwin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+15.9 KB
...ct.tsx-snapshots/visual-Popover-screenshot-for-long-content-1-Desktop-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+11.3 KB
....ct.tsx-snapshots/visual-Popover-screenshot-for-overlapped-1-Desktop-darwin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+10.6 KB
...r.ct.tsx-snapshots/visual-Popover-screenshot-for-overlapped-1-Desktop-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+13.6 KB
...tsx-snapshots/visual-Popover-screenshot-for-placement-auto-1-Desktop-darwin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.8 KB
....tsx-snapshots/visual-Popover-screenshot-for-placement-auto-1-Desktop-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+13.6 KB
...snapshots/visual-Popover-screenshot-for-placement-auto-end-1-Desktop-darwin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.9 KB
...-snapshots/visual-Popover-screenshot-for-placement-auto-end-1-Desktop-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+13.6 KB
...apshots/visual-Popover-screenshot-for-placement-auto-start-1-Desktop-darwin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.9 KB
...napshots/visual-Popover-screenshot-for-placement-auto-start-1-Desktop-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+13.6 KB
...x-snapshots/visual-Popover-screenshot-for-placement-bottom-1-Desktop-darwin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.9 KB
...sx-snapshots/visual-Popover-screenshot-for-placement-bottom-1-Desktop-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+13.6 KB
...apshots/visual-Popover-screenshot-for-placement-bottom-end-1-Desktop-darwin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.9 KB
...napshots/visual-Popover-screenshot-for-placement-bottom-end-1-Desktop-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+13.6 KB
...shots/visual-Popover-screenshot-for-placement-bottom-start-1-Desktop-darwin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.9 KB
...pshots/visual-Popover-screenshot-for-placement-bottom-start-1-Desktop-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+13.5 KB
...tsx-snapshots/visual-Popover-screenshot-for-placement-left-1-Desktop-darwin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.9 KB
....tsx-snapshots/visual-Popover-screenshot-for-placement-left-1-Desktop-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+13.6 KB
...snapshots/visual-Popover-screenshot-for-placement-left-end-1-Desktop-darwin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+13 KB
...-snapshots/visual-Popover-screenshot-for-placement-left-end-1-Desktop-linux.png
Oops, something went wrong.
Binary file added
BIN
+13.6 KB
...apshots/visual-Popover-screenshot-for-placement-left-start-1-Desktop-darwin.png
Oops, something went wrong.
Binary file added
BIN
+12.9 KB
...napshots/visual-Popover-screenshot-for-placement-left-start-1-Desktop-linux.png
Oops, something went wrong.
Binary file added
BIN
+13.6 KB
...sx-snapshots/visual-Popover-screenshot-for-placement-right-1-Desktop-darwin.png
Oops, something went wrong.
Binary file added
BIN
+12.8 KB
...tsx-snapshots/visual-Popover-screenshot-for-placement-right-1-Desktop-linux.png
Oops, something went wrong.
Binary file added
BIN
+13.7 KB
...napshots/visual-Popover-screenshot-for-placement-right-end-1-Desktop-darwin.png
Oops, something went wrong.
Binary file added
BIN
+13 KB
...snapshots/visual-Popover-screenshot-for-placement-right-end-1-Desktop-linux.png
Oops, something went wrong.
Binary file added
BIN
+13.6 KB
...pshots/visual-Popover-screenshot-for-placement-right-start-1-Desktop-darwin.png
Oops, something went wrong.
Binary file added
BIN
+12.9 KB
...apshots/visual-Popover-screenshot-for-placement-right-start-1-Desktop-linux.png
Oops, something went wrong.
Binary file added
BIN
+13.7 KB
....tsx-snapshots/visual-Popover-screenshot-for-placement-top-1-Desktop-darwin.png
Oops, something went wrong.
Binary file added
BIN
+13.1 KB
...t.tsx-snapshots/visual-Popover-screenshot-for-placement-top-1-Desktop-linux.png
Oops, something went wrong.
Binary file added
BIN
+13.7 KB
...-snapshots/visual-Popover-screenshot-for-placement-top-end-1-Desktop-darwin.png
Oops, something went wrong.
Binary file added
BIN
+13 KB
...x-snapshots/visual-Popover-screenshot-for-placement-top-end-1-Desktop-linux.png
Oops, something went wrong.
Binary file added
BIN
+13.6 KB
...napshots/visual-Popover-screenshot-for-placement-top-start-1-Desktop-darwin.png
Oops, something went wrong.
Binary file added
BIN
+13.1 KB
...snapshots/visual-Popover-screenshot-for-placement-top-start-1-Desktop-linux.png
Oops, something went wrong.
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