chore: document and stabilize vitest browser setup

This commit is contained in:
Esdras Renan 2025-10-22 17:19:12 -03:00
parent 42942350dc
commit eee0f432e7
12 changed files with 1238 additions and 325 deletions

View file

@ -0,0 +1,40 @@
import { expect, test } from "vitest"
test("CTA button snapshot", async () => {
const html = `
<main
style="
font-family: 'Inter', sans-serif;
padding: 48px;
display: flex;
align-items: center;
justify-content: center;
background: linear-gradient(135deg, #111827, #1f2937);
min-height: 320px;
"
>
<button
data-testid="cta"
style="
font-size: 18px;
padding: 14px 28px;
border-radius: 9999px;
border: none;
color: white;
background: #2563eb;
box-shadow: 0 10px 20px rgba(37, 99, 235, 0.35);
cursor: pointer;
"
>
Abrir chamado
</button>
</main>
`
document.body.innerHTML = html
const ctaButton = document.querySelector("[data-testid='cta']")
expect(ctaButton).toBeTruthy()
await expect(document.body).toMatchScreenshot("cta-button")
})