Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into responsive_snapshot…
Browse files Browse the repository at this point in the history
…_capture_support
  • Loading branch information
chinmay-browserstack committed Sep 27, 2024
2 parents 3ffddbb + e246873 commit be98d8d
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ assignees: ''
There are common setup gotchas that happen with Percy's SDKs, it would be worth reading
the debugging document, which might already answer your question:
https://docs.percy.io/docs/debugging-sdk
https://www.browserstack.com/docs/percy/integrate/percy-sdk-workflow#debugging-sdks
## Reach out to Percy support instead?
Expand Down Expand Up @@ -43,7 +43,7 @@ If necessary, describe the problem you have been experiencing in more detail.
## Debug logs

If you are reporting a bug, _always_ include logs! [Give the "Debugging SDKs"
document a quick read for how to gather logs](https://docs.percy.io/docs/debugging-sdks#debugging-sdks)
document a quick read for how to gather logs](https://www.browserstack.com/docs/percy/integrate/percy-sdk-workflow#debugging-sdks)

Please do not trim or edit these logs, often times there are hints in the full
logs that help debug what is going on.
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ node_modules/
.project
.vscode
.settings

.DS_Store
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,4 +232,4 @@ $ percy exec -- [java test command]
[percy] Done!
```

Refer to docs here: [Percy on Automate](https://docs.percy.io/docs/integrate-functional-testing-with-visual-testing)
Refer to docs here: [Percy on Automate](https://www.browserstack.com/docs/percy/integrate/functional-and-visual)
6 changes: 3 additions & 3 deletions src/main/java/io/percy/selenium/Percy.java
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ private boolean isCaptureResponsiveDOM(Map<String, Object> options) {

public JSONObject snapshot(String name, Map<String, Object> options) {
if (!isPercyEnabled) { return null; }
if ("automate".equals(sessionType)) { throw new RuntimeException("Invalid function call - snapshot(). Please use screenshot() function while using Percy with Automate. For more information on usage of PercyScreenshot, refer https://docs.percy.io/docs/integrate-functional-testing-with-visual-testing"); }
if ("automate".equals(sessionType)) { throw new RuntimeException("Invalid function call - snapshot(). Please use screenshot() function while using Percy with Automate. For more information on usage of PercyScreenshot, refer https://www.browserstack.com/docs/percy/integrate/functional-and-visual"); }

List<Map<String, Object>> domSnapshot = new ArrayList<>();

Expand Down Expand Up @@ -223,7 +223,7 @@ public JSONObject screenshot(String name) throws UnsupportedOperationException {
*/
public JSONObject screenshot(String name, Map<String, Object> options) throws UnsupportedOperationException {
if (!isPercyEnabled) { return null; }
if (!"automate".equals(sessionType)) { throw new RuntimeException("Invalid function call - screenshot(). Please use snapshot() function for taking screenshot. screenshot() should be used only while using Percy with Automate. For more information on usage of snapshot(), refer doc for your language https://docs.percy.io/docs/end-to-end-testing"); }
if (!"automate".equals(sessionType)) { throw new RuntimeException("Invalid function call - screenshot(). Please use snapshot() function for taking screenshot. screenshot() should be used only while using Percy with Automate. For more information on usage of snapshot(), refer doc for your language https://www.browserstack.com/docs/percy/integrate/overview"); }

List<String> driverArray = Arrays.asList(driver.getClass().toString().split("\\$")); // Added to handle testcase (mocked driver)
Iterator<String> driverIterator = driverArray.iterator();
Expand Down Expand Up @@ -291,7 +291,7 @@ private boolean healthcheck() {
log("You may be using @percy/agent" +
"which is no longer supported by this SDK." +
"Please uninstall @percy/agent and install @percy/cli instead." +
"https://docs.percy.io/docs/migrating-to-percy-cli"
"https://www.browserstack.com/docs/percy/migration/migrate-to-cli"
);

return false;
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/io/percy/selenium/SdkTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -197,14 +197,14 @@ public void takeScreenshotWithOptions() {
public void takeSnapshotThrowErrorForPOA() {
percy.sessionType = "automate";
Throwable exception = assertThrows(RuntimeException.class, () -> percy.snapshot("Test"));
assertEquals("Invalid function call - snapshot(). Please use screenshot() function while using Percy with Automate. For more information on usage of PercyScreenshot, refer https://docs.percy.io/docs/integrate-functional-testing-with-visual-testing", exception.getMessage());
assertEquals("Invalid function call - snapshot(). Please use screenshot() function while using Percy with Automate. For more information on usage of PercyScreenshot, refer https://www.browserstack.com/docs/percy/integrate/functional-and-visual", exception.getMessage());
}

@Test
public void takeScreenshotThrowErrorForWeb() {
RemoteWebDriver mockedDriver = mock(RemoteWebDriver.class);
percy = spy(new Percy(mockedDriver));
Throwable exception = assertThrows(RuntimeException.class, () -> percy.screenshot("Test"));
assertEquals("Invalid function call - screenshot(). Please use snapshot() function for taking screenshot. screenshot() should be used only while using Percy with Automate. For more information on usage of snapshot(), refer doc for your language https://docs.percy.io/docs/end-to-end-testing", exception.getMessage());
assertEquals("Invalid function call - screenshot(). Please use snapshot() function for taking screenshot. screenshot() should be used only while using Percy with Automate. For more information on usage of snapshot(), refer doc for your language https://www.browserstack.com/docs/percy/integrate/overview", exception.getMessage());
}
}

0 comments on commit be98d8d

Please sign in to comment.