Print sources if Selenium test fail

This commit is contained in:
nicolas.dorier 2019-05-14 19:19:23 +09:00
parent 9d2d2d0d64
commit fac546cc0b
No known key found for this signature in database
GPG Key ID: 6618763EF09186FE

View File

@ -21,20 +21,26 @@ namespace BTCPayServer.Tests
{
StringBuilder builder = new StringBuilder();
builder.AppendLine();
foreach (var logKind in new []{ LogType.Browser, LogType.Client, LogType.Driver })
foreach (var logKind in new []{ LogType.Browser, LogType.Client, LogType.Driver, LogType.Server })
{
try
{
var logs = driver.Manage().Logs.GetLog(logKind);
builder.AppendLine($"Selenium [{logKind}]:");
foreach (var entry in driver.Manage().Logs.GetLog(logKind))
foreach (var entry in logs)
{
builder.AppendLine($"[{entry.Level}]: {entry.Message}");
}
builder.AppendLine($"---------");
}
catch { }
builder.AppendLine($"---------");
}
Logs.Tester.LogInformation(builder.ToString());
builder = new StringBuilder();
builder.AppendLine($"Selenium [Sources]:");
builder.AppendLine(driver.PageSource);
builder.AppendLine($"---------");
Logs.Tester.LogInformation(builder.ToString());
throw;
}
}