Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Java] PR Linting #70

Merged
merged 3 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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