зеркало из https://github.com/mozilla/treeherder.git
Bug 1729251 - Link to devtools test documentation (#7261)
* Bug 1729251 - Devtools perfdocs * Bug 1729251 - Adding tests for Perfdocs * Bug 1729251 - Treating exception cases * Bug 1729251 - Address change request * Bug 1729251 - Non-documented tests are excluded for now
This commit is contained in:
Родитель
78addd16b9
Коммит
d3c81dc1f2
|
@ -0,0 +1,104 @@
|
|||
import {
|
||||
Perfdocs,
|
||||
removedOldTestsDevTools,
|
||||
nonDocumentedTestsDevTools,
|
||||
} from '../../../ui/perfherder/perf-helpers/perfdocs';
|
||||
|
||||
test('Passing undefined to the Perfdocs constructor does not result in exception', () => {
|
||||
const framework = undefined;
|
||||
const suite = undefined;
|
||||
const platform = undefined;
|
||||
const title = undefined;
|
||||
|
||||
const perfdocs = new Perfdocs(framework, suite, platform, title);
|
||||
expect(perfdocs.documentationURL).toEqual(
|
||||
'https://firefox-source-docs.mozilla.org/testing/perfdocs/',
|
||||
);
|
||||
expect(perfdocs.framework).toEqual('');
|
||||
expect(perfdocs.suite).toEqual('');
|
||||
expect(perfdocs.platform).toEqual('');
|
||||
expect(perfdocs.title).toEqual('');
|
||||
expect(perfdocs.remainingName).toEqual('');
|
||||
expect(perfdocs.hasDocumentation()).toBeFalsy();
|
||||
});
|
||||
|
||||
test('Passing null to the Perfdocs constructor does not result in exception', () => {
|
||||
const framework = null;
|
||||
const suite = null;
|
||||
const platform = null;
|
||||
const title = null;
|
||||
|
||||
const perfdocs = new Perfdocs(framework, suite, platform, title);
|
||||
expect(perfdocs.documentationURL).toEqual(
|
||||
'https://firefox-source-docs.mozilla.org/testing/perfdocs/',
|
||||
);
|
||||
expect(perfdocs.framework).toEqual('');
|
||||
expect(perfdocs.suite).toEqual('');
|
||||
expect(perfdocs.platform).toEqual('');
|
||||
expect(perfdocs.title).toEqual('');
|
||||
expect(perfdocs.remainingName).toEqual('');
|
||||
expect(perfdocs.hasDocumentation()).toBeFalsy();
|
||||
});
|
||||
|
||||
test('If the framework is unknown the documentation url resulted is a general one', () => {
|
||||
const framework = 'someFrameworkName';
|
||||
const suite = 'someSuite';
|
||||
|
||||
const perfdocs = new Perfdocs(framework, suite);
|
||||
expect(perfdocs.documentationURL).toEqual(
|
||||
'https://firefox-source-docs.mozilla.org/testing/perfdocs/',
|
||||
);
|
||||
});
|
||||
|
||||
test('For framework browsertime the documentation url is correct', () => {
|
||||
const framework = 'browsertime';
|
||||
const suite = 'web-de';
|
||||
const platform = 'android';
|
||||
|
||||
const perfdocs = new Perfdocs(framework, suite, platform);
|
||||
expect(perfdocs.documentationURL).toEqual(
|
||||
'https://firefox-source-docs.mozilla.org/testing/perfdocs/raptor.html#web-de-m',
|
||||
);
|
||||
});
|
||||
|
||||
test('For framework devtools the documentation url is correct', () => {
|
||||
const framework = 'devtools';
|
||||
const suite = 'damp';
|
||||
|
||||
const perfdocs = new Perfdocs(framework, suite);
|
||||
expect(perfdocs.documentationURL).toEqual(
|
||||
'https://firefox-source-docs.mozilla.org/devtools/tests/performance-tests-overview.html#damp',
|
||||
);
|
||||
});
|
||||
|
||||
test("Framework browsertime doesn't have documentation on Tests View", () => {
|
||||
const framework = 'browsertime';
|
||||
const suite = 'someSuite';
|
||||
|
||||
const perfdocs = new Perfdocs(framework, suite);
|
||||
expect(perfdocs.hasDocumentation('testsView')).toBeFalsy();
|
||||
});
|
||||
|
||||
test('Framework browsertime has documentation on Alerts View', () => {
|
||||
const framework = 'browsertime';
|
||||
const suite = 'someSuite';
|
||||
|
||||
const perfdocs = new Perfdocs(framework, suite);
|
||||
expect(perfdocs.hasDocumentation('alertsView')).toBeTruthy();
|
||||
});
|
||||
|
||||
test("Some DevTools tests were removed/renamed and don't have documentation", () => {
|
||||
const framework = 'devtools';
|
||||
const suite = removedOldTestsDevTools[0];
|
||||
|
||||
const perfdocs = new Perfdocs(framework, suite);
|
||||
expect(perfdocs.hasDocumentation()).toBeFalsy();
|
||||
});
|
||||
|
||||
test("Some DevTools tests are not yet completed and don't have documentation", () => {
|
||||
const framework = 'devtools';
|
||||
const suite = nonDocumentedTestsDevTools[0];
|
||||
|
||||
const perfdocs = new Perfdocs(framework, suite);
|
||||
expect(perfdocs.hasDocumentation()).toBeFalsy();
|
||||
});
|
|
@ -6,7 +6,12 @@ export const perfViews = {
|
|||
fileBugMarkdown: 'fileBugMarkdown',
|
||||
};
|
||||
|
||||
const testDocumentationFrameworks = ['talos', 'awsy', 'browsertime'];
|
||||
const testDocumentationFrameworks = [
|
||||
'talos',
|
||||
'awsy',
|
||||
'browsertime',
|
||||
'devtools',
|
||||
];
|
||||
const browsertimeDocsUnavailableViews = [
|
||||
perfViews.compareView,
|
||||
perfViews.testsView,
|
||||
|
@ -15,6 +20,7 @@ const supportedPerfdocsFrameworks = {
|
|||
talos: 'talos',
|
||||
awsy: 'awsy',
|
||||
browsertime: 'raptor',
|
||||
devtools: 'performance-tests-overview',
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -93,63 +99,105 @@ const browsertimeBenchmarks = [
|
|||
'youtube-playback-widevine-hfr',
|
||||
];
|
||||
|
||||
const invertedTestsNamesDevTools = {
|
||||
'parent-process:toolbox': 'toolbox:parent-process',
|
||||
'parent-process:target': 'target:parent-process',
|
||||
'parent-process:reload': 'reload:parent-process',
|
||||
'content-process:reload': 'reload:content-process',
|
||||
};
|
||||
|
||||
export const removedOldTestsDevTools = [
|
||||
'total-after-gc',
|
||||
'reload-total-after-gc',
|
||||
'content-total-after-gc',
|
||||
'reload-content-total-after-gc',
|
||||
'toolbox-total-after-gc',
|
||||
'target-total-after-gc',
|
||||
];
|
||||
|
||||
// TODO: remove these once the documentation for DevTools is complete
|
||||
export const nonDocumentedTestsDevTools = [
|
||||
'reload-inspector:content-process',
|
||||
'reload-inspector:parent-process',
|
||||
'reload-debugger:content-process',
|
||||
'reload-debugger:parent-process',
|
||||
'reload-no-devtools:content-process',
|
||||
'reload-no-devtools:parent-process',
|
||||
'reload-netmonitor:content-process',
|
||||
'reload-netmonitor:parent-process',
|
||||
'reload-webconsole:parent-process',
|
||||
'reload-webconsole:content-process',
|
||||
];
|
||||
|
||||
/**
|
||||
* TODO: remove hardcoded names once suffixes are removed from Perfdocs
|
||||
* @link https://firefox-source-docs.mozilla.org/testing/perfdocs/raptor.html#custom
|
||||
*/
|
||||
const browsertimeCustomTests = ['process-switch', 'welcome'];
|
||||
|
||||
const baseURL = 'https://firefox-source-docs.mozilla.org/testing/perfdocs/';
|
||||
const baseURL = 'https://firefox-source-docs.mozilla.org/';
|
||||
|
||||
export class Perfdocs {
|
||||
/**
|
||||
* Class that provides a link where possible with
|
||||
* detailed information about each test suite.
|
||||
*/
|
||||
constructor(framework, suite, platform = null, title = null) {
|
||||
this.framework = framework;
|
||||
constructor(framework, suite, platform = '', title = '') {
|
||||
this.framework = framework || '';
|
||||
this.suite = suite || '';
|
||||
this.platform = platform;
|
||||
this.platform = platform || '';
|
||||
this.title = title || '';
|
||||
this.url = null;
|
||||
this.remainingTestName = null;
|
||||
this.remainingTestName = '';
|
||||
}
|
||||
|
||||
get remainingName() {
|
||||
if (!this.remainingTestName) {
|
||||
if (this.remainingTestName.length === 0) {
|
||||
this.remainingTestName = this.title.replace(this.suite, '');
|
||||
}
|
||||
return this.remainingTestName;
|
||||
}
|
||||
|
||||
get documentationURL() {
|
||||
if (!this.url) {
|
||||
const frameworkName = supportedPerfdocsFrameworks[this.framework];
|
||||
this.url = baseURL.concat(
|
||||
frameworkName,
|
||||
'.html#',
|
||||
this.suite.replace(/_|\s/g, '-').toLowerCase(),
|
||||
);
|
||||
if (this.framework === 'browsertime') {
|
||||
if (browsertimeBenchmarks.includes(this.suite)) {
|
||||
this.url = this.url.concat('-b');
|
||||
} else if (browsertimeCustomTests.includes(this.suite)) {
|
||||
this.url = this.url.concat('-c');
|
||||
} else if (this.platform.includes('android')) {
|
||||
this.url = this.url.concat('-m');
|
||||
} else this.url = this.url.concat('-d');
|
||||
}
|
||||
let url;
|
||||
const frameworkName = supportedPerfdocsFrameworks[this.framework];
|
||||
if (!frameworkName) {
|
||||
url = baseURL.concat('testing/perfdocs/');
|
||||
return url;
|
||||
}
|
||||
return this.url;
|
||||
url =
|
||||
frameworkName === 'performance-tests-overview'
|
||||
? baseURL.concat('devtools/tests/')
|
||||
: baseURL.concat('testing/perfdocs/');
|
||||
if (this.suite in invertedTestsNamesDevTools) {
|
||||
this.suite = invertedTestsNamesDevTools[this.suite];
|
||||
}
|
||||
url = url.concat(
|
||||
frameworkName,
|
||||
'.html#',
|
||||
this.suite.replace(/:|_|\s|\./g, '-').toLowerCase(),
|
||||
);
|
||||
if (frameworkName === 'raptor') {
|
||||
if (browsertimeBenchmarks.includes(this.suite)) {
|
||||
url = url.concat('-b');
|
||||
} else if (browsertimeCustomTests.includes(this.suite)) {
|
||||
url = url.concat('-c');
|
||||
} else if (this.platform.includes('android')) {
|
||||
url = url.concat('-m');
|
||||
} else url = url.concat('-d');
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
hasDocumentation(perfherderView = null) {
|
||||
if (
|
||||
this.framework === 'browsertime' &&
|
||||
browsertimeDocsUnavailableViews.includes(perfherderView)
|
||||
(this.framework === 'browsertime' &&
|
||||
browsertimeDocsUnavailableViews.includes(perfherderView)) ||
|
||||
removedOldTestsDevTools.includes(this.suite) ||
|
||||
nonDocumentedTestsDevTools.includes(this.suite)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return testDocumentationFrameworks.includes(this.framework);
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче