Skip to content

Commit fcb841c

Browse files
[release/7.0] [wasm] Test, and app host fixes (#75295)
* [wasm] Use explicity allowed ports with playwright, on linux too Fixes #72436 . * [wasm] Quote path, and arguments for wasm app host Fixes use of app host on windows, when it's installed in `c:\program files`. * Update BrowserRunner.cs Co-authored-by: Ankit Jain <radical@gmail.com>
1 parent 784974e commit fcb841c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/mono/wasm/build/WasmApp.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@
126126
<PropertyGroup Condition="'$(WasmGenerateAppBundle)' == 'true'">
127127
<RunCommand Condition="'$(DOTNET_HOST_PATH)' != '' and Exists($(DOTNET_HOST_PATH))">$(DOTNET_HOST_PATH)</RunCommand>
128128
<RunCommand Condition="'$(RunCommand)' == ''">dotnet</RunCommand>
129-
<RunArguments Condition="'$(RunArguments)' == ''">exec $([MSBuild]::NormalizePath($(WasmAppHostDir), 'WasmAppHost.dll')) --runtime-config $(_AppBundleDirForRunCommand)/$(AssemblyName).runtimeconfig.json $(WasmHostArguments)</RunArguments>
129+
<RunArguments Condition="'$(RunArguments)' == ''">exec &quot;$([MSBuild]::NormalizePath($(WasmAppHostDir), 'WasmAppHost.dll'))&quot; --runtime-config &quot;$(_AppBundleDirForRunCommand)/$(AssemblyName).runtimeconfig.json&quot; $(WasmHostArguments)</RunArguments>
130130
<RunWorkingDirectory Condition="'$(RunWorkingDirectory)' == ''">$(_AppBundleDirForRunCommand)</RunWorkingDirectory>
131131
</PropertyGroup>
132132

src/tests/BuildWasmApps/Wasm.Build.Tests/BrowserRunner.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,12 @@ public async Task<IPage> RunAsync(ToolCommand cmd, string args, bool headless =
7777

7878
var url = new Uri(urlAvailable.Task.Result);
7979
Playwright = await Microsoft.Playwright.Playwright.CreateAsync();
80+
string[] chromeArgs = new[] { $"--explicitly-allowed-ports={url.Port}" };
81+
Console.WriteLine($"Launching chrome ('{s_chromePath.Value}') via playwright with args = {string.Join(',', chromeArgs)}");
8082
Browser = await Playwright.Chromium.LaunchAsync(new BrowserTypeLaunchOptions{
8183
ExecutablePath = s_chromePath.Value,
8284
Headless = headless,
83-
Args = OperatingSystem.IsWindows()
84-
? new[] { $"--explicitly-allowed-ports={url.Port}" }
85-
: Array.Empty<string>()
85+
Args = chromeArgs
8686
});
8787

8888
IPage page = await Browser.NewPageAsync();

0 commit comments

Comments
 (0)