Skip to content

Commit

Permalink
test(Truncate): replace chromatic visual test with playwright
Browse files Browse the repository at this point in the history
  • Loading branch information
mainframev committed Jan 24, 2024
1 parent f85c91e commit a259d9b
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 0 deletions.
34 changes: 34 additions & 0 deletions packages/orbit-components/src/Truncate/Truncate.ct-story.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import React from "react";

import Text from "../Text";
import Stack from "../Stack";
import Heading from "../Heading";

import Truncate from ".";

export default function TileStory() {
const content =
"Duis ante orci, molestie vitae vehicula venenatis, tincidunt ac pede. Duis bibendum, lectus ut viverra rhoncus, dolor nunc faucibus libero, eget facilisis enim ipsum id lacus. Nulla pulvinar eleifend sem. Sed ac dolor sit amet purus malesuada congue. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Pellentesque pretium lectus id turpis. Etiam dictum tincidunt diam.";

return (
<div className="space-y-sm">
<Truncate maxWidth="20%">
<Text>{content}</Text>
</Truncate>
<Stack direction="row">
<Truncate maxWidth="20%">
<Text>{content}</Text>
</Truncate>
<Truncate maxWidth="50%">
<Text>{content}</Text>
</Truncate>
<Truncate>
<Text>{content}</Text>
</Truncate>
</Stack>
<Truncate maxWidth="60%">
<Heading>This is a Heading component inside a Truncate</Heading>
</Truncate>
</div>
);
}
12 changes: 12 additions & 0 deletions packages/orbit-components/src/Truncate/Truncate.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 TruncateStory from "./Truncate.ct-story";

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

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 a259d9b

Please sign in to comment.