flexpect - v0.21.0
    Preparing search index...
    • Asserts that the target element is aligned with the specified container element based on the provided axis and alignment mode, considering an optional tolerance percentage.

      • Horizontal Start Alignment:
      ┌───────────────────────────────┐
      │┌─────────┐                    │
      ││ Element │                    │
      │└─────────┘                    │
      └───────────────────────────────┘
      
      • Horizontal Center Alignment:
      ┌───────────────────────────────┐
      │          ┌─────────┐          │
      │          │ Element │          │
      │          └─────────┘          │
      └───────────────────────────────┘
      
      • Horizontal End Alignment:
      ┌───────────────────────────────┐
      │                    ┌─────────┐│
      │                    │ Element ││
      │                    └─────────┘│
      └───────────────────────────────┘
      
      • Vertical Start Alignment:
      ┌───────────────────────────────┐
      │┌─────────────────────────────┐│
      ││           Element           ││
      │└─────────────────────────────┘│
      │                               │
      │                               │
      └───────────────────────────────┘
      
      • Vertical Center Alignment:
      ┌───────────────────────────────┐
      │┌─────────────────────────────┐│
      ││           Element           ││
      │└─────────────────────────────┘│
      │                               │
      └───────────────────────────────┘
      
      • Vertical End Alignment:
      ┌───────────────────────────────┐
      │                               │
      │                               │
      │┌─────────────────────────────┐│
      ││           Element           ││
      │└─────────────────────────────┘│
      └───────────────────────────────┘
      

      Parameters

      • element: Locator

        The element as a Locator to check for alignment.

      • container: Locator

        The container element as a Locator relative to which alignment is checked.

      • axis: Axis

        The axis along which to check alignment (horizontal or vertical).

      • mode: Alignment

        The alignment mode to check (start, center, or end).

      • options: Tolerance = {}

        Optional alignment options.

      Returns Promise<MatcherReturnType>

      A Promise that resolves with the matcher result.

      // Checks that the button is horizontally centered with its parent within 2% tolerance
      await expect(buttonLocator).toBeAlignedWith(parentLocator, Axis.Horizontal, Alignment.Center, {
      tolerance: 2,
      toleranceUnit: ToleranceUnit.Percent
      });
      // Checks that the button is aligned to the start vertically with no tolerance
      await expect(buttonLocator).toBeAlignedWith(parentLocator, Axis.Vertical, Alignment.Start);