Class MapElement

java.lang.Object
com.vaadin.testbench.TestBenchElement
com.vaadin.flow.component.map.testbench.MapElement
All Implemented Interfaces:
com.vaadin.testbench.commands.CanCompareScreenshots, com.vaadin.testbench.HasCallFunction, com.vaadin.testbench.HasDriver, com.vaadin.testbench.HasElementQuery, com.vaadin.testbench.HasPropertySettersGetters, com.vaadin.testbench.HasSearchContext, com.vaadin.testbench.HasTestBenchCommandExecutor, org.openqa.selenium.SearchContext, org.openqa.selenium.TakesScreenshot, org.openqa.selenium.WebElement, org.openqa.selenium.WrapsElement

public class MapElement extends com.vaadin.testbench.TestBenchElement
  • Constructor Details

    • MapElement

      public MapElement()
  • Method Details

    • getMapReference

      public MapElement.MapReference getMapReference()
      Returns a MapElement.ConfigurationObjectReference wrapper for the OpenLayers map instance. Used to access nested configuration objects in the browser and extract values from them to be used for assertions.
    • clickAtCoordinates

      public void clickAtCoordinates(double x, double y)
      Performs a native click at the specified map coordinates. The method will convert the coordinates into pixel values, and perform a click on the map at the calculated pixel offset.
      Parameters:
      x -
      y -
    • getPixelCoordinates

      public MapElement.PixelCoordinate getPixelCoordinates(double x, double y)
      Returns the pixel coordinates of the specified x and y map coordinates.

      The pixel coordinates are based from the top-left corner of the map.

      Parameters:
      x - the x map coordinate
      y - the y map coordinate
      Returns:
      the equivalent pixel coordinate on the map element
    • getPixelCoordinates

      public MapElement.PixelCoordinate getPixelCoordinates(double x, double y, boolean relativeToCenter)
      Returns the pixel coordinates of the specified x and y map coordinates.

      If relativeToCenter is true, then the pixel coordinates are based from the center of the map. This is useful for Selenium mouse actions, which are based off of the center of the element. If relativeToCenter is false, then the pixel coordinates are based from the top-left corner of the map.

      Parameters:
      x - the x map coordinate
      y - the y map coordinate
      relativeToCenter - whether to base the resulting pixel coordinates from the center of the map element
      Returns:
      the equivalent pixel coordinate on the map element
    • getAttributionContainer

      public com.vaadin.testbench.TestBenchElement getAttributionContainer()
      Gets the attribution container div
      Returns:
      attribution container div
    • getAttributionItems

      public List<com.vaadin.testbench.TestBenchElement> getAttributionItems()
      Gets the list of attributions list items in the attribution container div
      Returns:
      list of list items
    • disableInteractions

      public void disableInteractions()
      Disables all interactions that could interfere with a test, such as double-click to zoom.