PerformanceAssertions
Playwright\Performance\Test\PerformanceAssertions
Trait providing performance-related assertions for PHPUnit tests.
Methods
assertLcpBelowThreshold()
voidAssert that LCP (Largest Contentful Paint) is below the specified threshold in milliseconds.
function assertLcpBelowThreshold(CoreWebVitals $vitals, float $thresholdMs, string $message = ''): void
assertLcpIsGood()
voidAssert that LCP is "Good" according to Core Web Vitals thresholds (<2.5s).
function assertLcpIsGood(CoreWebVitals $vitals, string $message = ''): void
assertFcpBelowThreshold()
voidAssert that FCP (First Contentful Paint) is below the specified threshold in milliseconds.
function assertFcpBelowThreshold(CoreWebVitals $vitals, float $thresholdMs, string $message = ''): void
assertFcpIsGood()
voidAssert that FCP is "Good" according to Core Web Vitals thresholds (<1.8s).
function assertFcpIsGood(CoreWebVitals $vitals, string $message = ''): void
assertClsBelowThreshold()
voidAssert that CLS (Cumulative Layout Shift) is below the specified threshold.
function assertClsBelowThreshold(CoreWebVitals $vitals, float $threshold, string $message = ''): void
assertClsIsGood()
voidAssert that CLS is "Good" according to Core Web Vitals thresholds (<0.1).
function assertClsIsGood(CoreWebVitals $vitals, string $message = ''): void
assertInpBelowThreshold()
voidAssert that INP (Interaction to Next Paint) is below the specified threshold in milliseconds. Note: INP requires real user interaction and may be 0 in automated tests.
function assertInpBelowThreshold(CoreWebVitals $vitals, float $thresholdMs, string $message = ''): void
assertInpIsGood()
voidAssert that INP is "Good" according to Core Web Vitals thresholds (<200ms). Note: INP requires real user interaction and may be 0 in automated tests.
function assertInpIsGood(CoreWebVitals $vitals, string $message = ''): void
assertFidBelowThreshold()
voidAssert that FID (First Input Delay) is below the specified threshold in milliseconds. Note: FID requires real user interaction and may be 0 in automated tests.
function assertFidBelowThreshold(CoreWebVitals $vitals, float $thresholdMs, string $message = ''): void
assertFidIsGood()
voidAssert that FID is "Good" according to Core Web Vitals thresholds (<100ms). Note: FID requires real user interaction and may be 0 in automated tests.
function assertFidIsGood(CoreWebVitals $vitals, string $message = ''): void
assertTtfbBelowThreshold()
voidAssert that TTFB (Time to First Byte) is below the specified threshold in milliseconds.
function assertTtfbBelowThreshold(CoreWebVitals $vitals, float $thresholdMs, string $message = ''): void
assertTtfbIsGood()
voidAssert that TTFB is "Good" according to Core Web Vitals thresholds (<800ms).
function assertTtfbIsGood(CoreWebVitals $vitals, string $message = ''): void
assertTbtBelowThreshold()
voidAssert that TBT (Total Blocking Time) is below the specified threshold in milliseconds.
function assertTbtBelowThreshold(CoreWebVitals $vitals, float $thresholdMs, string $message = ''): void
assertTbtIsGood()
voidAssert that TBT is "Good" according to Core Web Vitals thresholds (<200ms).
function assertTbtIsGood(CoreWebVitals $vitals, string $message = ''): void
assertAllCoreWebVitalsAreGood()
voidAssert that all Core Web Vitals are "Good" according to recommended thresholds. Note: INP and FID may be 0 in automated tests and will be skipped if so.
function assertAllCoreWebVitalsAreGood(CoreWebVitals $vitals, string $message = ''): void
assertResourceCountBelowThreshold()
voidAssert that the total number of resources is below the specified threshold.
function assertResourceCountBelowThreshold(array $resources, int $threshold, string $message = ''): void
assertTotalResourceSizeBelowThreshold()
voidAssert that the total size of all resources is below the specified threshold in bytes.
function assertTotalResourceSizeBelowThreshold(array $resources, int $thresholdBytes, string $message = ''): void
assertResourceTypeSizeBelowThreshold()
voidAssert that a specific resource type's total size is below the specified threshold in bytes.
function assertResourceTypeSizeBelowThreshold(array $resources, string $type, int $thresholdBytes, string $message = ''): void
assertNoResourceExceedsDuration()
voidAssert that no single resource exceeds the specified duration threshold in milliseconds.
function assertNoResourceExceedsDuration(array $resources, float $thresholdMs, string $message = ''): void