private void ParseAndAddLogs(IEnumerable <HtmlNode> TestStepsNode, ExtentTest ExtentTest) { if (TestStepsNode != null & TestStepsNode.Any()) { if (TestStepsNode.First().ChildNodes.Where(x => x.Name.Equals("table")).Count() == 0) { return; } var logs = new LogConverter(TestStepsNode.First()).Convert(); if (logs != null) { ExtentTest.GetTest().LogList = logs; } } }
public List <Test> Convert() { List <Test> nodeList = null; var li = _nodeListNode.ChildNodes.Where(x => x.Name.Equals("li")); if (li != null & li.Any()) { nodeList = new List <Test>(); li.ToList().ForEach(node => { var test = new Test(); test.ChildNode = true; var nodeName = node.Descendants("div").Where(x => x.Attributes["class"].Value.Contains("test-node-name")).First().InnerHtml; test.Name = nodeName; //var status = node.Descendants("span").Where(x => x.Attributes["class"].Value.Contains("test-status")).First().InnerText; //test.Status = (LogStatus) Enum.Parse(typeof(LogStatus), status); var startTime = node.Descendants("span").Where(x => x.Attributes["class"].Value.Contains("test-started-time")).First().InnerText; test.StartTime = System.Convert.ToDateTime(startTime); var endTime = node.Descendants("span").Where(x => x.Attributes["class"].Value.Contains("test-started-time")).First().InnerText; test.EndTime = System.Convert.ToDateTime(endTime); var testStepsNode = node.Descendants("div").Where(x => x.Attributes["class"].Value.Contains("test-steps")).First(); var logs = new LogConverter(testStepsNode).Convert(); test.LogList = logs; test.PrepareFinalize(); test.HasEnded = true; nodeList.Add(test); }); } return(nodeList); }