0
votes

I have a couple of selenium tests(project type: .net core, xunit framework, selenium) that I am running in chrome headless mode. Only one test is getting detected when I attempt to run the tests via cmd line.

on cmd line: dotnet vstest

I have tried adding chromeoptions, but none of them seem to work.

chromeoptions.AddArguments("--headless");
chromeoptions.AddArguments("--disable-gpu");
chromeoptions.AddArguments("--no-sandbox");
chromeoptions.AddArguments("--window-size=1920,1080");
chromeoptions.AddArguments("--allow-insecure-localhost");
chromeoptions.AddAdditionalCapability("--acceptInsecureCerts", true, true);
chromeoptions.AddArguments("--start-maximized");
chromeoptions.AddArguments("--proxy-server='direct://'");
chromeoptions.AddArguments("--proxy-bypass-list=*");
chromeoptions.AddArguments("--disable-extensions");

The cs.proj look like below:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>netcoreapp2.1</TargetFramework>

    <IsPackable>false</IsPackable>
    <PublishChromeDriver>true</PublishChromeDriver>

    <RootNamespace>CVProSmokeTest</RootNamespace>

    <AssemblyName>CVProSmokeTest</AssemblyName>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
    <WarningsAsErrors />
    <Optimize>false</Optimize>
    <DebugType>full</DebugType>
    <DebugSymbols>true</DebugSymbols>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.2.0" />
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
    <PackageReference Include="Microsoft.TestPlatform.TestHost" Version="16.1.1" />
    <PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
    <PackageReference Include="Selenium.Support" Version="3.141.0" />
    <PackageReference Include="Selenium.WebDriver" Version="3.141.0" />
    <PackageReference Include="Selenium.WebDriver.ChromeDriver" Version="74.0.3729.6" />
    <PackageReference Include="System.Configuration.ConfigurationManager" Version="4.5.0" />
    <PackageReference Include="xunit" Version="2.4.0" />
    <PackageReference Include="xunit.runner.console" Version="2.4.1">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
  </ItemGroup>

  <ItemGroup>
    <None Update="Config\config.json">
      <CopyToOutputDirectory>Never</CopyToOutputDirectory>
    </None>
  </ItemGroup>

</Project>

I have two tests [Facts], only one seems to get picked up, any help would be appreciated.

1

1 Answers

0
votes

I just wanted to close the loop on this one, I disabled my test ran them on debug and then ran them independently, I had to adjust the script flow as well (slowed the script down a bit), so no sure shot way of resolving this issue.