Skip to content

Commit

Permalink
revert back to JDK 11 / upgrade dependencies to latest
Browse files Browse the repository at this point in the history
  • Loading branch information
grossopa committed Dec 1, 2024
1 parent 123acf0 commit 516c247
Show file tree
Hide file tree
Showing 7 changed files with 115 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ 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') }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,17 @@ public void selectByVisibleText(String text, Long delayInMillis) {
}
}

@Override
public void selectByContainsVisibleText(String text, Long delayInMillis) {
List<WebComponent> 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();
Expand Down Expand Up @@ -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<WebComponent> getOptions2() {
return getOptions2(0L);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -325,6 +346,11 @@ public void deselectByVisibleText(String visibleText) {
deselectByVisibleText(visibleText, 0L);
}

@Override
public void deSelectByContainsVisibleText(String text) {
deSelectByContainsVisibleText(text, 0L);
}

protected Optional<WebComponent> tryToFindAutocompletePanel() {
MatOverlayContainer container = overlayFinder.findTopVisibleContainer();
if (container != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,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);
Expand Down Expand Up @@ -268,12 +279,23 @@ 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<WebComponent> options, Predicate<WebComponent> isTrue) {
for (WebComponent option : options) {
if (isTrue.test(option)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,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<WebComponent> options = getOptions2(delayInMillis);
Expand All @@ -340,6 +345,17 @@ public void selectByVisibleText(String text, Long delayInMillis) {
}
}

@Override
public void selectByContainsVisibleText(String text, Long delayInMillis) {
List<WebComponent> 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);
Expand Down Expand Up @@ -428,11 +444,30 @@ public void deselectByVisibleText(String text) {
}
}

@Override
public void deSelectByContainsVisibleText(String text) {
List<MuiAutocompleteTag> 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.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down Expand Up @@ -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);
}
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@
<java.version>11</java.version>

<!-- project dependencies -->
<commons-lang3.version>3.12.0</commons-lang3.version>
<commons-lang3.version>3.17.0</commons-lang3.version>
<commons-math3.version>3.6.1</commons-math3.version>
<selenium-java.version>4.6.0</selenium-java.version>
<selenium-java.version>4.27.0</selenium-java.version>

<!-- testing dependencies -->
<junit-jupiter.version>RELEASE</junit-jupiter.version>
Expand Down

0 comments on commit 516c247

Please sign in to comment.