@@ -214,6 +214,16 @@ protected static string RunWithXHarness(string testCommand, string testLogPath,
214214 args . Append ( $ " --expected-exit-code={ expectedAppExitCode } ") ;
215215 args . Append ( $ " { extraXHarnessArgs ?? string . Empty } ") ;
216216
217+ if ( File . Exists ( "/.dockerenv" ) )
218+ args . Append ( " --browser-arg=--no-sandbox" ) ;
219+
220+ if ( ! string . IsNullOrEmpty ( EnvironmentVariables . BrowserPathForTests ) )
221+ {
222+ if ( ! File . Exists ( EnvironmentVariables . BrowserPathForTests ) )
223+ throw new Exception ( $ "Cannot find BROWSER_PATH_FOR_TESTS={ EnvironmentVariables . BrowserPathForTests } ") ;
224+ args . Append ( $ " --browser-path=\" { EnvironmentVariables . BrowserPathForTests } \" ") ;
225+ }
226+
217227 args . Append ( " -- " ) ;
218228 if ( extraXHarnessMonoArgs != null )
219229 {
@@ -326,7 +336,8 @@ protected static BuildArgs ExpandBuildArgs(BuildArgs buildArgs, string extraProp
326336 {
327337 _testOutput . WriteLine ( $ "Using existing build found at { product . ProjectDir } , with build log at { product . LogFile } ") ;
328338
329- Assert . True ( product . Result , $ "Found existing build at { product . ProjectDir } , but it had failed. Check build log at { product . LogFile } ") ;
339+ if ( ! product . Result )
340+ throw new XunitException ( $ "Found existing build at { product . ProjectDir } , but it had failed. Check build log at { product . LogFile } ") ;
330341 _projectDir = product . ProjectDir ;
331342
332343 // use this test's id for the run logs
@@ -360,7 +371,6 @@ protected static BuildArgs ExpandBuildArgs(BuildArgs buildArgs, string extraProp
360371 string logFilePath = Path . Combine ( _logPath , $ "{ buildArgs . ProjectName } { logFileSuffix } .binlog") ;
361372 _testOutput . WriteLine ( $ "-------- Building ---------") ;
362373 _testOutput . WriteLine ( $ "Binlog path: { logFilePath } ") ;
363- _testOutput . WriteLine ( $ "Binlog path: { logFilePath } ") ;
364374 sb . Append ( $ " /bl:\" { logFilePath } \" /nologo") ;
365375 sb . Append ( $ " /v:{ options . Verbosity ?? "minimal" } ") ;
366376 if ( buildArgs . ExtraBuildArgs != null )
@@ -650,10 +660,10 @@ protected static void AssertFile(string file0, string file1, string? label=null,
650660 protected ( int exitCode , string buildOutput ) AssertBuild ( string args , string label = "build" , bool expectSuccess = true , IDictionary < string , string > ? envVars = null , int ? timeoutMs = null )
651661 {
652662 var result = RunProcess ( s_buildEnv . DotNet , _testOutput , args , workingDir : _projectDir , label : label , envVars : envVars , timeoutMs : timeoutMs ?? s_defaultPerTestTimeoutMs ) ;
653- if ( expectSuccess )
654- Assert . True ( 0 == result . exitCode , $ "Build process exited with non-zero exit code: { result . exitCode } ") ;
655- else
656- Assert . True ( 0 != result . exitCode , $ "Build should have failed, but it didn't. Process exited with exitCode : { result . exitCode } ") ;
663+ if ( expectSuccess && result . exitCode != 0 )
664+ throw new XunitException ( $ "Build process exited with non-zero exit code: { result . exitCode } ") ;
665+ if ( ! expectSuccess && result . exitCode == 0 )
666+ throw new XunitException ( $ "Build should have failed, but it didn't. Process exited with exitCode : { result . exitCode } ") ;
657667
658668 return result ;
659669 }
0 commit comments