3
0
镜像自地址 https://github.com/wikimedia/Vector 已同步 2024-05-30 13:42:48 +08:00

Merge "Restore test and increase budget with debug information"

这个提交包含在:
jenkins-bot 2023-11-06 13:34:49 +00:00 提交者 Gerrit Code Review
当前提交 e4581e03e6
共有 2 个文件被更改,包括 14 次插入7 次删除

查看文件

@ -2,11 +2,11 @@
"total": {
"vector-2022": {
"scripts": "70.1KB",
"styles": "15KB"
"styles": "17.0KB"
},
"vector": {
"scripts": "57.3KB",
"styles": "8.6KB"
"scripts": "70.1KB",
"styles": "17.0KB"
}
},
"modules": [

查看文件

@ -78,6 +78,11 @@ class PerformanceBudgetTest extends MediaWikiIntegrationTestCase {
* @throws \SkinException
*/
protected function prepareSkin( string $skinName ): \Skin {
// FIXME: disable flagged revisions for purpose of this test by making
// sure the page is not "reviewable" until T350514 is resolved.
$this->overrideConfigValue( 'FlaggedRevsNamespaces', [] );
// END FIXME
$skinFactory = MediaWikiServices::getInstance()->getSkinFactory();
$skin = $skinFactory->makeSkin( $skinName );
$title = $this->getExistingTestPage()->getTitle();
@ -143,34 +148,36 @@ class PerformanceBudgetTest extends MediaWikiIntegrationTestCase {
* @throws MediaWiki\Config\ConfigException
*/
public function testTotalModulesSize( $skinName, $maxSizes ) {
$this->markTestSkipped( 'T350338' );
$skin = $this->prepareSkin( $skinName );
$moduleStyles = $skin->getOutput()->getModuleStyles();
$size = 0;
foreach ( $moduleStyles as $moduleName ) {
$size += $this->getContentTransferSize( $moduleName, $skinName );
}
$debugInformation = "The following modules are enabled on page load:\n" .
implode( "\n", $moduleStyles );
$stylesMaxSize = $this->getSizeInBytes( $maxSizes[ 'styles' ] );
$message = "T346813: Performance budget for style in skin" .
" $skinName on main article namespace has been exceeded." .
" Total size of style modules is $size bytes is greater" .
" than the current budget size of $stylesMaxSize bytes" .
" Please reduce styles that you are loading on page load" .
" or talk to the skin maintainer about modifying the budget.";
" or talk to the skin maintainer about modifying the budget. $debugInformation";
$this->assertLessThanOrEqual( $stylesMaxSize, $size, $message );
$modulesScripts = $skin->getOutput()->getModules();
$size = 0;
foreach ( $modulesScripts as $moduleName ) {
$size += $this->getContentTransferSize( $moduleName, $skinName );
}
$debugInformation = "The following modules are enabled on page load:\n" .
implode( "\n", $modulesScripts );
$scriptsMaxSize = $this->getSizeInBytes( $maxSizes[ 'scripts' ] );
$message = "T346813: Performance budget for scripts in skin" .
" $skinName on main article namespace has been exceeded." .
" Total size of script modules is $size bytes is greater" .
" than the current budget size of $scriptsMaxSize bytes" .
" Please reduce scripts that you are loading on page load" .
" or talk to the skin maintainer about modifying the budget.";
" or talk to the skin maintainer about modifying the budget. $debugInformation";
$this->assertLessThanOrEqual( $scriptsMaxSize, $size, $message );
}
}