quadraecom / pest-plugin-selectors
Add CSS selector-based testing capabilities to Pest
Fund package maintenance!
QuadraEcommerce
Installs: 1 549
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: ^7.4 || ^8.0
- ext-dom: *
- ext-libxml: *
- laravel/framework: ^8.0 || ^9.0
- pestphp/pest: ^1.0
- pestphp/pest-plugin: ^1.0
- pestphp/pest-plugin-laravel: ^1.2
- symfony/css-selector: ^5.4
Requires (Dev)
- orchestra/testbench: ^6.7.2 || ^7.0
- roave/security-advisories: dev-latest
README
Add CSS selector-based testing capabilities to Pest
Install
composer require quadraecom/pest-plugin-selectors --dev
Usage
This package adds these methods:
getSelectorMatches(string $selector): DOMNodeList
This package adds these assertions:
assertSelectorExists(string $selector) assertSelectorNotExists(string $selector) assertSelectorCount(string $selector, int $count) assertSelectorContains(string $selector, string $value) assertSelectorsAllContain(string $selector, string $value) assertSelectorEquals(string $selector, string $value) assertSelectorsAllEqual(string $selector, string $value) assertSelectorNotEquals(string $selector, string $value) assertSelectorsAllNotEqual(string $selector, string $value) assertSelectorAttributeExists(string $selector, string $attribute) assertSelectorAttributeNotExists(string $selector, string $attribute) assertSelectorAttributeEquals(string $selector, string $attribute, $value) assertSelectorAttributeNotEquals(string $selector, string $attribute, $value)
See tests/Selectors.php for example usage.
If you want to start testing your application with Pest, visit the main Pest Repository.
Package Author
This package was created and is maintained by Quadra, Inc.
- Website: GoQuadra.com
- GitHub: QuadraEcommerce
The test assertions were inspired by code written by Liam Hammett (@ImLiam) that can be found in this post on his blog. Thank you, Liam! 🙌🏻