Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make IncrementallyUpdatesCache and CachesResourcesAfterFirstLoad tests more robust. Hopefully fixes #20154 #29091

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System.Collections.Concurrent;
using System.Collections.Generic;
using Microsoft.AspNetCore.Http;

namespace HostedInAspNet.Server
{
public class BootResourceRequestLog
{
private List<string> _requestPaths = new List<string>();
private ConcurrentBag<string> _requestPaths = new ConcurrentBag<string>();

public IReadOnlyCollection<string> RequestPaths => _requestPaths;

public void AddRequest(HttpRequest request)
{
_requestPaths.Add(request.Path);
Expand Down
2 changes: 2 additions & 0 deletions src/Components/test/E2ETest/Tests/BootResourceCachingTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public void CachesResourcesAfterFirstLoad()
// On subsequent loads, we skip the items referenced from blazor.boot.json
// which includes .dll files and dotnet.wasm
Navigate("about:blank");
Browser.Equal(string.Empty, () => Browser.Title);
Navigate("/");
WaitUntilLoaded();
var subsequentResourcesRequested = GetAndClearRequestedPaths();
Expand Down Expand Up @@ -87,6 +88,7 @@ public void IncrementallyUpdatesCache()
// On the next load, we'll fetch only the items we need (not things already cached)
GetAndClearRequestedPaths();
Navigate("about:blank");
Browser.Equal(string.Empty, () => Browser.Title);
Navigate("/");
WaitUntilLoaded();
var subsequentResourcesRequested = GetAndClearRequestedPaths();
Expand Down