Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
adamraine authored Nov 7, 2024
2 parents e4b8f8d + 92ec8cd commit a065cdd
Show file tree
Hide file tree
Showing 58 changed files with 107 additions and 343 deletions.
8 changes: 4 additions & 4 deletions cli/test/smokehouse/test-definitions/a11y.js
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ const expectations = {
'type': 'node',
'selector': 'body > section > button#button-name',
'snippet': '<button id="button-name">',
'explanation': 'Fix any of the following:\n Element does not have inner text that is visible to screen readers\n aria-label attribute does not exist or is empty\n aria-labelledby attribute does not exist, references elements that do not exist or references elements that are empty\n Element has no title attribute\n Element\'s default semantics were not overridden with role="none" or role="presentation"',
'explanation': 'Fix any of the following:\n Element does not have inner text that is visible to screen readers\n aria-label attribute does not exist or is empty\n aria-labelledby attribute does not exist, references elements that do not exist or references elements that are empty\n Element has no title attribute\n Element does not have an implicit (wrapped) <label>\n Element does not have an explicit <label>\n Element\'s default semantics were not overridden with role="none" or role="presentation"',
'nodeLabel': 'body > section > button#button-name',
},
},
Expand Down Expand Up @@ -688,7 +688,7 @@ const expectations = {
'type': 'node',
'selector': 'body > section > form > input#input-button-name',
'snippet': '<input type="button" id="input-button-name">',
'explanation': 'Fix any of the following:\n Element has a value attribute and the value attribute is empty\n Element has no value attribute\n aria-label attribute does not exist or is empty\n aria-labelledby attribute does not exist, references elements that do not exist or references elements that are empty\n Element has no title attribute\n Element\'s default semantics were not overridden with role="none" or role="presentation"',
'explanation': 'Fix any of the following:\n Element has a value attribute and the value attribute is empty\n Element has no value attribute\n aria-label attribute does not exist or is empty\n aria-labelledby attribute does not exist, references elements that do not exist or references elements that are empty\n Element has no title attribute\n Element does not have an implicit (wrapped) <label>\n Element does not have an explicit <label>\n Element\'s default semantics were not overridden with role="none" or role="presentation"',
'nodeLabel': 'body > section > form > input#input-button-name',
},
},
Expand All @@ -704,7 +704,7 @@ const expectations = {
'type': 'node',
'selector': 'body > section > input#input-image-alt',
'snippet': '<input type="image" id="input-image-alt">',
'explanation': 'Fix any of the following:\n Element has no alt attribute\n aria-label attribute does not exist or is empty\n aria-labelledby attribute does not exist, references elements that do not exist or references elements that are empty\n Element has no title attribute',
'explanation': 'Fix any of the following:\n Element has no alt attribute\n aria-label attribute does not exist or is empty\n aria-labelledby attribute does not exist, references elements that do not exist or references elements that are empty\n Element has no title attribute\n Element does not have an implicit (wrapped) <label>\n Element does not have an explicit <label>',
'nodeLabel': 'body > section > input#input-image-alt',
},
},
Expand Down Expand Up @@ -866,7 +866,7 @@ const expectations = {
'type': 'node',
'selector': 'body > section > select#select-name',
'snippet': '<select id="select-name">',
'explanation': 'Fix any of the following:\n Form element does not have an implicit (wrapped) <label>\n Form element does not have an explicit <label>\n aria-label attribute does not exist or is empty\n aria-labelledby attribute does not exist, references elements that do not exist or references elements that are empty\n Element has no title attribute\n Element\'s default semantics were not overridden with role="none" or role="presentation"',
'explanation': 'Fix any of the following:\n Element does not have an implicit (wrapped) <label>\n Element does not have an explicit <label>\n aria-label attribute does not exist or is empty\n aria-labelledby attribute does not exist, references elements that do not exist or references elements that are empty\n Element has no title attribute\n Element\'s default semantics were not overridden with role="none" or role="presentation"',
'nodeLabel': 'body > section > select#select-name',
},
},
Expand Down
5 changes: 5 additions & 0 deletions core/config/lr-mobile-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ const config = {
settings: {
maxWaitForFcp: 15 * 1000,
maxWaitForLoad: 35 * 1000,
throttling: {
// Determined using PSI CPU benchmark median and
// https://lighthouse-cpu-throttling-calculator.vercel.app/
cpuSlowdownMultiplier: 1.5,
},
skipAudits: [
// Skip the h2 audit so it doesn't lie to us. See https://github.com/GoogleChrome/lighthouse/issues/6539
'uses-http2',
Expand Down
4 changes: 4 additions & 0 deletions core/gather/driver/target-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@ class TargetManager extends ProtocolEventEmitter {
// Sometimes targets can be closed before we even have a chance to listen to their network activity.
if (/Target closed/.test(err.message)) return;

// `Target.getTargetInfo` is not implemented for certain target types.
// Lighthouse isn't interested in these targets anyway so we can just ignore them.
if (/'Target.getTargetInfo' wasn't found/.test(err)) return;

// Worker targets can be a bit fickle and we only enable them for diagnostic purposes.
// We shouldn't throw a fatal error if there were issues attaching to them.
if (targetType === 'worker') {
Expand Down
1 change: 0 additions & 1 deletion core/scripts/i18n/collect-strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,6 @@ function checkKnownFixedCollisions(strings) {
'Back/forward cache is disabled due to a keepalive request.',
'Consider uploading your GIF to a service which will make it available to embed as an HTML5 video.',
'Consider uploading your GIF to a service which will make it available to embed as an HTML5 video.',
'Consider uploading your GIF to a service which will make it available to embed as an HTML5 video.',
'Document contains a $MARKDOWN_SNIPPET_0$ that triggers $MARKDOWN_SNIPPET_1$',
'Document contains a $MARKDOWN_SNIPPET_0$ that triggers $MARKDOWN_SNIPPET_1$',
'Document has a valid $MARKDOWN_SNIPPET_0$',
Expand Down
16 changes: 13 additions & 3 deletions core/scripts/pptr-run-devtools.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,22 @@ async function evaluateInSession(session, fn, deps) {
* @return {Promise<R>}
*/
async function waitForFunction(session, fn, deps) {
let iterations = 0;
// eslint-disable-next-line no-constant-condition
while (true) {
try {
return await evaluateInSession(session, fn, deps);
} catch {
} catch (err) {
// Random transient errors are common when first booting up.
// Only surface errors if this fails 10 times in a row (~5s)
if (iterations > 10) {
console.error(`Error waiting for function (#${iterations}):`);
console.error(err);
console.error('Retrying...');
}
await new Promise(r => setTimeout(r, 500));
} finally {
++iterations;
}
}
}
Expand Down Expand Up @@ -161,7 +171,7 @@ async function waitForLighthouseReady() {

const panel = LighthousePanel.LighthousePanel.instance();

const button = panel.contentElement.querySelector('devtools-button,button');
const button = panel.contentElement.querySelector('.vbox.flex-auto').shadowRoot.querySelector('devtools-button,button');
if (button.disabled) throw new Error('Start button disabled');

const targetManager = TargetManager.TargetManager.instance();
Expand Down Expand Up @@ -213,7 +223,7 @@ async function runLighthouse() {
// In CI clicking the start button just once is flaky and can cause a timeout.
// Therefore, keep clicking the button until we detect that the run started.
const intervalHandle = setInterval(() => {
const button = panel.contentElement.querySelector('devtools-button,button');
const button = panel.contentElement.querySelector('.vbox.flex-auto').shadowRoot.querySelector('devtools-button,button');
button.click();
}, 100);

Expand Down
15 changes: 15 additions & 0 deletions core/test/gather/driver/target-manager-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,21 @@ describe('TargetManager', () => {
expect(sendMock.findAllInvocations('Runtime.runIfWaitingForDebugger')).toHaveLength(1);
});

it('should ignore errors if Target.getTargetInfo is undefined', async () => {
targetInfo.type = 'worker';
sendMock
.mockResponse('Target.getTargetInfo', () => {
throw new Error(`'Target.getTargetInfo' wasn't found`);
});
await targetManager.enable();

const invocations = sendMock.findAllInvocations('Target.setAutoAttach');
expect(invocations).toHaveLength(0);

// Should still be resumed.
expect(sendMock.findAllInvocations('Runtime.runIfWaitingForDebugger')).toHaveLength(1);
});

it('should ignore targets that are not frames or web workers', async () => {
targetInfo.type = 'service_worker';
sendMock
Expand Down
7 changes: 4 additions & 3 deletions core/test/lib/stack-packs-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,20 +101,22 @@ Array [
"id": "drupal",
"keys": Array [
"unused-css-rules",
"unused-javascript",
"modern-image-formats",
"offscreen-images",
"total-byte-weight",
"render-blocking-resources",
"unminified-css",
"unminified-javascript",
"efficient-animated-content",
"unused-javascript",
"uses-long-cache-ttl",
"uses-optimized-images",
"uses-text-compression",
"uses-responsive-images",
"prioritize-lcp-image",
"server-response-time",
"redirects",
"uses-rel-preconnect",
"font-display",
],
},
Object {
Expand Down Expand Up @@ -216,7 +218,6 @@ Array [
"uses-optimized-images",
"uses-text-compression",
"uses-responsive-images",
"server-response-time",
"dom-size",
"font-display",
],
Expand Down
2 changes: 1 addition & 1 deletion core/test/results/sample_v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -6933,7 +6933,7 @@
"uses-optimized-images": "Consider using an [image optimization WordPress plugin](https://wordpress.org/plugins/search/optimize+images/) that compresses your images while retaining quality.",
"uses-text-compression": "You can enable text compression in your web server configuration.",
"uses-responsive-images": "Upload images directly through the [media library](https://wordpress.org/support/article/media-library-screen/) to ensure that the required image sizes are available, and then insert them from the media library or use the image widget to ensure the optimal image sizes are used (including those for the responsive breakpoints). Avoid using `Full Size` images unless the dimensions are adequate for their usage. [Learn More](https://wordpress.org/support/article/inserting-images-into-posts-and-pages/).",
"server-response-time": "Themes, plugins, and server specifications all contribute to server response time. Consider finding a more optimized theme, carefully selecting an optimization plugin, and/or upgrading your server."
"server-response-time": "Choose a lightweight theme (ideally a block theme) and implement full-page caching or a static site solution. Disable unnecessary plugins to minimize server overhead. Consider upgrading your hosting to managed or dedicated service."
}
}
],
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
"dependencies": {
"@paulirish/trace_engine": "0.0.32",
"@sentry/node": "^7.0.0",
"axe-core": "^4.10.0",
"axe-core": "^4.10.2",
"chrome-launcher": "^1.1.2",
"configstore": "^5.0.1",
"csp_evaluator": "1.1.1",
Expand All @@ -194,7 +194,7 @@
"jpeg-js": "^0.4.4",
"js-library-detector": "^6.7.0",
"lighthouse-logger": "^2.0.1",
"lighthouse-stack-packs": "1.12.1",
"lighthouse-stack-packs": "1.12.2",
"lodash-es": "^4.17.21",
"lookup-closest-locale": "6.2.0",
"metaviewport-parser": "0.3.0",
Expand All @@ -204,7 +204,7 @@
"robots-parser": "^3.0.1",
"semver": "^5.3.0",
"speedline-core": "^1.4.3",
"third-party-web": "^0.24.5",
"third-party-web": "^0.26.1",
"tldts-icann": "^6.1.16",
"ws": "^7.0.0",
"yargs": "^17.3.1",
Expand Down
6 changes: 0 additions & 6 deletions shared/localization/locales/ar-XB.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions shared/localization/locales/ar.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions shared/localization/locales/bg.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a065cdd

Please sign in to comment.