Skip to content

Commit

Permalink
Addressed comments
Browse files Browse the repository at this point in the history
  • Loading branch information
chinmay-browserstack committed Oct 3, 2024
1 parent 4ec4554 commit e21faaa
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/main/java/io/percy/selenium/Percy.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public class Percy {
// Type of session automate/web
protected String sessionType = null;
protected JSONObject eligibleWidths;
private JSONObject CLIconfig;
private JSONObject cliConfig;

// Is the Percy server running or not
private boolean isPercyEnabled = healthcheck();
Expand Down Expand Up @@ -82,7 +82,7 @@ public Percy(WebDriver driver) {
*
*/
public JSONObject snapshot(String name) {
return snapshot(name, null, null, false, null, null, null);
return snapshot(name, null, null, false, null, null, null, null);
}

/**
Expand All @@ -93,7 +93,7 @@ public JSONObject snapshot(String name) {
* pixels.
*/
public JSONObject snapshot(String name, List<Integer> widths) {
return snapshot(name, widths, null, false, null, null, null);
return snapshot(name, widths, null, false, null, null, null, null);
}

/**
Expand All @@ -105,7 +105,7 @@ public JSONObject snapshot(String name, List<Integer> widths) {
* @param minHeight The minimum height of the resulting snapshot. In pixels.
*/
public JSONObject snapshot(String name, List<Integer> widths, Integer minHeight) {
return snapshot(name, widths, minHeight, false, null, null, null);
return snapshot(name, widths, minHeight, false, null, null, null, null);
}

/**
Expand All @@ -118,7 +118,7 @@ public JSONObject snapshot(String name, List<Integer> widths, Integer minHeight)
* @param enableJavaScript Enable JavaScript in the Percy rendering environment
*/
public JSONObject snapshot(String name, List<Integer> widths, Integer minHeight, boolean enableJavaScript) {
return snapshot(name, widths, minHeight, enableJavaScript, null, null, null);
return snapshot(name, widths, minHeight, enableJavaScript, null, null, null, null);
}

/**
Expand All @@ -132,7 +132,7 @@ public JSONObject snapshot(String name, List<Integer> widths, Integer minHeight,
* @param percyCSS Percy specific CSS that is only applied in Percy's browsers
*/
public JSONObject snapshot(String name, @Nullable List<Integer> widths, Integer minHeight, boolean enableJavaScript, String percyCSS) {
return snapshot(name, widths, minHeight, enableJavaScript, percyCSS, null, null);
return snapshot(name, widths, minHeight, enableJavaScript, percyCSS, null, null, null);
}

/**
Expand All @@ -147,7 +147,7 @@ public JSONObject snapshot(String name, @Nullable List<Integer> widths, Integer
* @param scope A CSS selector to scope the screenshot to
*/
public JSONObject snapshot(String name, @Nullable List<Integer> widths, Integer minHeight, boolean enableJavaScript, String percyCSS, String scope) {
return snapshot(name, widths, minHeight, enableJavaScript, percyCSS, scope, null);
return snapshot(name, widths, minHeight, enableJavaScript, percyCSS, scope, null, null);
}

public JSONObject snapshot(String name, @Nullable List<Integer> widths, Integer minHeight, boolean enableJavaScript, String percyCSS, String scope, @Nullable Boolean sync) {
Expand All @@ -171,8 +171,8 @@ public JSONObject snapshot(String name, @Nullable List<Integer> widths, Integer
}

private boolean isCaptureResponsiveDOM(Map<String, Object> options) {
if (CLIconfig.has("percy") && !CLIconfig.isNull("percy")) {
JSONObject percyProperty = CLIconfig.getJSONObject("percy");
if (cliConfig.has("percy") && !cliConfig.isNull("percy")) {
JSONObject percyProperty = cliConfig.getJSONObject("percy");

if (percyProperty.has("deferUploads") && !percyProperty.isNull("deferUploads") && percyProperty.getBoolean("deferUploads")) {
return false;
Expand All @@ -181,8 +181,8 @@ private boolean isCaptureResponsiveDOM(Map<String, Object> options) {

boolean responsiveSnapshotCaptureCLI = false;
if (eligibleWidths == null) { return false; }
if (CLIconfig.getJSONObject("snapshot").has("responsiveSnapshotCapture")) {
responsiveSnapshotCaptureCLI = CLIconfig.getJSONObject("snapshot").getBoolean("responsiveSnapshotCapture");
if (cliConfig.getJSONObject("snapshot").has("responsiveSnapshotCapture")) {
responsiveSnapshotCaptureCLI = cliConfig.getJSONObject("snapshot").getBoolean("responsiveSnapshotCapture");
}
Object responsiveSnapshotCaptureSDK = options.get("responsiveSnapshotCapture");

Expand Down Expand Up @@ -319,7 +319,7 @@ private boolean healthcheck() {
JSONObject responseObject = new JSONObject(responseString);
sessionType = (String) responseObject.optString("type", null);
eligibleWidths = responseObject.optJSONObject("widths");
CLIconfig = responseObject.optJSONObject("config");
cliConfig = responseObject.optJSONObject("config");

return true;
} catch (Exception ex) {
Expand Down

0 comments on commit e21faaa

Please sign in to comment.