Skip to content

Commit feb0722

Browse files
authored
adding support for label (#242)
1 parent ba66ad2 commit feb0722

File tree

4 files changed

+21
-1
lines changed

4 files changed

+21
-1
lines changed

src/main/java/io/percy/appium/lib/CliWrapper.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public boolean healthcheck() {
8989
*/
9090
public JSONObject postScreenshot(String name, JSONObject tag, List<Tile> tiles, String externalDebugUrl,
9191
JSONObject ignoredElementsData, JSONObject consideredElementsData, Boolean sync, String testCase,
92-
String thTestCaseExecutionId) {
92+
String labels, String thTestCaseExecutionId) {
9393
// Build a JSON object to POST back to the cli node process
9494
JSONObject data = new JSONObject();
9595
data.put("name", name);
@@ -102,6 +102,7 @@ public JSONObject postScreenshot(String name, JSONObject tag, List<Tile> tiles,
102102
data.put("environmentInfo", env.getEnvironmentInfo());
103103
data.put("sync", sync);
104104
data.put("testCase", testCase);
105+
data.put("labels", labels);
105106
data.put("thTestCaseExecutionId", thTestCaseExecutionId);
106107
int timeout = 600000; // 600 seconds = 600,000 milliseconds
107108

src/main/java/io/percy/appium/lib/ScreenshotOptions.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public class ScreenshotOptions {
1818
private Integer screenLengths = 4;
1919
private @Nullable Boolean sync = null;
2020
private String testCase = null;
21+
private String labels = null;
2122
private String thTestCaseExecutionId = null;
2223
private List<String> ignoreRegionXpaths = new ArrayList<String>();
2324
private List<String> ignoreRegionAccessibilityIds = new ArrayList<String>();
@@ -62,6 +63,10 @@ public String getTestCase() {
6263
return testCase;
6364
}
6465

66+
public String getLabels() {
67+
return labels;
68+
}
69+
6570
public String getThTestCaseExecutionId() {
6671
return thTestCaseExecutionId;
6772
}
@@ -126,6 +131,10 @@ public void setTestCase(String testCase) {
126131
this.testCase = testCase;
127132
}
128133

134+
public void setLabels(String labels) {
135+
this.labels = labels;
136+
}
137+
129138
public void setThTestCaseExecutionId(String thTestCaseExecutionId) {
130139
this.thTestCaseExecutionId = thTestCaseExecutionId;
131140
}

src/main/java/io/percy/appium/providers/GenericProvider.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ public JSONObject screenshot(String name, ScreenshotOptions options,
138138
getObjectForArray("considerElementsData", considerRegions),
139139
options.getSync(),
140140
options.getTestCase(),
141+
options.getLabels(),
141142
options.getThTestCaseExecutionId());
142143
}
143144

src/test/java/io/percy/appium/lib/ScreenshotOptionsTest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,13 @@ public void testThTestCaseExecutionId() {
8383

8484
assertEquals(options.getThTestCaseExecutionId(), null);
8585
}
86+
87+
@Test
88+
public void testLabelsExecutionId() {
89+
ScreenshotOptions options = new ScreenshotOptions();
90+
91+
assertEquals(options.getLabels(), null);
92+
options.setLabels("app;testing");
93+
assertEquals(options.getLabels(), "app;testing");
94+
}
8695
}

0 commit comments

Comments
 (0)