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 test should verify actual cache behavior changes by making repeated requests and checking cache headers or response times, not just that no exceptions are thrown.
[Test]
-public void CanSetCacheBehavior()+public async Task CanSetCacheBehavior()
{
- Assert.That(async () => await bidi.Network.SetCacheBehaviorAsync(CacheBehavior.Default), Throws.Nothing);- Assert.That(async () => await context.Network.SetCacheBehaviorAsync(CacheBehavior.Default), Throws.Nothing);+ await bidi.Network.SetCacheBehaviorAsync(CacheBehavior.Default);+ var response1 = await context.NavigateAsync(UrlBuilder.WhereIs("cacheable"));+ var response2 = await context.NavigateAsync(UrlBuilder.WhereIs("cacheable"));+ Assert.That(response2.FromCache, Is.True, "Response should be cached");++ await bidi.Network.SetCacheBehaviorAsync(CacheBehavior.Bypass);+ var response3 = await context.NavigateAsync(UrlBuilder.WhereIs("cacheable"));+ Assert.That(response3.FromCache, Is.False, "Response should bypass cache");
}
Apply this suggestion
Suggestion importance[1-10]: 8
Why: The suggestion significantly improves test quality by adding actual verification of cache behavior functionality instead of just checking for exceptions. The proposed test properly validates both default and bypass cache behaviors with real HTTP requests.
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.
User description
Description
Expanding BiDi coverage in .NET
Motivation and Context
Fixes #14532
Types of changes
Checklist
PR Type
Enhancement, Tests
Description
Added
SetCacheBehaviorcommand to the Network module in .NET BiDi.Implemented
SetCacheBehaviorCommandand related parameters and options.Updated
BrowsingContextNetworkModuleandNetworkModuleto support cache behavior configuration.Added unit tests to validate
SetCacheBehaviorfunctionality.Changes walkthrough 📝
Command.cs
Register `SetCacheBehaviorCommand` in command typesdotnet/src/webdriver/BiDi/Communication/Command.cs
SetCacheBehaviorCommandas a derived type for networkcommands.
BrowsingContextNetworkModule.cs
Add `SetCacheBehaviorAsync` to BrowsingContextNetworkModuledotnet/src/webdriver/BiDi/Modules/BrowsingContext/BrowsingContextNetworkModule.cs
SetCacheBehaviorAsyncmethod to configure cache behavior.SetCacheBehaviorOptionsfor browsing context.NetworkModule.cs
Implement `SetCacheBehaviorAsync` in NetworkModuledotnet/src/webdriver/BiDi/Modules/Network/NetworkModule.cs
SetCacheBehaviorAsyncmethod inNetworkModule.SetCacheBehaviorCommandParametersand options.SetCacheBehaviorCommand.cs
Add `SetCacheBehaviorCommand` and related classesdotnet/src/webdriver/BiDi/Modules/Network/SetCacheBehaviorCommand.cs
SetCacheBehaviorCommandclass and parameters.SetCacheBehaviorOptionsandCacheBehaviorenum.NetworkTest.cs
Add unit tests for `SetCacheBehavior`dotnet/test/common/BiDi/Network/NetworkTest.cs
SetCacheBehaviorfunctionality.