Objective
What to automate
Assert the closed host contract, prove its public shadowRoot is null, and prove a scoped button locator finds no internal control.
Preconditions and test data
Preconditions
- Use a fresh isolated Practice Lab browser context.
- Open the fixture identified by FX-SHD-001.
Test data
host test id: closed-shadow-hostdata-shadow-root: closed
Expected result
The documented host remains observable, while the internal button remains inaccessible to page JavaScript and Playwright locators.
Progressive hints
Hint 1
Start with the closed host and its data-shadow-root attribute.
Hint 2
Evaluate only the public host shadowRoot property.
Hint 3
Assert zero scoped buttons rather than attempting to click the internal control.
I’ve tried it — show solution
- Start with the closed host and its data-shadow-root attribute.
- Evaluate only the public host shadowRoot property.
- Assert zero scoped buttons rather than attempting to click the internal control.
The deliberately failing starter is in tests/shadow-dom.spec.ts inside the TypeScript starter ZIP.