Skip to content

Commit

Permalink
[Java] PR Linting (#70)
Browse files Browse the repository at this point in the history
Co-authored-by: Logan Graham <logan.graham@saucelabs.com>
  • Loading branch information
omacranger and Logan Graham authored May 31, 2024
1 parent cfbe5d8 commit 75bafd0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/java-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ jobs:
distribution: 'temurin'
java-version: ${{ matrix.version }}
cache: 'maven'
- name: Format / Lint Check
run: mvn fmt:check --file pom.xml
if: matrix.version == '11'
- name: Build with Maven
run: mvn -B package --file pom.xml
if: matrix.version == '8'
- name: Build and Lint with Maven
run: mvn -B verify --file pom.xml
if: matrix.version == '11'
2 changes: 1 addition & 1 deletion visual-java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.saucelabs.visual</groupId>
<artifactId>java-client</artifactId>
<version>0.9.0</version>
<version>0.7.0</version>
<name>visual-java-client</name>
<description>Java library to interact with Sauce Visual</description>

Expand Down
11 changes: 2 additions & 9 deletions visual-java/src/main/java/com/saucelabs/visual/VisualApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ private List<ElementIn> extractIgnoreElements(CheckOptions options) {
List<ElementIn> result = new ArrayList<>();
for (int i = 0; i < ignoredElements.size(); i++) {
WebElement element = ignoredElements.get(i);
if (validateRemoteElement(element) == null) {
if (validate(element) == null) {
throw new VisualApiException("options.ignoreElement[" + i + "] does not exist (yet)");
}
result.add(VisualRegion.ignoreChangesFor(element).toElementIn());
Expand All @@ -530,14 +530,7 @@ private List<ElementIn> extractIgnoreElements(CheckOptions options) {
}

private WebElement validate(WebElement element) {
if (element == null || !element.isDisplayed() || element.getRect() == null) {
return null;
}
return element;
}

private WebElement validateRemoteElement(WebElement element) {
if (element != null && element instanceof RemoteWebElement && element.isDisplayed()) {
if (element instanceof RemoteWebElement && element.isDisplayed()) {
return element;
}
return null;
Expand Down

0 comments on commit 75bafd0

Please sign in to comment.