You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
• The PR enables BiDi network command tests for Chrome browser, which may help address ChromeDriver connection issues
Requires further human verification:
• Need to verify if the PR actually fixes the specific "ConnectFailure" error when instantiating multiple ChromeDrivers
• Need to test with the specific Chrome/ChromeDriver versions mentioned in the ticket
The error handling in canContinueWithoutAuthCredentials and canCancelAuth tests has been changed significantly. Verify that the new implementation correctly tests the expected behavior when authentication is rejected or canceled.
voidcanContinueWithoutAuthCredentials() {
try (Networknetwork = newNetwork(driver)) {
network.addIntercept(newAddInterceptParameters(InterceptPhase.AUTH_REQUIRED));
network.onAuthRequired(
responseDetails -> {
if (responseDetails.getRequest().getUrl().contains("basicAuth")) {
network.continueWithAuthNoCredentials(responseDetails.getRequest().getRequestId());
}
});
page = appServer.whereIs("basicAuth");
BrowsingContextbrowsingContext = newBrowsingContext(driver, driver.getWindowHandle());
try {
browsingContext.navigate(page, ReadinessState.COMPLETE);
fail("Exception should be thrown");
} catch (Exceptione) {
assertThat(e).isInstanceOf(WebDriverException.class);
}
}
}
@Test@NeedsFreshDrivervoidcanCancelAuth() throwsInterruptedException {
try (Networknetwork = newNetwork(driver)) {
network.addIntercept(newAddInterceptParameters(InterceptPhase.AUTH_REQUIRED));
network.onAuthRequired(
responseDetails -> {
if (responseDetails.getRequest().getUrl().contains("basicAuth")) {
// Does not handle the alertnetwork.cancelAuth(responseDetails.getRequest().getRequestId());
}
});
AtomicIntegerstatus = newAtomicInteger();
CountDownLatchlatch = newCountDownLatch(1);
network.onResponseCompleted(
responseDetails -> {
if (responseDetails.getRequest().getUrl().contains("basicAuth")) {
status.set(responseDetails.getResponseData().getStatus());
latch.countDown();
}
});
page = appServer.whereIs("basicAuth");
BrowsingContextbrowsingContext = newBrowsingContext(driver, driver.getWindowHandle());
try {
browsingContext.navigate(page, ReadinessState.COMPLETE);
} catch (ExceptionBiDiException) {
// Ignore// Only Chromium browsers throw an error because the navigation did not complete as// expected.
}
latch.await(10, TimeUnit.SECONDS);
assertThat(status.get()).isEqualTo(401);
}
All navigation calls have been changed from driver.get() to BrowsingContext.navigate() with ReadinessState.COMPLETE. Ensure this doesn't change the test behavior or timing in unexpected ways.
The URL used in the navigation doesn't match the URL set in the page variable. The test sets page to the basicAuth URL but then attempts to navigate to the logEntryAdded.html page, which is inconsistent and could lead to unreliable test results.
[To ensure code accuracy, apply this suggestion manually]
Suggestion importance[1-10]: 9
__
Why: The suggestion correctly identifies a critical inconsistency where the test sets page to basicAuth URL but navigates to a different URL. This mismatch could cause test reliability issues and doesn't properly test the intended functionality of failing requests to the basicAuth endpoint.
High
Learned best practice
Add null checks for parameters and properties before accessing their members to prevent NullPointerExceptions
Add null checks for the responseDetails and its nested properties before accessing them to prevent potential NullPointerExceptions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔗 Related Issues
💥 What does this PR do?
Added tests for BiDi network module what work with Chrome.
🔧 Implementation Notes
💡 Additional Considerations
🔄 Types of changes