flexpect - v0.21.0
    Preparing search index...
    • Asserts that the target element has the same width and height as the specified container element.

      Parameters

      • element: Locator

        The element as a Locator to check for size.

      • container: Locator

        A Locator representing the element to compare size with.

      • options: Tolerance = {}

        Optional comparison options.

      Returns Promise<MatcherReturnType>

      A Promise that resolves with the matcher result.

      // Checks that the element matches the container's size, with up to 5% tolerance in width and height
      await expect(elementLocator).toHaveSameSizeAs(containerLocator, {
      tolerance: 5,
      toleranceUnit: ToleranceUnit.Percent
      });
      // Checks that the element has exactly the same width and height as its container using default alignment options
      await expect(elementLocator).toHaveSameSizeAs(containerLocator);