lighthouse 9.5.0-dev.20220619 → 9.5.0-dev.20220622
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lighthouse-cli/bin.js +8 -2
- package/lighthouse-cli/test/smokehouse/__snapshots__/report-assert-test.js.snap +71 -0
- package/lighthouse-cli/test/smokehouse/report-assert-test.js +264 -0
- package/lighthouse-cli/test/smokehouse/report-assert.js +39 -35
- package/lighthouse-core/audits/byte-efficiency/unused-javascript.js +1 -1
- package/lighthouse-core/config/config-helpers.js +15 -0
- package/lighthouse-core/fraggle-rock/config/config.js +45 -1
- package/lighthouse-core/fraggle-rock/gather/driver.js +13 -5
- package/lighthouse-core/fraggle-rock/gather/session.js +23 -67
- package/lighthouse-core/gather/driver/navigation.js +1 -1
- package/lighthouse-core/gather/driver/network-monitor.js +14 -59
- package/lighthouse-core/gather/driver/target-manager.js +110 -45
- package/lighthouse-core/gather/driver.js +24 -16
- package/lighthouse-core/gather/gatherers/devtools-log.js +7 -11
- package/lighthouse-core/gather/gatherers/full-page-screenshot.js +1 -1
- package/lighthouse-core/index.js +24 -9
- package/lighthouse-core/lib/cdt/Common.js +13 -0
- package/lighthouse-core/lib/cdt/Platform.js +3 -0
- package/lighthouse-core/lib/cdt/generated/ParsedURL.js +178 -0
- package/lighthouse-core/lib/cdt/generated/SourceMap.js +155 -62
- package/package.json +2 -2
- package/third-party/devtools-tests/README.md +14 -0
- package/third-party/devtools-tests/e2e/lighthouse/generate-report_test.ts +29 -0
- package/third-party/devtools-tests/e2e/lighthouse/indexeddb-warning_test.ts +29 -0
- package/third-party/devtools-tests/e2e/resources/lighthouse/lighthouse-storage.html +11 -0
- package/third-party/download-content-shell/README.md +1 -0
- package/third-party/download-content-shell/download-content-shell.js +6 -1
- package/types/gatherer.d.ts +5 -2
- package/types/protocol.d.ts +19 -17
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Devtools e2e Tests
|
|
2
|
+
|
|
3
|
+
These tests are rolled into the Chromium DevTools Frontend codebase. They "belong" to the devtools frontend, but are truly defined in this Lighthouse repo.
|
|
4
|
+
|
|
5
|
+
Run with `sh lighthouse-core/test/devtools-tests/test-locally.sh`.
|
|
6
|
+
|
|
7
|
+
See `lighthouse-core/test/chromium-web-tests/README.md` for more.
|
|
8
|
+
|
|
9
|
+
## Sync
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
rsync -ahvz --exclude='OWNERS' --exclude='BUILD.gn' ~/src/devtools/devtools-frontend/test/e2e/lighthouse/ third-party/devtools-tests/e2e/lighthouse/
|
|
13
|
+
rsync -ahvz --exclude='OWNERS' --exclude='BUILD.gn' ~/src/devtools/devtools-frontend/test/e2e/resources/lighthouse/ third-party/devtools-tests/e2e/resources/lighthouse/
|
|
14
|
+
```
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Copyright 2020 The Chromium Authors. All rights reserved.
|
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
import {assert} from 'chai';
|
|
6
|
+
|
|
7
|
+
import {goToResource} from '../../shared/helper.js';
|
|
8
|
+
import {describe, it} from '../../shared/mocha-extensions.js';
|
|
9
|
+
import {isGenerateReportButtonDisabled, navigateToLighthouseTab} from '../helpers/lighthouse-helpers.js';
|
|
10
|
+
|
|
11
|
+
describe('The Lighthouse Tab', function() {
|
|
12
|
+
this.timeout(20_000);
|
|
13
|
+
|
|
14
|
+
it('shows a button to generate a new report', async () => {
|
|
15
|
+
await navigateToLighthouseTab('empty.html');
|
|
16
|
+
|
|
17
|
+
const disabled = await isGenerateReportButtonDisabled();
|
|
18
|
+
assert.isFalse(disabled, 'The Generate Report button should not be disabled');
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
// Broken on non-debug runs
|
|
22
|
+
it.skip('[crbug.com/1057948] shows generate report button even when navigating to an unreachable page', async () => {
|
|
23
|
+
await navigateToLighthouseTab('empty.html');
|
|
24
|
+
|
|
25
|
+
await goToResource('network/unreachable.rawresponse');
|
|
26
|
+
const disabled = await isGenerateReportButtonDisabled();
|
|
27
|
+
assert.isTrue(disabled, 'The Generate Report button should be disabled');
|
|
28
|
+
});
|
|
29
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Copyright 2022 The Chromium Authors. All rights reserved.
|
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
import {assert} from 'chai';
|
|
6
|
+
|
|
7
|
+
import {waitFor} from '../../shared/helper.js';
|
|
8
|
+
import {describe, it} from '../../shared/mocha-extensions.js';
|
|
9
|
+
import {navigateToLighthouseTab} from '../helpers/lighthouse-helpers.js';
|
|
10
|
+
|
|
11
|
+
describe('IndexedDB warning', function() {
|
|
12
|
+
this.timeout(20_000);
|
|
13
|
+
|
|
14
|
+
it('displays when important data may affect performance', async () => {
|
|
15
|
+
await navigateToLighthouseTab('empty.html');
|
|
16
|
+
|
|
17
|
+
let warningElem = await waitFor('.lighthouse-warning-text.hidden');
|
|
18
|
+
const warningText1 = await warningElem.evaluate(node => node.textContent?.trim());
|
|
19
|
+
assert.strictEqual(warningText1, '');
|
|
20
|
+
|
|
21
|
+
await navigateToLighthouseTab('lighthouse/lighthouse-storage.html');
|
|
22
|
+
|
|
23
|
+
warningElem = await waitFor('.lighthouse-warning-text:not(.hidden)');
|
|
24
|
+
const expected =
|
|
25
|
+
'There may be stored data affecting loading performance in this location: IndexedDB. Audit this page in an incognito window to prevent those resources from affecting your scores.';
|
|
26
|
+
const warningText2 = await warningElem.evaluate(node => node.textContent?.trim());
|
|
27
|
+
assert.strictEqual(warningText2, expected);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
@@ -34,7 +34,6 @@ function main() {
|
|
|
34
34
|
console.log('Unable to download because of error:', error);
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
main();
|
|
38
37
|
|
|
39
38
|
function onUploadedCommitPosition(commitPosition) {
|
|
40
39
|
const contentShellDirPath = path.resolve(CACHE_PATH, commitPosition, 'out', TARGET);
|
|
@@ -176,3 +175,9 @@ function getContentShellBinaryPath(dirPath) {
|
|
|
176
175
|
return path.resolve(dirPath, 'Content Shell.app', 'Contents', 'MacOS', 'Content Shell');
|
|
177
176
|
}
|
|
178
177
|
}
|
|
178
|
+
|
|
179
|
+
if (process.argv[2] === '--resolve-executable-path') {
|
|
180
|
+
console.log(getContentShellBinaryPath(process.argv[3]));
|
|
181
|
+
} else {
|
|
182
|
+
main();
|
|
183
|
+
}
|
package/types/gatherer.d.ts
CHANGED
|
@@ -28,8 +28,6 @@ declare module Gatherer {
|
|
|
28
28
|
setNextProtocolTimeout(ms: number): void;
|
|
29
29
|
on<TEvent extends keyof LH.CrdpEvents>(event: TEvent, callback: (...args: LH.CrdpEvents[TEvent]) => void): void;
|
|
30
30
|
once<TEvent extends keyof LH.CrdpEvents>(event: TEvent, callback: (...args: LH.CrdpEvents[TEvent]) => void): void;
|
|
31
|
-
addProtocolMessageListener(callback: (payload: Protocol.RawEventMessage) => void): void
|
|
32
|
-
removeProtocolMessageListener(callback: (payload: Protocol.RawEventMessage) => void): void
|
|
33
31
|
off<TEvent extends keyof LH.CrdpEvents>(event: TEvent, callback: (...args: LH.CrdpEvents[TEvent]) => void): void;
|
|
34
32
|
sendCommand<TMethod extends keyof LH.CrdpCommands>(method: TMethod, ...params: LH.CrdpCommands[TMethod]['paramsType']): Promise<LH.CrdpCommands[TMethod]['returnType']>;
|
|
35
33
|
dispose(): Promise<void>;
|
|
@@ -41,6 +39,11 @@ declare module Gatherer {
|
|
|
41
39
|
executionContext: ExecutionContext;
|
|
42
40
|
fetcher: Fetcher;
|
|
43
41
|
url: () => Promise<string>;
|
|
42
|
+
targetManager: {
|
|
43
|
+
rootSession(): FRProtocolSession;
|
|
44
|
+
on(event: 'protocolevent', callback: (payload: Protocol.RawEventMessage) => void): void
|
|
45
|
+
off(event: 'protocolevent', callback: (payload: Protocol.RawEventMessage) => void): void
|
|
46
|
+
};
|
|
44
47
|
}
|
|
45
48
|
|
|
46
49
|
/** The limited context interface shared between pre and post Fraggle Rock Lighthouse. */
|
package/types/protocol.d.ts
CHANGED
|
@@ -5,6 +5,23 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
declare module Protocol {
|
|
8
|
+
/**
|
|
9
|
+
* An intermediate type, used to create a record of all possible Crdp raw event
|
|
10
|
+
* messages, keyed on method. e.g. {
|
|
11
|
+
* 'Domain.method1Name': {method: 'Domain.method1Name', params: EventPayload1},
|
|
12
|
+
* 'Domain.method2Name': {method: 'Domain.method2Name', params: EventPayload2},
|
|
13
|
+
* }
|
|
14
|
+
*/
|
|
15
|
+
type RawEventMessageRecord = {
|
|
16
|
+
[K in keyof LH.CrdpEvents]: {
|
|
17
|
+
method: K,
|
|
18
|
+
// Drop [] for `undefined` (so a JS value is valid).
|
|
19
|
+
params: LH.CrdpEvents[K] extends [] ? undefined: LH.CrdpEvents[K][number]
|
|
20
|
+
// If sessionId is not set, it means the event was from the root target.
|
|
21
|
+
sessionId?: string;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
8
25
|
/**
|
|
9
26
|
* Union of raw (over the wire) message format of all possible Crdp events,
|
|
10
27
|
* of the form `{method: 'Domain.event', params: eventPayload}`.
|
|
@@ -50,24 +67,9 @@ declare module Protocol {
|
|
|
50
67
|
once<E extends keyof TEventRecord>(event: E, listener: (...args: TEventRecord[E]) => void): void;
|
|
51
68
|
|
|
52
69
|
emit<E extends keyof TEventRecord>(event: E, ...request: TEventRecord[E]): void;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
70
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
* messages, keyed on method. e.g. {
|
|
59
|
-
* 'Domain.method1Name': {method: 'Domain.method1Name', params: EventPayload1},
|
|
60
|
-
* 'Domain.method2Name': {method: 'Domain.method2Name', params: EventPayload2},
|
|
61
|
-
* }
|
|
62
|
-
*/
|
|
63
|
-
type RawEventMessageRecord = {
|
|
64
|
-
[K in keyof LH.CrdpEvents]: {
|
|
65
|
-
method: K,
|
|
66
|
-
// Drop [] for `undefined` (so a JS value is valid).
|
|
67
|
-
params: LH.CrdpEvents[K] extends [] ? undefined: LH.CrdpEvents[K][number]
|
|
68
|
-
// If sessionId is not set, it means the event was from the root target.
|
|
69
|
-
sessionId?: string;
|
|
70
|
-
};
|
|
71
|
+
listenerCount<E extends keyof TEventRecord>(event: E): number;
|
|
72
|
+
}
|
|
71
73
|
}
|
|
72
74
|
|
|
73
75
|
export default Protocol;
|