Skip to content

Commit 19de01d

Browse files
authored
tests: Stabilize screenshot tests and clean up flaky infrastructure (#1220)
* tests: Stabilize screenshot tests and clean up flaky infrastructure * Update image caption test and refresh screenshots Updates the Markdown image caption test to use a new caption and image. Regenerates all related test screenshots to reflect the change. * Update test scripts to separate snapshot updates in vitest * Document Vitest usage and remove old screenshot baselines Add detailed instructions for running and updating Vitest browser-based unit tests in the README. Remove outdated screenshot baseline PNGs from __tests__/__screenshots__. * Update image test to add className and refresh screenshot Add guidance in README to be selective when updating screenshots. * Update testing guidelines for React Router and snapshot usage
1 parent caa1dfc commit 19de01d

File tree

81 files changed

+75
-19
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+75
-19
lines changed

.github/workflows/pull-request.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,3 @@ jobs:
4747
run: yarn playwright install --with-deps
4848
- name: Vitest
4949
run: yarn ci:test
50-
- name: Commit and Push changes
51-
uses: stefanzweifel/git-auto-commit-action@v5
52-
with:
53-
commit_message: "chore: update vitest screenshots [skip ci]"
54-
file_pattern: "**/__screenshots__/**/*.png"

AGENTS.md

Lines changed: 5 additions & 2 deletions

README.md

Lines changed: 21 additions & 0 deletions

__tests__/MarkdownComponents_.test.res

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,12 +203,14 @@ test("renders Image with caption", async () => {
203203
let screen = await render(
204204
<div dataTestId="image-wrapper">
205205
<Markdown.Image
206-
src="https://rescript-lang.org/brand/rescript-brandmark.svg" caption="The ReScript logo"
206+
className="rounded-lg border border-gray-90/5 text-gray-60"
207+
src="https://rescript-lang.org/lp/community-3.avif"
208+
caption="A sample image caption"
207209
/>
208210
</div>,
209211
)
210212

211-
let caption = await screen->getByText("The ReScript logo")
213+
let caption = await screen->getByText("A sample image caption")
212214
await element(caption)->toBeVisible
213215

214216
let wrapper = await screen->getByTestId("image-wrapper")
@@ -226,9 +228,6 @@ test("renders Video with caption", async () => {
226228

227229
let caption = await screen->getByText("A sample video")
228230
await element(caption)->toBeVisible
229-
230-
let wrapper = await screen->getByTestId("video-wrapper")
231-
await element(wrapper)->toMatchScreenshot("markdown-video")
232231
})
233232

234233
test("renders horizontal rule", async () => {

__tests__/NavbarSecondary_.test.res

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ test("desktop secondary navbar shows all doc section links", async () => {
55
await viewport(1440, 500)
66

77
let screen = await render(
8-
<BrowserRouter>
8+
<MemoryRouter initialEntries=["/docs/manual/introduction"]>
99
<NavbarSecondary />
10-
</BrowserRouter>,
10+
</MemoryRouter>,
1111
)
1212

1313
let navbar = await screen->getByTestId("navbar-secondary")
@@ -24,9 +24,9 @@ test("mobile secondary navbar shows all links", async () => {
2424
await viewport(600, 500)
2525

2626
let screen = await render(
27-
<BrowserRouter>
27+
<MemoryRouter initialEntries=["/docs/manual/introduction"]>
2828
<NavbarSecondary />
29-
</BrowserRouter>,
29+
</MemoryRouter>,
3030
)
3131

3232
let navbar = await screen->getByTestId("navbar-secondary")
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)