Packages narrative
packages / test-viewport

test-viewport

Functions

NameDescription
installMatchMediaInstalls a controllable
presetToUseMaps a preset to the Playwright
responsiveProjectsBuilds one Playwright project per preset, naming each
breakpointForWidthResolves a CSS pixel width to its mobile-first breakpoint name.

Types

NameDescription
MatchMediaControllerControls a installed shim: resize the emulated viewport, then restore globals.
ResponsiveProjectA Playwright project config carrying a viewport preset's emulation settings.
ResponsiveProjectsOptionsOptions for
ResponsiveUseThe subset of a Playwright project
BreakpointMobile-first breakpoint names, ascending by min-width.
ViewportPresetA named device viewport used to drive unit and e2e responsive checks.

Variables

NameDescription
BREAKPOINT_MIN_WIDTHAscending min-width (px) at which each breakpoint becomes active.
CORE_RESPONSIVE_MATRIXA compact, opinionated matrix for app-level e2e: one device per visually distinct tier (folded foldable, phone, tablet, side-by-side desktop) so the device fan-out stays cheap while still covering every layout branch.
DESKTOPDesktop — 1440 design width.
FOLDABLE_FOLDEDCover screen of a folded book-style foldable (Galaxy Z Fold) — extreme narrow stress.
FOLDABLE_UNFOLDEDInner screen of an unfolded book-style foldable — square-ish, lands in
LAPTOPLaptop — common 1280-wide notebook; first
MOBILEModern mid-size phone — iPhone 12/13/14 class.
MOBILE_SMALLNarrowest realistic phone — iPhone SE; the floor for "no horizontal overflow" checks.
TABLET_LANDSCAPETablet landscape — the boundary where the editor flips to side-by-side (
TABLET_PORTRAITTablet portrait — iPad class; the lower edge of
VIEWPORT_PRESETSEvery preset, ascending by width.
VIEWPORT_PRESETS_BY_IDPresets indexed by id for direct lookup.
WIDEWide / large desktop —

Other

On this page