flexpect - v0.21.0
    Preparing search index...
    • Asserts that the element is fully visible within the current viewport, optionally respecting a safety margin from the viewport edges.

      ┌────────────────────────────────────┐
      │             Viewport               │
      │                                    │
      │  ┌──marginPixel──┐                 │
      │  │               │                 │
      │  │   [element]   │ ← must be here  │
      │  │               │                 │
      │  └───────────────┘                 │
      └────────────────────────────────────┘
      

      Parameters

      Returns Promise<MatcherReturnType>

      A Promise that resolves with the matcher result.

      // Element must be fully in viewport (no margin)
      await expect(card).toBeWithinViewport();
      // Element must be fully visible with 50px margin from all edges
      await expect(modal).toBeWithinViewport({ marginPixel: 50 });