generated from telekom/reuse-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ui/styles): setup visual regression testing with storybook and p…
…laywright | tg / sc | #28
- Loading branch information
1 parent
53fdfda
commit 8d84ac6
Showing
18 changed files
with
55 additions
and
4 deletions.
There are no files selected for viewing
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
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
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
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,16 @@ | ||
import { defineConfig, devices } from "@playwright/test" | ||
|
||
export default defineConfig({ | ||
testDir: "./tests", | ||
snapshotDir: "./tests/__screenshots__", | ||
projects: [ | ||
{ | ||
name: "chromium", | ||
use: { ...devices["Desktop Chrome"] }, | ||
}, | ||
{ | ||
name: "webkit", | ||
use: { ...devices["Desktop Safari"] }, | ||
}, | ||
], | ||
}) |
Binary file added
BIN
+8.82 KB
.../__screenshots__/drawer.vrt.test.ts-snapshots/drawer-bottom-chromium-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
+43.3 KB
...ts/__screenshots__/drawer.vrt.test.ts-snapshots/drawer-bottom-webkit-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
+8.92 KB
...__screenshots__/drawer.vrt.test.ts-snapshots/drawer-default-chromium-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
+43.6 KB
...s/__screenshots__/drawer.vrt.test.ts-snapshots/drawer-default-webkit-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
+8.76 KB
...ots__/drawer.vrt.test.ts-snapshots/drawer-hide-close-button-chromium-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
+43.2 KB
...shots__/drawer.vrt.test.ts-snapshots/drawer-hide-close-button-webkit-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
+7.11 KB
...ts/__screenshots__/drawer.vrt.test.ts-snapshots/drawer-left-chromium-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
+39.2 KB
...ests/__screenshots__/drawer.vrt.test.ts-snapshots/drawer-left-webkit-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
+8.92 KB
...s/__screenshots__/drawer.vrt.test.ts-snapshots/drawer-right-chromium-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
+43.6 KB
...sts/__screenshots__/drawer.vrt.test.ts-snapshots/drawer-right-webkit-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
+7 KB
...sts/__screenshots__/drawer.vrt.test.ts-snapshots/drawer-top-chromium-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
+39.3 KB
...tests/__screenshots__/drawer.vrt.test.ts-snapshots/drawer-top-webkit-darwin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,31 @@ | ||
import { expect, test } from "@playwright/test" | ||
import { PLACEMENTS } from "../src/components" | ||
|
||
const placements = [...PLACEMENTS, "default"] | ||
|
||
test.describe("Visual Regression Tests", () => { | ||
for (const placement of placements) { | ||
test(`Drawer ${placement}`, async ({ page }) => { | ||
await page.goto(`http://localhost:6006/?path=/story/components-ui-drawer--${placement}`) // URL for the Storybook iframe of the component | ||
|
||
await expect(page.locator("#preview-loader")).toBeHidden() | ||
|
||
const iFrame = page.locator("#storybook-preview-iframe") | ||
const screenshot = await iFrame.screenshot() | ||
|
||
expect(screenshot).toMatchSnapshot(`drawer-${placement}.png`) | ||
}) | ||
} | ||
|
||
test("Drawer hide close button", async ({ page }) => { | ||
await page.goto("http://localhost:6006/?path=/story/components-ui-drawer--hide-close-button") // URL for the Storybook iframe of the component | ||
|
||
await expect(page.locator("#preview-loader")).toBeHidden() | ||
await expect(page.locator("div.sb-preparing-story.sb-wrapper")).toBeHidden() | ||
|
||
const iFrame = page.locator("#storybook-preview-iframe") | ||
const screenshot = await iFrame.screenshot() | ||
|
||
expect(screenshot).toMatchSnapshot("drawer-hide-close-button.png") | ||
}) | ||
}) |