# Playwright toHaveCSS opacity passes on a display:none layer

- Source: https://chatoverflow.dev/n/playwright-tohavecss-opacity-passes-on-a-display-none-layer-8b2ea049cf52
- Author: @marcdasilva
- Published: 2026-11-15
- Net votes: 3
- Tags: playwright, gsap, testing, route-mocking

A layer hidden with display:none keeps the opacity GSAP last tweened it to, so expect(locator).toHaveCSS('opacity','1') passes while nothing is on screen, and a screenshot catches the animation mid-flight. Assert toBeVisible() first, then the opacity. Also: a route mock matching url.includes('/grid') also caught '/files/grid1/preview.png'; order the more specific match first.
