Class MuiComponents

  • All Implemented Interfaces:
    com.github.grossopa.selenium.core.component.Components

    public class MuiComponents
    extends com.github.grossopa.selenium.core.component.AbstractComponents
    Contains the definition of Material UI components.
    Since:
    1.0
    Author:
    Jack Yin
    • Constructor Detail

      • MuiComponents

        public MuiComponents()
        Constructs an instance with default MuiConfig.
      • MuiComponents

        public MuiComponents​(MuiConfig config)
        Constructs an instance with provided MuiConfig.
        Parameters:
        config - the MUI configuration instance
    • Method Detail

      • toAutocomplete

        public MuiAutocomplete toAutocomplete​(@Nullable
                                              org.openqa.selenium.By optionLocator)
        Wraps the current WebComponent to MuiAutocomplete with customized optionLocator.

        It supports both Material UI version MuiVersion.V4 and MuiVersion.V5.

        The WebElement should have css class "MuiAutocomplete-root".

        Parameters:
        optionLocator - the option locator for finding the option elements
        Returns:
        the wrapped MuiAutocomplete instance on the given component
      • toAutocomplete

        public MuiAutocomplete toAutocomplete​(@Nullable
                                              org.openqa.selenium.By optionLocator,
                                              @Nullable
                                              MuiAutocompleteTagLocators tagLocators)
        Wraps the current WebComponent to MuiAutocomplete with customized optionLocator and tagLocators (for multiple selection feature).

        It supports both Material UI version MuiVersion.V4 and MuiVersion.V5.

        The WebElement should have css class "MuiAutocomplete-root".

        Parameters:
        optionLocator - the option locator for finding the option elements
        tagLocators - the tag locators for finding the selected option elements
        Returns:
        the wrapped MuiAutocomplete instance on the given component
      • toAutocomplete

        public MuiAutocomplete toAutocomplete​(@Nullable
                                              org.openqa.selenium.By optionLocator,
                                              @Nullable
                                              MuiAutocompleteTagLocators tagLocators,
                                              @Nullable
                                              OpenOptionsAction openOptionsAction,
                                              @Nullable
                                              CloseOptionsAction closeOptionsAction)
        Wraps the current WebComponent to MuiAutocomplete with customized optionLocator, tagLocators (for multiple selection feature), and actions for opening and closing the options.

        It supports both Material UI version MuiVersion.V4 and MuiVersion.V5.

        The WebElement should have css class "MuiAutocomplete-root".

        Parameters:
        optionLocator - the option locator for finding the option elements
        tagLocators - the tag locators for finding the selected option elements
        openOptionsAction - the customized open options action
        closeOptionsAction - the customized close options action
        Returns:
        the wrapped MuiAutocomplete instance on the given component
      • toButton

        public MuiButton toButton()
        Wraps the current WebComponent to MuiButton instance.

        It supports both Material UI version MuiVersion.V4 and MuiVersion.V5.

        The WebElement should have css class "MuiButton-root".

        Returns:
        wrapped MuiButton instance on the given component
      • toButtonGroup

        public MuiButtonGroup toButtonGroup()
        Wraps the current WebComponent to MuiButtonGroup instance.

        It supports both Material UI version MuiVersion.V4 and MuiVersion.V5.

        The WebElement should have below structure: <div class="MuiButtonGroup-root"> <div class="MuiButton-root ..."></div> <div class="MuiButton-root ..."></div> <div class="MuiButton-root ..."></div> </div>

        Returns:
        wrapped MuiButtonGroup instance on the given component
      • toFab

        public MuiFab toFab()
        Wraps the current WebComponent to MuiFab instance.

        It supports both Material UI version MuiVersion.V4 and MuiVersion.V5.

        The WebElement should have css class "MuiFab-root".

        Returns:
        wrapped MuiFab instance on the given component
      • toRadio

        public MuiRadio toRadio()
        Wraps the current WebComponent to MuiRadio.

        It supports both Material UI version MuiVersion.V4 and MuiVersion.V5.

        The WebElement should have css class "MuiRadio-root".

        Returns:
        the wrapped MuiRadio instance on the given component
      • toRadioGroup

        public MuiRadioGroup toRadioGroup()
        Wraps the current WebComponent to MuiRadioGroup.

        It supports both Material UI version MuiVersion.V4 and MuiVersion.V5.

        The WebElement should have below structure: <div class="MuiFormGroup-root"> .... <span class="MuiRadio-root ..."></span> <span class="MuiRadio-root ..."></span> <span class="MuiRadio-root ..."></span> </div>

        Returns:
        the wrapped MuiRadioGroup instance on the given component
      • toSelect

        public MuiSelect toSelect​(org.openqa.selenium.By optionLocator)
        Wraps the current WebComponent to MuiSelect instance.

        It supports both Material UI version MuiVersion.V4 and MuiVersion.V5.

        The WebElement should have css class "MuiSelect-root".

        Parameters:
        optionLocator - the locator for locating the options (NOTE: it is the option element NOT the option container)
        Returns:
        wrapped MuiSelect instance on the given component
      • toSelect

        public MuiSelect toSelect​(org.openqa.selenium.By optionLocator,
                                  String optionValueAttribute)
        Wraps the current WebComponent to MuiSelect instance.

        It supports both Material UI version MuiVersion.V4 and MuiVersion.V5.

        The WebElement should have css class "MuiSelect-root".

        Parameters:
        optionLocator - the locator for locating the options (NOTE: it is the option element NOT the option container)
        optionValueAttribute - if the option value will be marked somewhere in the element. with this attribute it will make sure MuiSelect.selectByValue(String) and MuiSelect.deselectByValue(String) works properly.
        Returns:
        wrapped MuiSelect instance on the given component
      • toSelect

        public MuiSelect toSelect​(org.openqa.selenium.By optionLocator,
                                  java.util.function.Consumer<MuiSelectConfig.MuiSelectConfigBuilder> configEnrichConsumer)
        Wraps the current WebComponent to MuiSelect instance.

        It supports both Material UI version MuiVersion.V4 and MuiVersion.V5.

        The WebElement should have css class "MuiSelect-root".

        Parameters:
        optionLocator - the locator for locating the options (NOTE: it is the option element NOT the option container)
        configEnrichConsumer - allows developer to configure using the builder
        Returns:
        wrapped MuiSelect instance on the given component
      • toSlider

        public MuiSlider toSlider​(java.util.function.UnaryOperator<Double> inverseScaleFunction)
        Wraps the current WebComponent to MuiSlider instance with scale function configured. MuiSlider for MuiVersion.V4 and MuiSliderV5 for MuiVersion.V5.

        The WebElement should have css class "MuiSlider-root".

        Parameters:
        inverseScaleFunction - the non-null customized inverse scale function
        Returns:
        the wrapped MuiSlider instance on the given component
      • toAvatar

        public MuiAvatar toAvatar()
        Wraps the current WebComponent to MuiAvatar.

        It supports both Material UI version MuiVersion.V4 and MuiVersion.V5.

        The WebElement should have css class "MuiAvatar-root".

        Returns:
        the wrapped MuiAvatar instance on the given component
      • toBadge

        public MuiBadge toBadge()
        Wraps the current WebComponent to MuiBadge.

        It supports both Material UI version MuiVersion.V4 and MuiVersion.V5.

        The WebElement should have css class "MuiBadge-root".

        Returns:
        the wrapped MuiBadge instance on the given component
      • toChip

        public MuiChip toChip()
        Wraps the current WebComponent to MuiChip.

        It supports both Material UI version MuiVersion.V4 and MuiVersion.V5.

        The WebElement should have css class "MuiChip-root".

        Returns:
        the wrapped MuiChip instance on the given component
      • toList

        public MuiList toList()
        Wraps the current WebComponent to MuiList.

        It supports both Material UI version MuiVersion.V4 and MuiVersion.V5.

        The WebElement should have css class "MuiList-root".

        Returns:
        the wrapped MuiList instance on the given component
      • toSnackbar

        public MuiSnackbar toSnackbar​(long autoHideDuration)
        Wraps the current WebComponent to MuiSnackbar with custom auto hide duration for further checking.

        It supports both Material UI version MuiVersion.V4 and MuiVersion.V5.

        The WebElement should have css class "MuiSnackbar-root".

        Parameters:
        autoHideDuration - the autoHideDuration, should be a little longer than the value set in the component.
        Returns:
        the wrapped MuiSnackbar instance on the given component
      • toAppBar

        public MuiAppBar toAppBar()
        Wraps the current WebComponent to MuiAppBar.

        It supports both Material UI version MuiVersion.V4 and MuiVersion.V5.

        The WebElement should have css class "MuiAppBar-root". Note there is usually another layer named "MuiToolbar-root" from the Material UI example. within with contains the actual children.

        Returns:
        the wrapped MuiAppBar instance on the given component
      • toLink

        public MuiLink toLink()
        Wraps the current WebComponent to MuiLink.

        It supports both Material UI version MuiVersion.V4 and MuiVersion.V5.

        The WebElement should have css class "MuiLink-root".

        Returns:
        the wrapped MuiLink instance on the given component
      • toMenu

        public MuiMenu toMenu()
        Wraps the current WebComponent to MuiMenu.

        It supports both Material UI version MuiVersion.V4 and MuiVersion.V5.

        The WebElement should have css class "MuiMenu-root". it is the top layer of the overlay.

        Returns:
        the wrapped MuiMenu instance on the given component
      • toPagination

        public MuiPagination toPagination()
        Wraps the current WebComponent to MuiPagination.

        It supports both Material UI version MuiVersion.V4 and MuiVersion.V5.

        The WebElement should have css class "MuiPagination-root". it is the top layer of the overlay.

        Returns:
        the wrapped MuiPagination instance on the given component
      • toPagination

        public MuiPagination toPagination​(@Nullable
                                          MuiPaginationLocators locators)
        Wraps the current WebComponent to MuiPagination with customized button locators

        It supports both Material UI version MuiVersion.V4 and MuiVersion.V5.

        The WebElement should have css class "MuiPagination-root". it is the top layer of the overlay.

        Parameters:
        locators - the customized locators for pagination buttons and index
        Returns:
        the wrapped MuiPagination instance on the given component
      • toTabs

        public MuiTabs toTabs()
        Wraps the current WebComponent to MuiTabs.

        It supports both Material UI version MuiVersion.V4 and MuiVersion.V5.

        The WebElement should have below structure: <div class="MuiTabs-root"> .... <button class="MuiTab-root ..."></span> <button class="MuiTab-root ..."></span> <button class="MuiTab-root ..."></span> </div>

        Returns:
        the wrapped MuiTabs instance on the given component
      • toGrid

        public MuiGrid toGrid()
        Wraps the current WebComponent to MuiGrid instance.
        Returns:
        wrapped MuiGrid instance on the given component
      • toPager

        public MuiPager toPager()
        Wraps the current WebComponent to MuiPager.
        Returns:
        the wrapped MuiPager instance on the given component