hyva-playwright-test▌
hyva-themes/hyva-ai-tools · updated Apr 8, 2026
MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.
Hyvä replaces Luma's KnockoutJS/RequireJS/jQuery with Alpine.js + Tailwind CSS. Playwright's strict mode (rejects locators matching multiple elements) conflicts with Alpine.js DOM patterns where hidden elements exist throughout the page. This skill documents pitfalls and solutions discovered while writing Playwright tests for Hyvä storefronts.
Writing Playwright Tests for Hyvä + Alpine.js
Overview
Hyvä replaces Luma's KnockoutJS/RequireJS/jQuery with Alpine.js + Tailwind CSS. Playwright's strict mode (rejects locators matching multiple elements) conflicts with Alpine.js DOM patterns where hidden elements exist throughout the page. This skill documents pitfalls and solutions discovered while writing Playwright tests for Hyvä storefronts.
The #1 Rule: Hidden Alpine Elements
Hyvä templates scatter elements like <div x-show="displayErrorMessage" class="message error"> throughout the DOM. These are invisible but present, so a bare selector like .message.error matches both hidden and visible instances, causing Playwright strict mode violations.
Always scope page-level messages to the #messages container:
// WRONG — matches hidden Alpine x-show elements throughout DOM
await expect(page.locator('.message.success')).toContainText('Added to cart');
await expect(page.locator('.message-error')).toContainText('Error');
// RIGHT — scoped to the visible messages container
await expect(page.locator('#messages .message.success')).toContainText('Added to cart');
await expect(page.locator('#messages .message-error, #messages .message.error')).toContainText('Error');
Never use: bare .message, .message.error, .message.success, or div.message as selectors.
Exception — inline page messages: Not all .message elements are flash messages. The search results "no results" notice (.message.notice) renders as static inline content inside #maincontent, not inside the #messages container. For these inline messages, the bare class selector is correct.
Selector Strategy
Follow Playwright's recommended locator priority:
getByRole()— always prefer — closest to how users perceive the page. Avoids text ambiguity where the same text appears in headings, links, breadcrumbs, andsr-onlyspans.getByLabel()— for form controls (checkboxes, inputs with associated labels).getByText()— for non-interactive elements, scoped to a container (e.g.,page.locator('#maincontent').getByText(...)).getByPlaceholder(),getByAltText()— for inputs and images respectively.getByTestId()— when Hyvä providesdata-testidattributes or when adding custom test IDs.- CSS selectors — last resort, only when user-facing locators aren't available. Prefer
aria-*attribute selectors (e.g.,[aria-label="pagination"],[aria-current="page"]) over class-based selectors. When CSS is necessary, scope to a unique container (e.g.,#messages .message.success).
Avoid: :visible pseudo-selector — per Playwright docs, "it's usually better to find a more reliable way to uniquely identify the element." Scope to a container or use role/attribute selectors instead. Only use :visible as an absolute last resort when the DOM provides no other way to distinguish elements.
Alpine.js Interaction Patterns
| Pattern | Problem | Solution |
|---|---|---|
x-show hidden elements |
Strict mode: multiple matches | Scope to unique container (#messages), use role/attribute selectors |
x-defer="intersect" |
Element not initialized until visible | scrollIntoViewIfNeeded() before interacting |
x-if (template) |
Elements don't exist in DOM until condition true | Click the trigger first, then query children |
x-model on inputs |
Alpine clears value after form submit | Don't assert input value post-submit; verify via success message |
x-text / x-html async |
Cart badge updates asynchronously | Use web-first assertions with timeout: not.toHaveText('0', { timeout: 15_000 }) |
x-show submenus |
Hidden until hover | hover() on parent before clicking child |
| Alpine form reveal | Fields hidden until checkbox checked | waitFor({ state: 'visible' }) after checking the checkbox |
press('Enter') on input |
May submit Alpine-bound form unexpectedly | Prefer explicit .click() on submit button |
Assertions
Always use web-first assertions that auto-wait and retry:
// DO — auto-retries // DON'T — no retry
await expect(loc).toBeVisible(); // expect(await loc.isVisible()).toBe(true);
await expect(loc).toContainText('X'); // expect(await loc.textContent()).toContain('X');
For async Alpine.js updates (cart counts, prices), use extended timeouts on the assertion — never waitForTimeout():
// Cart count updates asynchronously via Alpine x-text
await expect(page.locator('#menu-cart-icon span[x-text="summaryCount"]'))
.not.toHaveText('0', { timeout: 15_000 });
Hyvä vs Luma Selector Differences
| Element | Hyvä Selector | Luma Selector |
|---|---|---|
| Pagination nav | getByRole('navigation', { name: 'pagination' }) |
ul.pages-items |
| Page link | getByRole('link', { name: 'Page 2' }) |
.pages-items li a |
| Active page | [aria-current="page"] |
<strong> element |
| Filter button | getByRole('button', { name: 'Color filter' }) |
.filter-options-title |
| Cart icon badge | #menu-cart-icon > span[x-text="summaryCount"] |
.counter-number |
| Account menu | #customer-menu + nav |
.customer-menu |
| Success message | #messages .message.success |
.message-success |
| Error message | #messages .message-error, #messages .message.error |
.message-error |
| Main menu | getByRole('navigation', { name: 'Main menu' }) |
nav.navigation |
| Footer nav | getByRole('navigation', { name: 'Company Menu' }).getByRole('link', { name }) |
nav ul li:nth-child(N) a |
| Product image | #gallery img[itemprop="image"] |
#gallery img:visible |
| Add to Cart (card) | getByRole('button', { name: /Add to Cart/ }).first() |
button.btn-primary:visible |
References
See references/ for code examples. Load files relevant to the current task:
Always useful:
- page-object-patterns.md — Page object structure, navigation, form submits, redirects
- selector-patterns.md — Before/after selector fixes (messages, text ambiguity, forms)
Page-specific (load when testing that page):
- cart-patterns.md — Cart spinner wait, quantity changes, mini cart
- product-patterns.md — Bundle quantities, gallery images
- account-patterns.md — Password change (Alpine checkbox reveal)
- category-patterns.md — Filters (x-defer scroll), pagination (ARIA)
How to use hyva-playwright-test on Cursor
AI-first code editor with Composer
Prerequisites
Before installing skills in Cursor, ensure your development environment meets these requirements:
- ›Cursor installed and configured on your development machine
- ›Node.js version 16.0+ with npm package manager (verify with
node --version) - ›Active project directory or workspace where you want to add hyva-playwright-test
Execute installation command
Execute the skills CLI command in your project's root directory to begin installation:
The skills CLI fetches hyva-playwright-test from GitHub repository hyva-themes/hyva-ai-tools and configures it for Cursor.
Select Cursor when prompted
The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:
Verify installation
Confirm successful installation by checking the skill directory location:
Reload or restart Cursor to activate hyva-playwright-test. Access the skill through slash commands (e.g., /hyva-playwright-test) or your agent's skill management interface.
Security & Verification Notice
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.
List & Monetize Your Skill
Submit your Claude Code skill and start earning
Use Cases▌
Task Automation & Efficiency
Automate repetitive workflows and reduce manual effort
Example
Generate reports, summarize documents, draft communications
Save 3-5 hours per week on routine tasks
Knowledge Enhancement
Learn new skills, understand complex topics, get expert guidance
Example
Explain concepts, provide examples, suggest learning resources
Accelerate learning and skill development by 2x
Quality Improvement
Enhance output quality through reviews, suggestions, and refinements
Example
Review drafts, suggest improvements, catch errors
Improve work quality by 30-40% with less effort
Implementation Guide▌
Prerequisites
- ›Claude Desktop or compatible AI client with skill support
- ›Clear understanding of task or problem to solve
- ›Willingness to iterate and refine outputs
Time Estimate
15-45 minutes depending on use case complexity
Installation Steps
- 1.Install skill using provided installation command
- 2.Test with simple use case relevant to your work
- 3.Evaluate output quality and relevance
- 4.Iterate on prompts to improve results
- 5.Integrate into regular workflow if valuable
Common Pitfalls
- ⚠Expecting perfect results without iteration
- ⚠Not providing enough context in prompts
- ⚠Using skill for tasks outside its intended scope
- ⚠Accepting outputs without review and validation
Best Practices▌
✓ Do
- +Start with clear, specific prompts
- +Provide relevant context and constraints
- +Review and refine all outputs before using
- +Iterate to improve output quality
- +Document successful prompt patterns
✗ Don't
- −Don't use without understanding skill limitations
- −Don't skip validation of outputs
- −Don't share sensitive information in prompts
- −Don't expect skill to replace human judgment
💡 Pro Tips
- ★Be specific about desired format and style
- ★Ask for multiple options to choose from
- ★Request explanations to understand reasoning
- ★Combine AI efficiency with human expertise
When to Use This▌
✓ Use When
Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.
✗ Avoid When
Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.
Learning Path▌
- 1Familiarize yourself with skill capabilities and limitations
- 2Start with low-risk, non-critical tasks
- 3Progress to more complex and valuable use cases
- 4Build expertise through regular use and experimentation
Discussion
Product Hunt–style comments (not star reviews)- No comments yet — start the thread.
Ratings
4.7★★★★★44 reviews- ★★★★★Pratham Ware· Dec 28, 2024
hyva-playwright-test is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
- ★★★★★Nikhil Sharma· Dec 24, 2024
hyva-playwright-test reduced setup friction for our internal harness; good balance of opinion and flexibility.
- ★★★★★Nikhil Chawla· Dec 16, 2024
Solid pick for teams standardizing on skills: hyva-playwright-test is focused, and the summary matches what you get after install.
- ★★★★★Arya Haddad· Dec 4, 2024
hyva-playwright-test has been reliable in day-to-day use. Documentation quality is above average for community skills.
- ★★★★★Arya Gill· Nov 23, 2024
Useful defaults in hyva-playwright-test — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
- ★★★★★Yash Thakker· Nov 19, 2024
Keeps context tight: hyva-playwright-test is the kind of skill you can hand to a new teammate without a long onboarding doc.
- ★★★★★Arya Desai· Nov 7, 2024
Registry listing for hyva-playwright-test matched our evaluation — installs cleanly and behaves as described in the markdown.
- ★★★★★Neel Rahman· Nov 3, 2024
I recommend hyva-playwright-test for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
- ★★★★★Neel Abbas· Oct 26, 2024
hyva-playwright-test fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
- ★★★★★Nikhil Bhatia· Oct 22, 2024
hyva-playwright-test reduced setup friction for our internal harness; good balance of opinion and flexibility.
showing 1-10 of 44