@@ -522,8 +522,8 @@ public void check(String name, CheckOptions options) {
522
522
*
523
523
* @param snapshotName A name for the snapshot
524
524
*/
525
- public void sauceVisualCheck (String snapshotName ) {
526
- sauceVisualCheck (snapshotName , new CheckOptions ());
525
+ public String sauceVisualCheck (String snapshotName ) {
526
+ return sauceVisualCheck (snapshotName , new CheckOptions ());
527
527
}
528
528
529
529
/**
@@ -532,15 +532,15 @@ public void sauceVisualCheck(String snapshotName) {
532
532
* @param snapshotName A name for the snapshot
533
533
* @param options Options for the API
534
534
*/
535
- public void sauceVisualCheck (String snapshotName , CheckOptions options ) {
535
+ public String sauceVisualCheck (String snapshotName , CheckOptions options ) {
536
536
if (isSauceSession ()) {
537
- sauceVisualCheckSauce (snapshotName , options );
537
+ return sauceVisualCheckSauce (snapshotName , options );
538
538
} else {
539
- sauceVisualCheckLocal (snapshotName , options );
539
+ return sauceVisualCheckLocal (snapshotName , options );
540
540
}
541
541
}
542
542
543
- private void sauceVisualCheckSauce (String snapshotName , CheckOptions options ) {
543
+ private String sauceVisualCheckSauce (String snapshotName , CheckOptions options ) {
544
544
DiffingMethod diffingMethod = toDiffingMethod (options );
545
545
546
546
CreateSnapshotFromWebDriverMutation .CreateSnapshotFromWebDriverIn input =
@@ -598,10 +598,21 @@ private void sauceVisualCheckSauce(String snapshotName, CheckOptions options) {
598
598
if (check != null && check .result != null ) {
599
599
uploadedDiffIds .addAll (
600
600
check .result .diffs .getNodes ().stream ().map (Diff ::getId ).collect (Collectors .toList ()));
601
+
602
+ return check .result .id ;
601
603
}
604
+
605
+ return null ;
606
+ }
607
+
608
+ /**
609
+ * Expose execute binding directly, allowing queries to the Visual API using the existing client.
610
+ */
611
+ public <D > D execute (GraphQLOperation operation , Class <D > responseType ) {
612
+ return this .client .execute (operation , responseType );
602
613
}
603
614
604
- private void sauceVisualCheckLocal (String snapshotName , CheckOptions options ) {
615
+ private String sauceVisualCheckLocal (String snapshotName , CheckOptions options ) {
605
616
Window window = new Window (this .driver );
606
617
Rectangle viewport = window .getViewport ();
607
618
@@ -712,7 +723,9 @@ private void sauceVisualCheckLocal(String snapshotName, CheckOptions options) {
712
723
.orElse (null ))
713
724
.withName (snapshotName )
714
725
.build ());
715
- this .client .execute (snapshotMutation , CreateSnapshotMutation .Data .class );
726
+ CreateSnapshotMutation .Data result =
727
+ this .client .execute (snapshotMutation , CreateSnapshotMutation .Data .class );
728
+ return result .result .getId ();
716
729
}
717
730
718
731
/** Parse the Selenium parsed value from window.devicePixelRatio into a Double for our API */
0 commit comments