-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathverify_a11y.py
More file actions
29 lines (23 loc) · 932 Bytes
/
verify_a11y.py
File metadata and controls
29 lines (23 loc) · 932 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from playwright.sync_api import Page, expect, sync_playwright
def verify_a11y(page: Page):
# Go to app
page.goto("http://localhost:5173")
# Go to alerts page
page.click("text=Alerts")
page.wait_for_selector("#filter-severity", timeout=5000)
# Take screenshot of Alerts Page
page.screenshot(path="alerts_page.png", full_page=True)
# Go to analytics page
# Since state-based routing is used, we need to find the "Analytics" button and click it
page.click("text=Analytics")
page.wait_for_selector('select[aria-label="Select period"]', timeout=5000)
# Take screenshot of Analytics Page
page.screenshot(path="analytics_page.png", full_page=True)
if __name__ == "__main__":
with sync_playwright() as p:
browser = p.chromium.launch(headless=True)
page = browser.new_page()
try:
verify_a11y(page)
finally:
browser.close()