chore: document and stabilize vitest browser setup
This commit is contained in:
parent
42942350dc
commit
eee0f432e7
12 changed files with 1238 additions and 325 deletions
40
tests/browser/example.browser.test.ts
Normal file
40
tests/browser/example.browser.test.ts
Normal 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")
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue