Skip to content

Commit

Permalink
adding support for label (#242)
Browse files Browse the repository at this point in the history
  • Loading branch information
prklm10 authored Oct 28, 2024
1 parent ba66ad2 commit feb0722
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/io/percy/appium/lib/CliWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public boolean healthcheck() {
*/
public JSONObject postScreenshot(String name, JSONObject tag, List<Tile> tiles, String externalDebugUrl,
JSONObject ignoredElementsData, JSONObject consideredElementsData, Boolean sync, String testCase,
String thTestCaseExecutionId) {
String labels, String thTestCaseExecutionId) {
// Build a JSON object to POST back to the cli node process
JSONObject data = new JSONObject();
data.put("name", name);
Expand All @@ -102,6 +102,7 @@ public JSONObject postScreenshot(String name, JSONObject tag, List<Tile> tiles,
data.put("environmentInfo", env.getEnvironmentInfo());
data.put("sync", sync);
data.put("testCase", testCase);
data.put("labels", labels);
data.put("thTestCaseExecutionId", thTestCaseExecutionId);
int timeout = 600000; // 600 seconds = 600,000 milliseconds

Expand Down
9 changes: 9 additions & 0 deletions src/main/java/io/percy/appium/lib/ScreenshotOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class ScreenshotOptions {
private Integer screenLengths = 4;
private @Nullable Boolean sync = null;
private String testCase = null;
private String labels = null;
private String thTestCaseExecutionId = null;
private List<String> ignoreRegionXpaths = new ArrayList<String>();
private List<String> ignoreRegionAccessibilityIds = new ArrayList<String>();
Expand Down Expand Up @@ -62,6 +63,10 @@ public String getTestCase() {
return testCase;
}

public String getLabels() {
return labels;
}

public String getThTestCaseExecutionId() {
return thTestCaseExecutionId;
}
Expand Down Expand Up @@ -126,6 +131,10 @@ public void setTestCase(String testCase) {
this.testCase = testCase;
}

public void setLabels(String labels) {
this.labels = labels;
}

public void setThTestCaseExecutionId(String thTestCaseExecutionId) {
this.thTestCaseExecutionId = thTestCaseExecutionId;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ public JSONObject screenshot(String name, ScreenshotOptions options,
getObjectForArray("considerElementsData", considerRegions),
options.getSync(),
options.getTestCase(),
options.getLabels(),
options.getThTestCaseExecutionId());
}

Expand Down
9 changes: 9 additions & 0 deletions src/test/java/io/percy/appium/lib/ScreenshotOptionsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,13 @@ public void testThTestCaseExecutionId() {

assertEquals(options.getThTestCaseExecutionId(), null);
}

@Test
public void testLabelsExecutionId() {
ScreenshotOptions options = new ScreenshotOptions();

assertEquals(options.getLabels(), null);
options.setLabels("app;testing");
assertEquals(options.getLabels(), "app;testing");
}
}

0 comments on commit feb0722

Please sign in to comment.