@webability/core 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -35,6 +35,58 @@ import { scan } from '@webability/core'
35
35
  const result = await scan(page)
36
36
  ```
37
37
 
38
+ ## Playwright test helper
39
+
40
+ `@webability/core/playwright` is the new home of the old `@webability/playwright` package — same API, one less dependency. Needs `playwright` installed (optional peer).
41
+
42
+ ```typescript
43
+ import { test, expect } from '@playwright/test'
44
+ import { a11yCheck, WebAbility } from '@webability/core/playwright'
45
+
46
+ test('homepage is accessible', async ({ page }) => {
47
+ await page.goto('/')
48
+ const result = await a11yCheck(page)
49
+ expect(result.summary.critical).toBe(0)
50
+ })
51
+
52
+ test('no new issues during checkout flow', async ({ page }) => {
53
+ const wa = new WebAbility(page)
54
+ await wa.start()
55
+ await page.goto('/cart')
56
+ await page.click('text=Checkout')
57
+ const result = await wa.stop() // merged issues across the whole flow
58
+ expect(result.summary.critical).toBe(0)
59
+ })
60
+ ```
61
+
62
+ For mobile coverage, emulate the device first — the engine includes touch-target (2.5.8), reflow (1.4.10), and zoom (1.4.4) checks:
63
+
64
+ ```typescript
65
+ import { chromium, devices } from 'playwright'
66
+
67
+ const browser = await chromium.launch()
68
+ const page = await browser.newPage({ ...devices['iPhone 14'] })
69
+ await page.goto('https://example.com')
70
+ const result = await scan(page)
71
+ ```
72
+
73
+ ## In-DOM and component scans
74
+
75
+ `@webability/core/dom` runs the full engine against a live `document` — no browser automation. Use it in jsdom component tests, content scripts, or any in-browser consumer:
76
+
77
+ ```typescript
78
+ // component.test.tsx (jsdom environment)
79
+ import { scanDocument } from '@webability/core/dom'
80
+
81
+ test('login form is accessible', async () => {
82
+ render(<LoginForm />)
83
+ const result = await scanDocument()
84
+ expect(result.summary.critical).toBe(0)
85
+ })
86
+ ```
87
+
88
+ Same detectors, same dedupe, same axe-core pass as a full page scan.
89
+
38
90
  ## Options
39
91
 
40
92
  ```typescript