Class BrowserNetworkInterceptionRule
java.lang.Object
com.shaft.gui.browser.internal.BrowserNetworkInterceptionRule
Describes one browser network interception rule.
-
Method Summary
Modifier and TypeMethodDescriptionmock(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.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.
-
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 requestsresponseFactory- 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 requestsresponseValidation- validation callback for the real response- Returns:
- the interception rule
-