write-ui-testlisted
Install: claude install-skill rohitmann721994/vexa
# Write a UI Test
## Overview
Scaffold a new UI test the way this framework expects: locators + actions in a
page object under `pages/ui/`, assertions in a test under `tests/ui/`, using the
`uiLibrary` and `evidence` fixtures. Read `CLAUDE.md` first for the architecture
and conventions.
**The golden rule: page objects hold locators and actions; tests hold
assertions. No raw Playwright calls in tests, no assertions in page objects.**
## Steps
Track these as todos; do them in order.
### 1. Confirm the flow and selectors live
Before writing code, drive the flow interactively (Playwright MCP, headed) to
capture real, stable selectors. Prefer role/text/id selectors over brittle CSS
paths. Note anything that only works headed, or any dialog/flag/precondition.
### 2. Create or extend the page object
`pages/ui/<page>.py` — one class per screen. Locators in `__init__`, one method
per meaningful action or query. No assertions. Follow `pages/ui/home_page.py`:
```python
from playwright.sync_api import Page
class WidgetPage:
def __init__(self, page: Page) -> None:
self.page = page
self.save_button = "#save"
self.status_label = "#status"
def save(self) -> None:
self.page.click(self.save_button)
def status_text(self) -> str:
return (self.page.text_content(self.status_label) or "").strip()
```
### 3. Write the test
`tests/ui/test_<feature>.py`. Follow `tests/ui/test_example_login.py`:
```python
import pytest
from pages.ui.