|
| 1 | +--- |
| 2 | +name: rhdh-playwright |
| 3 | +description: >- |
| 4 | + Use when navigating, testing, or verifying a RHDH instance via |
| 5 | + playwright-cli. Covers guest login, sidebar navigation, catalog browsing, |
| 6 | + entity page inspection, tab verification, and plugin exploration. Trigger on |
| 7 | + "check RHDH", "verify catalog entity", "entity should have tab", |
| 8 | + "navigate RHDH", or any RHDH UI testing task. |
| 9 | +--- |
| 10 | + |
| 11 | +# Play RHDH |
| 12 | + |
| 13 | +Automate RHDH UI navigation and verification using `playwright-cli` (NOT the Playwright MCP). |
| 14 | + |
| 15 | +## Quick Start |
| 16 | + |
| 17 | +```bash |
| 18 | +# Always use --browser chromium |
| 19 | +playwright-cli open <RHDH_URL> --browser chromium |
| 20 | +``` |
| 21 | + |
| 22 | +The URL is never hardcoded — the user provides it (or it comes from context like CLAUDE.md). |
| 23 | + |
| 24 | +## Authentication — Guest Login |
| 25 | + |
| 26 | +After opening a RHDH instance, check whether a login page appeared. If the page title contains "Sign In" or "Log in", or the snapshot shows sign-in buttons, log in as guest: |
| 27 | + |
| 28 | +```bash |
| 29 | +# Take a snapshot to check for login |
| 30 | +playwright-cli snapshot |
| 31 | + |
| 32 | +# If a login page is detected, look for a guest sign-in option: |
| 33 | +# - Button or link matching: "Enter" (on guest sign-in provider card) |
| 34 | +# - Or a "Guest" / "Sign in as Guest" button |
| 35 | +# Click it: |
| 36 | +playwright-cli click "<ref>" # ref of the guest sign-in button |
| 37 | +``` |
| 38 | + |
| 39 | +RHDH login pages typically show provider cards. The guest provider shows a title like "Guest" with an "Enter" button. Click the "Enter" button on the guest card. |
| 40 | + |
| 41 | +After login, verify navigation succeeded by checking that the sidebar appeared: |
| 42 | + |
| 43 | +```bash |
| 44 | +playwright-cli snapshot --depth 3 |
| 45 | +# Confirm: navigation "sidebar nav" is present |
| 46 | +``` |
| 47 | + |
| 48 | +## Sidebar Navigation |
| 49 | + |
| 50 | +The sidebar uses `navigation "sidebar nav"` containing links. Navigate by clicking the link with the target label. |
| 51 | + |
| 52 | +| Destination | Selector pattern | |
| 53 | +|---|---| |
| 54 | +| Home | `link "Home"` | |
| 55 | +| Catalog | `link "Catalog"` | |
| 56 | +| APIs | `link "APIs"` | |
| 57 | +| Docs | `link "Docs"` | |
| 58 | +| Create | `link "Create"` | |
| 59 | +| Explore | `link "Explore"` | |
| 60 | +| Settings | `link "Settings"` | |
| 61 | +| Notifications | `link "Notifications"` | |
| 62 | +| Search | `button "Search"` | |
| 63 | + |
| 64 | +Additional sidebar items (plugins) appear below a separator. Their labels match their menu name (e.g., `link "Tech Radar"`). |
| 65 | + |
| 66 | +```bash |
| 67 | +# Navigate to a sidebar item |
| 68 | +playwright-cli click "getByRole('navigation', { name: 'sidebar nav' }).getByRole('link', { name: 'Catalog' })" |
| 69 | +``` |
| 70 | + |
| 71 | +## Catalog Page |
| 72 | + |
| 73 | +After navigating to the catalog, the page shows filters and a table of entities. |
| 74 | + |
| 75 | +### Filters |
| 76 | + |
| 77 | +| Filter | Element type | Locator | |
| 78 | +|---|---|---| |
| 79 | +| Kind | button (shows current value) | `button "Component"` (or current kind) | |
| 80 | +| Type | button | `button "all"` (or current type) | |
| 81 | +| Owner | combobox + textbox | `textbox "Owner"` | |
| 82 | +| Lifecycle | combobox + textbox | `textbox "Lifecycle"` | |
| 83 | +| Tags | combobox + textbox | `textbox "Tags"` | |
| 84 | + |
| 85 | +To filter by Kind, click the Kind button and select from the dropdown: |
| 86 | + |
| 87 | +```bash |
| 88 | +playwright-cli click "getByRole('button', { name: 'Component' })" |
| 89 | +playwright-cli snapshot # find the desired kind option |
| 90 | +playwright-cli click "<ref>" # click the desired kind |
| 91 | +``` |
| 92 | + |
| 93 | +### Search the Catalog |
| 94 | + |
| 95 | +```bash |
| 96 | +playwright-cli fill "getByRole('textbox', { name: 'Search' })" "my-entity" |
| 97 | +``` |
| 98 | + |
| 99 | +### Catalog Table |
| 100 | + |
| 101 | +The entity table has columns: Name, System, Owner, Type, Lifecycle, Description, Tags, Actions. |
| 102 | + |
| 103 | +Entity names in the table are links. Their URL pattern is: `/catalog/{namespace}/{kind}/{name}` |
| 104 | + |
| 105 | +```bash |
| 106 | +# Click an entity by name |
| 107 | +playwright-cli click "getByRole('link', { name: 'artist-lookup' })" |
| 108 | +``` |
| 109 | + |
| 110 | +### Personal vs All |
| 111 | + |
| 112 | +The catalog has a menu toggle between "Personal" (Owned / Starred) and "RHDH" (All): |
| 113 | + |
| 114 | +```bash |
| 115 | +# Switch to "All" entities |
| 116 | +playwright-cli click "getByRole('menuitem', { name: /All/ })" |
| 117 | +``` |
| 118 | + |
| 119 | +## Entity Page |
| 120 | + |
| 121 | +An entity page has: |
| 122 | +1. **Header** — shows kind, type, entity name, and metadata (Owner, Lifecycle) |
| 123 | +2. **Tabs** — `tablist "Tabs"` containing `tab` elements |
| 124 | +3. **Content area** — `article` below the tabs |
| 125 | + |
| 126 | +### Verify an Entity Exists |
| 127 | + |
| 128 | +```bash |
| 129 | +playwright-cli open "<RHDH_URL>/catalog/default/component/<entity-name>" --browser chromium |
| 130 | +playwright-cli snapshot --depth 3 |
| 131 | +# Confirm: heading with entity name is present |
| 132 | +# The page title format: "<entity-name> | <tab> | <site-title>" |
| 133 | +``` |
| 134 | + |
| 135 | +Or search through the catalog: |
| 136 | + |
| 137 | +```bash |
| 138 | +playwright-cli open "<RHDH_URL>/catalog" --browser chromium |
| 139 | +playwright-cli fill "getByRole('textbox', { name: 'Search' })" "<entity-name>" |
| 140 | +# Check the table for a matching row |
| 141 | +playwright-cli snapshot |
| 142 | +``` |
| 143 | + |
| 144 | +### Read Entity Metadata |
| 145 | + |
| 146 | +From the entity page snapshot, find: |
| 147 | +- **Kind + Type**: `paragraph` above the heading (e.g., "component — service") |
| 148 | +- **Owner**: under a "Owner" label, a link to the owning group |
| 149 | +- **Lifecycle**: under a "Lifecycle" label (e.g., "experimental", "production") |
| 150 | +- **System**: in the About card under "System" heading |
| 151 | + |
| 152 | +### Verify a Tab Exists |
| 153 | + |
| 154 | +```bash |
| 155 | +playwright-cli snapshot |
| 156 | +# Look for: tablist "Tabs" containing tab elements |
| 157 | +# Example output: |
| 158 | +# tablist "Tabs": |
| 159 | +# tab "Overview" [selected] |
| 160 | +# tab "Docs" |
| 161 | +# tab "APIs" |
| 162 | +# tab "Todo" |
| 163 | +``` |
| 164 | + |
| 165 | +Check that the expected tab name appears in the tablist. Tabs are `tab` role elements inside `tablist "Tabs"`. |
| 166 | + |
| 167 | +```bash |
| 168 | +# Click a specific tab |
| 169 | +playwright-cli click "getByRole('tab', { name: 'Docs' })" |
| 170 | +``` |
| 171 | + |
| 172 | +### About Card |
| 173 | + |
| 174 | +The entity Overview tab contains an "About" card (`heading "About"`) with: |
| 175 | +- Description, Owner, System, Tags, Kind, Type, Lifecycle |
| 176 | +- Links: "View Source", "View TechDocs" |
| 177 | + |
| 178 | +## Common Verification Patterns |
| 179 | + |
| 180 | +### Check that a catalog entity exists |
| 181 | + |
| 182 | +```bash |
| 183 | +playwright-cli open "<URL>" --browser chromium |
| 184 | +# Handle login if needed (see Authentication section) |
| 185 | +playwright-cli goto "<URL>/catalog/default/component/<name>" |
| 186 | +playwright-cli snapshot --depth 4 |
| 187 | +# SUCCESS: heading with entity name is visible |
| 188 | +# FAILURE: page shows "Entity not found" or similar error |
| 189 | +``` |
| 190 | + |
| 191 | +### Entity should have a specific tab |
| 192 | + |
| 193 | +```bash |
| 194 | +playwright-cli goto "<URL>/catalog/default/component/<name>" |
| 195 | +playwright-cli snapshot --depth 4 |
| 196 | +# Find: tablist "Tabs" → check for tab "<expected-tab>" |
| 197 | +``` |
| 198 | + |
| 199 | +### Navigate sidebar and verify page loaded |
| 200 | + |
| 201 | +```bash |
| 202 | +playwright-cli click "getByRole('navigation', { name: 'sidebar nav' }).getByRole('link', { name: '<Page>' })" |
| 203 | +playwright-cli snapshot --depth 3 |
| 204 | +# Confirm heading or page content matches expected page |
| 205 | +``` |
| 206 | + |
| 207 | +### Screenshot for evidence |
| 208 | + |
| 209 | +```bash |
| 210 | +playwright-cli screenshot --filename rhdh-evidence.png |
| 211 | +# Saved to .playwright-cli/rhdh-evidence.png |
| 212 | +``` |
| 213 | + |
| 214 | +## URL Patterns |
| 215 | + |
| 216 | +| Resource | URL pattern | |
| 217 | +|---|---| |
| 218 | +| Catalog list | `/catalog` | |
| 219 | +| Entity by kind | `/catalog/{namespace}/{kind}/{name}` | |
| 220 | +| API docs | `/api-docs` | |
| 221 | +| TechDocs | `/docs` | |
| 222 | +| Create (templates) | `/create` | |
| 223 | +| Settings | `/settings` | |
| 224 | + |
| 225 | +Default namespace is `default`. Common kinds: `component`, `system`, `group`, `user`, `api`, `resource`, `template`, `domain`, `location`. |
| 226 | + |
| 227 | +## Important |
| 228 | + |
| 229 | +- **Always** use `playwright-cli`, never the Playwright MCP tools. |
| 230 | +- **Always** pass `--browser chromium` to `playwright-cli open`. |
| 231 | +- The URL is provided by the user or derived from context — never hardcode it. |
| 232 | +- Logs and screenshots are automatically saved in `.playwright-cli/`. |
| 233 | +- After each `playwright-cli` command, a snapshot is returned — use the ref IDs from it for subsequent interactions. |
| 234 | +- Use `playwright-cli snapshot` to refresh the current page state at any time. |
0 commit comments