Open arnonax opened 6 years ago
Can you share a sample? Is this in the same test?
Yes, it's in the same test. Here's an example: ` [TestClass] public class ExtentTests { public TestContext TestContext { get; set; }
[TestMethod]
public void BookmarkInReport()
{
var extentReport = new ExtentReports();
extentReport.AttachReporter(new ExtentHtmlReporter("Report.html"));
TestContext.AddResultFile("Report.html");
var test = extentReport.CreateTest("MyTest");
test.Info(new LinkMarkup());
// Add 100 lines so the bookmark will have to scroll in order to get to its destination
for (int i = 0; i < 100; i++)
{
test.Info($"Line {i}");
}
test.Info(new BookmarkMarkup());
extentReport.Flush();
}
public class BookmarkMarkup : IMarkup
{
public string GetMarkup()
{
return "<span id='myBookmark'>This is the bottom line</span>";
}
}
public class LinkMarkup : IMarkup
{
public string GetMarkup()
{
return "<a href='#myBookmark'>Click here to jump to the bottom</a>";
}
}
}
`
I'm trying to add links from one line to another line inside the report, using IMarkup. In the line that contains the link I render
<a href='#myId'>my link text</a>
, and in the linked line I render<div id='myId'>link destination text</div>
. The link seems to render correctly, and when I click on it, I see#myId
appended to the URL as expected. However, the page doesn't scroll to the destination line.I tried to investigate it a little bit (though I'm not a HTML/CSS expert...), and it seems to be somehow related to layouts and CSS.