Skip to content

Commit

Permalink
[release/7.0] [wasm] Test, and app host fixes (dotnet#75295)
Browse files Browse the repository at this point in the history
* [wasm] Use explicity allowed ports with playwright, on linux too

Fixes dotnet#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 <[email protected]>
  • Loading branch information
github-actions[bot] and radical authored Sep 9, 2022
1 parent 784974e commit fcb841c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/mono/wasm/build/WasmApp.targets
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
<PropertyGroup Condition="'$(WasmGenerateAppBundle)' == 'true'">
<RunCommand Condition="'$(DOTNET_HOST_PATH)' != '' and Exists($(DOTNET_HOST_PATH))">$(DOTNET_HOST_PATH)</RunCommand>
<RunCommand Condition="'$(RunCommand)' == ''">dotnet</RunCommand>
<RunArguments Condition="'$(RunArguments)' == ''">exec $([MSBuild]::NormalizePath($(WasmAppHostDir), 'WasmAppHost.dll')) --runtime-config $(_AppBundleDirForRunCommand)/$(AssemblyName).runtimeconfig.json $(WasmHostArguments)</RunArguments>
<RunArguments Condition="'$(RunArguments)' == ''">exec &quot;$([MSBuild]::NormalizePath($(WasmAppHostDir), 'WasmAppHost.dll'))&quot; --runtime-config &quot;$(_AppBundleDirForRunCommand)/$(AssemblyName).runtimeconfig.json&quot; $(WasmHostArguments)</RunArguments>
<RunWorkingDirectory Condition="'$(RunWorkingDirectory)' == ''">$(_AppBundleDirForRunCommand)</RunWorkingDirectory>
</PropertyGroup>

Expand Down
6 changes: 3 additions & 3 deletions src/tests/BuildWasmApps/Wasm.Build.Tests/BrowserRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ public async Task<IPage> RunAsync(ToolCommand cmd, string args, bool headless =

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

IPage page = await Browser.NewPageAsync();
Expand Down

0 comments on commit fcb841c

Please sign in to comment.