quadraecom/pest-plugin-selectors

Add CSS selector-based testing capabilities to Pest
2,035 1
Install
composer require quadraecom/pest-plugin-selectors
Latest Version:v1.5.1
PHP:^7.4 || ^8.0
License:MIT
Last Updated:Jun 2, 2023
Links: GitHub  ·  Packagist
Maintainer: squatto

CSS Selector Plugin for Pest

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.

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! 🙌🏻

Related Packages

pestphp/pest-plugin-type-coverage

The Type Coverage plugin for Pest PHP.

4,941,558 36
nekofar/pest-plugin-mock-client

Pest Plugin for Mock HTTP client

22 1
pestphp/pest-plugin-agent

AI agent verification plugin for Pest

60,329 6
katalam/pest-plugin-translatable

A Pest plugin to test the existence of translations.

8 3