Class MuiConfig
- java.lang.Object
-
- com.github.grossopa.selenium.component.mui.config.MuiConfig
-
public class MuiConfig extends Object
The root configuration for material UI components- Since:
- 1.0
- Author:
- Jack Yin
-
-
Field Summary
Fields Modifier and Type Field Description static StringATTR_CLASSclass attribute name
-
Constructor Summary
Constructors Constructor Description MuiConfig()
-
Method Summary
Modifier and Type Method Description org.openqa.selenium.BybuttonLocator()For locating the button from direct parent containerList<com.github.grossopa.selenium.core.component.WebComponent>findVisiblePopoverLayers(com.github.grossopa.selenium.core.ComponentWebDriver driver, boolean includeMenu)Finds the currently visible Popover layers.StringgetIsCheckedCss()Gets the isChecked CSS.StringgetIsDisabledCss()Gets the isDisabled CSS.StringgetIsSelectedCss()Gets the isSelected CSS.StringgetRootCss(String componentName)Builds the root component css name from the component name, it is used for determining the root node of all MUI component.booleanisChecked(com.github.grossopa.selenium.core.component.WebComponent component)Checks whether the component has the checked css present.booleanisDisabled(com.github.grossopa.selenium.core.component.WebComponent component)Checks whether the component has the disabled css present.booleanisSelected(com.github.grossopa.selenium.core.component.WebComponent component)Checks whether the component has the selected css present.org.openqa.selenium.BymenuPagerLocator()Gets the Menu Pager elements inner the MuiPopover-root which is bound to a MuiMenu component.org.openqa.selenium.BypopoverLocator()For locating the popover layer of current page.org.openqa.selenium.ByradioLocator()For locating the radio from direct parent containerorg.openqa.selenium.BysliderThumbLocator()For locating the thumb element of the Slider.booleanvalidateByCss(com.github.grossopa.selenium.core.component.WebComponent component, String cssName)Validates whether the given component / item is the desired component by checking the css present.booleanvalidateComponentByCss(com.github.grossopa.selenium.core.component.WebComponent component, String componentName)Validates whether the given component is the desired component by checking the css present.
-
-
-
Field Detail
-
ATTR_CLASS
public static final String ATTR_CLASS
class attribute name- See Also:
- Constant Field Values
-
-
Method Detail
-
buttonLocator
public org.openqa.selenium.By buttonLocator()
For locating the button from direct parent container- Returns:
- the instance of button locator
-
radioLocator
public org.openqa.selenium.By radioLocator()
For locating the radio from direct parent container- Returns:
- the instance of radio locator
-
popoverLocator
public org.openqa.selenium.By popoverLocator()
For locating the popover layer of current page.Default xpath: /html/body/div[contains(@class, 'MuiPopover')]
- Returns:
- the instance of popover locator
-
menuPagerLocator
public org.openqa.selenium.By menuPagerLocator()
Gets the Menu Pager elements inner the MuiPopover-root which is bound to a MuiMenu component.- Returns:
- the Menu Pager elements inner the MuiPopover-root which is bound to a MuiMenu component.
-
sliderThumbLocator
public org.openqa.selenium.By sliderThumbLocator()
For locating the thumb element of the Slider.- Returns:
- the instance of Slider thumb locator
-
isChecked
public boolean isChecked(com.github.grossopa.selenium.core.component.WebComponent component)
Checks whether the component has the checked css present.- Parameters:
component- the component to check- Returns:
- whether the checked css presents
- See Also:
getIsCheckedCss()
-
isSelected
public boolean isSelected(com.github.grossopa.selenium.core.component.WebComponent component)
Checks whether the component has the selected css present.- Parameters:
component- the component to check- Returns:
- whether the selected css presents
- See Also:
getIsSelectedCss()
-
isDisabled
public boolean isDisabled(com.github.grossopa.selenium.core.component.WebComponent component)
Checks whether the component has the disabled css present.- Parameters:
component- the component to check- Returns:
- whether the disabled css presents
- See Also:
getIsDisabledCss()
-
getIsCheckedCss
public String getIsCheckedCss()
Gets the isChecked CSS. default value is "Mui-checked"- Returns:
- the isChecked CSS
-
getIsSelectedCss
public String getIsSelectedCss()
Gets the isSelected CSS. default value is "Mui-selected"- Returns:
- the isSelected CSS
-
getIsDisabledCss
public String getIsDisabledCss()
Gets the isDisabled CSS. default value is "Mui-disabled"- Returns:
- the isDisabled CSS
-
getRootCss
public String getRootCss(String componentName)
Builds the root component css name from the component name, it is used for determining the root node of all MUI component.- Parameters:
componentName- the component name in camel format- Returns:
- the built css
-
validateComponentByCss
public boolean validateComponentByCss(com.github.grossopa.selenium.core.component.WebComponent component, String componentName)Validates whether the given component is the desired component by checking the css present.- Parameters:
component- the target component to checkcomponentName- the component name- Returns:
- true for the
WebComponentis the desired component type - See Also:
getRootCss(String)
-
validateByCss
public boolean validateByCss(com.github.grossopa.selenium.core.component.WebComponent component, String cssName)Validates whether the given component / item is the desired component by checking the css present.- Parameters:
component- the target component to checkcssName- the expected css name- Returns:
- true for the
WebComponentis the desired component/ item type - See Also:
getRootCss(String)
-
findVisiblePopoverLayers
public List<com.github.grossopa.selenium.core.component.WebComponent> findVisiblePopoverLayers(com.github.grossopa.selenium.core.ComponentWebDriver driver, boolean includeMenu)
Finds the currently visible Popover layers.As of 2020-10, It seems that Menu component will by default produce a lot of presentation layers on the page no matter it's displayed or not, hence we need to explicitly exclude them from the search result sometimes for a more accurate searching for e.g.
MuiSelect.- Parameters:
driver- the current driverincludeMenu- whether should include the menu layer with child could be found bymenuPagerLocator()- Returns:
- the visible presentation layer
-
-