-
Notifications
You must be signed in to change notification settings - Fork 229
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
[BUG] Setting headless to false in .runsetttings does nothing when using .NET 4.8 #2353
Comments
Does not do anything with the standard installation instructions for a .NET 6 project, either. I'm just following them verbatim for minimal spinup to validate that it works better than Selenium and I added it to our current runsettings file and it makes no difference. However, it might be being used, because the test passes without setting the options. After adding the settings:
Also fails from |
I see that the options are used on net7 But not net48. Net7 test passes (and a window flashes on the screen) the other test fails. I've just modified the csproj in the example above to build for both TFMs: <PropertyGroup>
<TargetFrameworks>net4.8;net7.0</TargetFrameworks>
</PropertyGroup> And then run: |
@mxschmitt Running with 30380, 3, 2022/11/10, 10:10:05.664, 2320259055406, testhost.net48.exe, SettingsProviderExtensionManager: Loading settings provider Microsoft.Playwright.TestAdapter.PlaywrightSettingsProvider Debugging your actual implementation, to see what is actually passed there. |
Sooo there are 2 problems happening. The original issue is caused by sharing the settings via static fields which does not happen to be shared in .NET Framework because there we use AppDomains, and the intialization runs in a different appdomain than the execution. If you disable Appdomains by adding the setting to your runsettings you will run into another bug:
This is because adapters don't normally reference To work around this you can install the dependency directly into your csproj: <PackageReference Include="Microsoft.TestPlatform.ObjectModel" Version="17.4.0" /> So to work around this take the two steps above. |
For reference: # file .runsettings
<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
<RunConfiguration>
<DisableAppDomain>True</DisableAppDomain>
</RunConfiguration>
<Playwright>
<BrowserName>chromium</BrowserName>
<LaunchOptions>
<Headless>false</Headless>
</LaunchOptions>
</Playwright>
</RunSettings> <!-- file PlaywrightTests.csproj -->
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net4.8;net7.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
<PackageReference Include="Microsoft.TestPlatform.ObjectModel" Version="17.4.0" />
<PackageReference Include="Microsoft.Playwright.MSTest" Version="1.27.1" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.10" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.10" />
<PackageReference Include="coverlet.collector" Version="3.1.2" />
</ItemGroup>
</Project>
|
Context:
Code Snippet
https://github.com/sakull/mstest-runsettings-headless
Describe the bug
When running the tests on .NET 4.8, headless option is not read, .NET 6 works just fine.
The text was updated successfully, but these errors were encountered: