diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 918c39d6..88e8586a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,19 +19,19 @@ jobs: with: java-version: 11 - name: Cache SonarCloud packages - uses: actions/cache@v1 + uses: actions/cache@v4 with: path: ~/.sonar/cache key: ${{ runner.os }}-sonar restore-keys: ${{ runner.os }}-sonar - name: Cache Maven packages - uses: actions/cache@v1 + uses: actions/cache@v4 with: path: ~/.m2 key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} restore-keys: ${{ runner.os }}-m2 - - name: Build and analyze - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar +# - name: Build and analyze +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any +# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} +# run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar diff --git a/hamster-playwright/pom.xml b/hamster-playwright/pom.xml new file mode 100644 index 00000000..2940aef3 --- /dev/null +++ b/hamster-playwright/pom.xml @@ -0,0 +1,52 @@ + + + + + 4.0.0 + + com.github.grossopa + hamster-selenium-parent + 1.12.0-SNAPSHOT + + + hamster-playwright + + + 11 + 11 + UTF-8 + + + + + com.microsoft.playwright + playwright + 1.31.0 + + + + diff --git a/hamster-selenium-component-antdesign/src/test/java/com/github/grossopa/selenium/component/antd/general/AntdButtonTest.java b/hamster-selenium-component-antdesign/src/test/java/com/github/grossopa/selenium/component/antd/general/AntdButtonTest.java index dc545b60..83639bd3 100644 --- a/hamster-selenium-component-antdesign/src/test/java/com/github/grossopa/selenium/component/antd/general/AntdButtonTest.java +++ b/hamster-selenium-component-antdesign/src/test/java/com/github/grossopa/selenium/component/antd/general/AntdButtonTest.java @@ -61,34 +61,34 @@ void getComponentName() { @Test void validate() { when(element.getTagName()).thenReturn("button"); - when(element.getAttribute("class")).thenReturn("sss-btn sss-btn-primary"); + when(element.getDomAttribute("class")).thenReturn("sss-btn sss-btn-primary"); assertTrue(testSubject.validate()); } @Test void validateNegative1() { when(element.getTagName()).thenReturn("label"); - when(element.getAttribute("class")).thenReturn("sss-btn sss-btn-primary"); + when(element.getDomAttribute("class")).thenReturn("sss-btn sss-btn-primary"); assertFalse(testSubject.validate()); } @Test void validateNegative2() { when(element.getTagName()).thenReturn("button"); - when(element.getAttribute("class")).thenReturn("sss-ddd sss-btn-primary"); + when(element.getDomAttribute("class")).thenReturn("sss-ddd sss-btn-primary"); assertFalse(testSubject.validate()); } @Test void isLoadingTrue() { when(element.getTagName()).thenReturn("button"); - when(element.getAttribute("class")).thenReturn("sss-btn sss-btn-loading"); + when(element.getDomAttribute("class")).thenReturn("sss-btn sss-btn-loading"); assertTrue(testSubject.isLoading()); } @Test void isLoadingFalse() { - when(element.getAttribute("class")).thenReturn("sss-ddd sss-btn-primary"); + when(element.getDomAttribute("class")).thenReturn("sss-ddd sss-btn-primary"); assertFalse(testSubject.isLoading()); } } diff --git a/hamster-selenium-component-html/src/main/java/com/github/grossopa/selenium/component/html/HtmlSelect.java b/hamster-selenium-component-html/src/main/java/com/github/grossopa/selenium/component/html/HtmlSelect.java index 922fe442..9f513cb4 100644 --- a/hamster-selenium-component-html/src/main/java/com/github/grossopa/selenium/component/html/HtmlSelect.java +++ b/hamster-selenium-component-html/src/main/java/com/github/grossopa/selenium/component/html/HtmlSelect.java @@ -79,6 +79,11 @@ public void selectByVisibleText(String text) { selectComponent.selectByVisibleText(text); } + @Override + public void selectByContainsVisibleText(String text) { + selectComponent.selectByContainsVisibleText(text); + } + @Override public void selectByIndex(int index) { selectComponent.selectByIndex(index); @@ -109,6 +114,11 @@ public void deselectByVisibleText(String text) { selectComponent.deselectByVisibleText(text); } + @Override + public void deSelectByContainsVisibleText(String text) { + selectComponent.deSelectByContainsVisibleText(text); + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/hamster-selenium-component-html/src/test/java/com/github/grossopa/selenium/component/html/HtmlSelectTest.java b/hamster-selenium-component-html/src/test/java/com/github/grossopa/selenium/component/html/HtmlSelectTest.java index 7338e336..4669806f 100644 --- a/hamster-selenium-component-html/src/test/java/com/github/grossopa/selenium/component/html/HtmlSelectTest.java +++ b/hamster-selenium-component-html/src/test/java/com/github/grossopa/selenium/component/html/HtmlSelectTest.java @@ -44,6 +44,7 @@ * @author Jack Yin * @since 1.0 */ +@SuppressWarnings("deprecation") class HtmlSelectTest { HtmlSelect testSubject; @@ -53,8 +54,10 @@ class HtmlSelectTest { private WebElement createOption(String value, String label, Integer index, boolean selected) { WebElement element = mock(WebElement.class); + when(element.getDomAttribute("value")).thenReturn(value); when(element.getAttribute("value")).thenReturn(value); when(element.getText()).thenReturn(label); + when(element.getDomAttribute("index")).thenReturn(String.valueOf(index)); when(element.getAttribute("index")).thenReturn(String.valueOf(index)); when(element.isSelected()).thenReturn(selected); when(element.isEnabled()).thenReturn(true); diff --git a/hamster-selenium-component-mat/src/main/java/com/github/grossopa/hamster/selenium/component/mat/config/MatConfig.java b/hamster-selenium-component-mat/src/main/java/com/github/grossopa/hamster/selenium/component/mat/config/MatConfig.java index 95ec584e..5e4a4e5a 100644 --- a/hamster-selenium-component-mat/src/main/java/com/github/grossopa/hamster/selenium/component/mat/config/MatConfig.java +++ b/hamster-selenium-component-mat/src/main/java/com/github/grossopa/hamster/selenium/component/mat/config/MatConfig.java @@ -159,7 +159,7 @@ public String getIsDisabledCss() { @Override public boolean isDisabled(WebComponent component) { return ComponentConfig.super.isDisabled(component) || "true".equalsIgnoreCase( - component.getAttribute("aria-disabled")); + component.getDomAttribute("aria-disabled")); } @Override diff --git a/hamster-selenium-component-mat/src/main/java/com/github/grossopa/hamster/selenium/component/mat/main/MatAutocomplete.java b/hamster-selenium-component-mat/src/main/java/com/github/grossopa/hamster/selenium/component/mat/main/MatAutocomplete.java index b26c279a..4fe168b1 100644 --- a/hamster-selenium-component-mat/src/main/java/com/github/grossopa/hamster/selenium/component/mat/main/MatAutocomplete.java +++ b/hamster-selenium-component-mat/src/main/java/com/github/grossopa/hamster/selenium/component/mat/main/MatAutocomplete.java @@ -230,6 +230,17 @@ public void selectByVisibleText(String text, Long delayInMillis) { } } + @Override + public void selectByContainsVisibleText(String text, Long delayInMillis) { + List options = getOptions2(delayInMillis); + for (WebComponent option : options) { + if (StringUtils.contains(option.getText(), text)) { + option.click(); + return; + } + } + } + @Override public void selectByIndex(int index, Long delayInMillis) { getOptions2(delayInMillis).get(index).click(); @@ -260,6 +271,11 @@ public void deselectByVisibleText(String text, Long delayInMillis) { SeleniumUtils.cleanText(this.getInput()); } + @Override + public void deSelectByContainsVisibleText(String text, Long delayInMillis) { + SeleniumUtils.cleanText(this.getInput()); + } + @Override public List getOptions2() { return getOptions2(0L); @@ -295,6 +311,11 @@ public void selectByVisibleText(String text) { selectByVisibleText(text, 0L); } + @Override + public void selectByContainsVisibleText(String text) { + selectByContainsVisibleText(text, 0L); + } + @Override public void selectByIndex(int i) { selectByIndex(i, 0L); @@ -325,6 +346,11 @@ public void deselectByVisibleText(String visibleText) { deselectByVisibleText(visibleText, 0L); } + @Override + public void deSelectByContainsVisibleText(String text) { + deSelectByContainsVisibleText(text, 0L); + } + protected Optional tryToFindAutocompletePanel() { MatOverlayContainer container = overlayFinder.findTopVisibleContainer(); if (container != null) { diff --git a/hamster-selenium-component-mat/src/main/java/com/github/grossopa/hamster/selenium/component/mat/main/MatExpansionPanel.java b/hamster-selenium-component-mat/src/main/java/com/github/grossopa/hamster/selenium/component/mat/main/MatExpansionPanel.java index 45a66c91..a64a43af 100644 --- a/hamster-selenium-component-mat/src/main/java/com/github/grossopa/hamster/selenium/component/mat/main/MatExpansionPanel.java +++ b/hamster-selenium-component-mat/src/main/java/com/github/grossopa/hamster/selenium/component/mat/main/MatExpansionPanel.java @@ -70,7 +70,7 @@ public boolean validate() { @Override public boolean isEnabled() { - return element.getAttribute("disabled") == null; + return element.getDomAttribute("disabled") == null; } @Override diff --git a/hamster-selenium-component-mat/src/main/java/com/github/grossopa/hamster/selenium/component/mat/main/MatGridList.java b/hamster-selenium-component-mat/src/main/java/com/github/grossopa/hamster/selenium/component/mat/main/MatGridList.java index c01bd271..b9585ff5 100644 --- a/hamster-selenium-component-mat/src/main/java/com/github/grossopa/hamster/selenium/component/mat/main/MatGridList.java +++ b/hamster-selenium-component-mat/src/main/java/com/github/grossopa/hamster/selenium/component/mat/main/MatGridList.java @@ -77,7 +77,7 @@ public boolean validate() { * @return the column count */ public int getCols() { - return Integer.parseInt(element.getAttribute("cols")); + return Integer.parseInt(element.getDomAttribute("cols")); } public List getGridTiles() { diff --git a/hamster-selenium-component-mat/src/main/java/com/github/grossopa/hamster/selenium/component/mat/main/MatGridTile.java b/hamster-selenium-component-mat/src/main/java/com/github/grossopa/hamster/selenium/component/mat/main/MatGridTile.java index 67b4492c..0397f877 100644 --- a/hamster-selenium-component-mat/src/main/java/com/github/grossopa/hamster/selenium/component/mat/main/MatGridTile.java +++ b/hamster-selenium-component-mat/src/main/java/com/github/grossopa/hamster/selenium/component/mat/main/MatGridTile.java @@ -69,7 +69,7 @@ public boolean validate() { * @return the row span */ public int getRowSpan() { - return Integer.parseInt(this.getAttribute("rowspan")); + return Integer.parseInt(this.getDomAttribute("rowspan")); } /** @@ -78,6 +78,6 @@ public int getRowSpan() { * @return the row span */ public int getColSpan() { - return Integer.parseInt(this.getAttribute("colspan")); + return Integer.parseInt(this.getDomAttribute("colspan")); } } diff --git a/hamster-selenium-component-mat/src/main/java/com/github/grossopa/hamster/selenium/component/mat/main/MatProgressBar.java b/hamster-selenium-component-mat/src/main/java/com/github/grossopa/hamster/selenium/component/mat/main/MatProgressBar.java index cf97989b..ecae1501 100644 --- a/hamster-selenium-component-mat/src/main/java/com/github/grossopa/hamster/selenium/component/mat/main/MatProgressBar.java +++ b/hamster-selenium-component-mat/src/main/java/com/github/grossopa/hamster/selenium/component/mat/main/MatProgressBar.java @@ -72,7 +72,7 @@ public boolean validate() { * @return the min value of the progress bar */ public String getMinValue() { - return this.getAttribute("aria-valuemin"); + return this.getDomAttribute("aria-valuemin"); } /** @@ -81,7 +81,7 @@ public String getMinValue() { * @return the max value of the progress bar */ public String getMaxValue() { - return this.getAttribute("aria-valuemax"); + return this.getDomAttribute("aria-valuemax"); } /** @@ -90,7 +90,7 @@ public String getMaxValue() { * @return the current of the progress bar */ public String getValue() { - return this.getAttribute("aria-valuenow"); + return this.getDomAttribute("aria-valuenow"); } /** @@ -99,7 +99,7 @@ public String getValue() { * @return the current mode */ public Mode getMode() { - return Mode.valueOf(upperCase(this.getAttribute("mode"))); + return Mode.valueOf(upperCase(this.getDomAttribute("mode"))); } /** diff --git a/hamster-selenium-component-mat/src/main/java/com/github/grossopa/hamster/selenium/component/mat/main/MatSlider.java b/hamster-selenium-component-mat/src/main/java/com/github/grossopa/hamster/selenium/component/mat/main/MatSlider.java index 758d9433..e1235532 100644 --- a/hamster-selenium-component-mat/src/main/java/com/github/grossopa/hamster/selenium/component/mat/main/MatSlider.java +++ b/hamster-selenium-component-mat/src/main/java/com/github/grossopa/hamster/selenium/component/mat/main/MatSlider.java @@ -93,7 +93,7 @@ public boolean validate() { */ @Override public String getValue() { - return getAttribute("aria-valuenow"); + return getDomAttribute("aria-valuenow"); } /** @@ -145,7 +145,7 @@ public Double getValueDouble() { */ @Override public String getMinValue() { - return getAttribute("aria-valuemin"); + return getDomAttribute("aria-valuemin"); } /** @@ -197,7 +197,7 @@ public Double getMinValueDouble() { */ @Override public String getMaxValue() { - return getAttribute("aria-valuemax"); + return getDomAttribute("aria-valuemax"); } /** diff --git a/hamster-selenium-component-mat/src/main/java/com/github/grossopa/hamster/selenium/component/mat/main/sub/MatListOption.java b/hamster-selenium-component-mat/src/main/java/com/github/grossopa/hamster/selenium/component/mat/main/sub/MatListOption.java index e5af31ab..5f91d660 100644 --- a/hamster-selenium-component-mat/src/main/java/com/github/grossopa/hamster/selenium/component/mat/main/sub/MatListOption.java +++ b/hamster-selenium-component-mat/src/main/java/com/github/grossopa/hamster/selenium/component/mat/main/sub/MatListOption.java @@ -74,12 +74,12 @@ public boolean validate() { @Override public boolean isSelected() { - return "true".equalsIgnoreCase(this.getAttribute("aria-selected")); + return "true".equalsIgnoreCase(this.getDomAttribute("aria-selected")); } @Override public boolean isEnabled() { - return !"true".equalsIgnoreCase(this.getAttribute("aria-disabled")); + return !"true".equalsIgnoreCase(this.getDomAttribute("aria-disabled")); } /** diff --git a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/config/MatConfigTest.java b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/config/MatConfigTest.java index 7b7eba5e..8ebd38c0 100644 --- a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/config/MatConfigTest.java +++ b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/config/MatConfigTest.java @@ -145,7 +145,7 @@ void isDisabled2() { WebElement element = mock(WebElement.class); when(component.getWrappedElement()).thenReturn(element); when(element.isEnabled()).thenReturn(true); - when(component.getAttribute("class")).thenReturn("mat-disabled"); + when(component.getDomAttribute("class")).thenReturn("mat-disabled"); assertTrue(testSubject.isDisabled(component)); } @@ -155,8 +155,8 @@ void isDisabled3() { WebElement element = mock(WebElement.class); when(component.getWrappedElement()).thenReturn(element); when(element.isEnabled()).thenReturn(true); - when(component.getAttribute("class")).thenReturn(""); - when(component.getAttribute("aria-disabled")).thenReturn("true"); + when(component.getDomAttribute("class")).thenReturn(""); + when(component.getDomAttribute("aria-disabled")).thenReturn("true"); assertTrue(testSubject.isDisabled(component)); } @@ -166,7 +166,7 @@ void isDisabled4() { WebElement element = mock(WebElement.class); when(component.getWrappedElement()).thenReturn(element); when(element.isEnabled()).thenReturn(true); - when(component.getAttribute("class")).thenReturn(""); + when(component.getDomAttribute("class")).thenReturn(""); assertFalse(testSubject.isDisabled(component)); } } diff --git a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatAccordionTest.java b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatAccordionTest.java index 415d34a1..9ff6d827 100644 --- a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatAccordionTest.java +++ b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatAccordionTest.java @@ -59,13 +59,13 @@ void setUp() { @Test void validate() { - when(element.getAttribute("class")).thenReturn("mat-accordion"); + when(element.getDomAttribute("class")).thenReturn("mat-accordion"); assertTrue(testSubject.validate()); } @Test void validateFalse() { - when(element.getAttribute("class")).thenReturn("mat-accordion-333"); + when(element.getDomAttribute("class")).thenReturn("mat-accordion-333"); assertFalse(testSubject.validate()); } diff --git a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatAutocompleteTest.java b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatAutocompleteTest.java index be84efbd..04f70991 100644 --- a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatAutocompleteTest.java +++ b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatAutocompleteTest.java @@ -461,56 +461,56 @@ void selectByValueWithDelays() { @Test void deselectAll() { - when(inputElement.getAttribute("value")).thenReturn("Option 2"); + when(inputElement.getDomAttribute("value")).thenReturn("Option 2"); testSubject.deselectAll(); verify(inputElement, times(8)).sendKeys(BACK_SPACE); } @Test void deselectAllWithDelays() { - when(inputElement.getAttribute("value")).thenReturn("Option 2"); + when(inputElement.getDomAttribute("value")).thenReturn("Option 2"); testSubject.deselectAll(1000L); verify(inputElement, times(8)).sendKeys(BACK_SPACE); } @Test void deselectByValue() { - when(inputElement.getAttribute("value")).thenReturn("Option 2"); + when(inputElement.getDomAttribute("value")).thenReturn("Option 2"); testSubject.deselectByValue(null); verify(inputElement, times(8)).sendKeys(BACK_SPACE); } @Test void deselectByValueWithDelays() { - when(inputElement.getAttribute("value")).thenReturn("Option 2"); + when(inputElement.getDomAttribute("value")).thenReturn("Option 2"); testSubject.deselectByValue(null, 1000L); verify(inputElement, times(8)).sendKeys(BACK_SPACE); } @Test void deselectByIndex() { - when(inputElement.getAttribute("value")).thenReturn("Option 2"); + when(inputElement.getDomAttribute("value")).thenReturn("Option 2"); testSubject.deselectByIndex(1); verify(inputElement, times(8)).sendKeys(BACK_SPACE); } @Test void deselectByIndexWithDelays() { - when(inputElement.getAttribute("value")).thenReturn("Option 2"); + when(inputElement.getDomAttribute("value")).thenReturn("Option 2"); testSubject.deselectByIndex(1, 1000L); verify(inputElement, times(8)).sendKeys(BACK_SPACE); } @Test void deselectByVisibleText() { - when(inputElement.getAttribute("value")).thenReturn("Option 2"); + when(inputElement.getDomAttribute("value")).thenReturn("Option 2"); testSubject.deselectByVisibleText(null); verify(inputElement, times(8)).sendKeys(BACK_SPACE); } @Test void deselectByVisibleTextWithDelays() { - when(inputElement.getAttribute("value")).thenReturn("Option 2"); + when(inputElement.getDomAttribute("value")).thenReturn("Option 2"); testSubject.deselectByVisibleText(null, 1000L); verify(inputElement, times(8)).sendKeys(BACK_SPACE); } @@ -560,14 +560,14 @@ void testToString() { @Test void validate() { when(config.getCssPrefix()).thenReturn("mat-"); - when(element.getAttribute("class")).thenReturn("mat-autocomplete-trigger"); + when(element.getDomAttribute("class")).thenReturn("mat-autocomplete-trigger"); assertTrue(testSubject.validate()); } @Test void validateFalse() { when(config.getCssPrefix()).thenReturn("mat-"); - when(element.getAttribute("class")).thenReturn("mat-autocomplete-trigger-some-other"); + when(element.getDomAttribute("class")).thenReturn("mat-autocomplete-trigger-some-other"); assertFalse(testSubject.validate()); } } diff --git a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatBadgeTest.java b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatBadgeTest.java index 6442bd16..84f97a93 100644 --- a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatBadgeTest.java +++ b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatBadgeTest.java @@ -62,13 +62,13 @@ void getComponentName() { @Test void validate() { - when(element.getAttribute("class")).thenReturn("mat-badge"); + when(element.getDomAttribute("class")).thenReturn("mat-badge"); assertTrue(testSubject.validate()); } @Test void validateFalse() { - when(element.getAttribute("class")).thenReturn(""); + when(element.getDomAttribute("class")).thenReturn(""); assertFalse(testSubject.validate()); } diff --git a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatBottomSheetTest.java b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatBottomSheetTest.java index 3b863721..4947dbe1 100644 --- a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatBottomSheetTest.java +++ b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatBottomSheetTest.java @@ -61,13 +61,13 @@ void getComponentName() { @Test void validate() { - when(element.getAttribute("class")).thenReturn("mat-bottom-sheet-container"); + when(element.getDomAttribute("class")).thenReturn("mat-bottom-sheet-container"); assertTrue(testSubject.validate()); } @Test void validateFalse() { - when(element.getAttribute("class")).thenReturn("mat-bottom-sheet-container-123"); + when(element.getDomAttribute("class")).thenReturn("mat-bottom-sheet-container-123"); assertFalse(testSubject.validate()); } diff --git a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatButtonTest.java b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatButtonTest.java index d50fb50b..6cb15c6f 100644 --- a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatButtonTest.java +++ b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatButtonTest.java @@ -61,13 +61,13 @@ void getComponentName() { @Test void validate() { - when(element.getAttribute("class")).thenReturn("mat-button-base"); + when(element.getDomAttribute("class")).thenReturn("mat-button-base"); assertTrue(testSubject.validate()); } @Test void validateFalse() { - when(element.getAttribute("class")).thenReturn("mat-button-base-123"); + when(element.getDomAttribute("class")).thenReturn("mat-button-base-123"); assertFalse(testSubject.validate()); } diff --git a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatButtonToggleGroupTest.java b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatButtonToggleGroupTest.java index f0f59167..4c30b401 100644 --- a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatButtonToggleGroupTest.java +++ b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatButtonToggleGroupTest.java @@ -70,13 +70,13 @@ void getComponentName() { @Test void validate() { - when(element.getAttribute("class")).thenReturn("mat-button-toggle-group 123"); + when(element.getDomAttribute("class")).thenReturn("mat-button-toggle-group 123"); assertTrue(testSubject.validate()); } @Test void validateFalse() { - when(element.getAttribute("class")).thenReturn("mat-button-toggle-group-123 123"); + when(element.getDomAttribute("class")).thenReturn("mat-button-toggle-group-123 123"); assertFalse(testSubject.validate()); } diff --git a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatButtonToggleTest.java b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatButtonToggleTest.java index 2279ba19..aefd67dc 100644 --- a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatButtonToggleTest.java +++ b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatButtonToggleTest.java @@ -52,7 +52,7 @@ class MatButtonToggleTest { @BeforeEach void setUp() { when(config.getCssPrefix()).thenReturn("mat-"); - when(element.getAttribute("class")).thenReturn("mat-button-toggle"); + when(element.getDomAttribute("class")).thenReturn("mat-button-toggle"); when(element.findElement(By.xpath("./button"))).thenReturn(buttonElement); testSubject = new MatButtonToggle(element, driver, config); } @@ -64,13 +64,13 @@ void getComponentName() { @Test void validate() { - when(element.getAttribute("class")).thenReturn("mat-button-toggle adb"); + when(element.getDomAttribute("class")).thenReturn("mat-button-toggle adb"); assertTrue(testSubject.validate()); } @Test void validateFalse() { - when(element.getAttribute("class")).thenReturn("mat-button-toggle-123 adb"); + when(element.getDomAttribute("class")).thenReturn("mat-button-toggle-123 adb"); assertFalse(testSubject.validate()); } @@ -82,7 +82,7 @@ void click() { @Test void isSelected() { - when(element.getAttribute("class")).thenReturn("mat-button-toggle mat-button-toggle-checked"); + when(element.getDomAttribute("class")).thenReturn("mat-button-toggle mat-button-toggle-checked"); assertTrue(testSubject.isSelected()); } diff --git a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatCheckboxTest.java b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatCheckboxTest.java index 9d7d2f81..2ddd85c8 100644 --- a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatCheckboxTest.java +++ b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatCheckboxTest.java @@ -54,7 +54,7 @@ class MatCheckboxTest { @BeforeEach void setUp() { when(config.getCssPrefix()).thenReturn("mat-"); - when(element.getAttribute("class")).thenReturn("mat-checkbox"); + when(element.getDomAttribute("class")).thenReturn("mat-checkbox"); when(element.findElement(By.className("mat-checkbox-input"))).thenReturn(inputElement); testSubject = new MatCheckbox(element, driver, config); @@ -73,7 +73,7 @@ void validate() { @Test void validateFalse() { - when(element.getAttribute("class")).thenReturn("mat-checkbox-333"); + when(element.getDomAttribute("class")).thenReturn("mat-checkbox-333"); assertFalse(testSubject.validate()); } @@ -91,13 +91,13 @@ void isSelectedFalse() { @Test void isEnabled() { - when(element.getAttribute("class")).thenReturn("mat-checkbox"); + when(element.getDomAttribute("class")).thenReturn("mat-checkbox"); assertTrue(testSubject.isEnabled()); } @Test void isEnabledFalse() { - when(element.getAttribute("class")).thenReturn("mat-checkbox mat-checkbox-disabled"); + when(element.getDomAttribute("class")).thenReturn("mat-checkbox mat-checkbox-disabled"); assertFalse(testSubject.isEnabled()); } diff --git a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatChipListTest.java b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatChipListTest.java index ad1b1cd1..a73a15d6 100644 --- a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatChipListTest.java +++ b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatChipListTest.java @@ -69,13 +69,13 @@ void getComponentName() { @Test void validate() { - when(element.getAttribute("class")).thenReturn("mat-chip-list"); + when(element.getDomAttribute("class")).thenReturn("mat-chip-list"); assertTrue(testSubject.validate()); } @Test void validateFalse() { - when(element.getAttribute("class")).thenReturn("mat-chip-list-333"); + when(element.getDomAttribute("class")).thenReturn("mat-chip-list-333"); assertFalse(testSubject.validate()); } diff --git a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatDialogTest.java b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatDialogTest.java index dc4abb72..92458c26 100644 --- a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatDialogTest.java +++ b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatDialogTest.java @@ -58,13 +58,13 @@ void setUp() { @Test void validate() { - when(element.getAttribute("class")).thenReturn("mat-dialog-container"); + when(element.getDomAttribute("class")).thenReturn("mat-dialog-container"); assertTrue(testSubject.validate()); } @Test void validateFalse() { - when(element.getAttribute("class")).thenReturn("mat-dialog-container-333"); + when(element.getDomAttribute("class")).thenReturn("mat-dialog-container-333"); assertFalse(testSubject.validate()); } diff --git a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatExpansionPanelTest.java b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatExpansionPanelTest.java index 9bc6b442..89c6e143 100644 --- a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatExpansionPanelTest.java +++ b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatExpansionPanelTest.java @@ -65,26 +65,26 @@ void setUp() { @Test void validate() { - when(element.getAttribute("class")).thenReturn("mat-expansion-panel"); + when(element.getDomAttribute("class")).thenReturn("mat-expansion-panel"); assertTrue(testSubject.validate()); } @Test void validateFalse() { - when(element.getAttribute("class")).thenReturn("mat-expansion-panel-333"); + when(element.getDomAttribute("class")).thenReturn("mat-expansion-panel-333"); assertFalse(testSubject.validate()); } @Test void isEnabled() { - when(element.getAttribute("disabled")).thenReturn(null); + when(element.getDomAttribute("disabled")).thenReturn(null); assertTrue(testSubject.isEnabled()); } @Test void isEnabledFalse() { - when(element.getAttribute("disabled")).thenReturn(""); + when(element.getDomAttribute("disabled")).thenReturn(""); assertFalse(testSubject.isEnabled()); } @@ -101,21 +101,21 @@ void testToString() { @Test void isExpanded() { - when(element.getAttribute("class")).thenReturn("mat-expanded"); + when(element.getDomAttribute("class")).thenReturn("mat-expanded"); assertTrue(testSubject.isExpanded()); } @Test void isExpandedFalse() { - when(element.getAttribute("class")).thenReturn(""); + when(element.getDomAttribute("class")).thenReturn(""); assertFalse(testSubject.isExpanded()); } @Test void expand() { - when(element.getAttribute("class")).thenReturn(""); + when(element.getDomAttribute("class")).thenReturn(""); doAnswer(a -> { - when(element.getAttribute("class")).thenReturn("mat-expanded"); + when(element.getDomAttribute("class")).thenReturn("mat-expanded"); return null; }).when(headerElement).click(); @@ -127,7 +127,7 @@ void expand() { @Test void expandAlready() { - when(element.getAttribute("class")).thenReturn("mat-expanded"); + when(element.getDomAttribute("class")).thenReturn("mat-expanded"); assertTrue(testSubject.isExpanded()); testSubject.expand(); verify(headerElement, never()).click(); @@ -136,9 +136,9 @@ void expandAlready() { @Test void collapse() { - when(element.getAttribute("class")).thenReturn("mat-expanded"); + when(element.getDomAttribute("class")).thenReturn("mat-expanded"); doAnswer(a -> { - when(element.getAttribute("class")).thenReturn(""); + when(element.getDomAttribute("class")).thenReturn(""); return null; }).when(headerElement).click(); @@ -150,7 +150,7 @@ void collapse() { @Test void collapseAlready() { - when(element.getAttribute("class")).thenReturn(""); + when(element.getDomAttribute("class")).thenReturn(""); assertFalse(testSubject.isExpanded()); testSubject.collapse(); verify(headerElement, never()).click(); diff --git a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatFormFieldTest.java b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatFormFieldTest.java index ea34466c..191865b1 100644 --- a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatFormFieldTest.java +++ b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatFormFieldTest.java @@ -58,13 +58,13 @@ void setUp() { @Test void validate() { - when(element.getAttribute("class")).thenReturn("mat-form-field"); + when(element.getDomAttribute("class")).thenReturn("mat-form-field"); assertTrue(testSubject.validate()); } @Test void validateFalse() { - when(element.getAttribute("class")).thenReturn("mat-form-field-333"); + when(element.getDomAttribute("class")).thenReturn("mat-form-field-333"); assertFalse(testSubject.validate()); } diff --git a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatGridListTest.java b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatGridListTest.java index 51fe9c88..f0a378f1 100644 --- a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatGridListTest.java +++ b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatGridListTest.java @@ -59,13 +59,13 @@ void setUp() { @Test void validate() { - when(element.getAttribute("class")).thenReturn("mat-grid-list"); + when(element.getDomAttribute("class")).thenReturn("mat-grid-list"); assertTrue(testSubject.validate()); } @Test void validateFalse() { - when(element.getAttribute("class")).thenReturn("mat-grid-list-333"); + when(element.getDomAttribute("class")).thenReturn("mat-grid-list-333"); assertFalse(testSubject.validate()); } @@ -83,7 +83,7 @@ void testToString() { @Test void getCols() { - when(element.getAttribute("cols")).thenReturn("10"); + when(element.getDomAttribute("cols")).thenReturn("10"); assertEquals(10, testSubject.getCols()); } diff --git a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatGridTileTest.java b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatGridTileTest.java index 24d59a4e..7963394a 100644 --- a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatGridTileTest.java +++ b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatGridTileTest.java @@ -57,13 +57,13 @@ void setUp() { @Test void validate() { - when(element.getAttribute("class")).thenReturn("mat-grid-tile"); + when(element.getDomAttribute("class")).thenReturn("mat-grid-tile"); assertTrue(testSubject.validate()); } @Test void validateFalse() { - when(element.getAttribute("class")).thenReturn("mat-grid-tile-333"); + when(element.getDomAttribute("class")).thenReturn("mat-grid-tile-333"); assertFalse(testSubject.validate()); } @@ -80,13 +80,13 @@ void testToString() { @Test void getColSpan() { - when(element.getAttribute("colspan")).thenReturn("15"); + when(element.getDomAttribute("colspan")).thenReturn("15"); assertEquals(15, testSubject.getColSpan()); } @Test void getRowSpan() { - when(element.getAttribute("rowspan")).thenReturn("20"); + when(element.getDomAttribute("rowspan")).thenReturn("20"); assertEquals(20, testSubject.getRowSpan()); } } diff --git a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatListTest.java b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatListTest.java index ca323f20..2f253168 100644 --- a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatListTest.java +++ b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatListTest.java @@ -65,13 +65,13 @@ void getComponentName() { @Test void validate() { - when(element.getAttribute("class")).thenReturn("mat-list"); + when(element.getDomAttribute("class")).thenReturn("mat-list"); assertTrue(testSubject.validate()); } @Test void validateNegative() { - when(element.getAttribute("class")).thenReturn("mat-list-23"); + when(element.getDomAttribute("class")).thenReturn("mat-list-23"); assertFalse(testSubject.validate()); } diff --git a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatMenuTest.java b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatMenuTest.java index 929d5f1d..80a27cd9 100644 --- a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatMenuTest.java +++ b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatMenuTest.java @@ -73,9 +73,9 @@ void setUp() { menuItems.add(menuItem2); menuItems.add(menuItem3); - when(menuItem1.getAttribute("class")).thenReturn("mat-menu-item-submenu-trigger"); - when(menuItem2.getAttribute("class")).thenReturn("mat-menu-item-submenu-trigger"); - when(menuItem3.getAttribute("class")).thenReturn("mat-menu-item-submenu-trigger"); + when(menuItem1.getDomAttribute("class")).thenReturn("mat-menu-item-submenu-trigger"); + when(menuItem2.getDomAttribute("class")).thenReturn("mat-menu-item-submenu-trigger"); + when(menuItem3.getDomAttribute("class")).thenReturn("mat-menu-item-submenu-trigger"); when(menuItem1.getText()).thenReturn("Item 1"); when(menuItem2.getText()).thenReturn("Item 2"); @@ -119,13 +119,13 @@ void getComponentName() { @Test void validate() { - when(element.getAttribute("class")).thenReturn("mat-menu-panel"); + when(element.getDomAttribute("class")).thenReturn("mat-menu-panel"); assertTrue(testSubject.validate()); } @Test void validateNegative() { - when(element.getAttribute("class")).thenReturn("mat-menu-panel-23"); + when(element.getDomAttribute("class")).thenReturn("mat-menu-panel-23"); assertFalse(testSubject.validate()); } diff --git a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatOverlayContainerTest.java b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatOverlayContainerTest.java index ef81fb31..04744645 100644 --- a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatOverlayContainerTest.java +++ b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatOverlayContainerTest.java @@ -60,13 +60,13 @@ void getComponentName() { @Test void validate() { - when(element.getAttribute("class")).thenReturn("cdk-overlay-container"); + when(element.getDomAttribute("class")).thenReturn("cdk-overlay-container"); assertTrue(testSubject.validate()); } @Test void validateFalse() { - when(element.getAttribute("class")).thenReturn(""); + when(element.getDomAttribute("class")).thenReturn(""); assertFalse(testSubject.validate()); } diff --git a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatProgressBarTest.java b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatProgressBarTest.java index b93dbf05..111f5360 100644 --- a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatProgressBarTest.java +++ b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatProgressBarTest.java @@ -61,13 +61,13 @@ void getComponentName() { @Test void validate() { - when(element.getAttribute("class")).thenReturn("mat-progress-bar"); + when(element.getDomAttribute("class")).thenReturn("mat-progress-bar"); assertTrue(testSubject.validate()); } @Test void validateNegative() { - when(element.getAttribute("class")).thenReturn("mat-progress-bar-23"); + when(element.getDomAttribute("class")).thenReturn("mat-progress-bar-23"); assertFalse(testSubject.validate()); } @@ -80,25 +80,25 @@ void testToString() { @Test void getMinValue() { - when(element.getAttribute("aria-valuemin")).thenReturn("233"); + when(element.getDomAttribute("aria-valuemin")).thenReturn("233"); assertEquals("233", testSubject.getMinValue()); } @Test void getMaxValue() { - when(element.getAttribute("aria-valuemax")).thenReturn("3333"); + when(element.getDomAttribute("aria-valuemax")).thenReturn("3333"); assertEquals("3333", testSubject.getMaxValue()); } @Test void getValue() { - when(element.getAttribute("aria-valuenow")).thenReturn("4"); + when(element.getDomAttribute("aria-valuenow")).thenReturn("4"); assertEquals("4", testSubject.getValue()); } @Test void getMode() { - when(element.getAttribute("mode")).thenReturn("query"); + when(element.getDomAttribute("mode")).thenReturn("query"); assertEquals(MatProgressBar.Mode.QUERY, testSubject.getMode()); } } diff --git a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatSelectionListTest.java b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatSelectionListTest.java index e388c997..b479bc5d 100644 --- a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatSelectionListTest.java +++ b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatSelectionListTest.java @@ -65,13 +65,13 @@ void getComponentName() { @Test void validate() { - when(element.getAttribute("class")).thenReturn("mat-selection-list"); + when(element.getDomAttribute("class")).thenReturn("mat-selection-list"); assertTrue(testSubject.validate()); } @Test void validateNegative() { - when(element.getAttribute("class")).thenReturn("mat-selection-list-23"); + when(element.getDomAttribute("class")).thenReturn("mat-selection-list-23"); assertFalse(testSubject.validate()); } diff --git a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatSlideToggleTest.java b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatSlideToggleTest.java index 786af134..1f489730 100644 --- a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatSlideToggleTest.java +++ b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatSlideToggleTest.java @@ -62,13 +62,13 @@ void getComponentName() { @Test void validate() { - when(element.getAttribute("class")).thenReturn("mat-slide-toggle"); + when(element.getDomAttribute("class")).thenReturn("mat-slide-toggle"); assertTrue(testSubject.validate()); } @Test void validateNegative() { - when(element.getAttribute("class")).thenReturn("mat-slide-toggle-23"); + when(element.getDomAttribute("class")).thenReturn("mat-slide-toggle-23"); assertFalse(testSubject.validate()); } diff --git a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatSliderTest.java b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatSliderTest.java index ec50ceb7..fc4e133e 100644 --- a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatSliderTest.java +++ b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatSliderTest.java @@ -120,12 +120,12 @@ void setUp() { when(element.findElement(By.className("mat-slider-wrapper"))).thenReturn(sliderWrapper); when(sliderWrapper.getRect()).then(a -> new Rectangle(x, y, height, width)); - when(element.getAttribute("class")).then(a -> "mat-slider"); - when(hiddenInput.getAttribute("value")).then(a -> rawValue1); + when(element.getDomAttribute("class")).then(a -> "mat-slider"); + when(hiddenInput.getDomAttribute("value")).then(a -> rawValue1); - when(element.getAttribute("aria-valuemin")).then(a -> minValue.toString()); - when(element.getAttribute("aria-valuemax")).then(a -> maxValue.toString()); - when(element.getAttribute("aria-valuenow")).then(a -> rawValue1); + when(element.getDomAttribute("aria-valuemin")).then(a -> minValue.toString()); + when(element.getDomAttribute("aria-valuemax")).then(a -> maxValue.toString()); + when(element.getDomAttribute("aria-valuenow")).then(a -> rawValue1); when(thumb1.getRect()).then(a -> { double currentPercentage = (Double.parseDouble(rawValue1) - minValue) / (maxValue - minValue); @@ -153,13 +153,13 @@ void getComponentName() { @Test void validate() { - when(element.getAttribute("class")).thenReturn("mat-slider"); + when(element.getDomAttribute("class")).thenReturn("mat-slider"); assertTrue(testSubject.validate()); } @Test void validateNegative() { - when(element.getAttribute("class")).thenReturn("mat-slider-23"); + when(element.getDomAttribute("class")).thenReturn("mat-slider-23"); assertFalse(testSubject.validate()); } @@ -230,25 +230,25 @@ void getFirstThumb() { @Test void isVertical() { - when(element.getAttribute("class")).then(a -> "mat-slider mat-slider-vertical"); + when(element.getDomAttribute("class")).then(a -> "mat-slider mat-slider-vertical"); assertTrue(testSubject.isVertical()); } @Test void isVerticalNegative() { - when(element.getAttribute("class")).then(a -> "mat-slider "); + when(element.getDomAttribute("class")).then(a -> "mat-slider "); assertFalse(testSubject.isVertical()); } @Test void isInverted() { - when(element.getAttribute("class")).then(a -> "mat-slider mat-slider-axis-inverted"); + when(element.getDomAttribute("class")).then(a -> "mat-slider mat-slider-axis-inverted"); assertTrue(testSubject.isInverted()); } @Test void isInvertedNegative() { - when(element.getAttribute("class")).then(a -> "mat-slider"); + when(element.getDomAttribute("class")).then(a -> "mat-slider"); assertFalse(testSubject.isInverted()); } diff --git a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatSnackbarTest.java b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatSnackbarTest.java index 84630324..119c6a3e 100644 --- a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatSnackbarTest.java +++ b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/MatSnackbarTest.java @@ -70,13 +70,13 @@ void getComponentName() { @Test void validate() { - when(element.getAttribute("class")).thenReturn("mat-simple-snackbar"); + when(element.getDomAttribute("class")).thenReturn("mat-simple-snackbar"); assertTrue(testSubject.validate()); } @Test void validateNegative() { - when(element.getAttribute("class")).thenReturn("mat-simple-snackbar-23"); + when(element.getDomAttribute("class")).thenReturn("mat-simple-snackbar-23"); assertFalse(testSubject.validate()); } diff --git a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/sub/MatBadgeContentTest.java b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/sub/MatBadgeContentTest.java index 6ec84304..f4590552 100644 --- a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/sub/MatBadgeContentTest.java +++ b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/sub/MatBadgeContentTest.java @@ -60,13 +60,13 @@ void getComponentName() { @Test void validate() { - when(element.getAttribute("class")).thenReturn("mat-badge-content"); + when(element.getDomAttribute("class")).thenReturn("mat-badge-content"); assertTrue(testSubject.validate()); } @Test void validateFalse() { - when(element.getAttribute("class")).thenReturn(""); + when(element.getDomAttribute("class")).thenReturn(""); assertFalse(testSubject.validate()); } diff --git a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/sub/MatChipTest.java b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/sub/MatChipTest.java index 0122f77e..e4d3823e 100644 --- a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/sub/MatChipTest.java +++ b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/sub/MatChipTest.java @@ -104,13 +104,13 @@ void testToString() { @Test void validate() { - when(element.getAttribute("class")).thenReturn("mat-chip"); + when(element.getDomAttribute("class")).thenReturn("mat-chip"); assertTrue(testSubject.validate()); } @Test void validateFalse() { - when(element.getAttribute("class")).thenReturn("mat-chip-333"); + when(element.getDomAttribute("class")).thenReturn("mat-chip-333"); assertFalse(testSubject.validate()); } } diff --git a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/sub/MatListOptionTest.java b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/sub/MatListOptionTest.java index e894f2e2..2fd48724 100644 --- a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/sub/MatListOptionTest.java +++ b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/sub/MatListOptionTest.java @@ -65,26 +65,26 @@ void getComponentName() { @Test void validate() { - when(element.getAttribute("class")).thenReturn("mat-list-option"); + when(element.getDomAttribute("class")).thenReturn("mat-list-option"); assertTrue(testSubject.validate()); } @Test void validateNegative() { - when(element.getAttribute("class")).thenReturn("mat-list-option-23"); + when(element.getDomAttribute("class")).thenReturn("mat-list-option-23"); assertFalse(testSubject.validate()); } @Test void isSelected() { - when(element.getAttribute("aria-selected")).thenReturn("true"); + when(element.getDomAttribute("aria-selected")).thenReturn("true"); assertTrue(testSubject.isSelected()); } @Test void isSelectedNegative() { - when(element.getAttribute("aria-selected")).thenReturn(""); + when(element.getDomAttribute("aria-selected")).thenReturn(""); assertFalse(testSubject.isSelected()); } @@ -96,13 +96,13 @@ void testToString() { @Test void isEnabledNegative() { - when(element.getAttribute("aria-disabled")).thenReturn("true"); + when(element.getDomAttribute("aria-disabled")).thenReturn("true"); assertFalse(testSubject.isEnabled()); } @Test void isEnabled() { - when(element.getAttribute("aria-disabled")).thenReturn(""); + when(element.getDomAttribute("aria-disabled")).thenReturn(""); assertTrue(testSubject.isEnabled()); } diff --git a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/sub/MatMenuItemTest.java b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/sub/MatMenuItemTest.java index 2be2a4df..ea8c5046 100644 --- a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/sub/MatMenuItemTest.java +++ b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/sub/MatMenuItemTest.java @@ -72,26 +72,26 @@ void getComponentName() { @Test void validate() { - when(element.getAttribute("class")).thenReturn("mat-menu-item"); + when(element.getDomAttribute("class")).thenReturn("mat-menu-item"); assertTrue(testSubject.validate()); } @Test void validateNegative() { - when(element.getAttribute("class")).thenReturn("mat-menu-item-23"); + when(element.getDomAttribute("class")).thenReturn("mat-menu-item-23"); assertFalse(testSubject.validate()); } @Test void isExpanded() { - when(element.getAttribute("aria-expanded")).thenReturn("true"); + when(element.getDomAttribute("aria-expanded")).thenReturn("true"); assertTrue(testSubject.isExpanded()); } @Test void isExpandedNegative() { - when(element.getAttribute("aria-expanded")).thenReturn(null); + when(element.getDomAttribute("aria-expanded")).thenReturn(null); assertFalse(testSubject.isExpanded()); } @@ -103,13 +103,13 @@ void testToString() { @Test void isExpandable() { - when(element.getAttribute("class")).thenReturn("mat-menu-item-submenu-trigger"); + when(element.getDomAttribute("class")).thenReturn("mat-menu-item-submenu-trigger"); assertTrue(testSubject.isExpandable()); } @Test void isExpandableNegative() { - when(element.getAttribute("class")).thenReturn("mat-menu-item-submenu-trigger-123"); + when(element.getDomAttribute("class")).thenReturn("mat-menu-item-submenu-trigger-123"); assertFalse(testSubject.isExpandable()); } diff --git a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/sub/MatOptionTest.java b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/sub/MatOptionTest.java index 96d54d7f..12de1b22 100644 --- a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/sub/MatOptionTest.java +++ b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/sub/MatOptionTest.java @@ -75,13 +75,13 @@ void validateNegative() { @Test void isSelected() { - when(element.getAttribute("class")).thenReturn("mat-selected"); + when(element.getDomAttribute("class")).thenReturn("mat-selected"); assertTrue(testSubject.isSelected()); } @Test void isSelectedNegative() { - when(element.getAttribute("class")).thenReturn(""); + when(element.getDomAttribute("class")).thenReturn(""); assertFalse(testSubject.isSelected()); } diff --git a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/sub/MatPseudoCheckboxTest.java b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/sub/MatPseudoCheckboxTest.java index dbf86c12..fc82cab8 100644 --- a/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/sub/MatPseudoCheckboxTest.java +++ b/hamster-selenium-component-mat/src/test/java/com/github/grossopa/hamster/selenium/component/mat/main/sub/MatPseudoCheckboxTest.java @@ -62,26 +62,26 @@ void getComponentName() { @Test void validate() { - when(element.getAttribute("class")).thenReturn("mat-pseudo-checkbox"); + when(element.getDomAttribute("class")).thenReturn("mat-pseudo-checkbox"); assertTrue(testSubject.validate()); } @Test void validateNegative() { - when(element.getAttribute("class")).thenReturn("mat-pseudo-checkbox-23"); + when(element.getDomAttribute("class")).thenReturn("mat-pseudo-checkbox-23"); assertFalse(testSubject.validate()); } @Test void isSelected() { - when(element.getAttribute("class")).thenReturn("mat-pseudo-checkbox-checked"); + when(element.getDomAttribute("class")).thenReturn("mat-pseudo-checkbox-checked"); assertTrue(testSubject.isSelected()); } @Test void isSelectedNegative() { - when(element.getAttribute("class")).thenReturn("mat-pseudo-checkbox"); + when(element.getDomAttribute("class")).thenReturn("mat-pseudo-checkbox"); assertFalse(testSubject.isSelected()); } diff --git a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/MuiComponents.java b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/MuiComponents.java index 1b84c9b7..47a08cf5 100644 --- a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/MuiComponents.java +++ b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/MuiComponents.java @@ -922,15 +922,20 @@ public MuiDatePickerFormField toDatePickerFormField(ViewType... views) { /** * Wraps the current {@link WebComponent} to {@link MuiGrid} instance. * + *

It supports both Material UI version {@link MuiVersion#V4} and {@link MuiVersion#V5}.

+ * * @return wrapped {@link MuiGrid} instance on the given component */ public MuiGrid toGrid() { + return new MuiGrid(component, driver, config); } /** * Wraps the current {@link WebComponent} to {@link MuiPager}. * + *

It supports both Material UI version {@link MuiVersion#V4} and {@link MuiVersion#V5}.

+ * * @return the wrapped {@link MuiPager} instance on the given component */ public MuiPager toPager() { @@ -940,12 +945,25 @@ public MuiPager toPager() { /** * Wraps the current {@link WebComponent} to {@link MuiPickersDialog}. * + *

It supports both Material UI version {@link MuiVersion#V4} and {@link MuiVersion#V5}.

+ * * @return the wrapped {@link MuiPickersDialog} instance on the given component */ public MuiPickersDialog toPickersDialog() { return new MuiPickersDialog(component, driver, config); } + /** + * Wraps the current {@link WebComponent} to {@link MuiPickersDialog}. + * + *

It supports both Material UI version {@link MuiVersion#V4} and {@link MuiVersion#V5}.

+ * + * @return the wrapped {@link MuiPickersDialog} instance on the given component + */ + public MuiTooltip toTooltip() { + return new MuiTooltip(component, driver, config); + } + private T create(Supplier v4creatorFunc, Supplier v5creatorFunc) { if (config.getVersion() == V4) { return v4creatorFunc.get(); @@ -963,4 +981,5 @@ private T create(Supplier v4creatorFunc, Supplier v5creatorFunc) { public MuiConfig getConfig() { return config; } + } diff --git a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/MuiVersion.java b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/MuiVersion.java index b74dc21e..e2f56805 100644 --- a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/MuiVersion.java +++ b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/MuiVersion.java @@ -48,15 +48,25 @@ public R apply(Func func, T input) { public R apply(Func func, T input) { return func.applyV5(input); } + }, + + /** + * Version 6 current version as of year 2024, all V4 and V5 components are fully compatible with V6. + */ + V6 { + @Override + public R apply(Func func, T input) { + return func.applyV6(input); + } }; /** * Executes a function by current type. * - * @param func the function to execute + * @param func the function to execute * @param input the input parameter to be passed in - * @param the input type - * @param the result type + * @param the input type + * @param the result type * @return execution result */ public abstract R apply(Func func, T input); @@ -86,5 +96,13 @@ public interface Func { * @return the execution result */ R applyV5(T input); + + /** + * applies to {@link #V6}. + * + * @param input the input params + * @return the execution result + */ + R applyV6(T input); } } diff --git a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/core/MuiModal.java b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/core/MuiModal.java index 00bc919a..c25e0a29 100644 --- a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/core/MuiModal.java +++ b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/core/MuiModal.java @@ -33,8 +33,7 @@ import java.util.EnumSet; import java.util.Set; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.*; import static com.github.grossopa.selenium.core.util.SeleniumUtils.executeIgnoringStaleElementReference; import static org.openqa.selenium.Keys.ESCAPE; @@ -59,7 +58,7 @@ protected MuiModal(WebElement element, ComponentWebDriver driver, MuiConfig conf @Override public Set versions() { - return EnumSet.of(V4, V5); + return EnumSet.of(V4, V5, V6); } /** diff --git a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/core/MuiPopover.java b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/core/MuiPopover.java index 2dc3ecdc..4cf6f283 100644 --- a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/core/MuiPopover.java +++ b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/core/MuiPopover.java @@ -34,6 +34,7 @@ import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.V6; /** * A Popover can be used to display some content on top of another. @@ -61,7 +62,7 @@ protected MuiPopover(WebElement element, ComponentWebDriver driver, MuiConfig co @Override public Set versions() { - return EnumSet.of(V4, V5); + return EnumSet.of(V4, V5, V6); } @Override diff --git a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiAvatar.java b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiAvatar.java index 88de8d3e..1c24d075 100644 --- a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiAvatar.java +++ b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiAvatar.java @@ -37,6 +37,7 @@ import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.V6; /** * Avatars are found throughout material design with uses in everything from tables to dialog menus. @@ -71,7 +72,7 @@ public MuiAvatar(WebElement element, ComponentWebDriver driver, MuiConfig config @Override public Set versions() { - return EnumSet.of(V4, V5); + return EnumSet.of(V4, V5, V6); } @Override @@ -96,7 +97,7 @@ public WebComponent getImg() { * @return the alt attribute of the img element. */ public String getAlt() { - return getImg().getAttribute("alt"); + return getImg().getDomAttribute("alt"); } /** @@ -106,6 +107,6 @@ public String getAlt() { * @return the src attribute of the img element. */ public String getSrc() { - return getImg().getAttribute("src"); + return getImg().getDomAttribute("src"); } } diff --git a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiBadge.java b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiBadge.java index 938015e1..14698af6 100644 --- a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiBadge.java +++ b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiBadge.java @@ -42,6 +42,7 @@ import static java.util.Arrays.stream; import static org.apache.commons.lang3.StringUtils.endsWith; import static org.apache.commons.lang3.math.NumberUtils.isParsable; +import static com.github.grossopa.selenium.component.mui.MuiVersion.V6; /** * Badge generates a small badge to the top-right of its child(ren). @@ -70,7 +71,7 @@ public MuiBadge(WebElement element, ComponentWebDriver driver, MuiConfig config) @Override public Set versions() { - return EnumSet.of(V4, V5); + return EnumSet.of(V4, V5, V6); } /** @@ -102,7 +103,7 @@ public int getBadgeNumber() { * @return whether the dot is displayed */ public boolean isDotDisplayed() { - return stream(getBadge().getAttribute("class").split(" ")).anyMatch( + return stream(getBadge().getDomAttribute("class").split(" ")).anyMatch( str -> str.equalsIgnoreCase(config.getCssPrefix() + "Badge-dot")); } @@ -117,7 +118,7 @@ public String getComponentName() { * @return whether the badge is displayed or not */ public boolean isBadgeDisplayed() { - return stream(getBadge().getAttribute("class").split(" ")).map(StringUtils::trim) + return stream(getBadge().getDomAttribute("class").split(" ")).map(StringUtils::trim) .noneMatch(str -> str.equalsIgnoreCase(config.getCssPrefix() + "Badge-invisible")); } } diff --git a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiChip.java b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiChip.java index b8a6dc8f..4b75e4c5 100644 --- a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiChip.java +++ b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiChip.java @@ -37,6 +37,7 @@ import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.V6; /** * Chips are compact elements that represent an input, attribute, or action. @@ -65,7 +66,7 @@ public MuiChip(WebElement element, ComponentWebDriver driver, MuiConfig config) @Override public Set versions() { - return EnumSet.of(V4, V5); + return EnumSet.of(V4, V5, V6); } @Override diff --git a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiDivider.java b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiDivider.java index 0bb36a1d..6892ccf8 100644 --- a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiDivider.java +++ b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiDivider.java @@ -35,6 +35,7 @@ import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.V6; /** * Guidance and suggestions for using icons with Material-UI. @@ -63,7 +64,7 @@ public MuiDivider(WebElement element, ComponentWebDriver driver, MuiConfig confi @Override public Set versions() { - return EnumSet.of(V4, V5); + return EnumSet.of(V4, V5, V6); } @Override diff --git a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiList.java b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiList.java index e23bffa7..8f8baeaf 100644 --- a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiList.java +++ b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiList.java @@ -39,6 +39,7 @@ import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; import static java.util.stream.Collectors.toList; +import static com.github.grossopa.selenium.component.mui.MuiVersion.V6; /** * Lists are continuous, vertical indexes of text or images. @@ -67,7 +68,7 @@ public MuiList(WebElement element, ComponentWebDriver driver, MuiConfig config) @Override public Set versions() { - return EnumSet.of(V4, V5); + return EnumSet.of(V4, V5, V6); } @Override diff --git a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiListItem.java b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiListItem.java index 3900a0ba..798df751 100644 --- a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiListItem.java +++ b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiListItem.java @@ -35,6 +35,7 @@ import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.V6; /** * The item belongs to {@link MuiList}. @@ -62,7 +63,7 @@ public MuiListItem(WebElement element, ComponentWebDriver driver, MuiConfig conf @Override public Set versions() { - return EnumSet.of(V4, V5); + return EnumSet.of(V4, V5, V6); } @Override diff --git a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiTooltip.java b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiTooltip.java new file mode 100644 index 00000000..547add17 --- /dev/null +++ b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiTooltip.java @@ -0,0 +1,79 @@ +/* + * Copyright © 2024 the original author or authors. + * + * Licensed under the The MIT License (MIT) (the "License"); + * You may obtain a copy of the License at + * + * https://mit-license.org/ + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software + * and associated documentation files (the “Software”), to deal in the Software without + * restriction, including without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or + * substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING + * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package com.github.grossopa.selenium.component.mui.v4.datadisplay; + +import com.github.grossopa.selenium.component.mui.MuiVersion; +import com.github.grossopa.selenium.component.mui.config.MuiConfig; +import com.github.grossopa.selenium.component.mui.v4.AbstractMuiComponent; +import com.github.grossopa.selenium.core.ComponentWebDriver; +import org.openqa.selenium.WebElement; + +import java.util.EnumSet; +import java.util.Set; + +import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; +import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.V6; + +/** + * Tooltips display informative text when users hover over, focus on, or tap an element. + * + * @author Jack Yin + * @since 1.12.0 + */ +public class MuiTooltip extends AbstractMuiComponent { + + /** + * The component name + */ + public static final String COMPONENT_NAME = "Tooltip"; + + /** + * Constructs an instance with the delegated element and root driver + * + * @param element the delegated element + * @param driver the root driver + * @param config the Material UI configuration + */ + public MuiTooltip(WebElement element, ComponentWebDriver driver, MuiConfig config) { + super(element, driver, config); + } + + @Override + public boolean validate() { + return config.validateComponentByCss(this, "Popper") + && attributeContains("role", "tooltip"); + } + + @Override + public Set versions() { + return EnumSet.of(V4, V5, V6); + } + + @Override + public String getComponentName() { + return COMPONENT_NAME; + } +} diff --git a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/feedback/MuiBackdrop.java b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/feedback/MuiBackdrop.java index a0288f4b..3f44237d 100644 --- a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/feedback/MuiBackdrop.java +++ b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/feedback/MuiBackdrop.java @@ -35,6 +35,7 @@ import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.V6; /** * The backdrop component is used to provide emphasis on a particular element or parts of it. @@ -63,7 +64,7 @@ public MuiBackdrop(WebElement element, ComponentWebDriver driver, MuiConfig conf @Override public Set versions() { - return EnumSet.of(V4, V5); + return EnumSet.of(V4, V5, V6); } @Override diff --git a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/feedback/MuiDialog.java b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/feedback/MuiDialog.java index cfa73708..6f8fba75 100644 --- a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/feedback/MuiDialog.java +++ b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/feedback/MuiDialog.java @@ -37,6 +37,7 @@ import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.V6; /** * Dialogs inform users about a task and can contain critical information, require decisions, or involve multiple @@ -67,7 +68,7 @@ public MuiDialog(WebElement element, ComponentWebDriver driver, MuiConfig config @Override public Set versions() { - return EnumSet.of(V4, V5); + return EnumSet.of(V4, V5, V6); } @Override diff --git a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/feedback/MuiSnackbar.java b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/feedback/MuiSnackbar.java index 037f95df..6f0d95db 100644 --- a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/feedback/MuiSnackbar.java +++ b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/feedback/MuiSnackbar.java @@ -42,6 +42,7 @@ import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; import static com.github.grossopa.selenium.core.util.SeleniumUtils.executeIgnoringStaleElementReference; +import static com.github.grossopa.selenium.component.mui.MuiVersion.V6; /** * Snackbars provide brief messages about app processes. The component is also known as a toast. @@ -72,7 +73,7 @@ public MuiSnackbar(WebElement element, ComponentWebDriver driver, MuiConfig conf @Override public Set versions() { - return EnumSet.of(V4, V5); + return EnumSet.of(V4, V5, V6); } /** diff --git a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/feedback/MuiSnackbarContent.java b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/feedback/MuiSnackbarContent.java index 3379e4ee..704ae63d 100644 --- a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/feedback/MuiSnackbarContent.java +++ b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/feedback/MuiSnackbarContent.java @@ -35,8 +35,7 @@ import java.util.EnumSet; import java.util.Set; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.*; /** * The content element of {@link MuiSnackbar}. @@ -64,7 +63,7 @@ public MuiSnackbarContent(WebElement element, ComponentWebDriver driver, MuiConf @Override public Set versions() { - return EnumSet.of(V4, V5); + return EnumSet.of(V4, V5, V6); } @Override diff --git a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiButton.java b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiButton.java index 543511d3..770f02e4 100644 --- a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiButton.java +++ b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiButton.java @@ -35,6 +35,7 @@ import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.V6; /** * a simple Material UI button @@ -69,7 +70,7 @@ public String getComponentName() { @Override public Set versions() { - return EnumSet.of(V4, V5); + return EnumSet.of(V4, V5, V6); } @Override diff --git a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiButtonGroup.java b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiButtonGroup.java index d8bd7255..b4ec8ca2 100644 --- a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiButtonGroup.java +++ b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiButtonGroup.java @@ -37,6 +37,7 @@ import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; import static java.util.stream.Collectors.toList; +import static com.github.grossopa.selenium.component.mui.MuiVersion.V6; /** * The Material UI Basic ButtonGroup implementation. @@ -71,7 +72,7 @@ public String getComponentName() { @Override public Set versions() { - return EnumSet.of(V4, V5); + return EnumSet.of(V4, V5, V6); } /** diff --git a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiFab.java b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiFab.java index b0bafe5c..e1ddf963 100644 --- a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiFab.java +++ b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiFab.java @@ -35,6 +35,7 @@ import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.V6; /** * A floating action button (FAB) performs the primary, or most common, action on a screen. @@ -69,6 +70,6 @@ public String getComponentName() { @Override public Set versions() { - return EnumSet.of(V4, V5); + return EnumSet.of(V4, V5, V6); } } diff --git a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiRadio.java b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiRadio.java index 357e9702..b9161e64 100644 --- a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiRadio.java +++ b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiRadio.java @@ -35,6 +35,7 @@ import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.V6; /** * The Material UI Radio implementation @@ -64,7 +65,7 @@ public MuiRadio(WebElement element, ComponentWebDriver driver, MuiConfig config) @Override public Set versions() { - return EnumSet.of(V4, V5); + return EnumSet.of(V4, V5, V6); } @Override diff --git a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiRadioGroup.java b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiRadioGroup.java index 363747f8..781a5289 100644 --- a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiRadioGroup.java +++ b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiRadioGroup.java @@ -38,6 +38,7 @@ import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; import static com.github.grossopa.selenium.core.consts.HtmlConstants.CLASS; import static java.util.stream.Collectors.toList; +import static com.github.grossopa.selenium.component.mui.MuiVersion.V6; /** * The Material UI Radio implementation @@ -67,7 +68,7 @@ public MuiRadioGroup(WebElement element, ComponentWebDriver driver, MuiConfig co @Override public Set versions() { - return EnumSet.of(V4, V5); + return EnumSet.of(V4, V5, V6); } @Override diff --git a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiSelect.java b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiSelect.java index ec8bb34e..b38e93b6 100644 --- a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiSelect.java +++ b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiSelect.java @@ -50,6 +50,7 @@ import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; import static java.util.Objects.requireNonNull; import static java.util.stream.Collectors.toList; +import static com.github.grossopa.selenium.component.mui.MuiVersion.V6; /** * A MUI Select wrapper which supports the Popover-based options. @@ -102,7 +103,7 @@ public String getComponentName() { @Override public Set versions() { - return EnumSet.of(V4, V5); + return EnumSet.of(V4, V5, V6); } @Override @@ -198,12 +199,23 @@ public void selectByVisibleText(String text) { selectByVisibleText(text, 0L); } + @Override + public void selectByContainsVisibleText(String text) { + selectByContainsVisibleText(text, 0L); + } + @Override public void selectByVisibleText(String text, Long delayInMillis) { doFilterAndAction(getOptions2(delayInMillis), option -> !config.isSelected(option) && StringUtils.equals(text, option.getText())); } + @Override + public void selectByContainsVisibleText(String text, Long delayInMillis) { + doFilterAndAction(getOptions2(delayInMillis), + option -> !config.isSelected(option) && StringUtils.contains(option.getText(), text)); + } + @Override public void selectByIndex(int index) { selectByIndex(index, 0L); @@ -225,7 +237,7 @@ public void selectByValue(String value) { @Override public void selectByValue(String value, Long delayInMillis) { doFilterAndAction(getOptions2(delayInMillis), option -> !config.isSelected(option) && StringUtils.equals(value, - option.getAttribute(selectConfig.getOptionValueAttribute()))); + option.getDomAttribute(selectConfig.getOptionValueAttribute()))); } @Override @@ -247,7 +259,7 @@ public void deselectByValue(String value) { @Override public void deselectByValue(String value, Long delayInMillis) { doFilterAndAction(getOptions2(delayInMillis), option -> config.isSelected(option) && StringUtils.equals(value, - option.getAttribute(selectConfig.getOptionValueAttribute()))); + option.getDomAttribute(selectConfig.getOptionValueAttribute()))); } @Override @@ -268,15 +280,27 @@ public void deselectByVisibleText(String text) { deselectByVisibleText(text, 0L); } + @Override + public void deSelectByContainsVisibleText(String text) { + deSelectByContainsVisibleText(text, 0L); + } + @Override public void deselectByVisibleText(String text, Long delayInMillis) { doFilterAndAction(getOptions2(delayInMillis), option -> config.isSelected(option) && StringUtils.equals(text, option.getText())); } + @Override + public void deSelectByContainsVisibleText(String text, Long delayInMillis) { + doFilterAndAction(getOptions2(delayInMillis), + option -> config.isSelected(option) && StringUtils.contains(option.getText(), text)); + } + private void doFilterAndAction(List options, Predicate isTrue) { for (WebComponent option : options) { if (isTrue.test(option)) { + driver.scrollTo(option); option.click(); if (!selectConfig.isMultiple()) { return; diff --git a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiSliderThumb.java b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiSliderThumb.java index fd4df766..f8d83b32 100644 --- a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiSliderThumb.java +++ b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiSliderThumb.java @@ -80,7 +80,7 @@ public boolean validate() { * @return the orientation of current thumb. possible values are "horizontal" and "vertical". */ public String getOrientation() { - return element.getAttribute("aria-orientation"); + return element.getDomAttribute("aria-orientation"); } /** @@ -89,7 +89,7 @@ public String getOrientation() { * @return the value text */ public String getValueText() { - return element.getAttribute("aria-valuetext"); + return element.getDomAttribute("aria-valuetext"); } /** @@ -98,7 +98,7 @@ public String getValueText() { * @return the raw min value. */ public String getMaxValue() { - return element.getAttribute("aria-valuemax"); + return element.getDomAttribute("aria-valuemax"); } /** @@ -107,7 +107,7 @@ public String getMaxValue() { * @return the raw min value. */ public String getMinValue() { - return element.getAttribute("aria-valuemin"); + return element.getDomAttribute("aria-valuemin"); } /** @@ -116,7 +116,7 @@ public String getMinValue() { * @return the raw value. */ public String getValue() { - return element.getAttribute("aria-valuenow"); + return element.getDomAttribute("aria-valuenow"); } /** diff --git a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiTextField.java b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiTextField.java index 99712412..90f04fa0 100644 --- a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiTextField.java +++ b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiTextField.java @@ -38,6 +38,7 @@ import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.V6; /** * The Material UI TextField implementation @@ -67,7 +68,7 @@ public MuiTextField(WebElement element, ComponentWebDriver driver, MuiConfig con @Override public Set versions() { - return EnumSet.of(V4, V5); + return EnumSet.of(V4, V5, V6); } @Override diff --git a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/lab/MuiAutocomplete.java b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/lab/MuiAutocomplete.java index f86fbaca..edf75281 100644 --- a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/lab/MuiAutocomplete.java +++ b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/lab/MuiAutocomplete.java @@ -52,6 +52,7 @@ import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; import static com.github.grossopa.selenium.core.consts.HtmlConstants.CLASS; import static org.apache.commons.lang3.ObjectUtils.defaultIfNull; +import static com.github.grossopa.selenium.component.mui.MuiVersion.V6; /** * The autocomplete is a normal text input enhanced by a panel of suggested options. @@ -146,7 +147,7 @@ public String getComponentName() { @Override public Set versions() { - return EnumSet.of(V4, V5); + return EnumSet.of(V4, V5, V6); } @Override @@ -329,6 +330,11 @@ public void selectByVisibleText(String text) { selectByVisibleText(text, 0L); } + @Override + public void selectByContainsVisibleText(String text) { + selectByContainsVisibleText(text, 0L); + } + @Override public void selectByVisibleText(String text, Long delayInMillis) { List options = getOptions2(delayInMillis); @@ -340,6 +346,17 @@ public void selectByVisibleText(String text, Long delayInMillis) { } } + @Override + public void selectByContainsVisibleText(String text, Long delayInMillis) { + List options = getOptions2(delayInMillis); + for (WebComponent option : options) { + if (StringUtils.contains(option.getText(), text)) { + option.click(); + return; + } + } + } + @Override public void selectByIndex(int index) { selectByIndex(index, 0L); @@ -428,11 +445,30 @@ public void deselectByVisibleText(String text) { } } + @Override + public void deSelectByContainsVisibleText(String text) { + List options = getVisibleTags(); + for (MuiAutocompleteTag option : options) { + if (StringUtils.contains(option.getLabel(), text)) { + option.getDeleteButton().click(); + // return here as all components will be recreated after removing the element that caused + // the options are not valid after deletion. A potential side effect is that the deselect action + // will only remove one element (e.g. duplicated visible text). + return; + } + } + } + @Override public void deselectByVisibleText(String text, Long delayInMillis) { deselectByVisibleText(text); } + @Override + public void deSelectByContainsVisibleText(String text, Long delayInMillis) { + deSelectByContainsVisibleText(text); + } + /** * Whether there is no options. * diff --git a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/lab/MuiAutocompleteTag.java b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/lab/MuiAutocompleteTag.java index 7d40b183..59610b39 100644 --- a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/lab/MuiAutocompleteTag.java +++ b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/lab/MuiAutocompleteTag.java @@ -41,6 +41,7 @@ import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; import static org.apache.commons.lang3.ObjectUtils.defaultIfNull; +import static com.github.grossopa.selenium.component.mui.MuiVersion.V6; /** * The tags in multiple values feature of {@link MuiAutocomplete}. @@ -86,7 +87,7 @@ public MuiAutocompleteTag(WebElement element, ComponentWebDriver driver, MuiConf @Override public Set versions() { - return EnumSet.of(V4, V5); + return EnumSet.of(V4, V5, V6); } @Override diff --git a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/lab/MuiPagination.java b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/lab/MuiPagination.java index 22288e0b..96fa4a69 100644 --- a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/lab/MuiPagination.java +++ b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/lab/MuiPagination.java @@ -44,6 +44,7 @@ import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; import static java.util.stream.Collectors.toList; import static org.apache.commons.lang3.ObjectUtils.defaultIfNull; +import static com.github.grossopa.selenium.component.mui.MuiVersion.V6; /** * The Pagination component enables the user to select a specific page from a range of pages. @@ -88,7 +89,7 @@ public MuiPagination(WebElement element, ComponentWebDriver driver, MuiConfig co @Override public Set versions() { - return EnumSet.of(V4, V5); + return EnumSet.of(V4, V5, V6); } @Override diff --git a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiAccordion.java b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiAccordion.java index 0a1c19e1..cf3dc2b1 100644 --- a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiAccordion.java +++ b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiAccordion.java @@ -40,6 +40,7 @@ import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.V6; /** * Accordions contain creation flows and allow lightweight editing of an element. @@ -69,7 +70,7 @@ public MuiAccordion(WebElement element, ComponentWebDriver driver, MuiConfig con @Override public Set versions() { - return EnumSet.of(V4, V5); + return EnumSet.of(V4, V5, V6); } /** diff --git a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiAccordionActions.java b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiAccordionActions.java index e58b2990..e1fb559f 100644 --- a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiAccordionActions.java +++ b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiAccordionActions.java @@ -35,6 +35,7 @@ import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.V6; /** * The actions container of {@link MuiAccordion} @@ -62,7 +63,7 @@ public MuiAccordionActions(WebElement element, ComponentWebDriver driver, MuiCon @Override public Set versions() { - return EnumSet.of(V4, V5); + return EnumSet.of(V4, V5, V6); } @Override diff --git a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiAccordionDetails.java b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiAccordionDetails.java index d23f4797..3d08db29 100644 --- a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiAccordionDetails.java +++ b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiAccordionDetails.java @@ -35,6 +35,7 @@ import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.V6; /** * The body element of {@link MuiAccordion}. @@ -62,7 +63,7 @@ public MuiAccordionDetails(WebElement element, ComponentWebDriver driver, MuiCon @Override public Set versions() { - return EnumSet.of(V4, V5); + return EnumSet.of(V4, V5, V6); } @Override diff --git a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiAccordionSummary.java b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiAccordionSummary.java index 149b9539..efd4ec06 100644 --- a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiAccordionSummary.java +++ b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiAccordionSummary.java @@ -37,6 +37,7 @@ import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.V6; /** * Accordions contain creation flows and allow lightweight editing of an element. @@ -66,7 +67,7 @@ public MuiAccordionSummary(WebElement element, ComponentWebDriver driver, MuiCon @Override public Set versions() { - return EnumSet.of(V4, V5); + return EnumSet.of(V4, V5, V6); } @Override @@ -80,7 +81,7 @@ public String getComponentName() { * @return whether the Accordion Summary part is expanded. */ public boolean isExpand() { - return "true".equalsIgnoreCase(element.getAttribute("aria-expanded")); + return "true".equalsIgnoreCase(element.getDomAttribute("aria-expanded")); } /** diff --git a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiBottomNavigation.java b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiBottomNavigation.java index bb259c14..8b14b63e 100644 --- a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiBottomNavigation.java +++ b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiBottomNavigation.java @@ -35,8 +35,7 @@ import java.util.List; import java.util.Set; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.*; import static java.util.stream.Collectors.toList; /** @@ -67,7 +66,7 @@ public MuiBottomNavigation(WebElement element, ComponentWebDriver driver, MuiCon @Override public Set versions() { - return EnumSet.of(V4, V5); + return EnumSet.of(V4, V5, V6); } @Override diff --git a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiBottomNavigationAction.java b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiBottomNavigationAction.java index 20a0a02c..69c063f2 100644 --- a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiBottomNavigationAction.java +++ b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiBottomNavigationAction.java @@ -33,8 +33,7 @@ import java.util.EnumSet; import java.util.Set; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.*; /** * The action button item of bottom navigation bars allow movement between primary destinations in an app. @@ -64,7 +63,7 @@ public MuiBottomNavigationAction(WebElement element, ComponentWebDriver driver, @Override public Set versions() { - return EnumSet.of(V4, V5); + return EnumSet.of(V4, V5, V6); } @Override diff --git a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiBreadcrumbs.java b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiBreadcrumbs.java index ea4c83d4..e1e7c62d 100644 --- a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiBreadcrumbs.java +++ b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiBreadcrumbs.java @@ -41,6 +41,7 @@ import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; import static java.util.stream.Collectors.toList; +import static com.github.grossopa.selenium.component.mui.MuiVersion.V6; /** * Breadcrumbs allow users to make selections from a range of values. @@ -70,7 +71,7 @@ public MuiBreadcrumbs(WebElement element, ComponentWebDriver driver, MuiConfig c @Override public Set versions() { - return EnumSet.of(V4, V5); + return EnumSet.of(V4, V5, V6); } @Override @@ -135,7 +136,7 @@ protected By getSeparatorLocator() { } protected By getTouchRippleLocator() { - return By2.className(config.getCssPrefix() + "TouchRipple-root"); + return By2.attrExact("data-testid", "MoreHorizIcon"); } protected By getItemContainersLocator() { diff --git a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiLink.java b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiLink.java index 7300cfa4..b59f006e 100644 --- a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiLink.java +++ b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiLink.java @@ -35,6 +35,7 @@ import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.V6; /** * The Link component allows you to easily customize anchor elements with your theme colors and typography styles. @@ -69,7 +70,7 @@ public String getComponentName() { @Override public Set versions() { - return EnumSet.of(V4, V5); + return EnumSet.of(V4, V5, V6); } /** @@ -78,6 +79,6 @@ public Set versions() { * @return the href attribute value */ public String getHref() { - return this.getAttribute("href"); + return this.getDomAttribute("href"); } } diff --git a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiMenu.java b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiMenu.java index 65f431c0..cf0de269 100644 --- a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiMenu.java +++ b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiMenu.java @@ -38,6 +38,7 @@ import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; import static java.util.stream.Collectors.toList; +import static com.github.grossopa.selenium.component.mui.MuiVersion.V6; /** * A Menu displays a list of choices on a temporary surface. It appears when the user interacts with a button, or other @@ -66,7 +67,7 @@ public MuiMenu(WebElement element, ComponentWebDriver driver, MuiConfig config) @Override public Set versions() { - return EnumSet.of(V4, V5); + return EnumSet.of(V4, V5, V6); } @Override diff --git a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiMenuItem.java b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiMenuItem.java index be0d41c4..f4b17cc2 100644 --- a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiMenuItem.java +++ b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiMenuItem.java @@ -35,6 +35,7 @@ import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.V6; /** * The item of {@link MuiMenu}. @@ -62,7 +63,7 @@ protected MuiMenuItem(WebElement element, ComponentWebDriver driver, MuiConfig c @Override public Set versions() { - return EnumSet.of(V4, V5); + return EnumSet.of(V4, V5, V6); } @Override diff --git a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiTab.java b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiTab.java index a8f146e0..da341be8 100644 --- a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiTab.java +++ b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiTab.java @@ -35,6 +35,7 @@ import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.V6; /** * The Tab of Tabs that make it easy to explore and switch between different views. @@ -64,7 +65,7 @@ public MuiTab(WebElement element, ComponentWebDriver driver, MuiConfig config) { @Override public Set versions() { - return EnumSet.of(V4, V5); + return EnumSet.of(V4, V5, V6); } @Override diff --git a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiTabScrollButton.java b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiTabScrollButton.java index 6aaf7fa9..a39a6b4c 100644 --- a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiTabScrollButton.java +++ b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiTabScrollButton.java @@ -35,6 +35,7 @@ import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.V6; /** * The tab scrolling button when the tab items cannot be displayed within the {@link MuiTabs}. @@ -62,7 +63,7 @@ public MuiTabScrollButton(WebElement element, ComponentWebDriver driver, MuiConf @Override public Set versions() { - return EnumSet.of(V4, V5); + return EnumSet.of(V4, V5, V6); } @Override diff --git a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiTabs.java b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiTabs.java index e51f9fd2..a3384a81 100644 --- a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiTabs.java +++ b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiTabs.java @@ -25,8 +25,8 @@ package com.github.grossopa.selenium.component.mui.v4.navigation; import com.github.grossopa.selenium.component.mui.MuiVersion; -import com.github.grossopa.selenium.component.mui.v4.AbstractMuiComponent; import com.github.grossopa.selenium.component.mui.config.MuiConfig; +import com.github.grossopa.selenium.component.mui.v4.AbstractMuiComponent; import com.github.grossopa.selenium.core.ComponentWebDriver; import com.github.grossopa.selenium.core.locator.By2; import org.openqa.selenium.By; @@ -37,8 +37,7 @@ import java.util.Optional; import java.util.Set; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.*; import static java.util.stream.Collectors.toList; /** @@ -60,8 +59,8 @@ public class MuiTabs extends AbstractMuiComponent { * Constructs an instance with the delegated element and root driver * * @param element the delegated element - * @param driver the root driver - * @param config the Material UI configuration + * @param driver the root driver + * @param config the Material UI configuration */ public MuiTabs(WebElement element, ComponentWebDriver driver, MuiConfig config) { super(element, driver, config); @@ -69,7 +68,7 @@ public MuiTabs(WebElement element, ComponentWebDriver driver, MuiConfig config) @Override public Set versions() { - return EnumSet.of(V4, V5); + return EnumSet.of(V4, V5, V6); } @Override diff --git a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/surfaces/MuiAppBar.java b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/surfaces/MuiAppBar.java index eec44ba5..aeb2154c 100644 --- a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/surfaces/MuiAppBar.java +++ b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/surfaces/MuiAppBar.java @@ -35,7 +35,7 @@ import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; - +import static com.github.grossopa.selenium.component.mui.MuiVersion.V6; /** * The App Bar displays information and actions relating to the current screen. * @@ -62,7 +62,7 @@ public MuiAppBar(WebElement element, ComponentWebDriver driver, MuiConfig config @Override public Set versions() { - return EnumSet.of(V4, V5); + return EnumSet.of(V4, V5, V6); } @Override diff --git a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/surfaces/MuiToolbar.java b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/surfaces/MuiToolbar.java index 73a75788..47de78b3 100644 --- a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/surfaces/MuiToolbar.java +++ b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v4/surfaces/MuiToolbar.java @@ -35,6 +35,7 @@ import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.V6; /** * The wrappers for Material UI Toolbar. @@ -63,7 +64,7 @@ public MuiToolbar(WebElement element, ComponentWebDriver driver, MuiConfig confi @Override public Set versions() { - return EnumSet.of(V4, V5); + return EnumSet.of(V4, V5, V6); } @Override diff --git a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v5/datetime/sub/MuiPickersDay.java b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v5/datetime/sub/MuiPickersDay.java index 3b2156c5..4d85c3b8 100644 --- a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v5/datetime/sub/MuiPickersDay.java +++ b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v5/datetime/sub/MuiPickersDay.java @@ -77,7 +77,7 @@ public String getComponentName() { */ @Nullable public String getDateLabel() { - return getAttribute("aria-label"); + return getDomAttribute("aria-label"); } } diff --git a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v5/inputs/MuiCheckboxV5.java b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v5/inputs/MuiCheckboxV5.java index 7dfc919b..92f0d40b 100644 --- a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v5/inputs/MuiCheckboxV5.java +++ b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v5/inputs/MuiCheckboxV5.java @@ -34,6 +34,7 @@ import java.util.Set; import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.V6; import static com.github.grossopa.selenium.core.consts.HtmlConstants.CLASS; /** @@ -58,7 +59,7 @@ public MuiCheckboxV5(WebElement element, ComponentWebDriver driver, MuiConfig co @Override public Set versions() { - return EnumSet.of(V5); + return EnumSet.of(V5, V6); } /** diff --git a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v5/inputs/MuiSliderThumbV5.java b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v5/inputs/MuiSliderThumbV5.java index fca08ddb..dee8b324 100644 --- a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v5/inputs/MuiSliderThumbV5.java +++ b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v5/inputs/MuiSliderThumbV5.java @@ -34,6 +34,7 @@ import java.util.Set; import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.V6; import static com.github.grossopa.selenium.core.locator.By2.axesBuilder; /** @@ -57,7 +58,7 @@ public MuiSliderThumbV5(WebElement element, ComponentWebDriver driver, MuiConfig @Override public Set versions() { - return EnumSet.of(V5); + return EnumSet.of(V5, V6); } /** @@ -68,7 +69,7 @@ public Set versions() { */ @Override public String getOrientation() { - return getInputElement().getAttribute("aria-orientation"); + return getInputElement().getDomAttribute("aria-orientation"); } /** @@ -78,7 +79,7 @@ public String getOrientation() { */ @Override public String getValueText() { - return getInputElement().getAttribute("aria-valuetext"); + return getInputElement().getDomAttribute("aria-valuetext"); } /** @@ -88,7 +89,7 @@ public String getValueText() { */ @Override public String getMaxValue() { - return getInputElement().getAttribute("aria-valuemax"); + return getInputElement().getDomAttribute("aria-valuemax"); } /** @@ -98,7 +99,7 @@ public String getMaxValue() { */ @Override public String getMinValue() { - return getInputElement().getAttribute("aria-valuemin"); + return getInputElement().getDomAttribute("aria-valuemin"); } /** @@ -108,7 +109,7 @@ public String getMinValue() { */ @Override public String getValue() { - return getInputElement().getAttribute("aria-valuenow"); + return getInputElement().getDomAttribute("aria-valuenow"); } /** diff --git a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v5/inputs/MuiSliderV5.java b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v5/inputs/MuiSliderV5.java index 188f7ce4..8e2f39b4 100644 --- a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v5/inputs/MuiSliderV5.java +++ b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v5/inputs/MuiSliderV5.java @@ -36,6 +36,7 @@ import java.util.function.UnaryOperator; import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.V6; /** * Sliders allow users to make selections from a range of values. @@ -60,7 +61,7 @@ public MuiSliderV5(WebElement element, ComponentWebDriver driver, MuiConfig conf @Override public Set versions() { - return EnumSet.of(V5); + return EnumSet.of(V5, V6); } /** diff --git a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v5/inputs/MuiSwitchV5.java b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v5/inputs/MuiSwitchV5.java index d810854d..a533461e 100644 --- a/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v5/inputs/MuiSwitchV5.java +++ b/hamster-selenium-component-materialui/src/main/java/com/github/grossopa/selenium/component/mui/v5/inputs/MuiSwitchV5.java @@ -35,6 +35,7 @@ import java.util.Set; import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.V6; import static com.github.grossopa.selenium.core.locator.By2.axesBuilder; /** @@ -58,7 +59,7 @@ public MuiSwitchV5(WebElement element, ComponentWebDriver driver, MuiConfig conf @Override public Set versions() { - return EnumSet.of(V5); + return EnumSet.of(V5, V6); } @Override diff --git a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/config/MuiConfigTest.java b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/config/MuiConfigTest.java index 4f077c1e..217dd835 100644 --- a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/config/MuiConfigTest.java +++ b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/config/MuiConfigTest.java @@ -72,56 +72,56 @@ void menuPagerLocator() { @Test void isChecked() { WebComponent component = mock(WebComponent.class); - when(component.getAttribute(CLASS)).thenReturn("some-other some-thing Muiabc Mui-checked"); + when(component.getDomAttribute(CLASS)).thenReturn("some-other some-thing Muiabc Mui-checked"); assertTrue(testSubject.isChecked(component)); } @Test void isCheckedNegative() { WebComponent component = mock(WebComponent.class); - when(component.getAttribute(CLASS)).thenReturn("some-other some-thing Muiabc Mui-some"); + when(component.getDomAttribute(CLASS)).thenReturn("some-other some-thing Muiabc Mui-some"); assertFalse(testSubject.isChecked(component)); } @Test void isSelected() { WebComponent component = mock(WebComponent.class); - when(component.getAttribute(CLASS)).thenReturn("some-other some-thing Muiabc Mui-selected"); + when(component.getDomAttribute(CLASS)).thenReturn("some-other some-thing Muiabc Mui-selected"); assertTrue(testSubject.isSelected(component)); } @Test void isSelectedNegative() { WebComponent component = mock(WebComponent.class); - when(component.getAttribute(CLASS)).thenReturn("some-other some-thing Muiabc Mui-some"); + when(component.getDomAttribute(CLASS)).thenReturn("some-other some-thing Muiabc Mui-some"); assertFalse(testSubject.isSelected(component)); } @Test void isDisabled() { WebComponent component = mock(WebComponent.class); - when(component.getAttribute(CLASS)).thenReturn("some-other some-thing Muiabc Mui-disabled"); + when(component.getDomAttribute(CLASS)).thenReturn("some-other some-thing Muiabc Mui-disabled"); assertTrue(testSubject.isDisabled(component)); } @Test void isDisabledNegative() { WebComponent component = mock(WebComponent.class); - when(component.getAttribute(CLASS)).thenReturn("some-other some-thing Muiabc Mui-some"); + when(component.getDomAttribute(CLASS)).thenReturn("some-other some-thing Muiabc Mui-some"); assertFalse(testSubject.isDisabled(component)); } @Test void isGridContainer() { WebComponent component = mock(WebComponent.class); - when(component.getAttribute(CLASS)).thenReturn("MuiGrid-container Muiabc Mui-some"); + when(component.getDomAttribute(CLASS)).thenReturn("MuiGrid-container Muiabc Mui-some"); assertTrue(testSubject.isGridContainer(component)); } @Test void isGridItem() { WebComponent component = mock(WebComponent.class); - when(component.getAttribute(CLASS)).thenReturn("MuiGrid-item Muiabc Mui-some"); + when(component.getDomAttribute(CLASS)).thenReturn("MuiGrid-item Muiabc Mui-some"); assertTrue(testSubject.isGridItem(component)); } @@ -148,7 +148,7 @@ void getRootCss() { @Test void validateComponentByCss() { WebComponent component = mock(WebComponent.class); - when(component.getAttribute(CLASS)).thenReturn("MuiPager-root MuiSomeOther"); + when(component.getDomAttribute(CLASS)).thenReturn("MuiPager-root MuiSomeOther"); assertTrue(testSubject.validateComponentByCss(component, "Pager")); } @@ -156,21 +156,21 @@ void validateComponentByCss() { @Test void validateComponentByCssNegative() { WebComponent component = mock(WebComponent.class); - when(component.getAttribute(CLASS)).thenReturn("MuiSelect-root MuiSomeOther"); + when(component.getDomAttribute(CLASS)).thenReturn("MuiSelect-root MuiSomeOther"); assertFalse(testSubject.validateComponentByCss(component, "Pager")); } @Test void validateByCss() { WebComponent component = mock(WebComponent.class); - when(component.getAttribute(CLASS)).thenReturn("MuiPager-root MuiSomeOther"); + when(component.getDomAttribute(CLASS)).thenReturn("MuiPager-root MuiSomeOther"); assertTrue(testSubject.validateByCss(component, "MuiSomeOther")); } @Test void validateByCssNegative() { WebComponent component = mock(WebComponent.class); - when(component.getAttribute(CLASS)).thenReturn("MuiSelect-root MuiSomeOther"); + when(component.getDomAttribute(CLASS)).thenReturn("MuiSelect-root MuiSomeOther"); assertFalse(testSubject.validateComponentByCss(component, "Pager")); } diff --git a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/core/MuiModalTest.java b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/core/MuiModalTest.java index 36d1a20f..eb89282b 100644 --- a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/core/MuiModalTest.java +++ b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/core/MuiModalTest.java @@ -33,8 +33,7 @@ import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.support.ui.WebDriverWait; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.*; import static org.junit.jupiter.api.Assertions.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.*; @@ -77,7 +76,7 @@ void close() { @Test void versions() { - assertArrayEquals(new MuiVersion[]{V4, V5}, testSubject.versions().toArray()); + assertArrayEquals(new MuiVersion[]{V4, V5, V6}, testSubject.versions().toArray()); } @Test diff --git a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/core/MuiPopoverTest.java b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/core/MuiPopoverTest.java index 12152124..b2dbb7dc 100644 --- a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/core/MuiPopoverTest.java +++ b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/core/MuiPopoverTest.java @@ -31,8 +31,7 @@ import org.junit.jupiter.api.Test; import org.openqa.selenium.WebElement; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.*; import static org.junit.jupiter.api.Assertions.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.mock; @@ -58,7 +57,7 @@ void setUp() { @Test void versions() { - assertArrayEquals(new MuiVersion[]{V4, V5}, testSubject.versions().toArray()); + assertArrayEquals(new MuiVersion[]{V4, V5, V6}, testSubject.versions().toArray()); } @Test diff --git a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiAvatarTest.java b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiAvatarTest.java index e0b3cd84..de8d4dad 100644 --- a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiAvatarTest.java +++ b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiAvatarTest.java @@ -32,8 +32,7 @@ import org.openqa.selenium.By; import org.openqa.selenium.WebElement; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.*; import static org.junit.jupiter.api.Assertions.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.mock; @@ -56,8 +55,8 @@ class MuiAvatarTest { @BeforeEach void setUp() { when(element.findElement(By.tagName("img"))).thenReturn(imgElement); - when(imgElement.getAttribute("src")).thenReturn("some-src-value"); - when(imgElement.getAttribute("alt")).thenReturn("some-alt-value"); + when(imgElement.getDomAttribute("src")).thenReturn("some-src-value"); + when(imgElement.getDomAttribute("alt")).thenReturn("some-alt-value"); testSubject = new MuiAvatar(element, driver, config); } @@ -89,6 +88,6 @@ void testToString() { @Test void versions() { - assertArrayEquals(new MuiVersion[]{V4, V5}, testSubject.versions().toArray()); + assertArrayEquals(new MuiVersion[]{V4, V5, V6}, testSubject.versions().toArray()); } } diff --git a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiBadgeTest.java b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiBadgeTest.java index 4cf8b7a2..a7308249 100644 --- a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiBadgeTest.java +++ b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiBadgeTest.java @@ -32,8 +32,7 @@ import org.openqa.selenium.By; import org.openqa.selenium.WebElement; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.*; import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -56,14 +55,14 @@ class MuiBadgeTest { void setUp() { when(config.getCssPrefix()).thenReturn("Mui"); when(element.findElement(By.className("MuiBadge-badge"))).thenReturn(badgeElement); - when(badgeElement.getAttribute("class")).thenReturn( + when(badgeElement.getDomAttribute("class")).thenReturn( "MuiBadge-badge MuiBadge-anchorOriginTopRightRectangle MuiBadge-colorSecondary"); testSubject = new MuiBadge(element, driver, config); } @Test void versions() { - assertArrayEquals(new MuiVersion[]{V4, V5}, testSubject.versions().toArray()); + assertArrayEquals(new MuiVersion[]{V4, V5, V6}, testSubject.versions().toArray()); } @Test @@ -100,14 +99,14 @@ void getBadgeNumberExceedMax() { @Test void isDotDisplayed() { - when(badgeElement.getAttribute("class")).thenReturn( + when(badgeElement.getDomAttribute("class")).thenReturn( "MuiBadge-badge MuiBadge-anchorOriginTopRightRectangle MuiBadge-colorSecondary MuiBadge-dot"); assertTrue(testSubject.isDotDisplayed()); } @Test void isDotDisplayedFalse() { - when(badgeElement.getAttribute("class")).thenReturn( + when(badgeElement.getDomAttribute("class")).thenReturn( "MuiBadge-badge MuiBadge-anchorOriginTopRightRectangle MuiBadge-colorSecondary"); assertFalse(testSubject.isDotDisplayed()); } @@ -119,14 +118,14 @@ void getComponentName() { @Test void isBadgeDisplayed() { - when(badgeElement.getAttribute("class")).thenReturn( + when(badgeElement.getDomAttribute("class")).thenReturn( "MuiBadge-badge MuiBadge-anchorOriginTopRightRectangle MuiBadge-colorSecondary"); assertTrue(testSubject.isBadgeDisplayed()); } @Test void isBadgeDisplayedInvisible() { - when(badgeElement.getAttribute("class")).thenReturn( + when(badgeElement.getDomAttribute("class")).thenReturn( "MuiBadge-badge MuiBadge-anchorOriginTopRightRectangle MuiBadge-colorSecondary MuiBadge-invisible"); assertFalse(testSubject.isBadgeDisplayed()); } diff --git a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiChipTest.java b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiChipTest.java index b35099bd..1de253e6 100644 --- a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiChipTest.java +++ b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiChipTest.java @@ -32,8 +32,7 @@ import org.openqa.selenium.By; import org.openqa.selenium.WebElement; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.*; import static java.util.Collections.singletonList; import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.mock; @@ -81,7 +80,7 @@ private void mockDeleteIcon() { @Test void versions() { - assertArrayEquals(new MuiVersion[]{V4, V5}, testSubject.versions().toArray()); + assertArrayEquals(new MuiVersion[]{V4, V5, V6}, testSubject.versions().toArray()); } @Test @@ -162,7 +161,7 @@ void deleteIconLocator() { @Test void isClickable() { - when(element.getAttribute("class")).thenReturn( + when(element.getDomAttribute("class")).thenReturn( "MuiButtonBase-root MuiChip-root MuiChip-colorPrimary MuiChip-clickableColorPrimary " + "MuiChip-deletableColorPrimary MuiChip-clickable"); assertTrue(testSubject.isClickable()); @@ -170,7 +169,7 @@ void isClickable() { @Test void isClickableNegative() { - when(element.getAttribute("class")).thenReturn( + when(element.getDomAttribute("class")).thenReturn( "MuiButtonBase-root MuiChip-root MuiChip-colorPrimary MuiChip-clickableColorPrimary " + "MuiChip-deletableColorPrimary"); assertFalse(testSubject.isClickable()); diff --git a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiDividerTest.java b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiDividerTest.java index 9e2df339..f804648f 100644 --- a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiDividerTest.java +++ b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiDividerTest.java @@ -31,8 +31,7 @@ import org.junit.jupiter.api.Test; import org.openqa.selenium.WebElement; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.*; import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -53,13 +52,13 @@ class MuiDividerTest { @BeforeEach void setUp() { when(config.getCssPrefix()).thenReturn("Mui"); - when(element.getAttribute("class")).thenReturn("MuiDivider-root MuiDivider-flexItem MuiDivider-vertical"); + when(element.getDomAttribute("class")).thenReturn("MuiDivider-root MuiDivider-flexItem MuiDivider-vertical"); testSubject = new MuiDivider(element, driver, config); } @Test void versions() { - assertArrayEquals(new MuiVersion[]{V4, V5}, testSubject.versions().toArray()); + assertArrayEquals(new MuiVersion[]{V4, V5, V6}, testSubject.versions().toArray()); } @Test @@ -74,7 +73,7 @@ void isVertical() { @Test void isVerticalFalse() { - when(element.getAttribute("class")).thenReturn("MuiDivider-root MuiDivider-flexItem"); + when(element.getDomAttribute("class")).thenReturn("MuiDivider-root MuiDivider-flexItem"); assertFalse(testSubject.isVertical()); } diff --git a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiListItemTest.java b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiListItemTest.java index 7e467f0d..6d5d42a2 100644 --- a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiListItemTest.java +++ b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiListItemTest.java @@ -31,8 +31,7 @@ import org.junit.jupiter.api.Test; import org.openqa.selenium.WebElement; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.*; import static org.junit.jupiter.api.Assertions.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.mock; @@ -58,7 +57,7 @@ void setUp() { @Test void versions() { - assertArrayEquals(new MuiVersion[]{V4, V5}, testSubject.versions().toArray()); + assertArrayEquals(new MuiVersion[]{V4, V5, V6}, testSubject.versions().toArray()); } @Test diff --git a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiListTest.java b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiListTest.java index df5fbd16..fbbefe77 100644 --- a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiListTest.java +++ b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiListTest.java @@ -33,8 +33,7 @@ import java.util.List; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.*; import static com.google.common.collect.Lists.newArrayList; import static org.junit.jupiter.api.Assertions.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -67,7 +66,7 @@ void setUp() { @Test void versions() { - assertArrayEquals(new MuiVersion[]{V4, V5}, testSubject.versions().toArray()); + assertArrayEquals(new MuiVersion[]{V4, V5, V6}, testSubject.versions().toArray()); } @Test diff --git a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiTooltipTest.java b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiTooltipTest.java new file mode 100644 index 00000000..27e859a3 --- /dev/null +++ b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/datadisplay/MuiTooltipTest.java @@ -0,0 +1,84 @@ +/* + * Copyright © 2024 the original author or authors. + * + * Licensed under the The MIT License (MIT) (the "License"); + * You may obtain a copy of the License at + * + * https://mit-license.org/ + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software + * and associated documentation files (the “Software”), to deal in the Software without + * restriction, including without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or + * substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING + * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +package com.github.grossopa.selenium.component.mui.v4.datadisplay; + +import com.github.grossopa.selenium.component.mui.MuiVersion; +import com.github.grossopa.selenium.component.mui.config.MuiConfig; +import com.github.grossopa.selenium.core.ComponentWebDriver; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.openqa.selenium.WebElement; + +import static com.github.grossopa.selenium.component.mui.MuiVersion.*; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +/** + * Tests for {@link MuiTooltip} + * + * @author Jack Yin + * @since 1.12.0 + */ +class MuiTooltipTest { + MuiTooltip testSubject; + WebElement element = mock(WebElement.class); + ComponentWebDriver driver = mock(ComponentWebDriver.class); + MuiConfig config = mock(MuiConfig.class); + + @BeforeEach + void setUp() { + testSubject = new MuiTooltip(element, driver, config); + } + + @Test + void versions() { + Assertions.assertArrayEquals(new MuiVersion[]{V4, V5, V6}, testSubject.versions().toArray()); + } + + @Test + void getComponentName() { + Assertions.assertEquals("Tooltip", testSubject.getComponentName()); + } + + @Test + void testToString() { + when(element.toString()).thenReturn("element-toString"); + Assertions.assertEquals("MuiTooltip{element=element-toString}", testSubject.toString()); + } + + @Test + void validate() { + when(element.getDomAttribute("role")).thenReturn("tooltip"); + when(config.validateComponentByCss(testSubject, "Popper")).thenReturn(true); + Assertions.assertTrue(testSubject.validate()); + } + + @Test + void validateNegative() { + when(element.getDomAttribute("role")).thenReturn("dialog"); + when(config.validateComponentByCss(testSubject, "Popper")).thenReturn(true); + Assertions.assertFalse(testSubject.validate()); + } +} \ No newline at end of file diff --git a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/feedback/MuiBackdropTest.java b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/feedback/MuiBackdropTest.java index 07aba847..03147cde 100644 --- a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/feedback/MuiBackdropTest.java +++ b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/feedback/MuiBackdropTest.java @@ -31,8 +31,7 @@ import org.junit.jupiter.api.Test; import org.openqa.selenium.WebElement; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.*; import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.*; @@ -67,6 +66,6 @@ void testToString() { @Test void versions() { - assertArrayEquals(new MuiVersion[]{V4, V5}, testSubject.versions().toArray()); + assertArrayEquals(new MuiVersion[]{V4, V5, V6}, testSubject.versions().toArray()); } } diff --git a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/feedback/MuiDialogTest.java b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/feedback/MuiDialogTest.java index 6540f5f4..4be9d171 100644 --- a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/feedback/MuiDialogTest.java +++ b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/feedback/MuiDialogTest.java @@ -34,8 +34,7 @@ import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Actions; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.*; import static org.junit.jupiter.api.Assertions.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.*; @@ -61,7 +60,7 @@ void setUp() { @Test void versions() { - assertArrayEquals(new MuiVersion[]{V4, V5}, testSubject.versions().toArray()); + assertArrayEquals(new MuiVersion[]{V4, V5, V6}, testSubject.versions().toArray()); } @Test diff --git a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/feedback/MuiSnackbarContentTest.java b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/feedback/MuiSnackbarContentTest.java index 24105e86..89b0383e 100644 --- a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/feedback/MuiSnackbarContentTest.java +++ b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/feedback/MuiSnackbarContentTest.java @@ -32,8 +32,7 @@ import org.openqa.selenium.By; import org.openqa.selenium.WebElement; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.*; import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.*; @@ -58,7 +57,7 @@ void setUp() { @Test void versions() { - assertArrayEquals(new MuiVersion[]{V4, V5}, testSubject.versions().toArray()); + assertArrayEquals(new MuiVersion[]{V4, V5, V6}, testSubject.versions().toArray()); } @Test diff --git a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/feedback/MuiSnackbarTest.java b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/feedback/MuiSnackbarTest.java index 014ecde4..d210ae71 100644 --- a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/feedback/MuiSnackbarTest.java +++ b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/feedback/MuiSnackbarTest.java @@ -37,8 +37,7 @@ import java.util.function.Function; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.*; import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.*; @@ -62,7 +61,7 @@ void setUp() { @Test void versions() { - assertArrayEquals(new MuiVersion[]{V4, V5}, testSubject.versions().toArray()); + assertArrayEquals(new MuiVersion[]{V4, V5, V6}, testSubject.versions().toArray()); } @Test diff --git a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiButtonGroupTest.java b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiButtonGroupTest.java index 7d98e680..3cf86184 100644 --- a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiButtonGroupTest.java +++ b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiButtonGroupTest.java @@ -32,8 +32,7 @@ import org.openqa.selenium.By; import org.openqa.selenium.WebElement; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.*; import static java.util.Arrays.asList; import static org.junit.jupiter.api.Assertions.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -65,7 +64,7 @@ void getComponentName() { @Test void versions() { - assertArrayEquals(new MuiVersion[]{V4, V5}, testSubject.versions().toArray()); + assertArrayEquals(new MuiVersion[]{V4, V5, V6}, testSubject.versions().toArray()); } @Test diff --git a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiButtonTest.java b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiButtonTest.java index b6cfd728..d0b38672 100644 --- a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiButtonTest.java +++ b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiButtonTest.java @@ -31,8 +31,7 @@ import org.junit.jupiter.api.Test; import org.openqa.selenium.WebElement; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.*; import static org.junit.jupiter.api.Assertions.*; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; @@ -64,7 +63,7 @@ void getComponentName() { @Test void versions() { - assertArrayEquals(new MuiVersion[]{V4, V5}, testSubject.versions().toArray()); + assertArrayEquals(new MuiVersion[]{V4, V5, V6}, testSubject.versions().toArray()); } @Test diff --git a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiFabTest.java b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiFabTest.java index 80f65dd9..4503375a 100644 --- a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiFabTest.java +++ b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiFabTest.java @@ -31,8 +31,7 @@ import org.junit.jupiter.api.Test; import org.openqa.selenium.WebElement; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.*; import static org.junit.jupiter.api.Assertions.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.mock; @@ -63,7 +62,7 @@ void getComponentName() { @Test void versions() { - assertArrayEquals(new MuiVersion[]{V4, V5}, testSubject.versions().toArray()); + assertArrayEquals(new MuiVersion[]{V4, V5, V6}, testSubject.versions().toArray()); } @Test diff --git a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiRadioGroupTest.java b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiRadioGroupTest.java index 285b80a9..55c7906b 100644 --- a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiRadioGroupTest.java +++ b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiRadioGroupTest.java @@ -32,8 +32,7 @@ import org.openqa.selenium.By; import org.openqa.selenium.WebElement; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.*; import static java.util.Arrays.asList; import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.mock; @@ -58,21 +57,21 @@ void setUp() { @Test void versions() { - assertArrayEquals(new MuiVersion[]{V4, V5}, testSubject.versions().toArray()); + assertArrayEquals(new MuiVersion[]{V4, V5, V6}, testSubject.versions().toArray()); } @Test void validate() { when(config.getRootCss("FormGroup")).thenReturn("MuiFormGroup-root"); - when(element.getAttribute("class")).thenReturn("MuiFormGroup-root"); + when(element.getDomAttribute("class")).thenReturn("MuiFormGroup-root"); assertTrue(testSubject.validate()); } @Test void validateFalse() { when(config.getRootCss("FormGroup")).thenReturn("MuiFormGroup-root"); - when(element.getAttribute("class")).thenReturn("MuiFormGroup-root-123"); + when(element.getDomAttribute("class")).thenReturn("MuiFormGroup-root-123"); assertFalse(testSubject.validate()); } diff --git a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiRadioTest.java b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiRadioTest.java index 9b86c5b3..b9b4213b 100644 --- a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiRadioTest.java +++ b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiRadioTest.java @@ -33,8 +33,7 @@ import org.openqa.selenium.By; import org.openqa.selenium.WebElement; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.*; import static org.junit.jupiter.api.Assertions.*; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; @@ -72,7 +71,7 @@ void getComponentName() { @Test void versions() { - assertArrayEquals(new MuiVersion[]{V4, V5}, testSubject.versions().toArray()); + assertArrayEquals(new MuiVersion[]{V4, V5, V6}, testSubject.versions().toArray()); } @Test diff --git a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiSelectTest.java b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiSelectTest.java index 0ed96b24..998f149b 100644 --- a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiSelectTest.java +++ b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiSelectTest.java @@ -44,8 +44,7 @@ import java.util.List; import java.util.function.Function; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.*; import static java.util.Arrays.asList; import static java.util.Collections.emptyList; import static java.util.Collections.singletonList; @@ -77,7 +76,7 @@ class MuiSelectTest { private WebComponent createOptions(String value, String label, boolean selected) { WebComponent option = mock(WebComponent.class); - when(option.getAttribute("attr-val")).thenReturn(value); + when(option.getDomAttribute("attr-val")).thenReturn(value); when(option.getText()).thenReturn(label); when(config.isSelected(option)).thenReturn(selected); doAnswer(a -> { @@ -146,7 +145,7 @@ void setUp() { return isTrueFunction.apply(driver); }); - when(optionContainer.getAttribute("class")).thenReturn("MuiPopover-root"); + when(optionContainer.getDomAttribute("class")).thenReturn("MuiPopover-root"); when(optionContainer.isDisplayed()).thenReturn(true); when(config.getOverlayAbsolutePath()).thenReturn("/html/body"); @@ -183,7 +182,7 @@ void getComponentName() { @Test void versions() { - assertArrayEquals(new MuiVersion[]{V4, V5}, testSubject.versions().toArray()); + assertArrayEquals(new MuiVersion[]{V4, V5, V6}, testSubject.versions().toArray()); } @Test diff --git a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiSliderTest.java b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiSliderTest.java index aa6cc3e9..765d99a4 100644 --- a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiSliderTest.java +++ b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiSliderTest.java @@ -127,12 +127,12 @@ void setUp() { when(element.findElements(sliderThumbLocator)).thenReturn(asList(thumb1, thumb2)); when(element.findElement(By2.attrExact("type", "hidden", "input"))).thenReturn(hiddenInput); when(element.getRect()).then(a -> new Rectangle(x, y, height, width)); - when(element.getAttribute("class")).then(a -> "MuiSlider-root MuiSlider-colorPrimary"); - when(hiddenInput.getAttribute("value")).then(a -> rawValue1); + when(element.getDomAttribute("class")).then(a -> "MuiSlider-root MuiSlider-colorPrimary"); + when(hiddenInput.getDomAttribute("value")).then(a -> rawValue1); - when(thumb1.getAttribute("aria-valuemin")).then(a -> minValue.toString()); - when(thumb1.getAttribute("aria-valuemax")).then(a -> maxValue.toString()); - when(thumb1.getAttribute("aria-valuenow")).then(a -> rawValue1); + when(thumb1.getDomAttribute("aria-valuemin")).then(a -> minValue.toString()); + when(thumb1.getDomAttribute("aria-valuemax")).then(a -> maxValue.toString()); + when(thumb1.getDomAttribute("aria-valuenow")).then(a -> rawValue1); when(thumb1.getRect()).then(a -> { double currentPercentage = (Double.parseDouble(rawValue1) - minValue) / (maxValue - minValue); @@ -149,9 +149,9 @@ void setUp() { return new Rectangle(thumbX, thumbY, thumbRadius << 1, thumbRadius << 1); }); - when(thumb2.getAttribute("aria-valuemin")).then(a -> minValue.toString()); - when(thumb2.getAttribute("aria-valuemax")).then(a -> maxValue.toString()); - when(thumb2.getAttribute("aria-valuenow")).then(a -> rawValue2); + when(thumb2.getDomAttribute("aria-valuemin")).then(a -> minValue.toString()); + when(thumb2.getDomAttribute("aria-valuemax")).then(a -> maxValue.toString()); + when(thumb2.getDomAttribute("aria-valuenow")).then(a -> rawValue2); when(thumb2.getRect()).then(a -> { double currentPercentage = (Double.parseDouble(rawValue2) - minValue) / (maxValue - minValue); @@ -243,25 +243,25 @@ void getFirstThumb() { @Test void isVertical() { - when(element.getAttribute("class")).then(a -> "MuiSlider-root MuiSlider-colorPrimary MuiSlider-vertical"); + when(element.getDomAttribute("class")).then(a -> "MuiSlider-root MuiSlider-colorPrimary MuiSlider-vertical"); assertTrue(testSubject.isVertical()); } @Test void isVerticalNegative() { - when(element.getAttribute("class")).then(a -> "MuiSlider-root MuiSlider-colorPrimary"); + when(element.getDomAttribute("class")).then(a -> "MuiSlider-root MuiSlider-colorPrimary"); assertFalse(testSubject.isVertical()); } @Test void isInverted() { - when(element.getAttribute("class")).then(a -> "MuiSlider-root MuiSlider-colorPrimary MuiSlider-trackInverted"); + when(element.getDomAttribute("class")).then(a -> "MuiSlider-root MuiSlider-colorPrimary MuiSlider-trackInverted"); assertTrue(testSubject.isInverted()); } @Test void isInvertedNegative() { - when(element.getAttribute("class")).then(a -> "MuiSlider-root MuiSlider-colorPrimary"); + when(element.getDomAttribute("class")).then(a -> "MuiSlider-root MuiSlider-colorPrimary"); assertFalse(testSubject.isInverted()); } diff --git a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiSliderThumbTest.java b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiSliderThumbTest.java index 2ef94ea7..66e8e94f 100644 --- a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiSliderThumbTest.java +++ b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiSliderThumbTest.java @@ -50,10 +50,10 @@ class MuiSliderThumbTest { @BeforeEach void setUp() { when(config.getCssPrefix()).thenReturn("Muiabc"); - when(element.getAttribute("aria-valuetext")).thenReturn("The value is 30"); - when(element.getAttribute("aria-valuemin")).thenReturn("20"); - when(element.getAttribute("aria-valuemax")).thenReturn("800"); - when(element.getAttribute("aria-valuenow")).thenReturn("30"); + when(element.getDomAttribute("aria-valuetext")).thenReturn("The value is 30"); + when(element.getDomAttribute("aria-valuemin")).thenReturn("20"); + when(element.getDomAttribute("aria-valuemax")).thenReturn("800"); + when(element.getDomAttribute("aria-valuenow")).thenReturn("30"); testSubject = new MuiSliderThumb(element, driver, config); } @@ -70,21 +70,21 @@ void validate() { @Test void getPercentageHorizontal() { - when(element.getAttribute("aria-orientation")).thenReturn("horizontal"); + when(element.getDomAttribute("aria-orientation")).thenReturn("horizontal"); when(element.getCssValue("left")).thenReturn("30%"); assertEquals("30%", testSubject.getPercentage()); } @Test void getPercentageVertical() { - when(element.getAttribute("aria-orientation")).thenReturn("vertical"); + when(element.getDomAttribute("aria-orientation")).thenReturn("vertical"); when(element.getCssValue("bottom")).thenReturn("30%"); assertEquals("30%", testSubject.getPercentage()); } @Test void getPercentageInvalid() { - when(element.getAttribute("orientation")).thenReturn("333"); + when(element.getDomAttribute("orientation")).thenReturn("333"); assertThrows(IllegalStateException.class, () -> testSubject.getPercentage()); } diff --git a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiTextFieldTest.java b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiTextFieldTest.java index c6ce7320..df03be55 100644 --- a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiTextFieldTest.java +++ b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/inputs/MuiTextFieldTest.java @@ -32,8 +32,7 @@ import org.junit.jupiter.api.Test; import org.openqa.selenium.WebElement; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.*; import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.*; @@ -69,7 +68,7 @@ void getComponentName() { @Test void versions() { - assertArrayEquals(new MuiVersion[]{V4, V5}, testSubject.versions().toArray()); + assertArrayEquals(new MuiVersion[]{V4, V5, V6}, testSubject.versions().toArray()); } @Test diff --git a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/lab/MuiAutocompleteTagTest.java b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/lab/MuiAutocompleteTagTest.java index 3224eb1d..d328b5f3 100644 --- a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/lab/MuiAutocompleteTagTest.java +++ b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/lab/MuiAutocompleteTagTest.java @@ -33,8 +33,7 @@ import org.openqa.selenium.By; import org.openqa.selenium.WebElement; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.*; import static org.junit.jupiter.api.Assertions.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.mock; @@ -74,7 +73,7 @@ void constructor1() { @Test void versions() { - assertArrayEquals(new MuiVersion[]{V4, V5}, testSubject.versions().toArray()); + assertArrayEquals(new MuiVersion[]{V4, V5, V6}, testSubject.versions().toArray()); } @Test diff --git a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/lab/MuiAutocompleteTest.java b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/lab/MuiAutocompleteTest.java index 88d35e73..512e9b6e 100644 --- a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/lab/MuiAutocompleteTest.java +++ b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/lab/MuiAutocompleteTest.java @@ -42,8 +42,7 @@ import java.util.List; import java.util.function.Function; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.*; import static com.google.common.collect.Lists.newArrayList; import static java.util.Collections.emptyList; import static java.util.Collections.singletonList; @@ -89,7 +88,7 @@ private WebComponent createOption(String text) { private WebElement createTag(String text) { WebElement tag = mock(WebElement.class); when(tag.getText()).thenReturn(text); - when(tag.getAttribute("value")).thenReturn("value " + text); + when(tag.getDomAttribute("value")).thenReturn("value " + text); WebElement deleteButton = mock(WebElement.class); when(tag.findElement(By.className("deleteButton"))).thenReturn(deleteButton); doAnswer(answer -> { @@ -118,7 +117,7 @@ void setUp() { when(inputElement.findElements(By.className("MuiAutocomplete-tag"))).thenReturn(visibleTags); when(tagLocators.getLabelFinder()).thenReturn(WebElement::getText); - when(tagLocators.getValueFinder()).thenReturn(element -> element.getAttribute("value")); + when(tagLocators.getValueFinder()).thenReturn(element -> element.getDomAttribute("value")); when(tagLocators.getDeleteButtonLocator()).thenReturn(By.className("deleteButton")); when(driver.findComponents(By.xpath("/html/body/some/app/div"))).thenReturn(singletonList(overlay)); @@ -129,7 +128,7 @@ void setUp() { }); when(overlay.isDisplayed()).thenReturn(true); - when(overlay.getAttribute("class")).thenReturn("MuiAutocomplete-popper some-other-class"); + when(overlay.getDomAttribute("class")).thenReturn("MuiAutocomplete-popper some-other-class"); when(overlay.findComponents(optionLocator)).thenReturn(options); testSubject = new MuiAutocomplete(element, driver, config, optionLocator, tagLocators, openOptionsAction, @@ -167,7 +166,7 @@ void getComponentName() { @Test void versions() { - assertArrayEquals(new MuiVersion[]{V4, V5}, testSubject.versions().toArray()); + assertArrayEquals(new MuiVersion[]{V4, V5, V6}, testSubject.versions().toArray()); } @Test @@ -185,13 +184,13 @@ void isEnabledFalse() { @Test void isReadOnly() { - when(inputElement.getAttribute("readonly")).thenReturn("true"); + when(inputElement.getDomAttribute("readonly")).thenReturn("true"); assertTrue(testSubject.isReadOnly()); } @Test void isReadOnlyNegative() { - when(inputElement.getAttribute("readonly")).thenReturn("false"); + when(inputElement.getDomAttribute("readonly")).thenReturn("false"); assertFalse(testSubject.isReadOnly()); } diff --git a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/lab/MuiPaginationTest.java b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/lab/MuiPaginationTest.java index eaa0273d..d07438e4 100644 --- a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/lab/MuiPaginationTest.java +++ b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/lab/MuiPaginationTest.java @@ -38,8 +38,7 @@ import java.util.List; import java.util.function.Function; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.*; import static com.google.common.collect.Lists.newArrayList; import static java.util.Collections.emptyList; import static java.util.Collections.singletonList; @@ -143,7 +142,7 @@ void getComponentName() { @Test void versions() { - assertArrayEquals(new MuiVersion[]{V4, V5}, testSubject.versions().toArray()); + assertArrayEquals(new MuiVersion[]{V4, V5, V6}, testSubject.versions().toArray()); } @Test diff --git a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/locator/MuiModalFinderTest.java b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/locator/MuiModalFinderTest.java index 0320cf67..be6a9800 100644 --- a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/locator/MuiModalFinderTest.java +++ b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/locator/MuiModalFinderTest.java @@ -71,7 +71,7 @@ void setUp() { WebComponent createMockOverlay(String classes, boolean isDisplayed) { WebComponent overlay = mock(WebComponent.class); when(overlay.isDisplayed()).thenReturn(isDisplayed); - when(overlay.getAttribute("class")).thenReturn(classes); + when(overlay.getDomAttribute("class")).thenReturn(classes); return overlay; } @@ -99,7 +99,7 @@ void findVisibleOverlaysByComponentName() { void findTopVisibleOverlay() { WebComponent component = testSubject.findTopVisibleOverlay(); assertNotNull(component); - assertEquals("MuiDrawer-root", component.getAttribute("class")); + assertEquals("MuiDrawer-root", component.getDomAttribute("class")); } @Test @@ -113,7 +113,7 @@ void findTopVisibleOverlayNotExists() { void findTopVisibleOverlayByComponentName() { WebComponent component = testSubject.findTopVisibleOverlay("Popover"); assertNotNull(component); - assertEquals("MuiPopover-root", component.getAttribute("class")); + assertEquals("MuiPopover-root", component.getDomAttribute("class")); } @Test diff --git a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiAccordionActionsTest.java b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiAccordionActionsTest.java index acb84655..8d104a2c 100644 --- a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiAccordionActionsTest.java +++ b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiAccordionActionsTest.java @@ -31,8 +31,7 @@ import org.junit.jupiter.api.Test; import org.openqa.selenium.WebElement; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.*; import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.*; @@ -57,7 +56,7 @@ void setUp() { @Test void versions() { - assertArrayEquals(new MuiVersion[]{V4, V5}, testSubject.versions().toArray()); + assertArrayEquals(new MuiVersion[]{V4, V5, V6}, testSubject.versions().toArray()); } @Test diff --git a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiAccordionDetailsTest.java b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiAccordionDetailsTest.java index 8aa17038..8c2747f4 100644 --- a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiAccordionDetailsTest.java +++ b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiAccordionDetailsTest.java @@ -31,8 +31,7 @@ import org.junit.jupiter.api.Test; import org.openqa.selenium.WebElement; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.*; import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.*; @@ -56,7 +55,7 @@ void setUp() { @Test void versions() { - assertArrayEquals(new MuiVersion[]{V4, V5}, testSubject.versions().toArray()); + assertArrayEquals(new MuiVersion[]{V4, V5, V6}, testSubject.versions().toArray()); } @Test diff --git a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiAccordionSummaryTest.java b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiAccordionSummaryTest.java index 9c1c0d7a..7d64272a 100644 --- a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiAccordionSummaryTest.java +++ b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiAccordionSummaryTest.java @@ -32,8 +32,7 @@ import org.openqa.selenium.By; import org.openqa.selenium.WebElement; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.*; import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -59,7 +58,7 @@ void setUp() { @Test void versions() { - assertArrayEquals(new MuiVersion[]{V4, V5}, testSubject.versions().toArray()); + assertArrayEquals(new MuiVersion[]{V4, V5, V6}, testSubject.versions().toArray()); } @Test @@ -69,25 +68,25 @@ void getComponentName() { @Test void isExpandTrue() { - when(element.getAttribute("aria-expanded")).thenReturn("true"); + when(element.getDomAttribute("aria-expanded")).thenReturn("true"); assertTrue(testSubject.isExpand()); } @Test void isExpandTrueUpper() { - when(element.getAttribute("aria-expanded")).thenReturn("TRUE"); + when(element.getDomAttribute("aria-expanded")).thenReturn("TRUE"); assertTrue(testSubject.isExpand()); } @Test void isExpandFalse() { - when(element.getAttribute("aria-expanded")).thenReturn("false"); + when(element.getDomAttribute("aria-expanded")).thenReturn("false"); assertFalse(testSubject.isExpand()); } @Test void isExpandFalse2() { - when(element.getAttribute("aria-expanded")).thenReturn("false"); + when(element.getDomAttribute("aria-expanded")).thenReturn("false"); assertFalse(testSubject.isExpand()); } diff --git a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiAccordionTest.java b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiAccordionTest.java index 86421381..e0128fda 100644 --- a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiAccordionTest.java +++ b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiAccordionTest.java @@ -32,8 +32,7 @@ import org.openqa.selenium.By; import org.openqa.selenium.WebElement; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.*; import static com.google.common.collect.Lists.newArrayList; import static java.util.Objects.requireNonNull; import static org.junit.jupiter.api.Assertions.*; @@ -64,7 +63,7 @@ void setUp() { @Test void versions() { - assertArrayEquals(new MuiVersion[]{V4, V5}, testSubject.versions().toArray()); + assertArrayEquals(new MuiVersion[]{V4, V5, V6}, testSubject.versions().toArray()); } @Test @@ -107,7 +106,7 @@ void getAccordionActionsNull() { void isExpand() { WebElement accordionSummary = mock(WebElement.class); when(element.findElements(By.className("MuiAccordionSummary-root"))).thenReturn(newArrayList(accordionSummary)); - when(accordionSummary.getAttribute("aria-expanded")).thenReturn("true"); + when(accordionSummary.getDomAttribute("aria-expanded")).thenReturn("true"); assertTrue(testSubject.isExpand()); } @@ -120,7 +119,7 @@ void isExpandFalse() { void isExpandFalse2() { WebElement accordionSummary = mock(WebElement.class); when(element.findElements(By.className("MuiAccordionSummary-root"))).thenReturn(newArrayList(accordionSummary)); - when(accordionSummary.getAttribute("aria-expanded")).thenReturn("false"); + when(accordionSummary.getDomAttribute("aria-expanded")).thenReturn("false"); assertFalse(testSubject.isExpand()); } @@ -142,13 +141,13 @@ void expandFallback() { @Test void isEnabled() { - when(element.getAttribute("class")).thenReturn("vbb Mui- ccc"); + when(element.getDomAttribute("class")).thenReturn("vbb Mui- ccc"); assertTrue(testSubject.isEnabled()); } @Test void isEnabledFalse() { - when(element.getAttribute("class")).thenReturn("vbb Mui-disabled ccc"); + when(element.getDomAttribute("class")).thenReturn("vbb Mui-disabled ccc"); assertFalse(testSubject.isEnabled()); } diff --git a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiBottomNavigationActionTest.java b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiBottomNavigationActionTest.java index f042ca31..755f3233 100644 --- a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiBottomNavigationActionTest.java +++ b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiBottomNavigationActionTest.java @@ -31,8 +31,7 @@ import org.junit.jupiter.api.Test; import org.openqa.selenium.WebElement; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.*; import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -57,7 +56,7 @@ void setUp() { @Test void versions() { - assertArrayEquals(new MuiVersion[]{V4, V5}, testSubject.versions().toArray()); + assertArrayEquals(new MuiVersion[]{V4, V5, V6}, testSubject.versions().toArray()); } @Test diff --git a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiBottomNavigationTest.java b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiBottomNavigationTest.java index 70502593..ed802dbe 100644 --- a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiBottomNavigationTest.java +++ b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiBottomNavigationTest.java @@ -34,8 +34,7 @@ import java.util.List; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.*; import static java.util.Arrays.asList; import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.*; @@ -60,7 +59,7 @@ void setUp() { @Test void versions() { - assertArrayEquals(new MuiVersion[]{V4, V5}, testSubject.versions().toArray()); + assertArrayEquals(new MuiVersion[]{V4, V5, V6}, testSubject.versions().toArray()); } @Test diff --git a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiBreadcrumbsTest.java b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiBreadcrumbsTest.java index d52666a5..dc09f850 100644 --- a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiBreadcrumbsTest.java +++ b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiBreadcrumbsTest.java @@ -37,8 +37,7 @@ import java.util.ArrayList; import java.util.List; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.*; import static java.util.Arrays.asList; import static java.util.Collections.singletonList; import static org.junit.jupiter.api.Assertions.*; @@ -90,7 +89,7 @@ void setUp() { @Test void versions() { - assertArrayEquals(new MuiVersion[]{V4, V5}, testSubject.versions().toArray()); + assertArrayEquals(new MuiVersion[]{V4, V5, V6}, testSubject.versions().toArray()); } @Test @@ -113,7 +112,7 @@ void getItems() { @Test void isCollapsed() { - when(element.findElements(By.className("MuiTouchRipple-root"))).thenReturn(singletonList(touchRipple)); + when(element.findElements(By2.attrExact("data-testid", "MoreHorizIcon"))).thenReturn(singletonList(touchRipple)); assertTrue(testSubject.isCollapsed()); } @@ -124,7 +123,7 @@ void isCollapsedNegative() { @Test void expand() { - when(element.findElements(By.className("MuiTouchRipple-root"))).thenReturn(singletonList(touchRipple)); + when(element.findElements(By2.attrExact("data-testid", "MoreHorizIcon"))).thenReturn(singletonList(touchRipple)); testSubject.expand(); verify(touchRippleParent, only()).click(); } diff --git a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiLinkTest.java b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiLinkTest.java index 60bde751..1f0d1760 100644 --- a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiLinkTest.java +++ b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiLinkTest.java @@ -31,8 +31,7 @@ import org.junit.jupiter.api.Test; import org.openqa.selenium.WebElement; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.*; import static org.junit.jupiter.api.Assertions.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.mock; @@ -58,7 +57,7 @@ void setUp() { @Test void versions() { - assertArrayEquals(new MuiVersion[]{V4, V5}, testSubject.versions().toArray()); + assertArrayEquals(new MuiVersion[]{V4, V5, V6}, testSubject.versions().toArray()); } @Test @@ -68,7 +67,7 @@ void getComponentName() { @Test void getHref() { - when(element.getAttribute("href")).thenReturn("abc"); + when(element.getDomAttribute("href")).thenReturn("abc"); assertEquals("abc", testSubject.getHref()); } diff --git a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiMenuItemTest.java b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiMenuItemTest.java index bcb18662..14ddc822 100644 --- a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiMenuItemTest.java +++ b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiMenuItemTest.java @@ -31,8 +31,7 @@ import org.junit.jupiter.api.Test; import org.openqa.selenium.WebElement; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.*; import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.*; @@ -56,7 +55,7 @@ void setUp() { @Test void versions() { - assertArrayEquals(new MuiVersion[]{V4, V5}, testSubject.versions().toArray()); + assertArrayEquals(new MuiVersion[]{V4, V5, V6}, testSubject.versions().toArray()); } @Test diff --git a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiMenuTest.java b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiMenuTest.java index d84ab70d..4771cb60 100644 --- a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiMenuTest.java +++ b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiMenuTest.java @@ -32,8 +32,7 @@ import org.openqa.selenium.By; import org.openqa.selenium.WebElement; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.*; import static java.util.Collections.singletonList; import static org.junit.jupiter.api.Assertions.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -61,7 +60,7 @@ void setUp() { @Test void versions() { - assertArrayEquals(new MuiVersion[]{V4, V5}, testSubject.versions().toArray()); + assertArrayEquals(new MuiVersion[]{V4, V5, V6}, testSubject.versions().toArray()); } @Test diff --git a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiTabScrollButtonTest.java b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiTabScrollButtonTest.java index a79b5f33..5e1cd0c7 100644 --- a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiTabScrollButtonTest.java +++ b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiTabScrollButtonTest.java @@ -31,8 +31,7 @@ import org.junit.jupiter.api.Test; import org.openqa.selenium.WebElement; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.*; import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.*; @@ -56,7 +55,7 @@ void setUp() { @Test void versions() { - assertArrayEquals(new MuiVersion[]{V4, V5}, testSubject.versions().toArray()); + assertArrayEquals(new MuiVersion[]{V4, V5, V6}, testSubject.versions().toArray()); } @Test diff --git a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiTabTest.java b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiTabTest.java index f91e5b13..bb608c1d 100644 --- a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiTabTest.java +++ b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiTabTest.java @@ -31,8 +31,7 @@ import org.junit.jupiter.api.Test; import org.openqa.selenium.WebElement; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.*; import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.*; @@ -56,7 +55,7 @@ void setUp() { @Test void versions() { - assertArrayEquals(new MuiVersion[]{V4, V5}, testSubject.versions().toArray()); + assertArrayEquals(new MuiVersion[]{V4, V5, V6}, testSubject.versions().toArray()); } @Test diff --git a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiTabsTest.java b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiTabsTest.java index 80cf39fd..2dee8a1f 100644 --- a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiTabsTest.java +++ b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/navigation/MuiTabsTest.java @@ -36,8 +36,7 @@ import java.util.List; import java.util.Optional; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.*; import static com.google.common.collect.Lists.newArrayList; import static java.util.Arrays.asList; import static org.junit.jupiter.api.Assertions.*; @@ -65,7 +64,7 @@ void setUp() { @Test void versions() { - assertArrayEquals(new MuiVersion[]{V4, V5}, testSubject.versions().toArray()); + assertArrayEquals(new MuiVersion[]{V4, V5, V6}, testSubject.versions().toArray()); } @Test @@ -137,14 +136,14 @@ void getNextScrollButtonNotPresent() { @Test void isVertical() { when(config.getCssPrefix()).thenReturn("Mui"); - when(element.getAttribute("class")).thenReturn("MuiTabs-vertical MuiTabs-other"); + when(element.getDomAttribute("class")).thenReturn("MuiTabs-vertical MuiTabs-other"); assertTrue(testSubject.isVertical()); } @Test void isVerticalNegative() { when(config.getCssPrefix()).thenReturn("Mui"); - when(element.getAttribute("class")).thenReturn("MuiTabs-some MuiTabs-other"); + when(element.getDomAttribute("class")).thenReturn("MuiTabs-some MuiTabs-other"); assertFalse(testSubject.isVertical()); } diff --git a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/pickers/MuiPickersCalendarTransitionContainerTest.java b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/pickers/MuiPickersCalendarTransitionContainerTest.java index caa794b6..f7403fc7 100644 --- a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/pickers/MuiPickersCalendarTransitionContainerTest.java +++ b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/pickers/MuiPickersCalendarTransitionContainerTest.java @@ -65,7 +65,7 @@ void setUp() { when(element.findElements(By.className("eee" + MuiPickersDay.NAME))) .thenReturn(newArrayList(pickersDay1, pickersDay2, pickersDay3, pickersDay4, pickersDay5)); - Consumer mockFunc = element -> when(element.getAttribute("class")) + Consumer mockFunc = element -> when(element.getDomAttribute("class")) .thenReturn("eeePickersDay-daySelectedabc"); mockFunc.accept(pickersDay1); @@ -90,7 +90,7 @@ void getDayList() { @Test void getSelectedDay() { - when(pickersDay3.getAttribute("class")).thenReturn("eeePickersDay-daySelected"); + when(pickersDay3.getDomAttribute("class")).thenReturn("eeePickersDay-daySelected"); assertEquals(pickersDay3, requireNonNull(testSubject.getSelectedDay()).getWrappedElement()); } diff --git a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/pickers/MuiPickersDayTest.java b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/pickers/MuiPickersDayTest.java index f8f0db4b..051aa046 100644 --- a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/pickers/MuiPickersDayTest.java +++ b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/pickers/MuiPickersDayTest.java @@ -74,13 +74,13 @@ void validateFalse() { @Test void isSelected() { - when(element.getAttribute("class")).thenReturn("dddPickersDay-daySelected"); + when(element.getDomAttribute("class")).thenReturn("dddPickersDay-daySelected"); assertTrue(testSubject.isSelected()); } @Test void isSelectedFalse() { - when(element.getAttribute("class")).thenReturn("dddPickersDay-daySelectedfff"); + when(element.getDomAttribute("class")).thenReturn("dddPickersDay-daySelectedfff"); assertFalse(testSubject.isSelected()); } diff --git a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/pickers/MuiPickersYearSelectionContainerTest.java b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/pickers/MuiPickersYearSelectionContainerTest.java index 5234c5e6..422fdaa0 100644 --- a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/pickers/MuiPickersYearSelectionContainerTest.java +++ b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/pickers/MuiPickersYearSelectionContainerTest.java @@ -63,10 +63,10 @@ void setUp() { when(element.findElements(By.className("MuiPickersYear-root"))) .thenReturn(newArrayList(year1, year2, year3, year4)); - when(year1.getAttribute("class")).thenReturn("MuiPickersYear-dd"); - when(year2.getAttribute("class")).thenReturn("MuiPickersYear-dd"); - when(year3.getAttribute("class")).thenReturn("MuiPickersYear-dd"); - when(year4.getAttribute("class")).thenReturn("MuiPickersYear-dd"); + when(year1.getDomAttribute("class")).thenReturn("MuiPickersYear-dd"); + when(year2.getDomAttribute("class")).thenReturn("MuiPickersYear-dd"); + when(year3.getDomAttribute("class")).thenReturn("MuiPickersYear-dd"); + when(year4.getDomAttribute("class")).thenReturn("MuiPickersYear-dd"); testSubject = new MuiPickersYearSelectionContainer(element, driver, config); } @@ -83,7 +83,7 @@ void getYearList() { @Test void getSelectedYear() { - when(year4.getAttribute("class")).thenReturn("MuiPickersYear-yearSelected"); + when(year4.getDomAttribute("class")).thenReturn("MuiPickersYear-yearSelected"); assertEquals(year4, requireNonNull(testSubject.getSelectedYear()).getWrappedElement()); } diff --git a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/pickers/MuiPickersYearTest.java b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/pickers/MuiPickersYearTest.java index 3c87431c..431d560c 100644 --- a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/pickers/MuiPickersYearTest.java +++ b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/pickers/MuiPickersYearTest.java @@ -60,7 +60,7 @@ void getComponentName() { @Test void isSelected() { when(config.getCssPrefix()).thenReturn("Mui"); - when(element.getAttribute("class")).thenReturn("MuiPickersYear-yearSelected"); + when(element.getDomAttribute("class")).thenReturn("MuiPickersYear-yearSelected"); assertTrue(testSubject.isSelected()); verify(config, times(1)).getCssPrefix(); } @@ -68,7 +68,7 @@ void isSelected() { @Test void isSelectedFalse() { when(config.getCssPrefix()).thenReturn("Mui"); - when(element.getAttribute("class")).thenReturn("MuiPickersYear-ddd"); + when(element.getDomAttribute("class")).thenReturn("MuiPickersYear-ddd"); assertFalse(testSubject.isSelected()); verify(config, times(1)).getCssPrefix(); } diff --git a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/surfaces/MuiAppBarTest.java b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/surfaces/MuiAppBarTest.java index 6c23e812..5f3c8fa7 100644 --- a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/surfaces/MuiAppBarTest.java +++ b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/surfaces/MuiAppBarTest.java @@ -31,8 +31,7 @@ import org.junit.jupiter.api.Test; import org.openqa.selenium.WebElement; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.*; import static org.junit.jupiter.api.Assertions.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.mock; @@ -58,7 +57,7 @@ void setUp() { @Test void versions() { - assertArrayEquals(new MuiVersion[]{V4, V5}, testSubject.versions().toArray()); + assertArrayEquals(new MuiVersion[]{V4, V5, V6}, testSubject.versions().toArray()); } @Test diff --git a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/surfaces/MuiToolbarTest.java b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/surfaces/MuiToolbarTest.java index 2ed6d83e..afd6471b 100644 --- a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/surfaces/MuiToolbarTest.java +++ b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v4/surfaces/MuiToolbarTest.java @@ -31,8 +31,7 @@ import org.junit.jupiter.api.Test; import org.openqa.selenium.WebElement; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V4; -import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.*; import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.*; @@ -56,7 +55,7 @@ void setUp() { @Test void versions() { - assertArrayEquals(new MuiVersion[]{V4, V5}, testSubject.versions().toArray()); + assertArrayEquals(new MuiVersion[]{V4, V5, V6}, testSubject.versions().toArray()); } @Test diff --git a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v5/datetime/sub/MuiPickersDayTest.java b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v5/datetime/sub/MuiPickersDayTest.java index 0ede8f86..5641512b 100644 --- a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v5/datetime/sub/MuiPickersDayTest.java +++ b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v5/datetime/sub/MuiPickersDayTest.java @@ -66,7 +66,7 @@ void getComponentName() { @Test void getDateLabel() { - when(element.getAttribute("aria-label")).thenReturn("Oct 13, 2021"); + when(element.getDomAttribute("aria-label")).thenReturn("Oct 13, 2021"); assertEquals("Oct 13, 2021", testSubject.getDateLabel()); } diff --git a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v5/inputs/MuiCheckboxV5Test.java b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v5/inputs/MuiCheckboxV5Test.java index a662fa5d..eab0bb07 100644 --- a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v5/inputs/MuiCheckboxV5Test.java +++ b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v5/inputs/MuiCheckboxV5Test.java @@ -32,6 +32,7 @@ import org.openqa.selenium.WebElement; import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.V6; import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -58,18 +59,18 @@ void setUp() { @Test void versions() { - assertArrayEquals(new MuiVersion[]{V5}, testSubject.versions().toArray()); + assertArrayEquals(new MuiVersion[]{V5, V6}, testSubject.versions().toArray()); } @Test void isIndeterminate() { - when(element.getAttribute("class")).thenReturn("MuiCheckbox-indeterminate"); + when(element.getDomAttribute("class")).thenReturn("MuiCheckbox-indeterminate"); assertTrue(testSubject.isIndeterminate()); } @Test void isIndeterminateFalse() { - when(element.getAttribute("class")).thenReturn("MuiCheckbox-indeterminate-123"); + when(element.getDomAttribute("class")).thenReturn("MuiCheckbox-indeterminate-123"); assertFalse(testSubject.isIndeterminate()); } diff --git a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v5/inputs/MuiSliderThumbV5Test.java b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v5/inputs/MuiSliderThumbV5Test.java index 0b2883a1..545cee44 100644 --- a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v5/inputs/MuiSliderThumbV5Test.java +++ b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v5/inputs/MuiSliderThumbV5Test.java @@ -33,6 +33,7 @@ import org.openqa.selenium.WebElement; import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.V6; import static org.junit.jupiter.api.Assertions.assertArrayEquals; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.mock; @@ -57,17 +58,17 @@ class MuiSliderThumbV5Test { void setUp() { when(config.getCssPrefix()).thenReturn("Muiabc"); when(element.findElement(By.xpath("./child::input"))).thenReturn(inputElement); - when(inputElement.getAttribute("aria-orientation")).thenReturn("horizontal"); - when(inputElement.getAttribute("aria-valuetext")).thenReturn("The value is 30"); - when(inputElement.getAttribute("aria-valuemin")).thenReturn("20"); - when(inputElement.getAttribute("aria-valuemax")).thenReturn("800"); - when(inputElement.getAttribute("aria-valuenow")).thenReturn("30"); + when(inputElement.getDomAttribute("aria-orientation")).thenReturn("horizontal"); + when(inputElement.getDomAttribute("aria-valuetext")).thenReturn("The value is 30"); + when(inputElement.getDomAttribute("aria-valuemin")).thenReturn("20"); + when(inputElement.getDomAttribute("aria-valuemax")).thenReturn("800"); + when(inputElement.getDomAttribute("aria-valuenow")).thenReturn("30"); testSubject = new MuiSliderThumbV5(element, driver, config); } @Test void versions() { - assertArrayEquals(new MuiVersion[]{V5}, testSubject.versions().toArray()); + assertArrayEquals(new MuiVersion[]{V5, V6}, testSubject.versions().toArray()); } @Test diff --git a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v5/inputs/MuiSliderV5Test.java b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v5/inputs/MuiSliderV5Test.java index 62d23bc1..9e7a49e1 100644 --- a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v5/inputs/MuiSliderV5Test.java +++ b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v5/inputs/MuiSliderV5Test.java @@ -32,6 +32,7 @@ import org.openqa.selenium.WebElement; import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.V6; import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -56,7 +57,7 @@ void setUp() { @Test void versions() { - assertArrayEquals(new MuiVersion[]{V5}, testSubject.versions().toArray()); + assertArrayEquals(new MuiVersion[]{V5, V6}, testSubject.versions().toArray()); } @Test diff --git a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v5/inputs/MuiSwitchV5Test.java b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v5/inputs/MuiSwitchV5Test.java index d8adb7fa..33cf6094 100644 --- a/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v5/inputs/MuiSwitchV5Test.java +++ b/hamster-selenium-component-materialui/src/test/java/com/github/grossopa/selenium/component/mui/v5/inputs/MuiSwitchV5Test.java @@ -33,6 +33,7 @@ import org.openqa.selenium.WebElement; import static com.github.grossopa.selenium.component.mui.MuiVersion.V5; +import static com.github.grossopa.selenium.component.mui.MuiVersion.V6; import static org.junit.jupiter.api.Assertions.*; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.mock; @@ -62,7 +63,7 @@ void setUp() { @Test void versions() { - assertArrayEquals(new MuiVersion[]{V5}, testSubject.versions().toArray()); + assertArrayEquals(new MuiVersion[]{V5, V6}, testSubject.versions().toArray()); } @Test diff --git a/hamster-selenium-core/src/main/java/com/github/grossopa/selenium/core/component/DefaultWebComponent.java b/hamster-selenium-core/src/main/java/com/github/grossopa/selenium/core/component/DefaultWebComponent.java index c0887dcd..b77e18b2 100644 --- a/hamster-selenium-core/src/main/java/com/github/grossopa/selenium/core/component/DefaultWebComponent.java +++ b/hamster-selenium-core/src/main/java/com/github/grossopa/selenium/core/component/DefaultWebComponent.java @@ -128,7 +128,7 @@ public boolean isFocused() { @Override public String outerHTML() { - return element.getAttribute("outerHTML"); + return element.getDomAttribute("outerHTML"); } @Override diff --git a/hamster-selenium-core/src/main/java/com/github/grossopa/selenium/core/component/api/DelayedSelect.java b/hamster-selenium-core/src/main/java/com/github/grossopa/selenium/core/component/api/DelayedSelect.java index 725477f4..17fc9f82 100644 --- a/hamster-selenium-core/src/main/java/com/github/grossopa/selenium/core/component/api/DelayedSelect.java +++ b/hamster-selenium-core/src/main/java/com/github/grossopa/selenium/core/component/api/DelayedSelect.java @@ -84,6 +84,15 @@ public interface DelayedSelect { */ void selectByVisibleText(String text, Long delayInMillis); + + /** + * Selects the option by visible text with delays + * + * @param text the text to be found + * @param delayInMillis the delay in milliseconds + */ + void selectByContainsVisibleText(String text, Long delayInMillis); + /** * Selects the option by option index with delays * @@ -127,8 +136,16 @@ public interface DelayedSelect { /** * Deselects the option by visible text and with delays * - * @param text the text of element ot be deselected + * @param text the text of element to be deselected * @param delayInMillis the delays in milliseconds */ void deselectByVisibleText(String text, Long delayInMillis); + + /** + * Deselects the option by visible text and with delays + * + * @param text the text of element to be deselected + * @param delayInMillis the delays in milliseconds + */ + void deSelectByContainsVisibleText(String text, Long delayInMillis); } diff --git a/hamster-selenium-core/src/main/java/com/github/grossopa/selenium/core/component/util/WebComponentUtils.java b/hamster-selenium-core/src/main/java/com/github/grossopa/selenium/core/component/util/WebComponentUtils.java index b26188db..6f6027cd 100644 --- a/hamster-selenium-core/src/main/java/com/github/grossopa/selenium/core/component/util/WebComponentUtils.java +++ b/hamster-selenium-core/src/main/java/com/github/grossopa/selenium/core/component/util/WebComponentUtils.java @@ -92,7 +92,7 @@ public static boolean attributeContains(WebElement element, String attributeName * @return true for found any matches */ public static boolean styleContains(WebElement element, String styleName, String styleValue) { - return stream(element.getAttribute("style").split(";")).map( + return stream(element.getDomAttribute("style").split(";")).map( str -> stream(str.split(":")).map(String::strip).collect(Collectors.joining(":"))) .anyMatch(str -> StringUtils.equalsIgnoreCase(str, styleName + ":" + styleValue)); } @@ -118,7 +118,7 @@ public static boolean styleContains(WebElement element, String styleName, String */ public static boolean attributeContains(WebElement element, String attributeName, String attributeValue, String splitRegex) { - String elementAttributeValue = element.getAttribute(attributeName); + String elementAttributeValue = element.getDomAttribute(attributeName); if (StringUtils.isBlank(elementAttributeValue)) { return false; } diff --git a/hamster-selenium-core/src/main/java/com/github/grossopa/selenium/core/intercepting/InterceptingMethods.java b/hamster-selenium-core/src/main/java/com/github/grossopa/selenium/core/intercepting/InterceptingMethods.java index 4161942b..0c24a694 100644 --- a/hamster-selenium-core/src/main/java/com/github/grossopa/selenium/core/intercepting/InterceptingMethods.java +++ b/hamster-selenium-core/src/main/java/com/github/grossopa/selenium/core/intercepting/InterceptingMethods.java @@ -75,12 +75,12 @@ private InterceptingMethods() { public static final String ELEMENT_GET_TAG_NAME = "element.getTagName"; /** - * Represents the {@link org.openqa.selenium.WebElement#getAttribute(String)} + * Represents the {@link org.openqa.selenium.WebElement#getDomAttribute(String)} */ public static final String ELEMENT_GET_ATTRIBUTE = "element.getAttribute"; /** - * Represents the {@link org.openqa.selenium.WebElement#getAttribute(String)} + * Represents the {@link org.openqa.selenium.WebElement#getDomAttribute(String)} */ public static final String ELEMENT_GET_DOM_ATTRIBUTE = "element.getAttribute"; diff --git a/hamster-selenium-core/src/main/java/com/github/grossopa/selenium/core/util/SeleniumUtils.java b/hamster-selenium-core/src/main/java/com/github/grossopa/selenium/core/util/SeleniumUtils.java index 992ec247..2c338022 100644 --- a/hamster-selenium-core/src/main/java/com/github/grossopa/selenium/core/util/SeleniumUtils.java +++ b/hamster-selenium-core/src/main/java/com/github/grossopa/selenium/core/util/SeleniumUtils.java @@ -104,7 +104,7 @@ public static boolean isNotDisplayed(@Nullable WebElement element) { */ @SuppressWarnings("java:S6212") public static void cleanText(WebElement inputElement) { - String text = inputElement.getAttribute("value"); + String text = inputElement.getDomAttribute("value"); for (int i = 0; i < text.length(); i++) { inputElement.sendKeys(BACK_SPACE); } @@ -263,7 +263,7 @@ private static String findTextNodeText(Map map) { * @return true if the value is not blank and not false */ public static boolean isTrueAttribute(WebElement element, String attributeName) { - String value = element.getAttribute(attributeName); + String value = element.getDomAttribute(attributeName); return !("false".equalsIgnoreCase(value) || isBlank(value)); } diff --git a/hamster-selenium-core/src/test/java/com/github/grossopa/selenium/core/component/AbstractDelegatedWebElementTest.java b/hamster-selenium-core/src/test/java/com/github/grossopa/selenium/core/component/AbstractDelegatedWebElementTest.java index 869ab8d6..9818c3bd 100644 --- a/hamster-selenium-core/src/test/java/com/github/grossopa/selenium/core/component/AbstractDelegatedWebElementTest.java +++ b/hamster-selenium-core/src/test/java/com/github/grossopa/selenium/core/component/AbstractDelegatedWebElementTest.java @@ -96,9 +96,9 @@ void getTagName() { } @Test - void getAttribute() { - when(element.getAttribute("attribute-1")).thenReturn("some-value"); - assertEquals("some-value", testSubject.getAttribute("attribute-1")); + void getDomAttribute() { + when(element.getDomAttribute("attribute-1")).thenReturn("some-value"); + assertEquals("some-value", testSubject.getDomAttribute("attribute-1")); } @Test @@ -228,8 +228,8 @@ void getShadowRoot() { } @Test - void getDomAttribute() { - when(element.getDomAttribute("some-attr")).thenReturn("some-value"); - assertEquals("some-value", testSubject.getDomAttribute("some-attr")); + void getAttribute() { + when(element.getAttribute("some-attr")).thenReturn("some-value"); + assertEquals("some-value", testSubject.getAttribute("some-attr")); } } diff --git a/hamster-selenium-core/src/test/java/com/github/grossopa/selenium/core/component/ComponentConfigTest.java b/hamster-selenium-core/src/test/java/com/github/grossopa/selenium/core/component/ComponentConfigTest.java index 6dde911c..6cbe9e4e 100644 --- a/hamster-selenium-core/src/test/java/com/github/grossopa/selenium/core/component/ComponentConfigTest.java +++ b/hamster-selenium-core/src/test/java/com/github/grossopa/selenium/core/component/ComponentConfigTest.java @@ -50,7 +50,7 @@ void setUp() { when(element.isEnabled()).thenReturn(true); when(component.getWrappedElement()).thenReturn(element); - when(component.getAttribute(CLASS)).thenReturn("prefix-selected prefix-checked prefix-disabled"); + when(component.getDomAttribute(CLASS)).thenReturn("prefix-selected prefix-checked prefix-disabled"); testSubject = new ComponentConfig() { @@ -90,19 +90,19 @@ void isDisabled2() { @Test void isCheckedFalse() { - when(component.getAttribute(CLASS)).thenReturn(""); + when(component.getDomAttribute(CLASS)).thenReturn(""); assertFalse(testSubject.isChecked(component)); } @Test void isSelectedFalse() { - when(component.getAttribute(CLASS)).thenReturn(""); + when(component.getDomAttribute(CLASS)).thenReturn(""); assertFalse(testSubject.isSelected(component)); } @Test void isDisabledFalse() { - when(component.getAttribute(CLASS)).thenReturn(""); + when(component.getDomAttribute(CLASS)).thenReturn(""); assertFalse(testSubject.isDisabled(component)); } diff --git a/hamster-selenium-core/src/test/java/com/github/grossopa/selenium/core/component/DefaultWebComponentTest.java b/hamster-selenium-core/src/test/java/com/github/grossopa/selenium/core/component/DefaultWebComponentTest.java index cfc6b7d7..5585aa92 100644 --- a/hamster-selenium-core/src/test/java/com/github/grossopa/selenium/core/component/DefaultWebComponentTest.java +++ b/hamster-selenium-core/src/test/java/com/github/grossopa/selenium/core/component/DefaultWebComponentTest.java @@ -97,9 +97,9 @@ void to() { @Test void attributeContains() { - when(element.getAttribute("aaa")).thenReturn("aaa bbb ccc"); + when(element.getDomAttribute("aaa")).thenReturn("aaa bbb ccc"); assertTrue(testSubject.attributeContains("aaa", "bbb")); - verify(element, only()).getAttribute("aaa"); + verify(element, only()).getDomAttribute("aaa"); } @Test @@ -151,7 +151,7 @@ void isFocusedFalse() { @Test void outerHTML() { - when(element.getAttribute("outerHTML")).thenReturn("some-outer-html"); + when(element.getDomAttribute("outerHTML")).thenReturn("some-outer-html"); assertEquals("some-outer-html", testSubject.outerHTML()); } @@ -191,7 +191,7 @@ void testToString() { @Test void styleContains() { - when(element.getAttribute("style")).thenReturn("display:block; background-color : black"); + when(element.getDomAttribute("style")).thenReturn("display:block; background-color : black"); assertTrue(testSubject.styleContains("background-color", "black")); assertFalse(testSubject.styleContains("background-color", "white")); } diff --git a/hamster-selenium-core/src/test/java/com/github/grossopa/selenium/core/component/util/WebComponentUtilsTest.java b/hamster-selenium-core/src/test/java/com/github/grossopa/selenium/core/component/util/WebComponentUtilsTest.java index 12fcb6b3..0627a56f 100644 --- a/hamster-selenium-core/src/test/java/com/github/grossopa/selenium/core/component/util/WebComponentUtilsTest.java +++ b/hamster-selenium-core/src/test/java/com/github/grossopa/selenium/core/component/util/WebComponentUtilsTest.java @@ -64,25 +64,25 @@ void constructor() { @Test void attributeContains() { - when(component.getAttribute("testAttributeName")).thenReturn("som1 some2 some-value some3"); + when(component.getDomAttribute("testAttributeName")).thenReturn("som1 some2 some-value some3"); assertTrue(WebComponentUtils.attributeContains(component, "testAttributeName", "some-value")); } @Test void attributeContainsNull() { - when(component.getAttribute("testAttributeName")).thenReturn(null); + when(component.getDomAttribute("testAttributeName")).thenReturn(null); assertFalse(WebComponentUtils.attributeContains(component, "testAttributeName", "some-value")); } @Test void attributeContainsNegative() { - when(component.getAttribute("testAttributeName")).thenReturn("som1 some2 some some3"); + when(component.getDomAttribute("testAttributeName")).thenReturn("som1 some2 some some3"); assertFalse(WebComponentUtils.attributeContains(component, "testAttributeName", "some-value")); } @Test void attributeContainsSplit() { - when(component.getAttribute("testAttributeName")).thenReturn("som1;some2;some-value;some3"); + when(component.getDomAttribute("testAttributeName")).thenReturn("som1;some2;some-value;some3"); assertTrue(WebComponentUtils.attributeContains(component, "testAttributeName", "some-value", ";")); } @@ -100,7 +100,7 @@ void getCenter() { @Test void styleContains() { WebElement element = mock(WebElement.class); - when(element.getAttribute("style")).thenReturn("display : block; width: 200px; height: 50% ; "); + when(element.getDomAttribute("style")).thenReturn("display : block; width: 200px; height: 50% ; "); assertTrue(WebComponentUtils.styleContains(element, "display", "block")); assertFalse(WebComponentUtils.styleContains(element, "display", "none")); assertFalse(WebComponentUtils.styleContains(element, "background-color", "white")); @@ -110,7 +110,7 @@ void styleContains() { @Test void styleContainsSimple() { WebElement element = mock(WebElement.class); - when(element.getAttribute("style")).thenReturn("display:block"); + when(element.getDomAttribute("style")).thenReturn("display:block"); assertTrue(WebComponentUtils.styleContains(element, "display", "block")); assertFalse(WebComponentUtils.styleContains(element, "display", "none")); } diff --git a/hamster-selenium-core/src/test/java/com/github/grossopa/selenium/core/util/SeleniumUtilsTest.java b/hamster-selenium-core/src/test/java/com/github/grossopa/selenium/core/util/SeleniumUtilsTest.java index 22ef007b..d1720949 100644 --- a/hamster-selenium-core/src/test/java/com/github/grossopa/selenium/core/util/SeleniumUtilsTest.java +++ b/hamster-selenium-core/src/test/java/com/github/grossopa/selenium/core/util/SeleniumUtilsTest.java @@ -94,7 +94,7 @@ void executeIgnoringStaleElementReferenceThrowOther() { @Test void cleanText() { WebElement element = mock(WebElement.class); - when(element.getAttribute("value")).thenReturn("aaaaaaaaaa"); + when(element.getDomAttribute("value")).thenReturn("aaaaaaaaaa"); SeleniumUtils.cleanText(element); verify(element, times(10)).sendKeys(BACK_SPACE); } @@ -102,7 +102,7 @@ void cleanText() { @Test void cleanTextEmpty() { WebElement element = mock(WebElement.class); - when(element.getAttribute("value")).thenReturn(""); + when(element.getDomAttribute("value")).thenReturn(""); SeleniumUtils.cleanText(element); verify(element, never()).sendKeys(BACK_SPACE); } @@ -366,19 +366,19 @@ void enrichQuoteDouble() { @Test void isTrueAttribute() { - when(element.getAttribute("readonly")).thenReturn("true"); + when(element.getDomAttribute("readonly")).thenReturn("true"); assertTrue(SeleniumUtils.isTrueAttribute(element, "readonly")); } @Test void isTrueAttributeNegative1() { - when(element.getAttribute("readonly")).thenReturn(null); + when(element.getDomAttribute("readonly")).thenReturn(null); assertFalse(SeleniumUtils.isTrueAttribute(element, "readonly")); } @Test void isTrueAttributeNegative2() { - when(element.getAttribute("readonly")).thenReturn("false"); + when(element.getDomAttribute("readonly")).thenReturn("false"); assertFalse(SeleniumUtils.isTrueAttribute(element, "readonly")); } } diff --git a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/StartDriverServiceMacEdge.java b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/StartDriverServiceMacEdge.java new file mode 100644 index 00000000..a4481724 --- /dev/null +++ b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/StartDriverServiceMacEdge.java @@ -0,0 +1,57 @@ +/* + * Copyright © 2021 the original author or authors. + * + * Licensed under the The MIT License (MIT) (the "License"); + * You may obtain a copy of the License at + * + * https://mit-license.org/ + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software + * and associated documentation files (the “Software”), to deal in the Software without + * restriction, including without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or + * substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING + * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package com.github.grossopa.selenium.examples; + +import com.github.grossopa.selenium.core.driver.CreateDriverServiceAction; +import com.github.grossopa.selenium.core.driver.DriverConfig; +import com.github.grossopa.selenium.core.driver.WebDriverType; +import org.openqa.selenium.remote.service.DriverService; + +import java.io.IOException; + +/** + * Main driver starter + * + * @author Jack Yin + * @since 1.0 + */ +public class StartDriverServiceMacEdge { + + public static final String EXECUTABLE_PATH = "/Users/jack/software/webdrivers/msedgedriver-131"; + + public static final int PORT = 38383; + + @SuppressWarnings("all") + public static void main(String[] args) throws IOException { + DriverConfig config = new DriverConfig(); + config.setDriverExecutablePath(EXECUTABLE_PATH); + config.setDriverVersion("111.0.1661.51"); + config.setType(WebDriverType.EDGE); + config.setPort(PORT); + + DriverService driverService = config.getType().apply(new CreateDriverServiceAction(), config); + driverService.start(); + } +} diff --git a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/helper/AbstractBrowserSupport.java b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/helper/AbstractBrowserSupport.java index f0a5ba26..1b6caa14 100644 --- a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/helper/AbstractBrowserSupport.java +++ b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/helper/AbstractBrowserSupport.java @@ -43,18 +43,19 @@ public abstract class AbstractBrowserSupport { public static final String EXECUTABLE_PATH = "D://software/drivers/chromedriver-84.exe"; - protected ComponentWebDriver driver; + protected static ComponentWebDriver driver; public void setUpDriver(WebDriverType type) { - DriverConfig config = new DriverConfig(); - config.setDriverExecutablePath(EXECUTABLE_PATH); - config.setDriverVersion("85"); - config.setType(type); - - Capabilities options = config.getType().apply(new CreateOptionsAction(), null); - WebDriver temp = config.getType().apply(new CreateWebDriverFromRunningServiceAction(), - new RunningServiceParams(options, "http://localhost:38383")); - - driver = new DefaultComponentWebDriver(new InterceptingWebDriver(temp, new LoggingHandler(0L))); + if (driver == null) { + DriverConfig config = new DriverConfig(); + config.setDriverExecutablePath(EXECUTABLE_PATH); + config.setDriverVersion("85"); + config.setType(type); + + Capabilities options = config.getType().apply(new CreateOptionsAction(), null); + WebDriver temp = config.getType().apply(new CreateWebDriverFromRunningServiceAction(), + new RunningServiceParams(options, "http://localhost:38383")); + driver = new DefaultComponentWebDriver(new InterceptingWebDriver(temp, new LoggingHandler(0L))); + } } } diff --git a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/locator/LocatorTestCases.java b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/locator/LocatorTestCases.java index 1584651f..26401dd9 100644 --- a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/locator/LocatorTestCases.java +++ b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/locator/LocatorTestCases.java @@ -49,13 +49,13 @@ public void testBy2Builder() { googleSearch = driver .findComponent(xpathBuilder().anywhere("input").attr("value").contains("oogle Se").build()); - assertEquals("Google Search", googleSearch.getAttribute("value")); + assertEquals("Google Search", googleSearch.getDomAttribute("value")); googleSearch = driver.findComponent(xpathBuilder().anywhere().attr("value").contains("oogle Se").build()); - assertEquals("Google Search", googleSearch.getAttribute("value")); + assertEquals("Google Search", googleSearch.getDomAttribute("value")); googleSearch = driver.findComponent(xpathBuilder().anywhere().attr("value").startsWith("Google Se").build()); - assertEquals("Google Search", googleSearch.getAttribute("value")); + assertEquals("Google Search", googleSearch.getDomAttribute("value")); googleSearch = driver.findComponent(xpathBuilder().anywhere().attr("value").exact("Google Search").build()); - assertEquals("Google Search", googleSearch.getAttribute("value")); + assertEquals("Google Search", googleSearch.getDomAttribute("value")); assertThrows(NoSuchElementException.class, () -> driver .findComponent(xpathBuilder().relative("input").attr("value").contains("oogle Se").build())); @@ -67,7 +67,7 @@ public void testBy2Builder() { () -> driver.findComponent(xpathBuilder().anywhere().attr("value").startsWith("oogle Se").build())); WebComponent lucky = driver.findComponent(xpathBuilder().anywhere().attr("value").startsWith("I'm").build()); - assertEquals("I'm Feeling Lucky", lucky.getAttribute("value")); + assertEquals("I'm Feeling Lucky", lucky.getDomAttribute("value")); } public static void main(String[] args) { diff --git a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mat/MatAutocompleteTestCases.java b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mat/MatAutocompleteTestCases.java index b21ab321..84400fcf 100644 --- a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mat/MatAutocompleteTestCases.java +++ b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mat/MatAutocompleteTestCases.java @@ -58,10 +58,10 @@ public void testAutocomplete() { autocomplete.selectByIndex(0, 100L); assertEquals("One", autocomplete.getFirstSelectedOption().getText()); - assertEquals("One", autocomplete.getInput().getAttribute("value")); + assertEquals("One", autocomplete.getInput().getDomAttribute("value")); autocomplete.deselectAll(); - assertEquals("", autocomplete.getInput().getAttribute("value")); + assertEquals("", autocomplete.getInput().getDomAttribute("value")); autocomplete.closeOptions(100L); } diff --git a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v4/MuiInputsTestCases.java b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v4/MuiInputsTestCases.java index f386709f..1cd2b757 100644 --- a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v4/MuiInputsTestCases.java +++ b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v4/MuiInputsTestCases.java @@ -286,7 +286,7 @@ public void testTextInput() { .findComponent(By.xpath("parent::*")).as(mui()).toTextField(); assertEquals("Standard", textField.getLabel().getText()); textField.sendText("ddd ccc fff"); - assertEquals("ddd ccc fff", textField.getInput().getAttribute("value")); + assertEquals("ddd ccc fff", textField.getInput().getDomAttribute("value")); } public void testRadio() { diff --git a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v4/MuiLabTestCases.java b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v4/MuiLabTestCases.java index f176865a..4a484fa7 100644 --- a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v4/MuiLabTestCases.java +++ b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v4/MuiLabTestCases.java @@ -56,14 +56,14 @@ public void testAutocompleteComboBox() { assertTrue(autoComplete.validate()); assertEquals("Combo box", autoComplete.getLabel().getText()); - assertEquals("", autoComplete.getInput().getAttribute("value")); + assertEquals("", autoComplete.getInput().getDomAttribute("value")); autoComplete.selectByIndex(0); driver.threadSleep(200L); - assertEquals("The Shawshank Redemption", autoComplete.getInput().getAttribute("value")); + assertEquals("The Shawshank Redemption", autoComplete.getInput().getDomAttribute("value")); autoComplete.closeOptions(); autoComplete.getClearButton().click(); - assertEquals("", autoComplete.getInput().getAttribute("value")); + assertEquals("", autoComplete.getInput().getDomAttribute("value")); autoComplete.getInput().sendKeys("Godfat"); assertEquals("The Godfather", autoComplete.getOptions2().get(0).getText()); @@ -72,7 +72,7 @@ public void testAutocompleteComboBox() { autoComplete.getClearButton().click(); autoComplete.selectByVisibleText("3 Idiots"); - assertEquals("3 Idiots", autoComplete.getInput().getAttribute("value")); + assertEquals("3 Idiots", autoComplete.getInput().getDomAttribute("value")); autoComplete.getInput() .sendKeys(BACK_SPACE, BACK_SPACE, BACK_SPACE, BACK_SPACE, BACK_SPACE, BACK_SPACE, BACK_SPACE, @@ -97,14 +97,14 @@ public void testAutocompleteComboBoxWithDelays() { assertTrue(autoComplete.validate()); assertEquals("Combo box", autoComplete.getLabel().getText()); - assertEquals("", autoComplete.getInput().getAttribute("value")); + assertEquals("", autoComplete.getInput().getDomAttribute("value")); autoComplete.selectByIndex(0, 500L); - assertEquals("The Shawshank Redemption", autoComplete.getInput().getAttribute("value")); + assertEquals("The Shawshank Redemption", autoComplete.getInput().getDomAttribute("value")); autoComplete.closeOptions(500L); autoComplete.getClearButton().click(); - assertEquals("", autoComplete.getInput().getAttribute("value")); + assertEquals("", autoComplete.getInput().getDomAttribute("value")); autoComplete.getInput().sendKeys("Godfat"); assertEquals("The Godfather", autoComplete.getOptions2(200L).get(0).getText()); @@ -113,7 +113,7 @@ public void testAutocompleteComboBoxWithDelays() { autoComplete.getClearButton().click(); autoComplete.selectByVisibleText("3 Idiots"); - assertEquals("3 Idiots", autoComplete.getInput().getAttribute("value")); + assertEquals("3 Idiots", autoComplete.getInput().getDomAttribute("value")); autoComplete.getInput() .sendKeys(BACK_SPACE, BACK_SPACE, BACK_SPACE, BACK_SPACE, BACK_SPACE, BACK_SPACE, BACK_SPACE, diff --git a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v4/MuiPickersTestCases.java b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v4/MuiPickersTestCases.java index e1da5565..77f356d5 100644 --- a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v4/MuiPickersTestCases.java +++ b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v4/MuiPickersTestCases.java @@ -56,7 +56,7 @@ public void testYearSelectionPopup() { MuiTextField inputField = driver.findComponent(By2.xpath("//label[text()='Year only']")) .findComponent(By2.parent()).findComponent(By.className("MuiInput-root")).as(mui()).toTextField(); - assertEquals("2022", inputField.getInput().getAttribute("value")); + assertEquals("2022", inputField.getInput().getDomAttribute("value")); inputField.click(); MuiDialogLocator locator = new MuiDialogLocator(driver, new MuiConfig()); @@ -70,7 +70,7 @@ public void testYearSelectionPopup() { dialog.getOkButton().click(); - assertEquals("1905", inputField.getInput().getAttribute("value")); + assertEquals("1905", inputField.getInput().getDomAttribute("value")); } public void testBasicExample() { @@ -79,7 +79,7 @@ public void testBasicExample() { MuiTextField inputField = driver.findComponent(By2.xpath("//label[text()='Basic example']")) .findComponent(By2.parent()).findComponent(By.className("MuiInput-root")).as(mui()).toTextField(); - assertEquals(getCurrentDayInString(), inputField.getInput().getAttribute("value")); + assertEquals(getCurrentDayInString(), inputField.getInput().getDomAttribute("value")); driver.moveTo(inputField); inputField.click(); @@ -108,7 +108,7 @@ public void testBasicExample() { Calendar calendar2 = Calendar.getInstance(); calendar2.set(Calendar.MONTH, calendar2.get(Calendar.MONTH) - 1); calendar2.set(Calendar.DAY_OF_MONTH, 14); - assertEquals(getDayInString(calendar2), inputField.getInput().getAttribute("value")); + assertEquals(getDayInString(calendar2), inputField.getInput().getDomAttribute("value")); } private String getCurrentDayInString() { diff --git a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/datadisplay/MuiAvatarsTestCases.java b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/datadisplay/MuiAvatarsTestCases.java index d02d5acf..8b31c5a7 100644 --- a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/datadisplay/MuiAvatarsTestCases.java +++ b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/datadisplay/MuiAvatarsTestCases.java @@ -47,8 +47,8 @@ public class MuiAvatarsTestCases extends AbstractBrowserSupport { /** * Tests the image avatars. * - * @see - * https://mui.com/components/avatars/#image-avatars + * @see + * https://mui.com/material-ui/react-avatar/#image-avatars */ public void testImageAvatars() { List imageAvatarList = driver.findComponent(By.id("ImageAvatars.js")).findComponent(By2.parent()) @@ -67,8 +67,8 @@ public void testImageAvatars() { /** * Tests the letter avatars. * - * @see - * https://mui.com/components/avatars/#letter-avatars + * @see + * https://mui.com/material-ui/react-avatar/#letter-avatars */ public void testLetterAvatars() { List letterAvatarList = driver.findComponent(By.id("LetterAvatars.js")).findComponent(By2.parent()) @@ -83,7 +83,7 @@ public void testLetterAvatars() { public static void main(String[] args) { MuiAvatarsTestCases test = new MuiAvatarsTestCases(); test.setUpDriver(EDGE); - test.driver.navigate().to("https://mui.com/components/avatars/"); + test.driver.navigate().to("https://mui.com/material-ui/react-avatar/"); test.testImageAvatars(); test.testLetterAvatars(); diff --git a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/datadisplay/MuiBadgeTestCases.java b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/datadisplay/MuiBadgeTestCases.java index 3bf99280..99e4ae56 100644 --- a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/datadisplay/MuiBadgeTestCases.java +++ b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/datadisplay/MuiBadgeTestCases.java @@ -46,7 +46,7 @@ public class MuiBadgeTestCases extends AbstractBrowserSupport { /** * Tests for basic badge * - * @see https://mui.com/components/badges/#basic-badge + * @see https://mui.com/material-ui/react-badge/#basic-badge */ public void testBasicBadge() { MuiBadge badge = driver.findComponent(By.id("SimpleBadge.js")).findComponent(By2.parent()) @@ -61,8 +61,8 @@ public void testBasicBadge() { /** * Tests for badge visibility * - * @see - * https://mui.com/components/badges/#badge-visibility + * @see + * https://mui.com/material-ui/react-badge/#badge-visibility */ public void testBadgeVisibility() { List badgeList = driver.findComponent(By.id("BadgeVisibility.js")).findComponent(By2.parent()) @@ -80,8 +80,8 @@ public void testBadgeVisibility() { /** * Tests the show / hide badge when it's zero * - * @see - * https://mui.com/components/badges/#badge-visibility + * @see + * https://mui.com/material-ui/react-badge/#badge-visibility */ public void testShowZeroBadge() { List badgeList = driver.findComponent(By.id("ShowZeroBadge.js")).findComponent(By2.parent()) @@ -99,8 +99,8 @@ public void testShowZeroBadge() { /** * Tests the maximum value * - * @see - * https://mui.com/components/badges/#maximum-value + * @see + * https://mui.com/material-ui/react-badge/#maximum-value */ public void testMaximumValue() { List badgeList = driver.findComponent(By.id("BadgeMax.js")).findComponent(By2.parent()) @@ -119,7 +119,7 @@ public void testMaximumValue() { public static void main(String[] args) { MuiBadgeTestCases test = new MuiBadgeTestCases(); test.setUpDriver(EDGE); - test.driver.navigate().to("https://mui.com/components/badges/"); + test.driver.navigate().to("https://mui.com/material-ui/react-badge/"); test.testBasicBadge(); test.testBadgeVisibility(); diff --git a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/datadisplay/MuiChipTestCases.java b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/datadisplay/MuiChipTestCases.java index ae2f47c8..0d410257 100644 --- a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/datadisplay/MuiChipTestCases.java +++ b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/datadisplay/MuiChipTestCases.java @@ -46,8 +46,8 @@ public class MuiChipTestCases extends AbstractBrowserSupport { /** * Tests the basic chip. * - * @see - * https://mui.com/components/chips/#basic-chip + * @see + * https://mui.com/material-ui/react-chip/#basic-chip */ public void testBasicChip() { List chipList = driver.findComponent(By.id("BasicChips.js")).findComponent(By2.parent()) @@ -66,8 +66,8 @@ public void testBasicChip() { /** * Tests the deletable chips. * - * @see - * https://mui.com/components/chips/#deletable + * @see + * https://mui.com/material-ui/react-chip/#deletable */ public void testDeletable() { List chipList = driver.findComponent(By.id("DeletableChips.js")).findComponent(By2.parent()) @@ -87,8 +87,8 @@ public void testDeletable() { /** * Tests the avatar chips. * - * @see - * https://mui.com/components/chips/#avatar-chip + * @see + * https://mui.com/material-ui/react-chip/#avatar-chip */ public void testAvatarChips() { List chipList = driver.findComponent(By.id("AvatarChips.js")).findComponent(By2.parent()) @@ -108,8 +108,8 @@ public void testAvatarChips() { /** * Tests the icon chips. * - * @see - * https://mui.com/components/chips/#icon-chip + * @see + * https://mui.com/material-ui/react-chip/#icon-chip */ public void testIconChips() { List chipList = driver.findComponent(By.id("IconChips.js")).findComponent(By2.parent()) @@ -129,7 +129,7 @@ public void testIconChips() { public static void main(String[] args) { MuiChipTestCases test = new MuiChipTestCases(); test.setUpDriver(EDGE); - test.driver.navigate().to("https://mui.com/components/chips/"); + test.driver.navigate().to("https://mui.com/material-ui/react-chip/"); test.testBasicChip(); test.testAvatarChips(); diff --git a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/datadisplay/MuiDividerTestCases.java b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/datadisplay/MuiDividerTestCases.java index c64c1b50..5b133e0d 100644 --- a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/datadisplay/MuiDividerTestCases.java +++ b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/datadisplay/MuiDividerTestCases.java @@ -47,13 +47,14 @@ public class MuiDividerTestCases extends AbstractBrowserSupport { /** * Tests the list dividers. * - * @see - * https://mui.com/components/dividers/#list-dividers + * @see + * https://mui.com/material-ui/react-divider/#list-dividers */ public void testListDividers() { List dividerList = driver.findComponent(By.id("ListDividers.js")).findComponent(By2.parent()) + .findComponent(By.className("MuiList-root")) .findComponentsAs(className("MuiDivider-root"), c -> c.as(muiV5()).toDivider()); - assertEquals(2, dividerList.size()); + assertEquals(3, dividerList.size()); dividerList.forEach(divider -> { assertTrue(divider.validate()); @@ -64,8 +65,8 @@ public void testListDividers() { /** * Tests the dividers with text, introduced in V5. * - * @see - * https://mui.com/components/dividers/#dividers-with-text + * @see + * https://mui.com/material-ui/react-divider/#dividers-with-text */ public void testDividersWithText() { List dividerList = driver.findComponent(By.id("DividerText.js")).findComponent(By2.parent()) @@ -80,15 +81,15 @@ public void testDividersWithText() { assertEquals("CENTER", dividerList.get(0).getText()); assertEquals("LEFT", dividerList.get(1).getText()); assertEquals("RIGHT", dividerList.get(2).getText()); - assertEquals("CHIP", + assertEquals("Chip", dividerList.get(3).findComponent(className("MuiChip-root")).as(muiV5()).toChip().getLabel().getText()); } /** * Tests the vertical divider. * - * @see - * https://mui.com/components/dividers/#vertical-divider + * @see + * https://mui.com/material-ui/react-divider/#vertical-divider */ public void testVerticalDivider() { List dividerList = driver.findComponent(By.id("VerticalDividers.js")).findComponent(By2.parent()) @@ -103,7 +104,7 @@ public void testVerticalDivider() { public static void main(String[] args) { MuiDividerTestCases test = new MuiDividerTestCases(); test.setUpDriver(EDGE); - test.driver.navigate().to("https://mui.com/components/dividers/"); + test.driver.navigate().to("https://mui.com/material-ui/react-divider/"); test.testListDividers(); test.testDividersWithText(); diff --git a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/datadisplay/MuiListTestCases.java b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/datadisplay/MuiListTestCases.java index 7cfa9716..b7ef5686 100644 --- a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/datadisplay/MuiListTestCases.java +++ b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/datadisplay/MuiListTestCases.java @@ -49,8 +49,8 @@ public class MuiListTestCases extends AbstractBrowserSupport { /** * Tests the basic lists. * - * @see - * https://mui.com/components/dividers/#basic-list + * @see + * https://mui.com/material-ui/react-divider/#basic-list */ public void testBasicList() { List lists = driver.findComponent(By.id("BasicList.js")).findComponent(By2.parent()) diff --git a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/datadisplay/MuiTooltipTestCases.java b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/datadisplay/MuiTooltipTestCases.java new file mode 100644 index 00000000..b612e136 --- /dev/null +++ b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/datadisplay/MuiTooltipTestCases.java @@ -0,0 +1,75 @@ +/* + * Copyright © 2021 the original author or authors. + * + * Licensed under the The MIT License (MIT) (the "License"); + * You may obtain a copy of the License at + * + * https://mit-license.org/ + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software + * and associated documentation files (the “Software”), to deal in the Software without + * restriction, including without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all copies or + * substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING + * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +package com.github.grossopa.selenium.examples.mui.v5.datadisplay; + +import com.github.grossopa.selenium.component.mui.v4.datadisplay.MuiTooltip; +import com.github.grossopa.selenium.component.mui.v4.inputs.MuiButton; +import com.github.grossopa.selenium.core.locator.By2; +import com.github.grossopa.selenium.examples.helper.AbstractBrowserSupport; +import org.openqa.selenium.By; + +import java.util.List; + +import static com.github.grossopa.selenium.component.mui.MuiComponents.muiV5; +import static com.github.grossopa.selenium.core.driver.WebDriverType.EDGE; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +/** + * Test cases for {@link MuiTooltip}. + * + * @author Jack Yin + * @since 1.12.0 + */ +public class MuiTooltipTestCases extends AbstractBrowserSupport { + + /** + * Tests the basic lists. + * + * @see + * https://mui.com/material-ui/react-divider/#basic-list + */ + public void testBasicList() { + List buttons = driver.findComponent(By.id("BasicTooltip.js")).findComponent(By2.parent()) + .findComponentsAs(By2.attrExact("aria-label", "Delete"), c -> c.as(muiV5()).toButton()); + assertEquals(1, buttons.size()); + + driver.moveTo(buttons.get(0)); + driver.threadSleep(1000L); + + MuiTooltip tooltip = driver.findComponent(By2.attrExact("role", "tooltip")).as(muiV5()).toTooltip(); + + assertTrue(tooltip.validate()); + assertEquals("Delete", tooltip.getText()); + } + + public static void main(String[] args) { + MuiTooltipTestCases test = new MuiTooltipTestCases(); + test.setUpDriver(EDGE); + test.driver.navigate().to("https://mui.com/material-ui/react-tooltip/"); + + test.testBasicList(); + } +} diff --git a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/feedback/MuiBackdropTestCases.java b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/feedback/MuiBackdropTestCases.java index 5c92a6fd..6a002c18 100644 --- a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/feedback/MuiBackdropTestCases.java +++ b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/feedback/MuiBackdropTestCases.java @@ -46,7 +46,7 @@ public class MuiBackdropTestCases extends AbstractBrowserSupport { /** * Tests the example. * - * @see https://mui.com/components/backdrop/#example + * @see https://mui.com/material-ui/react-backdrop/#example */ public void testExample() { MuiButton showBackdropButton = driver.findComponent(By.id("SimpleBackdrop.js")).findComponent(By2.parent()) @@ -63,7 +63,7 @@ public void testExample() { public static void main(String[] args) { MuiBackdropTestCases test = new MuiBackdropTestCases(); test.setUpDriver(EDGE); - test.driver.navigate().to("https://mui.com/components/backdrop/"); + test.driver.navigate().to("https://mui.com/material-ui/react-backdrop/"); test.testExample(); } diff --git a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/feedback/MuiDialogTestCases.java b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/feedback/MuiDialogTestCases.java index 20c86882..60ab327f 100644 --- a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/feedback/MuiDialogTestCases.java +++ b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/feedback/MuiDialogTestCases.java @@ -48,11 +48,11 @@ public class MuiDialogTestCases extends AbstractBrowserSupport { /** * Tests the basic dialog * - * @see - * https://mui.com/components/dialogs/#basic-dialog + * @see + * https://mui.com/material-ui/react-dialog/#basic-dialog */ public void testBasicDialog() { - MuiButton showDialogButton = driver.findComponent(By.id("SimpleDialog.js")).findComponent(By2.parent()) + MuiButton showDialogButton = driver.findComponent(By.id("SimpleDialogDemo.js")).findComponent(By2.parent()) .findComponent(By.className("MuiButton-root")).as(muiV5()).toButton(); showDialogButton.click(); @@ -68,8 +68,8 @@ public void testBasicDialog() { /** * Tests the alerts * - * @see - * https://mui.com/components/dialogs/#alerts + * @see + * https://mui.com/material-ui/react-dialog/#alerts */ public void testAlerts() { MuiButton openDialogButton = driver.findComponent(By.id("AlertDialog.js")).findComponent(By2.parent()) @@ -95,7 +95,7 @@ public void testAlerts() { public static void main(String[] args) { MuiDialogTestCases test = new MuiDialogTestCases(); test.setUpDriver(EDGE); - test.driver.navigate().to("https://mui.com/components/dialogs/"); + test.driver.navigate().to("https://mui.com/material-ui/react-dialog/"); test.testBasicDialog(); test.testAlerts(); diff --git a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/feedback/MuiSnackbarTestCases.java b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/feedback/MuiSnackbarTestCases.java index cd5967e2..98976b14 100644 --- a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/feedback/MuiSnackbarTestCases.java +++ b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/feedback/MuiSnackbarTestCases.java @@ -48,8 +48,8 @@ public class MuiSnackbarTestCases extends AbstractBrowserSupport { /** * Tests the simple Snackbars. * - * @see - * https://mui.com/components/snackbars/#simple-snackbars + * @see + * https://mui.com/material-ui/react-snackbar/#simple-snackbars */ public void testSimpleSnackbars() { MuiButton simpleSnackbarButton = driver.findComponent(By.id("SimpleSnackbar.js")).findComponent(By2.parent()) @@ -79,7 +79,7 @@ public void testSimpleSnackbars() { public static void main(String[] args) { MuiSnackbarTestCases test = new MuiSnackbarTestCases(); test.setUpDriver(EDGE); - test.driver.navigate().to("https://mui.com/components/snackbars/"); + test.driver.navigate().to("https://mui.com/material-ui/react-snackbar/"); test.testSimpleSnackbars(); } diff --git a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/inputs/MuiAutocompleteTestCases.java b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/inputs/MuiAutocompleteTestCases.java index 81e9d2ff..5c4fc8ee 100644 --- a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/inputs/MuiAutocompleteTestCases.java +++ b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/inputs/MuiAutocompleteTestCases.java @@ -56,8 +56,8 @@ public class MuiAutocompleteTestCases extends AbstractBrowserSupport { /** * Simple combobox testing * - * @see - * https://mui.com/components/autocomplete/#combo-box + * @see + * https://mui.com/material-ui/react-autocomplete/#combo-box */ public void testComboBox() { MuiAutocomplete autocomplete = driver.findComponent(By.id("ComboBox.js")).findComponent(By2.parent()) @@ -75,20 +75,20 @@ public void testComboBox() { // test auto complete search autocomplete.selectByVisibleText("Witness for the Prosecution"); - assertEquals("Witness for the Prosecution", autocomplete.getInput().getAttribute("value")); + assertEquals("Witness for the Prosecution", autocomplete.getInput().getDomAttribute("value")); cleanText(autocomplete.getInput()); // test directly select autocomplete.selectByValue("Eternal Sunshine of the Spotless Mind"); - assertEquals("Eternal Sunshine of the Spotless Mind", autocomplete.getInput().getAttribute("value")); + assertEquals("Eternal Sunshine of the Spotless Mind", autocomplete.getInput().getDomAttribute("value")); cleanText(autocomplete.getInput()); } /** * With multiple components with different options - but their behaviours is expected to be consistent * - * @see - * https://mui.com/components/autocomplete/#playground + * @see + * https://mui.com/material-ui/react-autocomplete/#playground */ public void testPlayground() { WebComponent container = driver.findComponent(By.id("Playground.js")).findComponent(By2.parent()); @@ -97,7 +97,7 @@ public void testPlayground() { c -> c.as(muiV5()).toAutocomplete()); autocompleteList.forEach(autocomplete -> { - log.info("Testing MuiAutocomplete" + autocomplete.getInput().getAttribute("value")); + log.info("Testing MuiAutocomplete" + autocomplete.getInput().getDomAttribute("value")); assertTrue(autocomplete.validate()); if (!autocomplete.isEnabled() || autocomplete.isReadOnly()) { @@ -115,12 +115,12 @@ public void testPlayground() { // test auto complete search autocomplete.selectByVisibleText("Witness for the Prosecution"); - assertEquals("Witness for the Prosecution", autocomplete.getInput().getAttribute("value")); + assertEquals("Witness for the Prosecution", autocomplete.getInput().getDomAttribute("value")); cleanText(autocomplete.getInput()); // test directly select autocomplete.selectByValue("Eternal Sunshine of the Spotless Mind"); - assertEquals("Eternal Sunshine of the Spotless Mind", autocomplete.getInput().getAttribute("value")); + assertEquals("Eternal Sunshine of the Spotless Mind", autocomplete.getInput().getDomAttribute("value")); cleanText(autocomplete.getInput()); }); } @@ -128,8 +128,8 @@ public void testPlayground() { /** * A country list * - * @see - * https://mui.com/components/autocomplete/#country-select + * @see + * https://mui.com/material-ui/react-autocomplete/#country-select */ public void testCountry() { MuiAutocomplete autocomplete = driver.findComponent(By.id("CountrySelect.js")).findComponent(By2.parent()) @@ -139,7 +139,7 @@ public void testCountry() { assertTrue(autocomplete.getOptions2().size() >= 100); autocomplete.getInput().sendKeys("china"); - assertEquals(2, autocomplete.getOptions2().size()); + assertEquals(1, autocomplete.getOptions2().size()); assertEquals("China (CN) +86", autocomplete.getOptions2().get(0).getText()); cleanText(autocomplete.getInput()); @@ -162,8 +162,8 @@ public void testCountry() { /** * Controlled states testing * - * @see - * https://mui.com/components/autocomplete/#controlled-states + * @see + * https://mui.com/material-ui/react-autocomplete/#controlled-states */ public void testControlledStates() { MuiAutocomplete autocomplete = driver.findComponent(By.id("ControllableStates.js")).findComponent(By2.parent()) @@ -187,8 +187,8 @@ public void testControlledStates() { /** * free solo will not display the "No Options" for none matches * - * @see - * https://mui.com/components/autocomplete/#free-solo + * @see + * https://mui.com/material-ui/react-autocomplete/#free-solo */ @SuppressWarnings("all") public void testFreeSolo() { @@ -202,15 +202,15 @@ public void testFreeSolo() { assertThrows(NoSuchElementException.class, () -> driver.findComponent( By.xpath("/html/body/div[contains(@class,'MuiAutocomplete-popper')]/div/div[text()='No options']"))); autocomplete.getClearButton().click(); - assertEquals("", autocomplete.getInput().getAttribute("value")); + assertEquals("", autocomplete.getInput().getDomAttribute("value")); autocomplete.closeOptions(); } /** * option 0 is disabled and 1 is enabled. * - * @see - * https://mui.com/components/autocomplete/#disabled-options + * @see + * https://mui.com/material-ui/react-autocomplete/#disabled-options */ public void testDisabledOptions() { MuiAutocomplete autocomplete = driver.findComponent(By.id("DisabledOptions.js")).findComponent(By2.parent()) @@ -220,16 +220,16 @@ public void testDisabledOptions() { List components = autocomplete.getOptions2(); // tricky - the option does have aria-disabled as true but nothing else - assertEquals("true", components.get(0).getAttribute("aria-disabled")); - assertEquals("false", components.get(1).getAttribute("aria-disabled")); + assertEquals("true", components.get(0).getDomAttribute("aria-disabled")); + assertEquals("false", components.get(1).getDomAttribute("aria-disabled")); autocomplete.closeOptions(); } /** * Multiple values testing * - * @see - * https://mui.com/components/autocomplete/#multiple-values + * @see + * https://mui.com/material-ui/react-autocomplete/#multiple-values */ public void testMultipleValues() { MuiAutocomplete autocomplete = driver.findComponent(By.id("Tags.js")).findComponent(By2.parent()) @@ -266,8 +266,8 @@ public void testMultipleValues() { /** * Fixed options testing with first one is disabled * - * @see - * https://mui.com/components/autocomplete/#fixed-options + * @see + * https://mui.com/material-ui/react-autocomplete/#fixed-options */ public void testFixedOptions() { MuiAutocomplete autocomplete = driver.findComponent(By.id("FixedTags.js")).findComponent(By2.parent()) @@ -286,7 +286,7 @@ public void testFixedOptions() { public static void main(String[] args) { MuiAutocompleteTestCases test = new MuiAutocompleteTestCases(); test.setUpDriver(EDGE); - test.driver.navigate().to("https://mui.com/components/autocomplete/"); + test.driver.navigate().to("https://mui.com/material-ui/react-autocomplete/"); test.testComboBox(); test.testPlayground(); diff --git a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/inputs/MuiButtonGroupTestCases.java b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/inputs/MuiButtonGroupTestCases.java index c49c0b5b..7c008c23 100644 --- a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/inputs/MuiButtonGroupTestCases.java +++ b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/inputs/MuiButtonGroupTestCases.java @@ -45,8 +45,8 @@ public class MuiButtonGroupTestCases extends AbstractBrowserSupport { /** * Tests the basic Button group * - * @see - * https://mui.com/components/button-group/#basic-button-group + * @see + * https://mui.com/material-ui/react-button-group/#basic-button-group */ public void testBasicButtonGroup() { MuiButtonGroup buttonGroup = driver.findComponent(By.id("BasicButtonGroup.js")).findComponent(By2.parent()) @@ -62,7 +62,7 @@ public void testBasicButtonGroup() { public static void main(String[] args) { MuiButtonGroupTestCases test = new MuiButtonGroupTestCases(); test.setUpDriver(EDGE); - test.driver.navigate().to("https://mui.com/components/button-group/"); + test.driver.navigate().to("https://mui.com/material-ui/react-button-group/"); test.testBasicButtonGroup(); } diff --git a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/inputs/MuiButtonTestCases.java b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/inputs/MuiButtonTestCases.java index c9379153..feebe8fd 100644 --- a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/inputs/MuiButtonTestCases.java +++ b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/inputs/MuiButtonTestCases.java @@ -47,11 +47,12 @@ public class MuiButtonTestCases extends AbstractBrowserSupport { /** * Test the basic features * - * @see - * https://mui.com/components/buttons/#basic-button + * @see + * https://mui.com/material-ui/react-button/ */ public void testBasicButtons() { List buttonList = driver.findComponent(By.id("BasicButtons.js")).findComponent(By2.parent()) + .findComponent(By.className("MuiStack-root")) .findComponentsAs(By.className("MuiButton-root"), c -> c.as(muiV5()).toButton()); buttonList.forEach(button -> assertTrue(button.validate())); @@ -64,11 +65,12 @@ public void testBasicButtons() { /** * Test the text button feature * - * @see - * https://mui.com/components/buttons/#text-button + * @see + * https://mui.com/material-ui/react-button/ */ public void testTextButtons() { List buttonList = driver.findComponent(By.id("TextButtons.js")).findComponent(By2.parent()) + .findComponent(By.className("MuiStack-root")) .findComponentsAs(By.className("MuiButton-root"), c -> c.as(muiV5()).toButton()); buttonList.forEach(button -> assertTrue(button.validate())); @@ -85,7 +87,7 @@ public void testTextButtons() { public static void main(String[] args) { MuiButtonTestCases test = new MuiButtonTestCases(); test.setUpDriver(EDGE); - test.driver.navigate().to("https://mui.com/components/buttons/"); + test.driver.navigate().to("https://mui.com/material-ui/react-button/"); test.testBasicButtons(); test.testTextButtons(); diff --git a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/inputs/MuiCheckboxTestCases.java b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/inputs/MuiCheckboxTestCases.java index 52d45575..4a6de81b 100644 --- a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/inputs/MuiCheckboxTestCases.java +++ b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/inputs/MuiCheckboxTestCases.java @@ -48,8 +48,8 @@ public class MuiCheckboxTestCases extends AbstractBrowserSupport { /** * Tests the basics. * - * @see - * https://mui.com/components/checkboxes/#basic-checkboxes + * @see + * https://mui.com/material-ui/react-checkbox/#basic-checkboxes */ public void testBasicCheckboxes() { List checkboxList = driver.findComponent(By.id("Checkboxes.js")).findComponent(By2.parent()) @@ -71,30 +71,33 @@ public void testBasicCheckboxes() { /** * Tests the label of the checkbox * - * @see - * https://mui.com/components/checkboxes/#label + * @see + * https://mui.com/material-ui/react-checkbox/#label */ public void testLabel() { List checkboxList = driver.findComponent(By.id("CheckboxLabels.js")).findComponent(By2.parent()) .findComponentsAs(By.className("MuiCheckbox-root"), c -> c.as(muiV5()).toCheckbox()); checkboxList.forEach(checkbox -> assertTrue(checkbox.validate())); - assertEquals(2, checkboxList.size()); + assertEquals(3, checkboxList.size()); assertTrue(checkboxList.get(0).isSelected()); assertFalse(checkboxList.get(1).isSelected()); + assertFalse(checkboxList.get(2).isSelected()); assertTrue(checkboxList.get(0).isEnabled()); - assertFalse(checkboxList.get(1).isEnabled()); + assertTrue(checkboxList.get(1).isEnabled()); + assertFalse(checkboxList.get(2).isEnabled()); assertEquals("Label", checkboxList.get(0).findComponent(axesBuilder().followingSibling().build()).getText()); - assertEquals("Disabled", checkboxList.get(1).findComponent(axesBuilder().followingSibling().build()).getText()); + assertEquals("Required *", checkboxList.get(1).findComponent(axesBuilder().followingSibling().build()).getText()); + assertEquals("Disabled", checkboxList.get(2).findComponent(axesBuilder().followingSibling().build()).getText()); } /** * Tests the Indeterminate feature * - * @see - * https://mui.com/components/checkboxes/#indeterminate + * @see + * https://mui.com/material-ui/react-checkbox/#indeterminate */ public void testIndeterminateCheckbox() { List checkboxList = driver.findComponent(By.id("IndeterminateCheckbox.js")) @@ -125,7 +128,7 @@ public void testIndeterminateCheckbox() { public static void main(String[] args) { MuiCheckboxTestCases test = new MuiCheckboxTestCases(); test.setUpDriver(EDGE); - test.driver.navigate().to("https://mui.com/components/checkboxes/"); + test.driver.navigate().to("https://mui.com/material-ui/react-checkbox/"); test.testBasicCheckboxes(); test.testLabel(); diff --git a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/inputs/MuiFabTestCases.java b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/inputs/MuiFabTestCases.java index ca486698..5714bf0a 100644 --- a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/inputs/MuiFabTestCases.java +++ b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/inputs/MuiFabTestCases.java @@ -46,8 +46,8 @@ public class MuiFabTestCases extends AbstractBrowserSupport { /** * Tests the basics. * - * @see - * https://mui.com/components/floating-action-button/#basic-fab + * @see + * https://mui.com/material-ui/react-floating-action-button/#basic-fab */ public void testBasicFab() { List fabList = driver.findComponent(By.id("FloatingActionButtons.js")).findComponent(By2.parent()) @@ -55,10 +55,10 @@ public void testBasicFab() { fabList.forEach(fab -> assertTrue(fab.validate())); assertEquals(4, fabList.size()); - assertEquals("add", fabList.get(0).getAttribute("aria-label")); - assertEquals("edit", fabList.get(1).getAttribute("aria-label")); + assertEquals("add", fabList.get(0).getDomAttribute("aria-label")); + assertEquals("edit", fabList.get(1).getDomAttribute("aria-label")); assertEquals("navigate", fabList.get(2).getText().toLowerCase()); - assertEquals("like", fabList.get(3).getAttribute("aria-label")); + assertEquals("like", fabList.get(3).getDomAttribute("aria-label")); assertTrue(fabList.get(0).isEnabled()); assertTrue(fabList.get(1).isEnabled()); @@ -73,7 +73,7 @@ public void testBasicFab() { public static void main(String[] args) { MuiFabTestCases test = new MuiFabTestCases(); test.setUpDriver(EDGE); - test.driver.navigate().to("https://mui.com/components/floating-action-button/"); + test.driver.navigate().to("https://mui.com/material-ui/react-floating-action-button/"); test.testBasicFab(); } diff --git a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/inputs/MuiRadioTestCases.java b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/inputs/MuiRadioTestCases.java index 7a230333..1ce8b926 100644 --- a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/inputs/MuiRadioTestCases.java +++ b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/inputs/MuiRadioTestCases.java @@ -48,8 +48,8 @@ public class MuiRadioTestCases extends AbstractBrowserSupport { /** * Tests the basic radio group feature. * - * @see - * https://mui.com/components/radio-buttons/#radio-group + * @see + * https://mui.com/material-ui/react-radio-button/#radio-group */ public void testRadioGroup() { MuiRadioGroup radioGroup = driver.findComponent(By.id("RadioButtonsGroup.js")).findComponent(By2.parent()) @@ -71,8 +71,8 @@ public void testRadioGroup() { /** * Tests of the enabled & disabled feature. * - * @see - * https://mui.com/components/radio-buttons/#direction + * @see + * https://mui.com/material-ui/react-radio-button/#direction */ public void testDisabled() { MuiRadioGroup radioGroup = driver.findComponent(By.id("RowRadioButtonsGroup.js")).findComponent(By2.parent()) @@ -91,7 +91,7 @@ public void testDisabled() { public static void main(String[] args) { MuiRadioTestCases test = new MuiRadioTestCases(); test.setUpDriver(EDGE); - test.driver.navigate().to("https://mui.com/components/radio-buttons/"); + test.driver.navigate().to("https://mui.com/material-ui/react-radio-button/"); test.testRadioGroup(); test.testDisabled(); diff --git a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/inputs/MuiSelectTestCases.java b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/inputs/MuiSelectTestCases.java index 7fbd23de..0871f027 100644 --- a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/inputs/MuiSelectTestCases.java +++ b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/inputs/MuiSelectTestCases.java @@ -52,8 +52,8 @@ public class MuiSelectTestCases extends AbstractBrowserSupport { /** * Test the basics of the select. * - * @see - * https://mui.com/components/selects/#basic-select + * @see + * https://mui.com/material-ui/react-select/#basic-select */ public void testBasicSelect() { MuiSelect select = driver.findComponent(By.id("BasicSelect.js")).findComponent(By2.parent()) @@ -75,7 +75,7 @@ public void testBasicSelect() { driver.threadSleep(animationMs); options = select.getOptions2(animationMs); - assertEquals("true", options.get(0).getAttribute("aria-selected")); + assertEquals("true", options.get(0).getDomAttribute("aria-selected")); assertFalse(SeleniumUtils.isTrueAttribute(options.get(1), "aria-selected")); assertFalse(SeleniumUtils.isTrueAttribute(options.get(2), "aria-selected")); @@ -85,7 +85,7 @@ public void testBasicSelect() { options = select.getOptions2(animationMs); assertFalse(SeleniumUtils.isTrueAttribute(options.get(0), "aria-selected")); - assertEquals("true", options.get(1).getAttribute("aria-selected")); + assertEquals("true", options.get(1).getDomAttribute("aria-selected")); assertFalse(SeleniumUtils.isTrueAttribute(options.get(2), "aria-selected")); select.selectByVisibleText("Thirty", animationMs); @@ -95,7 +95,7 @@ public void testBasicSelect() { options = select.getOptions2(animationMs); assertFalse(SeleniumUtils.isTrueAttribute(options.get(0), "aria-selected")); assertFalse(SeleniumUtils.isTrueAttribute(options.get(1), "aria-selected")); - assertEquals("true", options.get(2).getAttribute("aria-selected")); + assertEquals("true", options.get(2).getDomAttribute("aria-selected")); select.closeOptions(animationMs); } @@ -103,8 +103,8 @@ public void testBasicSelect() { /** * Tests other properties * - * @see - * https://mui.com/components/selects/#other-props + * @see + * https://mui.com/material-ui/react-select/#other-props */ public void testOtherProps() { List selectList = driver.findComponent(By.id("SelectOtherProps.js")).findComponent(By2.parent()) @@ -119,8 +119,8 @@ public void testOtherProps() { /** * Tests for Multiple Select default features. * - * @see - * https://mui.com/components/selects/#multiple-select + * @see + * https://mui.com/material-ui/react-select/#multiple-select */ public void testMultipleSelectDefault() { MuiSelect select = driver.findComponent(By.id("MultipleSelect.js")).findComponent(By2.parent()) @@ -128,15 +128,15 @@ public void testMultipleSelectDefault() { builder -> builder.multiple(true).optionValueAttribute("data-value").build()); //assertTrue(select.validate()); - final long animationMs = 800L; + final long animationMs = 1200L; - select.selectByVisibleText("April Tucker", animationMs); + select.selectByVisibleText("Omar Alexander", animationMs); select.selectByVisibleText("Bradley Wilkerson", animationMs); select.selectByValue("Kelly Snyder", animationMs); - assertEquals("April Tucker, Bradley Wilkerson, Kelly Snyder", select.getText()); + assertEquals("Omar Alexander, Bradley Wilkerson, Kelly Snyder", select.getText()); select.deselectByVisibleText("Bradley Wilkerson", animationMs); - assertEquals("April Tucker, Kelly Snyder", select.getText()); + assertEquals("Omar Alexander, Kelly Snyder", select.getText()); select.deselectAll(animationMs); assertEquals("", select.getText()); @@ -147,8 +147,8 @@ public void testMultipleSelectDefault() { /** * Tests for Multiple Select default checkmarks features. the behaviours should be consistent with default one. * - * @see - * https://mui.com/components/selects/#checkmarks + * @see + * https://mui.com/material-ui/react-select/#checkmarks */ public void testMultipleSelectCheckmarks() { MuiSelect select = driver.findComponent(By.id("MultipleSelectCheckmarks.js")).findComponent(By2.parent()) @@ -158,13 +158,13 @@ public void testMultipleSelectCheckmarks() { final long animationMs = 800L; - select.selectByVisibleText("April Tucker", animationMs); + select.selectByVisibleText("Omar Alexander", animationMs); select.selectByVisibleText("Bradley Wilkerson", animationMs); select.selectByValue("Kelly Snyder", animationMs); - assertEquals("April Tucker, Bradley Wilkerson, Kelly Snyder", select.getText()); + assertEquals("Omar Alexander, Bradley Wilkerson, Kelly Snyder", select.getText()); select.deselectByVisibleText("Bradley Wilkerson", animationMs); - assertEquals("April Tucker, Kelly Snyder", select.getText()); + assertEquals("Omar Alexander, Kelly Snyder", select.getText()); select.deselectAll(animationMs); assertEquals("", select.getText()); @@ -176,18 +176,18 @@ public void testMultipleSelectCheckmarks() { * Tests for Multiple Select default Chip features. as the chip is customized by developer so this framework will * not provide additional support for it. * - * @see - * https://mui.com/components/selects/#chip + * @see + * https://mui.com/material-ui/react-select/#chip */ public void testMultipleSelectChips() { MuiSelect select = driver.findComponent(By.id("MultipleSelectChip.js")).findComponent(By2.parent()) .findComponent(By.className("MuiSelect-select")).as(muiV5()).toSelect(By.className("MuiMenuItem-root"), builder -> builder.multiple(true).optionValueAttribute("data-value").build()); - // assertTrue(select.validate()); + // assertTrue(select.validate()); final long animationMs = 800L; - select.selectByVisibleText("April Tucker", animationMs); + select.selectByVisibleText("Omar Alexander", animationMs); select.selectByVisibleText("Bradley Wilkerson", animationMs); select.selectByVisibleText("Kelly Snyder", animationMs); @@ -196,7 +196,7 @@ public void testMultipleSelectChips() { driver.threadSleep(animationMs); List selectedValues = select.findComponents(By.className("MuiChip-label")).stream() .map(WebElement::getText).collect(toList()); - assertEquals("April Tucker, Bradley Wilkerson, Kelly Snyder", join(selectedValues, ", ")); + assertEquals("Omar Alexander, Bradley Wilkerson, Kelly Snyder", join(selectedValues, ", ")); driver.threadSleep(animationMs); select.deselectByVisibleText("Bradley Wilkerson", animationMs); @@ -204,7 +204,7 @@ public void testMultipleSelectChips() { selectedValues = select.findComponents(By.className("MuiChip-label")).stream().map(WebElement::getText) .filter(StringUtils::isNotBlank).collect(toList()); - assertEquals("April Tucker, Kelly Snyder", join(selectedValues, ", ")); + assertEquals("Omar Alexander, Kelly Snyder", join(selectedValues, ", ")); select.deselectAll(animationMs); driver.threadSleep(animationMs); @@ -216,7 +216,7 @@ public void testMultipleSelectChips() { public static void main(String[] args) { MuiSelectTestCases test = new MuiSelectTestCases(); test.setUpDriver(EDGE); - test.driver.navigate().to("https://mui.com/components/selects/"); + test.driver.navigate().to("https://mui.com/material-ui/react-select/"); test.testBasicSelect(); test.testOtherProps(); diff --git a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/inputs/MuiSliderTestCases.java b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/inputs/MuiSliderTestCases.java index 96eba15b..33ef745a 100644 --- a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/inputs/MuiSliderTestCases.java +++ b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/inputs/MuiSliderTestCases.java @@ -47,8 +47,8 @@ public class MuiSliderTestCases extends AbstractBrowserSupport { /** * Tests the basic continuous sliders * - * @see - * https://mui.com/components/slider/#continuous-sliders + * @see + * https://mui.com/material-ui/react-slider/#continuous-sliders */ public void testContinuousSliders() { List sliderList = driver.findComponent(By.id("ContinuousSlider.js")).findComponent(By2.parent()) @@ -77,8 +77,8 @@ public void testContinuousSliders() { /** * Tests the basic discrete sliders. * - * @see - * https://mui.com/components/slider/#discrete-sliders + * @see + * https://mui.com/material-ui/react-slider/#discrete-sliders */ public void testDiscreteSliders() { MuiSlider slider = driver.findComponent(By.id("DiscreteSlider.js")).findComponent(By2.parent()) @@ -99,8 +99,8 @@ public void testDiscreteSliders() { /** * to restrict the value to be selected. * - * @see - * https://mui.com/components/slider/#restricted-values + * @see + * https://mui.com/material-ui/react-slider/#restricted-values */ public void testRestrictedValues() { MuiSlider slider = driver.findComponent(By.id("DiscreteSliderValues.js")).findComponent(By2.parent()) @@ -117,8 +117,8 @@ public void testRestrictedValues() { /** * To select a range instead of a single value * - * @see - * https://mui.com/components/slider/#range-slider + * @see + * https://mui.com/material-ui/react-slider/#range-slider */ public void testRangeSlider() { MuiSlider slider = driver.findComponent(By.id("RangeSlider.js")).findComponent(By2.parent()) @@ -143,8 +143,8 @@ public void testRangeSlider() { /** * To test the vertical one if that works * - * @see - * https://mui.com/components/slider/#vertical-sliders + * @see + * https://mui.com/material-ui/react-slider/#vertical-sliders */ public void testVerticalSliders() { List sliderList = driver.findComponent(By.id("VerticalSlider.js")).findComponent(By2.parent()) @@ -184,8 +184,8 @@ public void testVerticalSliders() { /** * Test the turned off track (no difference on actions). * - * @see - * https://mui.com/components/slider/#removed-track + * @see + * https://mui.com/material-ui/react-slider/#removed-track */ public void testRemovedTrack() { List sliderList = driver.findComponent(By.id("TrackFalseSlider.js")).findComponent(By2.parent()) @@ -207,8 +207,8 @@ public void testRemovedTrack() { /** * Inverted track * - * @see - * https://mui.com/components/slider/#inverted-track + * @see + * https://mui.com/material-ui/react-slider/#inverted-track */ public void testInvertedTrack() { List sliderList = driver.findComponent(By.id("TrackInvertedSlider.js")).findComponent(By2.parent()) @@ -234,8 +234,8 @@ public void testInvertedTrack() { /** * Tests scale with a function. * - * @see - * https://mui.com/components/slider/#non-linear-scale + * @see + * https://mui.com/material-ui/react-slider/#non-linear-scale */ public void testNonLinearScale() { // x -> Math.log(x) / Math.log(2) is inverse function of Math.pow(2, x) @@ -258,7 +258,7 @@ public void testNonLinearScale() { public static void main(String[] args) { MuiSliderTestCases test = new MuiSliderTestCases(); test.setUpDriver(EDGE); - test.driver.navigate().to("https://mui.com/components/slider/"); + test.driver.navigate().to("https://mui.com/material-ui/react-slider/"); test.testContinuousSliders(); test.testDiscreteSliders(); diff --git a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/inputs/MuiSwitchTestCases.java b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/inputs/MuiSwitchTestCases.java index 2fd2e3a1..b2ba778e 100644 --- a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/inputs/MuiSwitchTestCases.java +++ b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/inputs/MuiSwitchTestCases.java @@ -47,8 +47,8 @@ public class MuiSwitchTestCases extends AbstractBrowserSupport { /** * Tests the basic Switches. * - * @see - * https://mui.com/components/switches/#basic-switches + * @see + * https://mui.com/material-ui/react-switch/#basic-switches */ public void testBasicSwitches() { List switchList = driver.findComponent(By.id("BasicSwitches.js")).findComponent(By2.parent()) @@ -73,23 +73,24 @@ public void testBasicSwitches() { /** * Tests the labels. * - * @see - * https://mui.com/components/switches/#label + * @see + * https://mui.com/material-ui/react-switch/#label */ public void testLabel() { List switchList = driver.findComponent(By.id("SwitchLabels.js")).findComponent(By2.parent()) .findComponentsAs(By.className("MuiSwitch-root"), c -> c.as(muiV5()).toSwitch()); - assertEquals(2, switchList.size()); + assertEquals(3, switchList.size()); switchList.forEach(s -> assertTrue(s.validate())); assertEquals("Label", switchList.get(0).findComponent(axesBuilder().followingSibling().build()).getText()); - assertEquals("Disabled", switchList.get(1).findComponent(axesBuilder().followingSibling().build()).getText()); + assertEquals("Required *", switchList.get(1).findComponent(axesBuilder().followingSibling().build()).getText()); + assertEquals("Disabled", switchList.get(2).findComponent(axesBuilder().followingSibling().build()).getText()); } public static void main(String[] args) { MuiSwitchTestCases test = new MuiSwitchTestCases(); test.setUpDriver(EDGE); - test.driver.navigate().to("https://mui.com/components/switches/"); + test.driver.navigate().to("https://mui.com/material-ui/react-switch/"); test.testBasicSwitches(); test.testLabel(); diff --git a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/inputs/MuiTextFieldTestCases.java b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/inputs/MuiTextFieldTestCases.java index 98e967bc..4813879f 100644 --- a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/inputs/MuiTextFieldTestCases.java +++ b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/inputs/MuiTextFieldTestCases.java @@ -47,8 +47,8 @@ public class MuiTextFieldTestCases extends AbstractBrowserSupport { /** * Tests the basics. * - * @see - * https://mui.com/components/text-fields/#basic-textfield + * @see + * https://mui.com/material-ui/react-text-field/#basic-textfield */ public void testBasicTextField() { List textFieldList = driver.findComponent(By.id("BasicTextFields.js")).findComponent(By2.parent()) @@ -62,7 +62,7 @@ public void testBasicTextField() { assertEquals(labels[i], textField.getLabel().getText()); textField.sendText("abc"); assertEquals(labels[i], textField.getLabel().getText()); - assertEquals("abc", textField.getInput().getAttribute("value")); + assertEquals("abc", textField.getInput().getDomAttribute("value")); cleanText(textField.getInput()); } } @@ -70,8 +70,8 @@ public void testBasicTextField() { /** * Tests the form properties * - * @see - * https://mui.com/components/text-fields/#form-props + * @see + * https://mui.com/material-ui/react-text-field/#form-props */ public void testFormProps() { List textFieldList = driver.findComponent(By.id("FormPropsTextFields.js")) @@ -87,15 +87,15 @@ public void testFormProps() { MuiTextField number = textFieldList.get(4); number.sendText("aa"); - assertEquals("", number.getInput().getAttribute("value")); + assertEquals("", number.getInput().getDomAttribute("value")); number.sendText("12345"); - assertEquals("12345", number.getInput().getAttribute("value")); + assertEquals("12345", number.getInput().getDomAttribute("value")); } public static void main(String[] args) { MuiTextFieldTestCases test = new MuiTextFieldTestCases(); test.setUpDriver(EDGE); - test.driver.navigate().to("https://mui.com/components/text-fields/"); + test.driver.navigate().to("https://mui.com/material-ui/react-text-field/"); test.testBasicTextField(); test.testFormProps(); diff --git a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/lab/MuiDatePickersTestCases.java b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/lab/MuiDatePickersTestCases.java index fac27aaf..e7b2b661 100644 --- a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/lab/MuiDatePickersTestCases.java +++ b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/lab/MuiDatePickersTestCases.java @@ -57,24 +57,24 @@ public class MuiDatePickersTestCases extends AbstractBrowserSupport { /** * Tests the basic date picker. * - * @see - * https://mui.com/components/date-picker/#basic-usage + * @see + * https://mui.com/x/react-date-pickers/date-picker/#basic-usage */ public void testBasicDatePicker() { MuiDatePickerFormField datePickerFormField = driver.findComponent(By.id("BasicDatePicker.js")) .findComponent(parent()).findComponent(By.className("MuiTextField-root")).as(muiV5()) .toDatePickerFormField(); - MuiCalendarPicker calendarPicker = datePickerFormField.openCalendarPicker(500L); + MuiCalendarPicker calendarPicker = datePickerFormField.openCalendarPicker(1200L); calendarPicker.setDate(LocalDate.of(2020, Month.JANUARY, 13), 500L); - assertEquals("01/13/2020", datePickerFormField.getInput().getAttribute("value")); + assertEquals("01/13/2020", datePickerFormField.getInput().getDomAttribute("value")); } /** * Tests the sub-component {@link MuiCalendarPicker}. * - * @see - * https://mui.com/components/date-picker/#sub-components + * @see + * https://mui.com/x/react-date-pickers/date-picker/#sub-components */ public void testSubComponentsPickersCalendarPicker() { MuiCalendarPicker calendarPicker = driver.findComponent(By.id("SubComponentsPickers.js")) @@ -130,8 +130,8 @@ public void testSubComponentsPickersCalendarPicker() { /** * Tests the sub-component {@link MuiMonthPicker}. * - * @see - * https://mui.com/components/date-picker/#sub-components + * @see + * https://mui.com/x/react-date-pickers/date-picker/#sub-components */ public void testSubComponentsPickersMonthPicker() { MuiMonthPicker monthPicker = driver.findComponent(By.id("SubComponentsPickers.js")).findComponent(parent()) @@ -149,8 +149,8 @@ public void testSubComponentsPickersMonthPicker() { /** * Tests the selection views of year, month and date * - * @see - * https://mui.com/components/date-picker/#views-playground + * @see + * https://mui.com/x/react-date-pickers/date-picker/#views-playground */ public void testViewsPlayground() { WebComponent container = driver.findComponent(By.id("ViewsDatePicker.js")).findComponent(parent()); @@ -162,25 +162,25 @@ public void testViewsPlayground() { driver.moveTo(yearOnly); yearOnly.openCalendarPicker(500L).getYearPicker().select(2047); - assertEquals("2047", yearOnly.getInput().getAttribute("value")); + assertEquals("2047", yearOnly.getInput().getDomAttribute("value")); driver.threadSleep(500L); yearOnly.openCalendarPicker(500L).getYearPicker().select(2099); - assertEquals("2099", yearOnly.getInput().getAttribute("value")); + assertEquals("2099", yearOnly.getInput().getDomAttribute("value")); driver.threadSleep(500L); yearOnly.openCalendarPicker(500L).getYearPicker().select(1900); - assertEquals("1900", yearOnly.getInput().getAttribute("value")); + assertEquals("1900", yearOnly.getInput().getDomAttribute("value")); driver.threadSleep(500L); yearOnly.setDate(LocalDate.of(2030, 1, 1), 500L); - assertEquals("2030", yearOnly.getInput().getAttribute("value")); + assertEquals("2030", yearOnly.getInput().getDomAttribute("value")); yearOnly.setDate(LocalDate.of(2041, 1, 1), 500L); - assertEquals("2041", yearOnly.getInput().getAttribute("value")); + assertEquals("2041", yearOnly.getInput().getDomAttribute("value")); MuiDatePickerFormField yearMonth = container.findComponent(textExact("Year and Month")).findComponent(parent()) .as(muiV5()).toDatePickerFormField(YEAR, MONTH); @@ -195,40 +195,40 @@ public void testViewsPlayground() { calendarPicker = yearMonth.openCalendarPicker(500L); calendarPicker.getMonthPicker().select(Month.DECEMBER); - assertEquals("December 2018", yearMonth.getInput().getAttribute("value")); + assertEquals("December 2018", yearMonth.getInput().getDomAttribute("value")); driver.threadSleep(500L); yearMonth.setDate(LocalDate.of(2021, Month.OCTOBER, 1), 500L); - assertEquals("October 2021", yearMonth.getInput().getAttribute("value")); + assertEquals("October 2021", yearMonth.getInput().getDomAttribute("value")); yearMonth.setDate(LocalDate.of(2021, Month.FEBRUARY, 1), 500L); - assertEquals("February 2021", yearMonth.getInput().getAttribute("value")); + assertEquals("February 2021", yearMonth.getInput().getDomAttribute("value")); yearMonth.setDate(LocalDate.of(2023, Month.FEBRUARY, 1), 500L); - assertEquals("February 2023", yearMonth.getInput().getAttribute("value")); + assertEquals("February 2023", yearMonth.getInput().getDomAttribute("value")); MuiDatePickerFormField yearMonthDate = container.findComponent(textExact("Year, month and date")) .findComponent(parent()).as(muiV5()).toDatePickerFormField(YEAR, MONTH, DAY); yearMonthDate.setDate(LocalDate.of(2013, Month.OCTOBER, 3), 500L); - assertEquals("10/03/2013", yearMonthDate.getInput().getAttribute("value")); + assertEquals("10/03/2013", yearMonthDate.getInput().getDomAttribute("value")); MuiDatePickerFormField dayMonthYear = container.findComponent(textExact("Invert the order of views")) .findComponent(parent()).as(muiV5()).toDatePickerFormField(DAY, MONTH, YEAR); dayMonthYear.setDate(LocalDate.of(2014, Month.JANUARY, 15), 500L); - assertEquals("01/15/2014", dayMonthYear.getInput().getAttribute("value")); + assertEquals("01/15/2014", dayMonthYear.getInput().getDomAttribute("value")); MuiDatePickerFormField justDate = container.findComponent(textExact("Just date")).findComponent(parent()) .as(muiV5()).toDatePickerFormField(DAY); justDate.setDate(LocalDate.of(2014, Month.JANUARY, 18), 500L); - assertEquals("01/18/2014", justDate.getInput().getAttribute("value")); + assertEquals("01/18/2014", justDate.getInput().getDomAttribute("value")); } public static void main(String[] args) { MuiDatePickersTestCases test = new MuiDatePickersTestCases(); test.setUpDriver(EDGE); - test.driver.navigate().to("https://mui.com/components/date-picker/"); + test.driver.navigate().to("https://mui.com/x/react-date-pickers/date-picker/"); test.testBasicDatePicker(); test.testSubComponentsPickersCalendarPicker(); diff --git a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/navigation/MuiBottomNavigationTestCases.java b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/navigation/MuiBottomNavigationTestCases.java index 2eec7abf..028840a6 100644 --- a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/navigation/MuiBottomNavigationTestCases.java +++ b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/navigation/MuiBottomNavigationTestCases.java @@ -48,8 +48,8 @@ public class MuiBottomNavigationTestCases extends AbstractBrowserSupport { /** * Tests the basic bottom navigation. * - * @see - * https://mui.com/components/bottom-navigation/#bottom-navigation + * @see + * https://mui.com/material-ui/react-bottom-navigation/#bottom-navigation */ public void testBottomNavigation() { MuiBottomNavigation bottomNavigation = driver.findComponent(By.id("SimpleBottomNavigation.js")) @@ -70,7 +70,7 @@ public void testBottomNavigation() { public static void main(String[] args) { MuiBottomNavigationTestCases test = new MuiBottomNavigationTestCases(); test.setUpDriver(EDGE); - test.driver.navigate().to("https://mui.com/components/bottom-navigation/"); + test.driver.navigate().to("https://mui.com/material-ui/react-bottom-navigation/"); test.testBottomNavigation(); } diff --git a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/navigation/MuiBreadcrumbsTestCases.java b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/navigation/MuiBreadcrumbsTestCases.java index 5048523a..6e95c360 100644 --- a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/navigation/MuiBreadcrumbsTestCases.java +++ b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/navigation/MuiBreadcrumbsTestCases.java @@ -46,8 +46,8 @@ public class MuiBreadcrumbsTestCases extends AbstractBrowserSupport { /** * Tests the basic features. - * - * https://mui.com/components/breadcrumbs/#basic-breadcrumbs + * + * https://mui.com/material-ui/react-breadcrumbs/#basic-breadcrumbs */ public void testBasicBreadcrumbs() { MuiBreadcrumbs breadcrumbs = driver.findComponent(By.id("BasicBreadcrumbs.js")).findComponent(By2.parent()) @@ -63,8 +63,8 @@ public void testBasicBreadcrumbs() { /** * Tests the collapsed feature. - * - * https://mui.com/components/breadcrumbs/#collapsed-breadcrumbs + * + * https://mui.com/material-ui/react-breadcrumbs/#collapsed-breadcrumbs */ public void testCollapsedBreadcrumbs() { MuiBreadcrumbs breadcrumbs = driver.findComponent(By.id("CollapsedBreadcrumbs.js")).findComponent(By2.parent()) @@ -89,7 +89,7 @@ public void testCollapsedBreadcrumbs() { public static void main(String[] args) { MuiBreadcrumbsTestCases test = new MuiBreadcrumbsTestCases(); test.setUpDriver(EDGE); - test.driver.navigate().to("https://mui.com/components/breadcrumbs/"); + test.driver.navigate().to("https://mui.com/material-ui/react-breadcrumbs/"); test.testBasicBreadcrumbs(); test.testCollapsedBreadcrumbs(); diff --git a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/navigation/MuiLinkTestCases.java b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/navigation/MuiLinkTestCases.java index da8409b2..6be70243 100644 --- a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/navigation/MuiLinkTestCases.java +++ b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/navigation/MuiLinkTestCases.java @@ -47,8 +47,8 @@ public class MuiLinkTestCases extends AbstractBrowserSupport { /** * Tests the basics. * - * @see - * https://mui.com/components/links/#basic-links + * @see + * https://mui.com/material-ui/react-link/#basic-links */ public void testBasicLinks() { List links = driver.findComponent(By.id("Links.js")).findComponent(By2.parent()) @@ -67,7 +67,7 @@ public void testBasicLinks() { public static void main(String[] args) { MuiLinkTestCases test = new MuiLinkTestCases(); test.setUpDriver(EDGE); - test.driver.navigate().to("https://mui.com/components/links/"); + test.driver.navigate().to("https://mui.com/material-ui/react-link/"); test.testBasicLinks(); } diff --git a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/navigation/MuiMenuTestCases.java b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/navigation/MuiMenuTestCases.java index 484649c0..b70006d4 100644 --- a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/navigation/MuiMenuTestCases.java +++ b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/navigation/MuiMenuTestCases.java @@ -51,7 +51,7 @@ public class MuiMenuTestCases extends AbstractBrowserSupport { /** * Tests for the basic menu. * - * @see https://mui.com/components/menus/#basic-menu + * @see https://mui.com/material-ui/react-menu/#basic-menu */ public void testBasicMenu() { MuiButton dashboardButton = driver.findComponent(By.id("BasicMenu.js")).findComponent(By2.parent()) @@ -75,7 +75,7 @@ public void testBasicMenu() { public static void main(String[] args) { MuiMenuTestCases test = new MuiMenuTestCases(); test.setUpDriver(EDGE); - test.driver.navigate().to("https://mui.com/components/menus/"); + test.driver.navigate().to("https://mui.com/material-ui/react-menu/"); test.testBasicMenu(); } diff --git a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/navigation/MuiPaginationTestCases.java b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/navigation/MuiPaginationTestCases.java index b2091793..edc81ea0 100644 --- a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/navigation/MuiPaginationTestCases.java +++ b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/navigation/MuiPaginationTestCases.java @@ -47,8 +47,8 @@ public class MuiPaginationTestCases extends AbstractBrowserSupport { /** * Tests the basic pagination. - * - * https://mui.com/components/pagination/#basic-pagination + * + * https://mui.com/material-ui/react-pagination/#basic-pagination */ public void testBasicPagination() { List paginationList = driver.findComponent(By.id("BasicPagination.js")) @@ -93,8 +93,8 @@ public void testBasicPagination() { /** * Tests the buttons of the pagination. - * - * https://mui.com/components/pagination/#buttons + * + * https://mui.com/material-ui/react-pagination/#buttons */ public void testButtons() { List paginationList = driver.findComponent(By.id("PaginationButtons.js")) @@ -134,7 +134,7 @@ public void testButtons() { public static void main(String[] args) { MuiPaginationTestCases test = new MuiPaginationTestCases(); test.setUpDriver(EDGE); - test.driver.navigate().to("https://mui.com/components/pagination/"); + test.driver.navigate().to("https://mui.com/material-ui/react-pagination/"); test.testBasicPagination(); test.testButtons(); diff --git a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/navigation/MuiTabsTestCases.java b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/navigation/MuiTabsTestCases.java index 12d025f9..3337cb14 100644 --- a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/navigation/MuiTabsTestCases.java +++ b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/navigation/MuiTabsTestCases.java @@ -44,7 +44,7 @@ public class MuiTabsTestCases extends AbstractBrowserSupport { /** * Tests the basics. * - * @see https://mui.com/components/tabs/#basic-tabs + * @see https://mui.com/material-ui/react-tabs/#basic-tabs */ public void testBasicTabs() { MuiTabs tabs = driver.findComponent(By.id("BasicTabs.js")).findComponent(By2.parent()) @@ -66,8 +66,8 @@ public void testBasicTabs() { /** * Tests the wrapped labels. * - * @see - * https://mui.com/components/tabs/#wrapped-labels + * @see + * https://mui.com/material-ui/react-tabs/#wrapped-labels */ public void testWrappedLabels() { MuiTabs tabs = driver.findComponent(By.id("TabsWrappedLabel.js")).findComponent(By2.parent()) @@ -86,7 +86,7 @@ public void testWrappedLabels() { /** * Tests the disabled tab. * - * @see https://mui.com/components/tabs/#disabled-tab + * @see https://mui.com/material-ui/react-tabs/#disabled-tab */ public void testDisabledTab() { MuiTabs tabs = driver.findComponent(By.id("DisabledTabs.js")).findComponent(By2.parent()) @@ -100,8 +100,8 @@ public void testDisabledTab() { /** * Tests the scrollable tab. * - * @see - * https://mui.com/components/tabs/#scrollable-tabs + * @see + * https://mui.com/material-ui/react-tabs/#scrollable-tabs */ public void testScrollableTabs() { MuiTabs tabs = driver.findComponent(By.id("ScrollableTabsButtonAuto.js")).findComponent(By2.parent()) @@ -118,14 +118,16 @@ public void testScrollableTabs() { assertEquals("ITEM SEVEN", tabs.getTabs().get(6).getText()); assertDoesNotThrow(() -> tabs.getNextScrollButton().orElseThrow().click()); + // Wait until animation completes + driver.threadSleep(1000L); assertDoesNotThrow(() -> tabs.getPreviousScrollButton().orElseThrow().click()); } /** * Tests the vertical tab. * - * @see - * https://mui.com/components/tabs/#vertical-tabs + * @see + * https://mui.com/material-ui/react-tabs/#vertical-tabs */ public void testVerticalTabs() { MuiTabs tabs = driver.findComponent(By.id("VerticalTabs.js")).findComponent(By2.parent()) @@ -139,7 +141,7 @@ public void testVerticalTabs() { public static void main(String[] args) { MuiTabsTestCases test = new MuiTabsTestCases(); test.setUpDriver(EDGE); - test.driver.navigate().to("https://mui.com/components/tabs/"); + test.driver.navigate().to("https://mui.com/material-ui/react-tabs/"); test.testBasicTabs(); test.testWrappedLabels(); diff --git a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/surfaces/MuiAccordionTestCases.java b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/surfaces/MuiAccordionTestCases.java index 3610d436..b2a33e66 100644 --- a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/surfaces/MuiAccordionTestCases.java +++ b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/surfaces/MuiAccordionTestCases.java @@ -47,11 +47,11 @@ public class MuiAccordionTestCases extends AbstractBrowserSupport { /** * Tests the basic features * - * @see - * https://mui.com/components/accordion/#basic-accordion + * @see + * https://mui.com/material-ui/react-accordion/#basic-accordion */ public void testBasicAccordion() { - List accordionList = driver.findComponent(By.id("BasicAccordion.js")).findComponent(By2.parent()) + List accordionList = driver.findComponent(By.id("DisabledAccordion.js")).findComponent(By2.parent()) .findComponentsAs(By.className("MuiAccordion-root"), c -> c.as(muiV5()).toAccordion()); assertEquals(3, accordionList.size()); accordionList.forEach(accordion -> { @@ -69,6 +69,7 @@ public void testBasicAccordion() { requireNonNull(accordionList.get(1).getAccordionSummary()).click(); assertTrue(accordionList.get(1).isExpand()); + driver.threadSleep(1000L); assertEquals("Lorem ipsum dolor sit amet, consectetur adipiscing elit. " + "Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget.", requireNonNull(accordionList.get(1).getAccordionDetails()).getText()); @@ -82,7 +83,7 @@ public void testBasicAccordion() { public static void main(String[] args) { MuiAccordionTestCases test = new MuiAccordionTestCases(); test.setUpDriver(EDGE); - test.driver.navigate().to("https://mui.com/components/accordion/"); + test.driver.navigate().to("https://mui.com/material-ui/react-accordion/"); test.testBasicAccordion(); } diff --git a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/surfaces/MuiAppBarTestCases.java b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/surfaces/MuiAppBarTestCases.java index 7cc90a66..3c371b8e 100644 --- a/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/surfaces/MuiAppBarTestCases.java +++ b/hamster-selenium-examples/src/test/java/com/github/grossopa/selenium/examples/mui/v5/surfaces/MuiAppBarTestCases.java @@ -45,8 +45,8 @@ public class MuiAppBarTestCases extends AbstractBrowserSupport { /** * Tests the basic features * - * @see - * https://mui.com/components/app-bar/#basic-app-bar + * @see + * https://mui.com/material-ui/react-app-bar/#basic-app-bar */ public void testBasicAppBar() { MuiAppBar appBar = driver.findComponent(By.id("ButtonAppBar.js")).findComponent(By2.parent()) @@ -59,7 +59,7 @@ public void testBasicAppBar() { public static void main(String[] args) { MuiAppBarTestCases test = new MuiAppBarTestCases(); test.setUpDriver(EDGE); - test.driver.navigate().to("https://mui.com/components/app-bar/"); + test.driver.navigate().to("https://mui.com/material-ui/react-app-bar/"); test.testBasicAppBar(); } diff --git a/pom.xml b/pom.xml index 276c2892..719b0998 100644 --- a/pom.xml +++ b/pom.xml @@ -70,6 +70,7 @@ hamster-selenium-component-antdesign hamster-selenium-component-mat hamster-selenium-examples + hamster-playwright @@ -77,9 +78,9 @@ 11 - 3.12.0 + 3.17.0 3.6.1 - 4.6.0 + 4.27.0 RELEASE