@wdio/lighthouse-service 10.0.0-alpha.150 → 10.0.0-alpha.18
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/README.md +5 -8
- package/build/auditor.d.ts +37 -12
- package/build/auditor.d.ts.map +1 -1
- package/build/commands.d.ts +12 -21
- package/build/commands.d.ts.map +1 -1
- package/build/constants.d.ts +15 -13
- package/build/constants.d.ts.map +1 -1
- package/build/gatherer/devtools.d.ts +19 -0
- package/build/gatherer/devtools.d.ts.map +1 -0
- package/build/gatherer/pwa.d.ts +28 -0
- package/build/gatherer/pwa.d.ts.map +1 -0
- package/build/gatherer/trace.d.ts +60 -0
- package/build/gatherer/trace.d.ts.map +1 -0
- package/build/handler/network.d.ts +1 -1
- package/build/handler/network.d.ts.map +1 -1
- package/build/index.d.ts +4 -4
- package/build/index.d.ts.map +1 -1
- package/build/index.js +574 -428
- package/build/lighthouse/cri.d.ts +22 -0
- package/build/lighthouse/cri.d.ts.map +1 -0
- package/build/scripts/collectMetaElements.d.ts +8 -0
- package/build/scripts/collectMetaElements.d.ts.map +1 -0
- package/build/scripts/registerPerformanceObserverInPage.d.ts +12 -0
- package/build/scripts/registerPerformanceObserverInPage.d.ts.map +1 -0
- package/build/types.d.ts +79 -96
- package/build/types.d.ts.map +1 -1
- package/build/utils.d.ts +6 -31
- package/build/utils.d.ts.map +1 -1
- package/package.json +21 -12
- package/AGENTS.md +0 -10
- package/build/pwa.d.ts +0 -47
- package/build/pwa.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -30,9 +30,7 @@ export const config = {
|
|
|
30
30
|
|
|
31
31
|
## Usage
|
|
32
32
|
|
|
33
|
-
The `@wdio/lighthouse-service` allows you to run Google Lighthouse accessibility and performance tests through WebdriverIO.
|
|
34
|
-
|
|
35
|
-
**Note:** this service requires Node.js 22.19 or newer because it depends on [Lighthouse 13](https://github.com/GoogleChrome/lighthouse/releases/tag/v13.4.1). The rest of WebdriverIO continues to support the versions listed in the project engines field.
|
|
33
|
+
The `@wdio/lighthouse-service` allows you to run Google Lighthouse accessibility and performance tests through WebdriverIO.
|
|
36
34
|
|
|
37
35
|
### Performance Testing
|
|
38
36
|
|
|
@@ -96,8 +94,7 @@ console.log(await browser.getMetrics())
|
|
|
96
94
|
* speedIndex: 3259,
|
|
97
95
|
* totalBlockingTime: 31,
|
|
98
96
|
* maxPotentialFID: 161,
|
|
99
|
-
* cumulativeLayoutShift:
|
|
100
|
-
* interactionToNextPaint: 120 }
|
|
97
|
+
* cumulativeLayoutShift: 2822 }
|
|
101
98
|
*/
|
|
102
99
|
```
|
|
103
100
|
|
|
@@ -146,7 +143,7 @@ console.log(await browser.getMainThreadWorkBreakdown())
|
|
|
146
143
|
|
|
147
144
|
#### getPerformanceScore
|
|
148
145
|
|
|
149
|
-
Returns the [Lighthouse Performance Score](https://
|
|
146
|
+
Returns the [Lighthouse Performance Score](https://developers.google.com/web/tools/lighthouse/scoring) which is a weighted mean of the following metrics: `firstContentfulPaint`, `speedIndex`, `largestContentfulPaint`, `cumulativeLayoutShift`, `totalBlockingTime`, `interactive`, `maxPotentialFID` or `cumulativeLayoutShift`.
|
|
150
147
|
|
|
151
148
|
```js
|
|
152
149
|
console.log(await browser.getPerformanceScore())
|
|
@@ -157,7 +154,7 @@ console.log(await browser.getPerformanceScore())
|
|
|
157
154
|
|
|
158
155
|
#### enablePerformanceAudits
|
|
159
156
|
|
|
160
|
-
Enables auto performance audits for all page loads that are caused by calling the `url` command or clicking on a link or anything that causes a page load. You can pass in a config object to determine some throttling options. The default throttling profile is `
|
|
157
|
+
Enables auto performance audits for all page loads that are caused by calling the `url` command or clicking on a link or anything that causes a page load. You can pass in a config object to determine some throttling options. The default throttling profile is `Good 3G` network with a 4x CPU throttling.
|
|
161
158
|
|
|
162
159
|
```js
|
|
163
160
|
await browser.enablePerformanceAudits({
|
|
@@ -172,7 +169,7 @@ The following network throttling profiles are available: `offline`, `GPRS`, `Reg
|
|
|
172
169
|
|
|
173
170
|
### PWA Testing
|
|
174
171
|
|
|
175
|
-
With the `checkPWA` command, you can validate if your web app is compliant to the latest web standards when it comes to progressive web apps.
|
|
172
|
+
With the `checkPWA` command, you can validate if your web app is compliant to the latest web standards when it comes to progressive web apps. It checks:
|
|
176
173
|
|
|
177
174
|
- whether your app is installable
|
|
178
175
|
- provides a service worker
|
package/build/auditor.d.ts
CHANGED
|
@@ -1,29 +1,54 @@
|
|
|
1
1
|
import type { CustomInstanceCommands } from 'webdriverio';
|
|
2
|
-
import type { FormFactor,
|
|
2
|
+
import type { FormFactor, Audit, AuditResult, LHAuditResult, ErrorAudit, PWAAudits } from './types.js';
|
|
3
|
+
import type { Trace } from './gatherer/trace.js';
|
|
4
|
+
import type { CDPSessionOnMessageObject } from './gatherer/devtools.js';
|
|
3
5
|
export default class Auditor {
|
|
4
|
-
private
|
|
6
|
+
private _traceLogs?;
|
|
7
|
+
private _devtoolsLogs?;
|
|
5
8
|
private _formFactor?;
|
|
6
|
-
|
|
9
|
+
private _url?;
|
|
10
|
+
constructor(_traceLogs?: Trace | undefined, _devtoolsLogs?: CDPSessionOnMessageObject[] | undefined, _formFactor?: FormFactor | undefined);
|
|
11
|
+
_audit(AUDIT: Audit, params?: {}): Promise<LHAuditResult> | ErrorAudit;
|
|
7
12
|
/**
|
|
8
|
-
* an Auditor instance is created for every
|
|
9
|
-
*
|
|
13
|
+
* an Auditor instance is created for every trace so provide an updateCommands
|
|
14
|
+
* function to receive the latest performance metrics with the browser instance
|
|
10
15
|
*/
|
|
11
16
|
updateCommands(browser: WebdriverIO.Browser, customFn?: CustomInstanceCommands<WebdriverIO.Browser>['addCommand']): void;
|
|
12
17
|
/**
|
|
13
|
-
* Returns a list with a breakdown of all main thread
|
|
18
|
+
* Returns a list with a breakdown of all main thread task and their total duration
|
|
14
19
|
*/
|
|
15
|
-
getMainThreadWorkBreakdown(): Promise<
|
|
20
|
+
getMainThreadWorkBreakdown(): Promise<{
|
|
21
|
+
group: string;
|
|
22
|
+
duration: number;
|
|
23
|
+
}[]>;
|
|
16
24
|
/**
|
|
17
25
|
* Get some useful diagnostics about the page load
|
|
18
26
|
*/
|
|
19
|
-
getDiagnostics(): Promise<
|
|
27
|
+
getDiagnostics(): Promise<any>;
|
|
20
28
|
/**
|
|
21
|
-
* Get most
|
|
29
|
+
* Get most common used performance metrics
|
|
22
30
|
*/
|
|
23
|
-
getMetrics(): Promise<
|
|
31
|
+
getMetrics(): Promise<{
|
|
32
|
+
timeToFirstByte: number;
|
|
33
|
+
serverResponseTime: number;
|
|
34
|
+
domContentLoaded: number;
|
|
35
|
+
firstVisualChange: number;
|
|
36
|
+
firstPaint: number;
|
|
37
|
+
firstContentfulPaint: number;
|
|
38
|
+
firstMeaningfulPaint: number;
|
|
39
|
+
largestContentfulPaint: number;
|
|
40
|
+
lastVisualChange: number;
|
|
41
|
+
interactive: number;
|
|
42
|
+
load: number;
|
|
43
|
+
speedIndex: number;
|
|
44
|
+
totalBlockingTime: number;
|
|
45
|
+
maxPotentialFID: number;
|
|
46
|
+
cumulativeLayoutShift: number;
|
|
47
|
+
}>;
|
|
24
48
|
/**
|
|
25
|
-
* Returns the Lighthouse Performance Score
|
|
49
|
+
* Returns the Lighthouse Performance Score which is a weighted mean of the following metrics: firstMeaningfulPaint, interactive, speedIndex
|
|
26
50
|
*/
|
|
27
|
-
getPerformanceScore(): Promise<
|
|
51
|
+
getPerformanceScore(): Promise<any>;
|
|
52
|
+
_auditPWA(params: unknown, auditsToBeRun?: PWAAudits[]): Promise<AuditResult>;
|
|
28
53
|
}
|
|
29
54
|
//# sourceMappingURL=auditor.d.ts.map
|
package/build/auditor.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auditor.d.ts","sourceRoot":"","sources":["../src/auditor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"auditor.d.ts","sourceRoot":"","sources":["../src/auditor.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AAGzD,OAAO,KAAK,EACR,UAAU,EAAE,KAAK,EAEjB,WAAW,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EACpD,MAAM,YAAY,CAAA;AACnB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAChD,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAA;AAMvE,MAAM,CAAC,OAAO,OAAO,OAAO;IAIpB,OAAO,CAAC,UAAU,CAAC;IACnB,OAAO,CAAC,aAAa,CAAC;IACtB,OAAO,CAAC,WAAW,CAAC;IALxB,OAAO,CAAC,IAAI,CAAC,CAAQ;gBAGT,UAAU,CAAC,EAAE,KAAK,YAAA,EAClB,aAAa,CAAC,EAAE,yBAAyB,EAAE,YAAA,EAC3C,WAAW,CAAC,EAAE,UAAU,YAAA;IAOpC,MAAM,CAAE,KAAK,EAAE,KAAK,EAAE,MAAM,KAAK,GAAG,OAAO,CAAC,aAAa,CAAC,GAAG,UAAU;IA8BvE;;;OAGG;IACH,cAAc,CAAE,OAAO,EAAE,WAAW,CAAC,OAAO,EAAE,QAAQ,CAAC,EAAE,sBAAsB,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,YAAY,CAAC;IAMlH;;OAEG;IACG,0BAA0B;;;;IAOhC;;OAEG;IACG,cAAc;IAapB;;OAEG;IACG,UAAU;;;;;;;;;;;;;;;;;IAwBhB;;OAEG;IACG,mBAAmB;IAuBnB,SAAS,CACX,MAAM,EAAE,OAAO,EACf,aAAa,GAA8B,SAAS,EAAE,GACvD,OAAO,CAAC,WAAW,CAAC;CAgB1B"}
|
package/build/commands.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { TraceEvent } from '@tracerbench/trace-event';
|
|
2
|
-
import type { CDPSession } from 'puppeteer-core';
|
|
3
|
-
import type { Page } from 'puppeteer-core';
|
|
4
|
-
import type { TracingOptions } from 'puppeteer-core';
|
|
2
|
+
import type { CDPSession } from 'puppeteer-core/lib/esm/puppeteer/api/CDPSession.js';
|
|
3
|
+
import type { Page } from 'puppeteer-core/lib/esm/puppeteer/api/Page.js';
|
|
4
|
+
import type { TracingOptions } from 'puppeteer-core/lib/esm/puppeteer/cdp/Tracing.js';
|
|
5
5
|
import type { RequestPayload } from './handler/network.js';
|
|
6
|
-
import type { DevtoolsConfig, EnablePerformanceAuditsOptions, PWAAudits } from './types.js';
|
|
6
|
+
import type { DevtoolsConfig, EnablePerformanceAuditsOptions, GathererDriver, PWAAudits } from './types.js';
|
|
7
7
|
export default class CommandHandler {
|
|
8
8
|
private _session;
|
|
9
9
|
private _page;
|
|
10
|
+
private _driver;
|
|
10
11
|
private _options;
|
|
11
12
|
private _browser;
|
|
12
13
|
private _isTracing;
|
|
@@ -17,13 +18,10 @@ export default class CommandHandler {
|
|
|
17
18
|
private _cpuThrottling?;
|
|
18
19
|
private _networkThrottling?;
|
|
19
20
|
private _formFactor?;
|
|
20
|
-
private
|
|
21
|
-
private
|
|
22
|
-
private
|
|
23
|
-
|
|
24
|
-
private _clickTraceTimeout?;
|
|
25
|
-
private _onFrameNavigated;
|
|
26
|
-
constructor(_session: CDPSession, _page: Page, _options: DevtoolsConfig, _browser: WebdriverIO.Browser | WebdriverIO.MultiRemoteBrowser);
|
|
21
|
+
private _traceGatherer?;
|
|
22
|
+
private _devtoolsGatherer?;
|
|
23
|
+
private _pwaGatherer?;
|
|
24
|
+
constructor(_session: CDPSession, _page: Page, _driver: GathererDriver, _options: DevtoolsConfig, _browser: WebdriverIO.Browser | WebdriverIO.MultiRemoteBrowser);
|
|
27
25
|
/**
|
|
28
26
|
* Start tracing the browser. You can optionally pass in custom tracing categories and the
|
|
29
27
|
* sampling frequency.
|
|
@@ -32,7 +30,7 @@ export default class CommandHandler {
|
|
|
32
30
|
/**
|
|
33
31
|
* Stop tracing the browser.
|
|
34
32
|
*/
|
|
35
|
-
endTracing(): Promise<TraceEvent[]>;
|
|
33
|
+
endTracing(): Promise<TraceEvent[] | undefined>;
|
|
36
34
|
/**
|
|
37
35
|
* Returns the tracelogs that was captured within the tracing period.
|
|
38
36
|
* You can use this command to store the trace logs on the file system to analyse the trace
|
|
@@ -83,14 +81,7 @@ export default class CommandHandler {
|
|
|
83
81
|
checkPWA(auditsToBeRun?: PWAAudits[]): Promise<import("./types.js").AuditResult>;
|
|
84
82
|
private _propagateWSEvents;
|
|
85
83
|
_initCommand(): Promise<void>;
|
|
86
|
-
_beforeCmd(commandName: string, params: unknown[]): Promise<void
|
|
87
|
-
_afterCmd(commandName: string): Promise<void
|
|
88
|
-
private _getFlowOptions;
|
|
89
|
-
private _handleFrameNavigated;
|
|
90
|
-
private _refreshAuditablePage;
|
|
91
|
-
private _navigateWithLighthouse;
|
|
92
|
-
private _cancelNavigation;
|
|
93
|
-
private _disposeFlow;
|
|
94
|
-
private _resetFlowState;
|
|
84
|
+
_beforeCmd(commandName: string, params: unknown[]): Promise<void> | undefined;
|
|
85
|
+
_afterCmd(commandName: string): Promise<void> | undefined;
|
|
95
86
|
}
|
|
96
87
|
//# sourceMappingURL=commands.d.ts.map
|
package/build/commands.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oDAAoD,CAAA;AACpF,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,8CAA8C,CAAA;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iDAAiD,CAAA;AAErF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAK1D,OAAO,KAAK,EACR,cAAc,EACd,8BAA8B,EAE9B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a,CAAC,EAAE,SAAS,EAAE;IAM3C,OAAO,CAAC,kBAAkB;IAkBpB,YAAY;IAWlB,UAAU,CAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE;IAiBlD,SAAS,CAAE,WAAW,EAAE,MAAM;CAmCjC"}
|
package/build/constants.d.ts
CHANGED
|
@@ -7,13 +7,11 @@ export declare const DEFAULT_TRACING_CATEGORIES: string[];
|
|
|
7
7
|
*/
|
|
8
8
|
export declare const IGNORED_URLS: readonly ["data:,", "about:", "chrome-extension://"];
|
|
9
9
|
export declare const FRAME_LOAD_START_TIMEOUT = 2000;
|
|
10
|
+
export declare const TRACING_TIMEOUT = 15000;
|
|
11
|
+
export declare const MAX_TRACE_WAIT_TIME = 45000;
|
|
10
12
|
export declare const DEFAULT_NETWORK_THROTTLING_STATE: "online";
|
|
11
13
|
export declare const DEFAULT_FORM_FACTOR: "desktop";
|
|
12
14
|
export declare const UNSUPPORTED_ERROR_MESSAGE: string;
|
|
13
|
-
/**
|
|
14
|
-
* Lighthouse throttling constants (core/config/constants.js).
|
|
15
|
-
* Regular 3G uses `mobileRegular3G`, Good 3G uses `mobileSlow4G`.
|
|
16
|
-
*/
|
|
17
15
|
export declare const NETWORK_STATES: {
|
|
18
16
|
offline: {
|
|
19
17
|
offline: boolean;
|
|
@@ -41,13 +39,13 @@ export declare const NETWORK_STATES: {
|
|
|
41
39
|
};
|
|
42
40
|
'Regular 3G': {
|
|
43
41
|
offline: boolean;
|
|
44
|
-
latency:
|
|
42
|
+
latency: any;
|
|
45
43
|
downloadThroughput: number;
|
|
46
44
|
uploadThroughput: number;
|
|
47
45
|
};
|
|
48
46
|
'Good 3G': {
|
|
49
47
|
offline: boolean;
|
|
50
|
-
latency:
|
|
48
|
+
latency: any;
|
|
51
49
|
downloadThroughput: number;
|
|
52
50
|
uploadThroughput: number;
|
|
53
51
|
};
|
|
@@ -83,11 +81,15 @@ export declare const DEFAULT_THROTTLE_STATE: {
|
|
|
83
81
|
readonly cacheEnabled: false;
|
|
84
82
|
readonly formFactor: "desktop";
|
|
85
83
|
};
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
84
|
+
export declare const NETWORK_RECORDER_EVENTS: readonly ["Network.requestWillBeSent", "Network.requestServedFromCache", "Network.responseReceived", "Network.dataReceived", "Network.loadingFinished", "Network.loadingFailed", "Network.resourceChangedPriority"];
|
|
85
|
+
export declare const PWA_AUDITS: {
|
|
86
|
+
readonly isInstallable: any;
|
|
87
|
+
readonly serviceWorker: any;
|
|
88
|
+
readonly splashScreen: any;
|
|
89
|
+
readonly themedOmnibox: any;
|
|
90
|
+
readonly contentWith: any;
|
|
91
|
+
readonly viewport: any;
|
|
92
|
+
readonly appleTouchIcon: any;
|
|
93
|
+
readonly maskableIcon: any;
|
|
94
|
+
};
|
|
93
95
|
//# sourceMappingURL=constants.d.ts.map
|
package/build/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAWA;;GAEG;AACH,eAAO,MAAM,0BAA0B,UAyCtC,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,YAAY,sDAIf,CAAA;AAEV,eAAO,MAAM,wBAAwB,OAAO,CAAA;AAC5C,eAAO,MAAM,eAAe,QAAQ,CAAA;AACpC,eAAO,MAAM,mBAAmB,QAAQ,CAAA;AACxC,eAAO,MAAM,gCAAgC,EAAG,QAAiB,CAAA;AACjE,eAAO,MAAM,mBAAmB,EAAG,SAAkB,CAAA;AACrD,eAAO,MAAM,yBAAyB,QAIrC,CAAA;AAED,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+D1B,CAAA;AAED,eAAO,MAAM,gBAAgB,qBAAqB,CAAA;AAClD,eAAO,MAAM,sBAAsB;gCACwB,MAAM,OAAO,cAAc;;;;CAI5E,CAAA;AAEV,eAAO,MAAM,uBAAuB,qNAQ1B,CAAA;AAEV,eAAO,MAAM,UAAU;;;;;;;;;CASb,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface CDPSessionOnMessageObject {
|
|
2
|
+
id?: number;
|
|
3
|
+
method: string;
|
|
4
|
+
params: Record<string, unknown>;
|
|
5
|
+
error: {
|
|
6
|
+
message: string;
|
|
7
|
+
data: unknown;
|
|
8
|
+
};
|
|
9
|
+
result?: unknown;
|
|
10
|
+
}
|
|
11
|
+
export default class DevtoolsGatherer {
|
|
12
|
+
private _logs;
|
|
13
|
+
onMessage(msgObj: CDPSessionOnMessageObject): void;
|
|
14
|
+
/**
|
|
15
|
+
* retrieve logs and clean cache
|
|
16
|
+
*/
|
|
17
|
+
getLogs(): CDPSessionOnMessageObject[];
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=devtools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"devtools.d.ts","sourceRoot":"","sources":["../../src/gatherer/devtools.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,yBAAyB;IACtC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,KAAK,EAAE;QACH,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,OAAO,CAAC;KACjB,CAAC;IACF,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,CAAC,OAAO,OAAO,gBAAgB;IACjC,OAAO,CAAC,KAAK,CAAkC;IAE/C,SAAS,CAAE,MAAM,EAAE,yBAAyB;IAI5C;;OAEG;IACH,OAAO;CAGV"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { CDPSession } from 'puppeteer-core/lib/esm/puppeteer/api/CDPSession.js';
|
|
2
|
+
import type { Page } from 'puppeteer-core/lib/esm/puppeteer/api/Page.js';
|
|
3
|
+
import type { GathererDriver } from '../types.js';
|
|
4
|
+
export default class PWAGatherer {
|
|
5
|
+
private _session;
|
|
6
|
+
private _page;
|
|
7
|
+
private _driver;
|
|
8
|
+
private _frGatherer;
|
|
9
|
+
private _networkRecorder;
|
|
10
|
+
private _networkRecords;
|
|
11
|
+
constructor(_session: CDPSession, _page: Page, _driver: GathererDriver);
|
|
12
|
+
gatherData(): Promise<{
|
|
13
|
+
URL: {
|
|
14
|
+
requestedUrl: string;
|
|
15
|
+
finalUrl: string;
|
|
16
|
+
};
|
|
17
|
+
WebAppManifest: any;
|
|
18
|
+
InstallabilityErrors: any;
|
|
19
|
+
MetaElements: any;
|
|
20
|
+
ViewportDimensions: any;
|
|
21
|
+
ServiceWorker: {
|
|
22
|
+
versions: any;
|
|
23
|
+
registrations: any;
|
|
24
|
+
};
|
|
25
|
+
LinkElements: any;
|
|
26
|
+
}>;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=pwa.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pwa.d.ts","sourceRoot":"","sources":["../../src/gatherer/pwa.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oDAAoD,CAAA;AACpF,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,8CAA8C,CAAA;AAIxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD,MAAM,CAAC,OAAO,OAAO,WAAW;IAMxB,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,OAAO;IAPnB,OAAO,CAAC,WAAW,CAAmB;IACtC,OAAO,CAAC,gBAAgB,CAAwB;IAChD,OAAO,CAAC,eAAe,CAA+B;gBAG1C,QAAQ,EAAE,UAAU,EACpB,KAAK,EAAE,IAAI,EACX,OAAO,EAAE,cAAc;IAsB7B,UAAU;;;;;;;;;;;;;;;CA4BnB"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { EventEmitter } from 'node:events';
|
|
2
|
+
import type { Protocol } from 'devtools-protocol';
|
|
3
|
+
import type { TraceEvent } from '@tracerbench/trace-event';
|
|
4
|
+
import type { HTTPRequest } from 'puppeteer-core/lib/esm/puppeteer/api/HTTPRequest.js';
|
|
5
|
+
import type { CDPSession } from 'puppeteer-core/lib/esm/puppeteer/api/CDPSession.js';
|
|
6
|
+
import type { Page } from 'puppeteer-core/lib/esm/puppeteer/api/Page.js';
|
|
7
|
+
import type { GathererDriver } from '../types.js';
|
|
8
|
+
export interface Trace {
|
|
9
|
+
traceEvents: TraceEvent[];
|
|
10
|
+
frameId?: string;
|
|
11
|
+
loaderId?: string;
|
|
12
|
+
pageUrl?: string;
|
|
13
|
+
traceStart?: number;
|
|
14
|
+
traceEnd?: number;
|
|
15
|
+
}
|
|
16
|
+
export interface WaitPromise {
|
|
17
|
+
promise: Promise<unknown>;
|
|
18
|
+
cancel: Function;
|
|
19
|
+
}
|
|
20
|
+
export default class TraceGatherer extends EventEmitter {
|
|
21
|
+
private _session;
|
|
22
|
+
private _page;
|
|
23
|
+
private _driver;
|
|
24
|
+
private _failingFrameLoadIds;
|
|
25
|
+
private _pageLoadDetected;
|
|
26
|
+
private _networkListeners;
|
|
27
|
+
private _frameId?;
|
|
28
|
+
private _loaderId?;
|
|
29
|
+
private _pageUrl?;
|
|
30
|
+
private _networkStatusMonitor;
|
|
31
|
+
private _networkMonitor;
|
|
32
|
+
private _protocolSession;
|
|
33
|
+
private _trace?;
|
|
34
|
+
private _traceStart?;
|
|
35
|
+
private _clickTraceTimeout?;
|
|
36
|
+
private _waitConditionPromises;
|
|
37
|
+
constructor(_session: CDPSession, _page: Page, _driver: GathererDriver);
|
|
38
|
+
startTracing(url: string): Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* store frame id of frames that are being traced
|
|
41
|
+
*/
|
|
42
|
+
onFrameNavigated(msgObj: Protocol.Page.FrameNavigatedEvent): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* once the page load event has fired, we can grab some performance
|
|
45
|
+
* metrics and timing
|
|
46
|
+
*/
|
|
47
|
+
onLoadEventFired(): Promise<void>;
|
|
48
|
+
onFrameLoadFail(request: HTTPRequest): void;
|
|
49
|
+
get isTracing(): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* once tracing has finished capture trace logs into memory
|
|
52
|
+
*/
|
|
53
|
+
completeTracing(): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* clear tracing states and emit tracingFinished
|
|
56
|
+
*/
|
|
57
|
+
finishTracing(): void;
|
|
58
|
+
waitForMaxTimeout(maxWaitForLoadedMs?: number): Promise<() => Promise<void>>;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=trace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trace.d.ts","sourceRoot":"","sources":["../../src/gatherer/trace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAO1C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,KAAK,EAAE,UAAU,EAAkB,MAAM,0BAA0B,CAAA;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qDAAqD,CAAA;AACtF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oDAAoD,CAAA;AACpF,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,8CAA8C,CAAA;AASxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAIjD,MAAM,WAAW,KAAK;IAClB,WAAW,EAAE,UAAU,EAAE,CAAA;IACzB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,M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@@
|
|
|
1
|
-
{"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../../src/handler/network.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../../src/handler/network.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oDAAoD,CAAA;AACpF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAIjD,UAAU,UAAU;IAChB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,OAAO,EAAE,CAAA;CACtB;AAED,UAAU,OAAO;IACb,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,cAAc,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAA;IACzC,eAAe,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAA;IAC1C,MAAM,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,cAAc,CAAA;IACxC,IAAI,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,YAAY,CAAA;IACpC,QAAQ,CAAC,EAAE;QACP,GAAG,EAAE,MAAM,CAAA;QACX,UAAU,EAAE,MAAM,CAAA;QAClB,cAAc,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAA;QACzC,eAAe,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAA;QAC1C,MAAM,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,cAAc,CAAA;KAC3C,CAAA;CACJ;AAED,MAAM,WAAW,cAAc;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,CAAC,OAAO,OAAO,cAAc;IAC/B,UAAU,EAAE,UAAU,CAAmB;IACzC,YAAY,EAAE;SACT,GAAG,IAAI,QAAQ,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,EAAE,cAAc;KAC1D,CAAK;IACN,kBAAkB,CAAC,EAAE,OAAO,CAAA;gBAEf,OAAO,EAAE,UAAU;IAOhC,WAAW,CAAE,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC,iBAAiB,GAAG,QAAQ,CAAC,OAAO,CAAC,qBAAqB;IAYhG,cAAc,CAAE,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC,iBAAiB;IAkB1D,yBAAyB,CAAE,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC,qBAAqB;IAgBzE,0BAA0B,CAAE,MAAM,EAAE,QAAQ,CAAC,OAAO,CAAC,sBAAsB;IAiE3E,oBAAoB,CAAE,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,mBAAmB;CAwBlE"}
|
package/build/index.d.ts
CHANGED
|
@@ -7,10 +7,10 @@ export default class DevToolsService implements Services.ServiceInstance {
|
|
|
7
7
|
private _command;
|
|
8
8
|
private _browser?;
|
|
9
9
|
constructor(_options: DevtoolsConfig);
|
|
10
|
-
before(caps: Capabilities.RequestedStandaloneCapabilities | Capabilities.
|
|
10
|
+
before(caps: Capabilities.RequestedStandaloneCapabilities | Capabilities.RequestedMultiremoteCapabilities, specs: string[], browser: WebdriverIO.Browser | WebdriverIO.MultiRemoteBrowser): Promise<void>;
|
|
11
11
|
onReload(): Promise<void>;
|
|
12
|
-
beforeCommand(commandName: string, params: unknown[]): Promise<void[]>;
|
|
13
|
-
afterCommand(commandName: string): Promise<void[]>;
|
|
12
|
+
beforeCommand(commandName: string, params: unknown[]): Promise<(void | undefined)[]>;
|
|
13
|
+
afterCommand(commandName: string): Promise<(void | undefined)[]>;
|
|
14
14
|
/**
|
|
15
15
|
* set flag to run performance audits for page transitions
|
|
16
16
|
*/
|
|
@@ -25,7 +25,7 @@ export default class DevToolsService implements Services.ServiceInstance {
|
|
|
25
25
|
}
|
|
26
26
|
export * from './types.js';
|
|
27
27
|
type CommandHandlerCommands = FunctionProperties<CommandHandler>;
|
|
28
|
-
type AuditorCommands = Omit<FunctionProperties<Auditor>, 'updateCommands'>;
|
|
28
|
+
type AuditorCommands = Omit<FunctionProperties<Auditor>, '_audit' | '_auditPWA' | 'updateCommands'>;
|
|
29
29
|
/**
|
|
30
30
|
* ToDo(Christian): use key remapping with TS 4.1
|
|
31
31
|
* https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-1.html#key-remapping-in-mapped-types
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAGtF,OAAO,cAAc,MAAM,eAAe,CAAA;AAC1C,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AAGvC,OAAO,KAAK,EAAE,cAAc,EAAE,8BAA8B,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAE3F,MAAM,CAAC,OAAO,OAAO,eAAgB,YAAW,QAAQ,CAAC,eAAe;IAIvD,OAAO,CAAC,QAAQ;IAH7B,OAAO,CAAC,QAAQ,CAAuB;IACvC,OAAO,CAAC,QAAQ,CAAC,CAAsD;gBAElD,QAAQ,EAAE,cAAc;IAEvC,MAAM,CACR,IAAI,EAAE,YAAY,CAAC,+BAA+B,GAAG,YAAY,CAAC,gCAAgC,EAClG,KAAK,EAAE,MAAM,EAAE,EACf,OAAO,EAAE,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,kBAAkB;IAM3D,QAAQ;IAQR,aAAa,CAAE,WAAW,EAAE,MAAM,EAAE,M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