Skip to content

Add rodney viewport WIDTH HEIGHT command for persistent viewport resizing #32

@matthewbjones

Description

@matthewbjones

Use Case

When doing QA testing at different viewport sizes (desktop, tablet, mobile), I need to interact with the page at a specific viewport — not just take a screenshot. For example, clicking a mobile hamburger menu, testing a mobile-only button, or verifying touch-target sizing.

Currently, rodney screenshot -w 390 -h 844 correctly uses EmulationSetDeviceMetricsOverride to set the viewport before capturing, which triggers CSS media queries properly. But the viewport reverts after the screenshot, so I can't interact with mobile-only elements.

Proposal

Add a rodney viewport WIDTH HEIGHT command that calls EmulationSetDeviceMetricsOverride persistently (without reverting), so subsequent click, input, exists, visible, js, etc. commands operate at the specified viewport size.

# Set mobile viewport
rodney viewport 390 844

# Now interact with mobile-only elements
rodney click ".mobile-menu-button"
rodney exists ".mobile-nav-drawer"

# Take a screenshot (already at mobile viewport)
rodney screenshot /tmp/mobile.png

# Switch to tablet
rodney viewport 768 1024

# Reset to default
rodney viewport --reset

Context

I'm using Rodney in CI (GitHub Actions) to drive automated QA testing against preview environments. The viewport resizing infrastructure already exists in the screenshot code path — this would just expose it as a standalone command.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions