Skip to content

Commit

Permalink
adding testcase and execution id (#183)
Browse files Browse the repository at this point in the history
  • Loading branch information
prklm10 authored Mar 28, 2024
1 parent b382d86 commit 1a84673
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/main/java/io/percy/appium/lib/CliWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ public boolean healthcheck() {
* unique.
*/
public JSONObject postScreenshot(String name, JSONObject tag, List<Tile> tiles, String externalDebugUrl,
JSONObject ignoredElementsData, JSONObject consideredElementsData, Boolean sync) {
JSONObject ignoredElementsData, JSONObject consideredElementsData, Boolean sync, String testCase,
String thTestCaseExecutionId) {
// Build a JSON object to POST back to the cli node process
JSONObject data = new JSONObject();
data.put("name", name);
Expand All @@ -100,6 +101,8 @@ public JSONObject postScreenshot(String name, JSONObject tag, List<Tile> tiles,
data.put("clientInfo", env.getClientInfo(false));
data.put("environmentInfo", env.getEnvironmentInfo());
data.put("sync", sync);
data.put("testCase", testCase);
data.put("thTestCaseExecutionId", thTestCaseExecutionId);
int timeout = 600000; // 600 seconds = 600,000 milliseconds

// Create RequestConfig with timeout
Expand Down
18 changes: 18 additions & 0 deletions src/main/java/io/percy/appium/lib/ScreenshotOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ public class ScreenshotOptions {
private Boolean fullScreen = false;
private Integer screenLengths = 4;
private @Nullable Boolean sync = null;
private String testCase = null;
private String thTestCaseExecutionId = null;
private List<String> ignoreRegionXpaths = new ArrayList<String>();
private List<String> ignoreRegionAccessibilityIds = new ArrayList<String>();
private List<WebElement> ignoreRegionAppiumElements = new ArrayList<WebElement>();
Expand Down Expand Up @@ -54,6 +56,14 @@ public String getOrientation() {
return orientation;
}

public String getTestCase() {
return testCase;
}

public String getThTestCaseExecutionId() {
return thTestCaseExecutionId;
}

public Boolean getFullPage() {
return fullPage;
}
Expand Down Expand Up @@ -110,6 +120,14 @@ public void setSync(Boolean sync) {
this.sync = sync;
}

public void setTestCase(String testCase) {
this.testCase = testCase;
}

public void setThTestCaseExecutionId(String thTestCaseExecutionId) {
this.thTestCaseExecutionId = thTestCaseExecutionId;
}

public List<String> getIgnoreRegionXpaths() {
return ignoreRegionXpaths;
}
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/io/percy/appium/providers/GenericProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ public JSONObject screenshot(String name, ScreenshotOptions options,
debugUrl,
getObjectForArray("ignoreElementsData", ignoreRegions),
getObjectForArray("considerElementsData", considerRegions),
options.getSync());
options.getSync(),
options.getTestCase(),
options.getThTestCaseExecutionId());
}

public void setMetadata(Metadata metadata) {
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/io/percy/appium/checkstyles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
<!-- See https://checkstyle.org/config_sizes.html -->
<module name="MethodLength"/>
<module name="ParameterNumber">
<property name="max" value="8"/>
<property name="max" value="10"/>
</module>
<!-- Checks for whitespace -->
<!-- See https://checkstyle.org/config_whitespace.html -->
Expand Down
15 changes: 14 additions & 1 deletion src/test/java/io/percy/appium/lib/ScreenshotOptionsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,20 @@ public void testCastMobileElementsToWebElements() {
public void testSyncOption() {
ScreenshotOptions options = new ScreenshotOptions();

// Create a list of MobileElements
assertEquals(options.getSync(), null);
}

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

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

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

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

0 comments on commit 1a84673

Please sign in to comment.