<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[57083] trunk: Build/Test Tools: Expand performance test scenarios.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/57083">57083</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/57083","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>swissspidy</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2023-11-08 10:30:21 +0000 (Wed, 08 Nov 2023)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Build/Test Tools: Expand performance test scenarios.
Adds new tests for localized sites as well as the dashboard.
Also amends Server-Timing output to measure memory usage in all scenarios.
Props swissspidy, joemcgill, flixos90, mukesh27, mamaduka.
See <a href="https://core.trac.wordpress.org/ticket/59656">#59656</a>.
Fixes <a href="https://core.trac.wordpress.org/ticket/59815">#59815</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkgithubworkflowsperformanceyml">trunk/.github/workflows/performance.yml</a></li>
<li><a href="#trunktestsperformancecompareresultsjs">trunk/tests/performance/compare-results.js</a></li>
<li><a href="#trunktestsperformancelogresultsjs">trunk/tests/performance/log-results.js</a></li>
<li><a href="#trunktestsperformanceplaywrightconfigjs">trunk/tests/performance/playwright.config.js</a></li>
<li><a href="#trunktestsperformanceresultsjs">trunk/tests/performance/results.js</a></li>
<li><a href="#trunktestsperformancespecshomeblockthemetestjs">trunk/tests/performance/specs/home-block-theme.test.js</a></li>
<li><a href="#trunktestsperformancespecshomeclassicthemetestjs">trunk/tests/performance/specs/home-classic-theme.test.js</a></li>
<li><a href="#trunktestsperformancewpcontentmupluginsservertimingphp">trunk/tests/performance/wp-content/mu-plugins/server-timing.php</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunktestsperformancespecsadminl10ntestjs">trunk/tests/performance/specs/admin-l10n.test.js</a></li>
<li><a href="#trunktestsperformancespecsadmintestjs">trunk/tests/performance/specs/admin.test.js</a></li>
<li><a href="#trunktestsperformancespecshomeblockthemel10ntestjs">trunk/tests/performance/specs/home-block-theme-l10n.test.js</a></li>
<li><a href="#trunktestsperformancespecshomeclassicthemel10ntestjs">trunk/tests/performance/specs/home-classic-theme-l10n.test.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkgithubworkflowsperformanceyml"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/.github/workflows/performance.yml</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/.github/workflows/performance.yml 2023-11-08 00:34:17 UTC (rev 57082)
+++ trunk/.github/workflows/performance.yml 2023-11-08 10:30:21 UTC (rev 57083)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -162,6 +162,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> run: |
</span><span class="cx" style="display: block; padding: 0 10px"> npm run env:cli -- rewrite structure '/%year%/%monthnum%/%postname%/' --path=/var/www/${{ env.LOCAL_DIR }}
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ - name: Install additional languages
+ run: |
+ npm run env:cli -- language core install de_DE --path=/var/www/${{ env.LOCAL_DIR }}
+ npm run env:cli -- language plugin install de_DE --all --path=/var/www/${{ env.LOCAL_DIR }}
+ npm run env:cli -- language theme install de_DE --all --path=/var/www/${{ env.LOCAL_DIR }}
+
</ins><span class="cx" style="display: block; padding: 0 10px"> - name: Install MU plugin
</span><span class="cx" style="display: block; padding: 0 10px"> run: |
</span><span class="cx" style="display: block; padding: 0 10px"> mkdir ./${{ env.LOCAL_DIR }}/wp-content/mu-plugins
</span></span></pre></div>
<a id="trunktestsperformancecompareresultsjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/performance/compare-results.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/performance/compare-results.js 2023-11-08 00:34:17 UTC (rev 57082)
+++ trunk/tests/performance/compare-results.js 2023-11-08 10:30:21 UTC (rev 57083)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -23,7 +23,14 @@
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // The list of test suites to log.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-const testSuites = [ 'home-block-theme', 'home-classic-theme' ];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+const testSuites = [
+ 'admin',
+ 'admin-l10n',
+ 'home-block-theme',
+ 'home-block-theme-l10n',
+ 'home-classic-theme',
+ 'home-classic-theme-l10n',
+];
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // The current commit's results.
</span><span class="cx" style="display: block; padding: 0 10px"> const testResults = Object.fromEntries(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -128,6 +135,23 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> console.log( 'Note: Due to the nature of how GitHub Actions work, some variance in the results is expected.\n' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/**
+ * Nicely formats a given value.
+ *
+ * @param {string} metric Metric.
+ * @param {number} value
+ */
+function formatValue( metric, value) {
+ if ( null === value ) {
+ return 'N/A';
+ }
+ if ( 'wpMemoryUsage' === metric ) {
+ return `${ ( value / Math.pow( 10, 6 ) ).toFixed( 2 ) } MB`;
+ }
+
+ return `${ value.toFixed( 2 ) } ms`;
+}
+
</ins><span class="cx" style="display: block; padding: 0 10px"> for ( const key of testSuites ) {
</span><span class="cx" style="display: block; padding: 0 10px"> const current = testResults[ key ] || {};
</span><span class="cx" style="display: block; padding: 0 10px"> const prev = prevResults[ key ] || {};
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -141,15 +165,15 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> for ( const [ metric, values ] of Object.entries( current ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> const value = median( values );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- const prevValue = median( prev[ metric ] );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ const prevValue = prev[ metric ] ? median( prev[ metric ] ) : null;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- const delta = value - prevValue;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ const delta = null !== prevValue ? value - prevValue : 0
</ins><span class="cx" style="display: block; padding: 0 10px"> const percentage = ( delta / value ) * 100;
</span><span class="cx" style="display: block; padding: 0 10px"> rows.push( {
</span><span class="cx" style="display: block; padding: 0 10px"> Metric: metric,
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- Before: `${ prevValue.toFixed( 2 ) } ms`,
- After: `${ value.toFixed( 2 ) } ms`,
- 'Diff abs.': `${ delta.toFixed( 2 ) } ms`,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ Before: formatValue( metric, prevValue ),
+ After: formatValue( metric, value ),
+ 'Diff abs.': formatValue( metric, delta ),
</ins><span class="cx" style="display: block; padding: 0 10px"> 'Diff %': `${ percentage.toFixed( 2 ) } %`,
</span><span class="cx" style="display: block; padding: 0 10px"> } );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunktestsperformancelogresultsjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/performance/log-results.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/performance/log-results.js 2023-11-08 00:34:17 UTC (rev 57082)
+++ trunk/tests/performance/log-results.js 2023-11-08 10:30:21 UTC (rev 57083)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -11,8 +11,12 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // The list of test suites to log.
</span><span class="cx" style="display: block; padding: 0 10px"> const testSuites = [
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'admin',
+ 'admin-l10n',
</ins><span class="cx" style="display: block; padding: 0 10px"> 'home-block-theme',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'home-block-theme-l10n',
</ins><span class="cx" style="display: block; padding: 0 10px"> 'home-classic-theme',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'home-classic-theme-l10n',
</ins><span class="cx" style="display: block; padding: 0 10px"> ];
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // A list of results to parse based on test suites.
</span></span></pre></div>
<a id="trunktestsperformanceplaywrightconfigjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/performance/playwright.config.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/performance/playwright.config.js 2023-11-08 00:34:17 UTC (rev 57082)
+++ trunk/tests/performance/playwright.config.js 2023-11-08 10:30:21 UTC (rev 57083)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -19,9 +19,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> const config = defineConfig( {
</span><span class="cx" style="display: block; padding: 0 10px"> ...baseConfig,
</span><span class="cx" style="display: block; padding: 0 10px"> globalSetup: require.resolve( './config/global-setup.js' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- reporter: process.env.CI
- ? './config/performance-reporter.js'
- : [ [ 'list' ], [ './config/performance-reporter.js' ] ],
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ reporter: [ [ 'list' ], [ './config/performance-reporter.js' ] ],
</ins><span class="cx" style="display: block; padding: 0 10px"> forbidOnly: !! process.env.CI,
</span><span class="cx" style="display: block; padding: 0 10px"> workers: 1,
</span><span class="cx" style="display: block; padding: 0 10px"> retries: 0,
</span></span></pre></div>
<a id="trunktestsperformanceresultsjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/performance/results.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/performance/results.js 2023-11-08 00:34:17 UTC (rev 57082)
+++ trunk/tests/performance/results.js 2023-11-08 10:30:21 UTC (rev 57083)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -8,8 +8,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> const { median, getResultsFilename } = require( './utils' );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> const testSuites = [
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'admin',
+ 'admin-l10n',
</ins><span class="cx" style="display: block; padding: 0 10px"> 'home-classic-theme',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'home-classic-theme-l10n',
</ins><span class="cx" style="display: block; padding: 0 10px"> 'home-block-theme',
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'home-block-theme-l10n',
</ins><span class="cx" style="display: block; padding: 0 10px"> ];
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> console.log( '\n>> 🎉 Results 🎉 \n' );
</span></span></pre></div>
<a id="trunktestsperformancespecsadminl10ntestjs"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/tests/performance/specs/admin-l10n.test.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/performance/specs/admin-l10n.test.js (rev 0)
+++ trunk/tests/performance/specs/admin-l10n.test.js 2023-11-08 10:30:21 UTC (rev 57083)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,52 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/**
+ * WordPress dependencies
+ */
+import { test } from '@wordpress/e2e-test-utils-playwright';
+
+/**
+ * Internal dependencies
+ */
+import { camelCaseDashes } from '../utils';
+
+const results = {
+ timeToFirstByte: [],
+};
+
+test.describe( 'Admin (L10N)', () => {
+ test.beforeAll( async ( { requestUtils } ) => {
+ await requestUtils.activateTheme( 'twentytwentyone' );
+ await requestUtils.updateSiteSettings( {
+ language: 'de_DE',
+ } );
+ } );
+
+ test.afterAll( async ( { requestUtils }, testInfo ) => {
+ await testInfo.attach( 'results', {
+ body: JSON.stringify( results, null, 2 ),
+ contentType: 'application/json',
+ } );
+ await requestUtils.updateSiteSettings( {
+ language: '',
+ } );
+ } );
+
+ const iterations = Number( process.env.TEST_RUNS );
+ for ( let i = 1; i <= iterations; i++ ) {
+ test( `Measure load time metrics (${ i } of ${ iterations })`, async ( {
+ admin,
+ metrics,
+ } ) => {
+ await admin.visitAdminPage( '/' );
+
+ const serverTiming = await metrics.getServerTiming();
+
+ for ( const [ key, value ] of Object.entries( serverTiming ) ) {
+ results[ camelCaseDashes( key ) ] ??= [];
+ results[ camelCaseDashes( key ) ].push( value );
+ }
+
+ const ttfb = await metrics.getTimeToFirstByte();
+ results.timeToFirstByte.push( ttfb );
+ } );
+ }
+} );
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/performance/specs/admin-l10n.test.js
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="trunktestsperformancespecsadmintestjs"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/tests/performance/specs/admin.test.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/performance/specs/admin.test.js (rev 0)
+++ trunk/tests/performance/specs/admin.test.js 2023-11-08 10:30:21 UTC (rev 57083)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,46 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/**
+ * WordPress dependencies
+ */
+import { test } from '@wordpress/e2e-test-utils-playwright';
+
+/**
+ * Internal dependencies
+ */
+import { camelCaseDashes } from '../utils';
+
+const results = {
+ timeToFirstByte: [],
+};
+
+test.describe( 'Admin', () => {
+ test.beforeAll( async ( { requestUtils } ) => {
+ await requestUtils.activateTheme( 'twentytwentyone' );
+ } );
+
+ test.afterAll( async ( {}, testInfo ) => {
+ await testInfo.attach( 'results', {
+ body: JSON.stringify( results, null, 2 ),
+ contentType: 'application/json',
+ } );
+ } );
+
+ const iterations = Number( process.env.TEST_RUNS );
+ for ( let i = 1; i <= iterations; i++ ) {
+ test( `Measure load time metrics (${ i } of ${ iterations })`, async ( {
+ admin,
+ metrics,
+ } ) => {
+ await admin.visitAdminPage( '/' );
+
+ const serverTiming = await metrics.getServerTiming();
+
+ for ( const [ key, value ] of Object.entries( serverTiming ) ) {
+ results[ camelCaseDashes( key ) ] ??= [];
+ results[ camelCaseDashes( key ) ].push( value );
+ }
+
+ const ttfb = await metrics.getTimeToFirstByte();
+ results.timeToFirstByte.push( ttfb );
+ } );
+ }
+} );
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/performance/specs/admin.test.js
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="trunktestsperformancespecshomeblockthemel10ntestjs"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/tests/performance/specs/home-block-theme-l10n.test.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/performance/specs/home-block-theme-l10n.test.js (rev 0)
+++ trunk/tests/performance/specs/home-block-theme-l10n.test.js 2023-11-08 10:30:21 UTC (rev 57083)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,63 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/**
+ * WordPress dependencies
+ */
+import { test } from '@wordpress/e2e-test-utils-playwright';
+
+/**
+ * Internal dependencies
+ */
+import { camelCaseDashes } from '../utils';
+
+const results = {
+ timeToFirstByte: [],
+ largestContentfulPaint: [],
+ lcpMinusTtfb: [],
+};
+
+test.describe( 'Front End - Twenty Twenty Three (L10N)', () => {
+ test.use( {
+ storageState: {}, // User will be logged out.
+ } );
+
+ test.beforeAll( async ( { requestUtils } ) => {
+ await requestUtils.activateTheme( 'twentytwentythree' );
+ await requestUtils.updateSiteSettings( {
+ language: 'de_DE',
+ } );
+ } );
+
+ test.afterAll( async ( { requestUtils }, testInfo ) => {
+ await testInfo.attach( 'results', {
+ body: JSON.stringify( results, null, 2 ),
+ contentType: 'application/json',
+ } );
+ await requestUtils.activateTheme( 'twentytwentyone' );
+ await requestUtils.updateSiteSettings( {
+ language: '',
+ } );
+ } );
+
+ const iterations = Number( process.env.TEST_RUNS );
+ for ( let i = 1; i <= iterations; i++ ) {
+ test( `Measure load time metrics (${ i } of ${ iterations })`, async ( {
+ page,
+ metrics,
+ } ) => {
+ await page.goto( '/' );
+
+ const serverTiming = await metrics.getServerTiming();
+
+ for ( const [ key, value ] of Object.entries( serverTiming ) ) {
+ results[ camelCaseDashes( key ) ] ??= [];
+ results[ camelCaseDashes( key ) ].push( value );
+ }
+
+ const ttfb = await metrics.getTimeToFirstByte();
+ const lcp = await metrics.getLargestContentfulPaint();
+
+ results.largestContentfulPaint.push( lcp );
+ results.timeToFirstByte.push( ttfb );
+ results.lcpMinusTtfb.push( lcp - ttfb );
+ } );
+ }
+} );
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/performance/specs/home-block-theme-l10n.test.js
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="trunktestsperformancespecshomeblockthemetestjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/performance/specs/home-block-theme.test.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/performance/specs/home-block-theme.test.js 2023-11-08 00:34:17 UTC (rev 57082)
+++ trunk/tests/performance/specs/home-block-theme.test.js 2023-11-08 10:30:21 UTC (rev 57083)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -41,7 +41,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> const serverTiming = await metrics.getServerTiming();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- for ( const [key, value] of Object.entries( serverTiming ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ for ( const [ key, value ] of Object.entries( serverTiming ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> results[ camelCaseDashes( key ) ] ??= [];
</span><span class="cx" style="display: block; padding: 0 10px"> results[ camelCaseDashes( key ) ].push( value );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunktestsperformancespecshomeclassicthemel10ntestjs"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: trunk/tests/performance/specs/home-classic-theme-l10n.test.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/performance/specs/home-classic-theme-l10n.test.js (rev 0)
+++ trunk/tests/performance/specs/home-classic-theme-l10n.test.js 2023-11-08 10:30:21 UTC (rev 57083)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -0,0 +1,62 @@
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/**
+ * WordPress dependencies
+ */
+import { test } from '@wordpress/e2e-test-utils-playwright';
+
+/**
+ * Internal dependencies
+ */
+import { camelCaseDashes } from '../utils';
+
+const results = {
+ timeToFirstByte: [],
+ largestContentfulPaint: [],
+ lcpMinusTtfb: [],
+};
+
+test.describe( 'Front End - Twenty Twenty One (L10N)', () => {
+ test.use( {
+ storageState: {}, // User will be logged out.
+ } );
+
+ test.beforeAll( async ( { requestUtils } ) => {
+ await requestUtils.activateTheme( 'twentytwentyone' );
+ await requestUtils.updateSiteSettings( {
+ language: 'de_DE',
+ } );
+ } );
+
+ test.afterAll( async ( { requestUtils }, testInfo ) => {
+ await testInfo.attach( 'results', {
+ body: JSON.stringify( results, null, 2 ),
+ contentType: 'application/json',
+ } );
+ await requestUtils.updateSiteSettings( {
+ language: '',
+ } );
+ } );
+
+ const iterations = Number( process.env.TEST_RUNS );
+ for ( let i = 1; i <= iterations; i++ ) {
+ test( `Measure load time metrics (${ i } of ${ iterations })`, async ( {
+ page,
+ metrics,
+ } ) => {
+ await page.goto( '/' );
+
+ const serverTiming = await metrics.getServerTiming();
+
+ for ( const [ key, value ] of Object.entries( serverTiming ) ) {
+ results[ camelCaseDashes( key ) ] ??= [];
+ results[ camelCaseDashes( key ) ].push( value );
+ }
+
+ const ttfb = await metrics.getTimeToFirstByte();
+ const lcp = await metrics.getLargestContentfulPaint();
+
+ results.largestContentfulPaint.push( lcp );
+ results.timeToFirstByte.push( ttfb );
+ results.lcpMinusTtfb.push( lcp - ttfb );
+ } );
+ }
+} );
</ins><span class="cx" style="display: block; padding: 0 10px">Property changes on: trunk/tests/performance/specs/home-classic-theme-l10n.test.js
</span><span class="cx" style="display: block; padding: 0 10px">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Added: svn:eol-style</h4></div>
<ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+native
</ins><span class="cx" style="display: block; padding: 0 10px">\ No newline at end of property
</span><a id="trunktestsperformancespecshomeclassicthemetestjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/performance/specs/home-classic-theme.test.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/performance/specs/home-classic-theme.test.js 2023-11-08 00:34:17 UTC (rev 57082)
+++ trunk/tests/performance/specs/home-classic-theme.test.js 2023-11-08 10:30:21 UTC (rev 57083)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -40,7 +40,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> const serverTiming = await metrics.getServerTiming();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- for (const [key, value] of Object.entries( serverTiming ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ for ( const [ key, value ] of Object.entries( serverTiming ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> results[ camelCaseDashes( key ) ] ??= [];
</span><span class="cx" style="display: block; padding: 0 10px"> results[ camelCaseDashes( key ) ].push( value );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre></div>
<a id="trunktestsperformancewpcontentmupluginsservertimingphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/performance/wp-content/mu-plugins/server-timing.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/performance/wp-content/mu-plugins/server-timing.php 2023-11-08 00:34:17 UTC (rev 57082)
+++ trunk/tests/performance/wp-content/mu-plugins/server-timing.php 2023-11-08 10:30:21 UTC (rev 57083)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -25,6 +25,13 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $server_timing_values['total'] = $server_timing_values['before-template'] + $server_timing_values['template'];
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ /*
+ * While values passed via Server-Timing are intended to be durations,
+ * any numeric value can actually be passed.
+ * This is a nice little trick as it allows to easily get this information in JS.
+ */
+ $server_timing_values['memory-usage'] = memory_get_usage();
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $header_values = array();
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $server_timing_values as $slug => $value ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( is_float( $value ) ) {
</span></span></pre>
</div>
</div>
</body>
</html>