Bug 1698567 - [perfdocs] Provide a way to link directly to individual Raptor tests r=sparky,perftest-reviewers,firefox-source-docs-reviewers,ahal

Differential Revision: https://phabricator.services.mozilla.com/D110779
This commit is contained in:
Myeongjun Go 2021-04-27 18:19:03 +00:00
parent b3f968cb03
commit a4c2f8da8d
5 changed files with 162 additions and 1 deletions

21
docs/_static/sphinx_panels.css vendored Normal file
View File

@ -0,0 +1,21 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* For Dropdown Link in panels of sphinx-panels */
a.dropdown-link {
color: #DDD;
margin-left: 0.5em;
padding: 0.25em;
visibility: hidden;
}
details.dropdown:hover a.dropdown-link {
visibility: visible;
}
a.dropdown-link:hover {
background-color: #36557c;
color: #ffffff;
text-decoration: none;
}

73
docs/_static/sphinx_panels.js vendored Normal file
View File

@ -0,0 +1,73 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
(function() {
"use strict";
var dropdownClassName = "dropdown";
function getDropdownElement() {
var dropdownId = window.location.hash;
if (!dropdownId) {
return false;
}
var dropdownElement = document.getElementById(dropdownId.substring(1));
if (
!dropdownElement ||
!dropdownElement.classList.contains(dropdownClassName)
) {
return false;
}
return dropdownElement;
}
function setupDropdownLink() {
var dropdowns = document.getElementsByClassName(dropdownClassName);
for (var i = 0; i < dropdowns.length; i++) {
for (var j = 0; j < dropdowns[i].classList.length; j++) {
if (dropdowns[i].classList[j].startsWith("anchor-id-")) {
dropdowns[i].id = dropdowns[i].classList[j].replace("anchor-id-", "");
}
}
var aTag = document.createElement("a");
aTag.setAttribute("href", "#" + dropdowns[i].id);
aTag.classList.add("dropdown-link");
aTag.innerHTML = "¶";
var summaryElement = dropdowns[i].getElementsByClassName(
"summary-title"
)[0];
summaryElement.insertBefore(
aTag,
summaryElement.getElementsByClassName("docutils")[0]
);
}
}
function scrollToDropdown() {
var dropdownElement = getDropdownElement();
if (dropdownElement) {
dropdownElement.open = true;
dropdownElement.scrollIntoView(true);
}
}
// Initiallize dropdown link
window.addEventListener("DOMContentLoaded", () => {
if (document.getElementsByClassName(dropdownClassName).length) {
setupDropdownLink();
window.onhashchange = scrollToDropdown;
}
});
// Scroll to and open the dropdown direct links
window.onload = () => {
if (document.getElementsByClassName(dropdownClassName).length) {
scrollToDropdown();
}
};
})();

View File

@ -116,6 +116,12 @@ html_show_copyright = False
autosectionlabel_maxdepth = 1
def install_sphinx_panels(app, pagename, templatename, context, doctree):
if "raptor" in pagename:
app.add_js_file("sphinx_panels.js")
app.add_css_file("sphinx_panels.css")
def setup(app):
app.add_config_value(
"recommonmark_config",
@ -129,3 +135,4 @@ def setup(app):
)
app.add_stylesheet("custom_theme.css")
app.add_transform(AutoStructify)
app.connect("html-page-context", install_sphinx_panels)

View File

@ -14,6 +14,7 @@ Desktop
Tests for page-load performance. The links direct to the actual websites that are being tested. (WX: WebExtension, BT: Browsertime, FF: Firefox, CH: Chrome, CU: Chromium)
.. dropdown:: amazon (BT, FF, CH, CU)
:container: + anchor-id-amazon-d
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -37,6 +38,7 @@ Tests for page-load performance. The links direct to the actual websites that ar
.. dropdown:: bing-search (BT, FF, CH, CU)
:container: + anchor-id-bing-search-d
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -60,6 +62,7 @@ Tests for page-load performance. The links direct to the actual websites that ar
.. dropdown:: buzzfeed (BT, FF, CH, CU)
:container: + anchor-id-buzzfeed-d
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -83,6 +86,7 @@ Tests for page-load performance. The links direct to the actual websites that ar
.. dropdown:: cnn (BT, FF, CH, CU)
:container: + anchor-id-cnn-d
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -106,6 +110,7 @@ Tests for page-load performance. The links direct to the actual websites that ar
.. dropdown:: ebay (BT, FF, CH, CU)
:container: + anchor-id-ebay-d
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -129,6 +134,7 @@ Tests for page-load performance. The links direct to the actual websites that ar
.. dropdown:: espn (BT, FF, CH, CU)
:container: + anchor-id-espn-d
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -152,6 +158,7 @@ Tests for page-load performance. The links direct to the actual websites that ar
.. dropdown:: expedia (BT, FF, CH, CU)
:container: + anchor-id-expedia-d
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -175,6 +182,7 @@ Tests for page-load performance. The links direct to the actual websites that ar
.. dropdown:: facebook (BT, FF, CH, CU)
:container: + anchor-id-facebook-d
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -198,6 +206,7 @@ Tests for page-load performance. The links direct to the actual websites that ar
.. dropdown:: fandom (BT, FF, CH, CU)
:container: + anchor-id-fandom-d
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -221,6 +230,7 @@ Tests for page-load performance. The links direct to the actual websites that ar
.. dropdown:: google-docs (BT, FF, CH, CU)
:container: + anchor-id-google-docs-d
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -244,6 +254,7 @@ Tests for page-load performance. The links direct to the actual websites that ar
.. dropdown:: google-mail (BT, FF, CH, CU)
:container: + anchor-id-google-mail-d
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -267,6 +278,7 @@ Tests for page-load performance. The links direct to the actual websites that ar
.. dropdown:: google-search (BT, FF, CH, CU)
:container: + anchor-id-google-search-d
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -290,6 +302,7 @@ Tests for page-load performance. The links direct to the actual websites that ar
.. dropdown:: google-slides (BT, FF, CH, CU)
:container: + anchor-id-google-slides-d
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -313,6 +326,7 @@ Tests for page-load performance. The links direct to the actual websites that ar
.. dropdown:: imdb (BT, FF, CH, CU)
:container: + anchor-id-imdb-d
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -336,6 +350,7 @@ Tests for page-load performance. The links direct to the actual websites that ar
.. dropdown:: imgur (BT, FF, CH, CU)
:container: + anchor-id-imgur-d
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -359,6 +374,7 @@ Tests for page-load performance. The links direct to the actual websites that ar
.. dropdown:: instagram (BT, FF, CH, CU)
:container: + anchor-id-instagram-d
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -382,6 +398,7 @@ Tests for page-load performance. The links direct to the actual websites that ar
.. dropdown:: linkedin (BT, FF, CH, CU)
:container: + anchor-id-linkedin-d
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -405,6 +422,7 @@ Tests for page-load performance. The links direct to the actual websites that ar
.. dropdown:: microsoft (BT, FF, CH, CU)
:container: + anchor-id-microsoft-d
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -428,6 +446,7 @@ Tests for page-load performance. The links direct to the actual websites that ar
.. dropdown:: netflix (BT, FF, CH, CU)
:container: + anchor-id-netflix-d
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -451,6 +470,7 @@ Tests for page-load performance. The links direct to the actual websites that ar
.. dropdown:: nytimes (BT, FF, CH, CU)
:container: + anchor-id-nytimes-d
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -474,6 +494,7 @@ Tests for page-load performance. The links direct to the actual websites that ar
.. dropdown:: office (BT, FF, CH, CU)
:container: + anchor-id-office-d
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -497,6 +518,7 @@ Tests for page-load performance. The links direct to the actual websites that ar
.. dropdown:: outlook (BT, FF, CH, CU)
:container: + anchor-id-outlook-d
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -520,6 +542,7 @@ Tests for page-load performance. The links direct to the actual websites that ar
.. dropdown:: paypal (BT, FF, CH, CU)
:container: + anchor-id-paypal-d
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -543,6 +566,7 @@ Tests for page-load performance. The links direct to the actual websites that ar
.. dropdown:: pinterest (BT, FF, CH, CU)
:container: + anchor-id-pinterest-d
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -566,6 +590,7 @@ Tests for page-load performance. The links direct to the actual websites that ar
.. dropdown:: reddit (BT, FF, CH, CU)
:container: + anchor-id-reddit-d
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -589,6 +614,7 @@ Tests for page-load performance. The links direct to the actual websites that ar
.. dropdown:: tumblr (BT, FF, CH, CU)
:container: + anchor-id-tumblr-d
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -612,6 +638,7 @@ Tests for page-load performance. The links direct to the actual websites that ar
.. dropdown:: twitch (BT, FF, CH, CU)
:container: + anchor-id-twitch-d
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -635,6 +662,7 @@ Tests for page-load performance. The links direct to the actual websites that ar
.. dropdown:: twitter (BT, FF, CH, CU)
:container: + anchor-id-twitter-d
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -658,6 +686,7 @@ Tests for page-load performance. The links direct to the actual websites that ar
.. dropdown:: wikia (BT, FF, CH, CU)
:container: + anchor-id-wikia-d
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -681,6 +710,7 @@ Tests for page-load performance. The links direct to the actual websites that ar
.. dropdown:: wikipedia (BT, FF, CH, CU)
:container: + anchor-id-wikipedia-d
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -704,6 +734,7 @@ Tests for page-load performance. The links direct to the actual websites that ar
.. dropdown:: yahoo-mail (BT, FF, CH, CU)
:container: + anchor-id-yahoo-mail-d
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -727,6 +758,7 @@ Tests for page-load performance. The links direct to the actual websites that ar
.. dropdown:: youtube (BT, FF, CH, CU)
:container: + anchor-id-youtube-d
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -760,6 +792,7 @@ Mobile
Page-load performance test suite on Android. The links direct to the actual websites that are being tested. (WX: WebExtension, BT: Browsertime, GV: Geckoview, RB: Refbrow, FE: Fenix, CH-M: Chrome mobile)
.. dropdown:: allrecipes (BT, GV, FE, RB, CH-M)
:container: + anchor-id-allrecipes-m
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -780,6 +813,7 @@ Page-load performance test suite on Android. The links direct to the actual webs
.. dropdown:: amazon (BT, GV, FE, RB, CH-M)
:container: + anchor-id-amazon-m
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -800,6 +834,7 @@ Page-load performance test suite on Android. The links direct to the actual webs
.. dropdown:: amazon-search (BT, GV, FE, RB, CH-M)
:container: + anchor-id-amazon-search-m
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -820,6 +855,7 @@ Page-load performance test suite on Android. The links direct to the actual webs
.. dropdown:: bbc (BT, GV, FE, RB, CH-M)
:container: + anchor-id-bbc-m
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -840,6 +876,7 @@ Page-load performance test suite on Android. The links direct to the actual webs
.. dropdown:: bing (BT, GV, FE, RB, CH-M)
:container: + anchor-id-bing-m
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -860,6 +897,7 @@ Page-load performance test suite on Android. The links direct to the actual webs
.. dropdown:: bing-search-restaurants (BT, GV, FE, RB, CH-M)
:container: + anchor-id-bing-search-restaurants-m
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -880,6 +918,7 @@ Page-load performance test suite on Android. The links direct to the actual webs
.. dropdown:: booking (BT, GV, FE, RB, CH-M)
:container: + anchor-id-booking-m
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -900,6 +939,7 @@ Page-load performance test suite on Android. The links direct to the actual webs
.. dropdown:: cnn (BT, GV, FE, RB, CH-M)
:container: + anchor-id-cnn-m
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -920,6 +960,7 @@ Page-load performance test suite on Android. The links direct to the actual webs
.. dropdown:: cnn-ampstories (BT, GV, FE, RB, CH-M)
:container: + anchor-id-cnn-ampstories-m
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -940,6 +981,7 @@ Page-load performance test suite on Android. The links direct to the actual webs
.. dropdown:: ebay-kleinanzeigen (BT, GV, FE, RB, CH-M)
:container: + anchor-id-ebay-kleinanzeigen-m
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -960,6 +1002,7 @@ Page-load performance test suite on Android. The links direct to the actual webs
.. dropdown:: ebay-kleinanzeigen-search (BT, GV, FE, RB, CH-M)
:container: + anchor-id-ebay-kleinanzeigen-search-m
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -980,6 +1023,7 @@ Page-load performance test suite on Android. The links direct to the actual webs
.. dropdown:: espn (BT, GV, FE, RB, CH-M)
:container: + anchor-id-espn-m
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -1000,6 +1044,7 @@ Page-load performance test suite on Android. The links direct to the actual webs
.. dropdown:: facebook (BT, GV, FE, RB, CH-M)
:container: + anchor-id-facebook-m
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -1021,6 +1066,7 @@ Page-load performance test suite on Android. The links direct to the actual webs
.. dropdown:: facebook-cristiano (BT, GV, FE, RB, CH-M)
:container: + anchor-id-facebook-cristiano-m
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -1041,6 +1087,7 @@ Page-load performance test suite on Android. The links direct to the actual webs
.. dropdown:: google (BT, GV, FE, RB, CH-M)
:container: + anchor-id-google-m
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -1062,6 +1109,7 @@ Page-load performance test suite on Android. The links direct to the actual webs
.. dropdown:: google-maps (BT, GV, FE, RB, CH-M)
:container: + anchor-id-google-maps-m
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -1082,6 +1130,7 @@ Page-load performance test suite on Android. The links direct to the actual webs
.. dropdown:: google-search-restaurants (BT, GV, FE, RB, CH-M)
:container: + anchor-id-google-search-restaurants-m
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -1103,6 +1152,7 @@ Page-load performance test suite on Android. The links direct to the actual webs
.. dropdown:: imdb (BT, GV, FE, RB, CH-M)
:container: + anchor-id-imdb-m
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -1123,6 +1173,7 @@ Page-load performance test suite on Android. The links direct to the actual webs
.. dropdown:: instagram (BT, GV, FE, RB, CH-M)
:container: + anchor-id-instagram-m
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -1144,6 +1195,7 @@ Page-load performance test suite on Android. The links direct to the actual webs
.. dropdown:: jianshu (BT, GV, FE, RB, CH-M)
:container: + anchor-id-jianshu-m
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -1164,6 +1216,7 @@ Page-load performance test suite on Android. The links direct to the actual webs
.. dropdown:: microsoft-support (BT, GV, FE, RB, CH-M)
:container: + anchor-id-microsoft-support-m
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -1184,6 +1237,7 @@ Page-load performance test suite on Android. The links direct to the actual webs
.. dropdown:: reddit (BT, GV, FE, RB, CH-M)
:container: + anchor-id-reddit-m
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -1204,6 +1258,7 @@ Page-load performance test suite on Android. The links direct to the actual webs
.. dropdown:: stackoverflow (BT, GV, FE, RB, CH-M)
:container: + anchor-id-stackoverflow-m
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -1224,6 +1279,7 @@ Page-load performance test suite on Android. The links direct to the actual webs
.. dropdown:: web-de (BT, GV, FE, RB, CH-M)
:container: + anchor-id-web-de-m
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -1244,6 +1300,7 @@ Page-load performance test suite on Android. The links direct to the actual webs
.. dropdown:: wikipedia (BT, GV, FE, RB, CH-M)
:container: + anchor-id-wikipedia-m
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -1264,6 +1321,7 @@ Page-load performance test suite on Android. The links direct to the actual webs
.. dropdown:: youtube (BT, GV, FE, RB, CH-M)
:container: + anchor-id-youtube-m
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0
@ -1284,6 +1342,7 @@ Page-load performance test suite on Android. The links direct to the actual webs
.. dropdown:: youtube-watch (BT, GV, FE, RB, CH-M)
:container: + anchor-id-youtube-watch-m
* **alert on**: fcp, loadtime
* **alert threshold**: 2.0

View File

@ -197,7 +197,8 @@ class RaptorGatherer(FrameworkGatherer):
logger.critical("No url found for test {}".format(title))
raise Exception("No url found for test")
result = f".. dropdown:: {title} ({test_description})\n\n"
result = f".. dropdown:: {title} ({test_description})\n"
result += f" :container: + anchor-id-{title}-{suite_name[0]}\n\n"
for idx, description in enumerate(matcher):
if description["name"] != title: