@@ -214,6 +214,16 @@ protected static string RunWithXHarness(string testCommand, string testLogPath,
214
214
args . Append ( $ " --expected-exit-code={ expectedAppExitCode } ") ;
215
215
args . Append ( $ " { extraXHarnessArgs ?? string . Empty } ") ;
216
216
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
+
217
227
args . Append ( " -- " ) ;
218
228
if ( extraXHarnessMonoArgs != null )
219
229
{
@@ -326,7 +336,8 @@ protected static BuildArgs ExpandBuildArgs(BuildArgs buildArgs, string extraProp
326
336
{
327
337
_testOutput . WriteLine ( $ "Using existing build found at { product . ProjectDir } , with build log at { product . LogFile } ") ;
328
338
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 } ") ;
330
341
_projectDir = product . ProjectDir ;
331
342
332
343
// use this test's id for the run logs
@@ -360,7 +371,6 @@ protected static BuildArgs ExpandBuildArgs(BuildArgs buildArgs, string extraProp
360
371
string logFilePath = Path . Combine ( _logPath , $ "{ buildArgs . ProjectName } { logFileSuffix } .binlog") ;
361
372
_testOutput . WriteLine ( $ "-------- Building ---------") ;
362
373
_testOutput . WriteLine ( $ "Binlog path: { logFilePath } ") ;
363
- _testOutput . WriteLine ( $ "Binlog path: { logFilePath } ") ;
364
374
sb . Append ( $ " /bl:\" { logFilePath } \" /nologo") ;
365
375
sb . Append ( $ " /v:{ options . Verbosity ?? "minimal" } ") ;
366
376
if ( buildArgs . ExtraBuildArgs != null )
@@ -650,10 +660,10 @@ protected static void AssertFile(string file0, string file1, string? label=null,
650
660
protected ( int exitCode , string buildOutput ) AssertBuild ( string args , string label = "build" , bool expectSuccess = true , IDictionary < string , string > ? envVars = null , int ? timeoutMs = null )
651
661
{
652
662
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 } ") ;
657
667
658
668
return result ;
659
669
}
0 commit comments