Class BrowserNetworkInterceptionRule

java.lang.Object
com.shaft.gui.browser.internal.BrowserNetworkInterceptionRule

public final class BrowserNetworkInterceptionRule extends Object
Describes one browser network interception rule.
  • Method Details

    • mock

      public static BrowserNetworkInterceptionRule mock(Predicate<org.openqa.selenium.remote.http.HttpRequest> requestPredicate, Function<org.openqa.selenium.remote.http.HttpRequest, org.openqa.selenium.remote.http.HttpResponse> responseFactory)
      Creates a rule that returns a mocked response without sending the real request.
      Parameters:
      requestPredicate - predicate used to match outgoing browser requests
      responseFactory - factory used to build the mocked response
      Returns:
      the interception rule
    • validate

      public static BrowserNetworkInterceptionRule validate(Predicate<org.openqa.selenium.remote.http.HttpRequest> requestPredicate, Consumer<io.restassured.response.Response> responseValidation)
      Creates a rule that lets the request proceed and validates the real response.
      Parameters:
      requestPredicate - predicate used to match outgoing browser requests
      responseValidation - validation callback for the real response
      Returns:
      the interception rule