Skip to content

Commit

Permalink
Lazy load screenshots (#339)
Browse files Browse the repository at this point in the history
All screenshots are loaded immediately when opening the report even if they aren't in view. When opening a large report hosted remotely containing thousands of screenshots it can take several minutes to load. A quick fix is to enable native image lazy loading which is supported in most popular browsers today.
  • Loading branch information
kevin-brotcke committed Nov 10, 2023
1 parent fc6cf94 commit 8290f5e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Sources/XCTestHTMLReportCore/HTML/screenshot.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
<span class="icon left screenshot-icon" style="margin-left: [[PADDING]]px"></span>
[[NAME]]
<span class="icon preview-icon" data="[[FILENAME]]" onclick="showScreenshot('[[FILENAME]]')"></span>
<img class="screenshot" src="[[SOURCE]]" id="screenshot-[[FILENAME]]" alt="[[FILENAME]]"/>
<img class="screenshot" src="[[SOURCE]]" loading="lazy" id="screenshot-[[FILENAME]]" alt="[[FILENAME]]"/>
</p>

0 comments on commit 8290f5e

Please sign in to comment.