Playwright page object.
OptionalmodalLocator: LocatorOptional custom locator for the modal. Defaults to getByRole('dialog').
Protected ReadonlymodalModal wrapper element.
Protected ReadonlypagePlaywright page object.
Testing helper method.
Checks if the modal is currently visible.
True if modal is visible, false otherwise.
Closes the modal by clicking the close button or pressing Escape.
OptionalcloseLocator: LocatorOptional locator for the close button. If not provided, will try to find a close button.
Closes the modal by pressing the Escape key.
Closes the modal by clicking the backdrop (if applicable).
Waits for screen size change and handles modal state accordingly.
Target width to resize to.
Target height to resize to.
Checks if modal should be closed on screen size change.
The width breakpoint at which modal should close.
True if modal was closed, false if it remains open.
Cleans up tests by closing modal if left open.
Base fixture for Modal components.
Example
Remarks
Provides common methods for locating modal elements and handling modal interactions. Can be extended for specific modal implementations.
Source