Skip to content

Commit 3eb6f20

Browse files
committed
screenshots
1 parent 80b836d commit 3eb6f20

8 files changed

Lines changed: 21 additions & 6 deletions

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,7 @@ __tests__/**/*.jsx
6868
_scripts
6969

7070
# Local env files
71-
.env.local
71+
.env.local
72+
73+
# Vitest screenshots
74+
!__tests__/__screenshots__/**/*

__tests__/NavbarPrimary_.test.res

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ test("desktop has everything visible", async () => {
2323
await element(rightContent->getByLabelText("X (formerly Twitter)"))->toBeVisible
2424
await element(rightContent->getByLabelText("Bluesky"))->toBeVisible
2525
await element(rightContent->getByLabelText("Forum"))->toBeVisible
26+
27+
let navbar = await screen->getByTestId("navbar-primary")
28+
29+
await element(navbar)->toMatchScreenshot("desktop-navbar-primary")
2630
})
2731

2832
test("tablet has everything visible", async () => {
@@ -47,6 +51,10 @@ test("tablet has everything visible", async () => {
4751
await element(rightContent->getByLabelText("X (formerly Twitter)"))->toBeVisible
4852
await element(rightContent->getByLabelText("Bluesky"))->toBeVisible
4953
await element(rightContent->getByLabelText("Forum"))->toBeVisible
54+
55+
let navbar = await screen->getByTestId("navbar-primary")
56+
57+
await element(navbar)->toMatchScreenshot("tablet-navbar-primary")
5058
})
5159

5260
test("phone has some things hidden and a mobile nav that can be toggled", async () => {
@@ -84,8 +92,9 @@ test("phone has some things hidden and a mobile nav that can be toggled", async
8492

8593
await element(mobileNav)->toBeVisible
8694

87-
// await element(screen->getByLabelText("Github"))->toBeVisible
88-
// await element(screen->getByLabelText("X (formerly Twitter)"))->toBeVisible
89-
// await element(screen->getByLabelText("Bluesky"))->toBeVisible
90-
// await element(screen->getByLabelText("Forum"))->toBeVisible
95+
let navbar = await screen->getByTestId("navbar-primary")
96+
97+
await element(navbar)->toMatchScreenshot("mobile-navbar-primary")
98+
99+
await element(mobileNav)->toMatchScreenshot("mobile-overlay-navbar-primary")
91100
})
1.89 KB
Loading
1.98 KB
Loading
6.69 KB
Loading
3.23 KB
Loading

src/bindings/Vitest.res

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,6 @@ external toBeVisible: element => promise<unit> = "toBeVisible"
7171

7272
@send @scope("not")
7373
external notToBeVisible: element => promise<unit> = "toBeVisible"
74+
75+
@send
76+
external toMatchScreenshot: (element, string) => promise<unit> = "toMatchScreenshot"

src/components/NavbarPrimary.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ let make = () => {
104104

105105
<>
106106
<nav
107-
id="main-navbar"
107+
dataTestId="navbar-primary"
108108
className={`
109109
sticky top-0 h-16 w-full items-center bg-gray-90 shadow text-white-80 text-14 z-100
110110
grid grid-rows-1 grid-cols-[[full-start]_minmax(1rem,1fr)_[content-start]_min(1280px,100%-2rem)_[content-end]_minmax(1rem,1fr)_[full-end]]

0 commit comments

Comments
 (0)