-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[mt] Add signalR WBT on WASM browser app #100723
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
Merged
Merged
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
2292870
WIP, fixing net::ERR_CONNECTION_REFUSED.
ilonatommy 4c65072
Change of setup - aspnet project serving WASM static files.
ilonatommy 12e30c0
Enable SharedArrayBuffer.
ilonatommy dc01d7f
WIP, investigating `JsonSerializerIsReflectionDisabled`
ilonatommy 6e97527
Fix serialization issue.
ilonatommy d046dc7
Fixed
ilonatommy b5918a8
Cleanup.
ilonatommy 787c0df
Trying to fix integrity check issue.
ilonatommy 025cbe8
Async interop + more logging.
ilonatommy 4d7c5c0
Move test preparation code to a method.
ilonatommy 27a66ed
Remove buttons, match other TestAppScenarios style.
ilonatommy d928673
Merge branch 'main' into wasm-signalR-tests
ilonatommy f9511d3
Moved the test out of TestAppScenarios. Standalone version works.
ilonatommy 5712028
Working version of test.
ilonatommy e6c13b7
Cleanup.
ilonatommy df70e02
Cleanup.
ilonatommy 39a51e4
@maraf's feedback - simplify the prebuild steps.
ilonatommy b2e9abd
WIP - merging blazor and wasmapp into one proj.
ilonatommy dafadb5
Missing change in a non-related test.
ilonatommy caf5c61
Do not pack blazor into a subfolder.
ilonatommy ef42e78
Remove old app.
ilonatommy b5d7e01
Connect test logic, simplify.
ilonatommy 897b859
Not intentional.
ilonatommy 3ae3274
AspServer serves only "standard content types"
ilonatommy e759621
Prevent loosing `InnerException` on exceptions thrown during `TaskCom…
ilonatommy 5fdf07f
Revert.
ilonatommy 8e24fa7
Cleanup.
ilonatommy 3c199ac
Merge branch 'main' into wasm-signalR-tests
ilonatommy 193b6f6
Merge branch 'main' into wasm-signalR-tests
ilonatommy 93c9196
@maraf's cleanup
ilonatommy 8411174
Merge branch 'main' into wasm-signalR-tests
ilonatommy 02aa107
SignalR hub is located in a url with path.
ilonatommy 9e2b8ee
Merge branch 'main' into wasm-signalR-tests
ilonatommy 657b603
Fix "GET http://localhost:5000/wasmclient, Response status code: 404"
ilonatommy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
27 changes: 27 additions & 0 deletions
27
src/mono/wasm/Wasm.Build.Tests/AspNetCore/SignalRClientTests.cs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| using System; | ||
| using System.Threading.Tasks; | ||
| using Xunit.Abstractions; | ||
| using Xunit; | ||
|
|
||
| #nullable enable | ||
|
|
||
| namespace Wasm.Build.Tests.AspNetCore; | ||
|
|
||
| public class SignalRClientTests : SignalRTestsBase | ||
| { | ||
| public SignalRClientTests(ITestOutputHelper output, SharedBuildPerTestClassFixture buildContext) | ||
| : base(output, buildContext) | ||
| { | ||
| } | ||
|
|
||
| [ConditionalTheory(typeof(BuildTestBase), nameof(IsWorkloadWithMultiThreadingForDefaultFramework))] | ||
| [InlineData("Debug", "LongPolling")] | ||
| [InlineData("Release", "LongPolling")] | ||
| [InlineData("Debug", "WebSockets")] | ||
| [InlineData("Release", "WebSockets")] | ||
| public async Task SignalRPassMessageWasmBrowser(string config, string transport) => | ||
| await SignalRPassMessage("wasmclient", config, transport); | ||
| } |
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
30 changes: 30 additions & 0 deletions
30
src/mono/wasm/Wasm.Build.Tests/Blazor/SignalRClientTests.cs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| using System; | ||
|
|
||
| using System.Threading.Tasks; | ||
| using Xunit.Abstractions; | ||
| using Xunit; | ||
|
|
||
| #nullable enable | ||
|
|
||
| namespace Wasm.Build.Tests.Blazor; | ||
|
|
||
| public class SignalRClientTests : SignalRTestsBase | ||
| { | ||
| public SignalRClientTests(ITestOutputHelper output, SharedBuildPerTestClassFixture buildContext) | ||
| : base(output, buildContext) | ||
| { | ||
| } | ||
|
|
||
| [ConditionalTheory(typeof(BuildTestBase), nameof(IsWorkloadWithMultiThreadingForDefaultFramework))] | ||
| [ActiveIssue("https://github.com/dotnet/runtime/issues/100445")] // to be fixed by: "https://github.com/dotnet/aspnetcore/issues/54365" | ||
| [InlineData("Debug", "LongPolling")] | ||
| [InlineData("Release", "LongPolling")] | ||
| [InlineData("Debug", "WebSockets")] | ||
| [InlineData("Release", "WebSockets")] | ||
| public async Task SignalRPassMessageBlazor(string config, string transport) => | ||
| await SignalRPassMessage("blazorclient", config, transport); | ||
| } | ||
|
|
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| using System.Text; | ||
| using System.Text.RegularExpressions; | ||
| using System.Threading.Tasks; | ||
| using System.Collections.Generic; | ||
| using Wasm.Build.Tests.TestAppScenarios; | ||
| using Xunit.Abstractions; | ||
| using Xunit; | ||
| #nullable enable | ||
|
|
||
| namespace Wasm.Build.Tests; | ||
|
|
||
| public class SignalRTestsBase : AppTestBase | ||
| { | ||
| public SignalRTestsBase(ITestOutputHelper output, SharedBuildPerTestClassFixture buildContext) | ||
| : base(output, buildContext) | ||
| { | ||
| } | ||
|
|
||
| protected async Task SignalRPassMessage(string staticWebAssetBasePath, string config, string transport) | ||
| { | ||
| CopyTestAsset("WasmOnAspNetCore", "SignalRClientTests", "AspNetCoreServer"); | ||
| PublishProject(config, runtimeType: RuntimeVariant.MultiThreaded, assertAppBundle: false); | ||
|
|
||
| var result = await RunSdkStyleAppForBuild(new( | ||
| Configuration: config, | ||
| ServerEnvironment: new Dictionary<string, string> { ["ASPNETCORE_ENVIRONMENT"] = "Development" }, | ||
| BrowserPath: staticWebAssetBasePath, | ||
| BrowserQueryString: new Dictionary<string, string> { ["transport"] = transport, ["message"] = "ping" } )); | ||
|
|
||
| string testOutput = string.Join("\n", result.TestOutput) ?? ""; | ||
| Assert.NotEmpty(testOutput); | ||
| // check sending and receiving threadId | ||
| string threadIdUsedForSending = GetThreadOfAction(testOutput, @"SignalRPassMessages was sent by CurrentManagedThreadId=(\d+)", "signalR message was sent"); | ||
| string threadIdUsedForReceiving = GetThreadOfAction(testOutput, @"ReceiveMessage from server on CurrentManagedThreadId=(\d+)", "signalR message was received"); | ||
| string consoleOutput = string.Join("\n", result.ConsoleOutput); | ||
| Assert.True("1" != threadIdUsedForSending || "1" != threadIdUsedForReceiving, | ||
| $"Expected to send/receive with signalR in non-UI threads, instead only CurrentManagedThreadId=1 was used. ConsoleOutput: {consoleOutput}."); | ||
| } | ||
|
|
||
| private string GetThreadOfAction(string testOutput, string pattern, string actionDescription) | ||
| { | ||
| Match match = Regex.Match(testOutput, pattern); | ||
| Assert.True(match.Success, $"Expected to find a log that {actionDescription}. TestOutput: {testOutput}."); | ||
| return match.Groups[1].Value ?? ""; | ||
| } | ||
| } |
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
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
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
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
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.