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

adding testcase and execution id #183

Merged
merged 1 commit into from
Mar 28, 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
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
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);
}
}
Loading