playwright-performance-regression 0.1.0-next.3 → 0.1.0-next.4

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.
Files changed (37) hide show
  1. package/CHANGELOG.md +250 -0
  2. package/README.md +45 -32
  3. package/dist/{chunk-AQ2XKYNV.js → chunk-CISGJCFW.js} +35 -7
  4. package/dist/chunk-CXE5IWZY.js +1648 -0
  5. package/dist/{chunk-MUZFQKGQ.js → chunk-E2IX265O.js} +321 -30
  6. package/dist/{chunk-BAOTUUTV.cjs → chunk-IUI4AFE5.cjs} +75 -28
  7. package/dist/{chunk-44ASXVQN.cjs → chunk-KELMALEG.cjs} +337 -45
  8. package/dist/{chunk-2JO5HVPC.cjs → chunk-LUA4WRIQ.cjs} +35 -7
  9. package/dist/{chunk-DX36GFOZ.js → chunk-RL27E3AB.js} +94 -57
  10. package/dist/{chunk-DYLCGMI2.js → chunk-S6UH6QPK.js} +6 -1
  11. package/dist/cli.js +1802 -2799
  12. package/dist/config.cjs +58 -120
  13. package/dist/config.d.cts +2 -3
  14. package/dist/config.d.ts +2 -3
  15. package/dist/config.js +48 -110
  16. package/dist/fixture.cjs +9 -5
  17. package/dist/fixture.d.cts +10 -4
  18. package/dist/fixture.d.ts +10 -4
  19. package/dist/fixture.js +4 -4
  20. package/dist/index.cjs +3 -3
  21. package/dist/index.d.cts +17 -9
  22. package/dist/index.d.ts +17 -9
  23. package/dist/index.js +1 -1
  24. package/dist/perf-api-2DH_keLh.d.cts +17 -0
  25. package/dist/perf-api-2DH_keLh.d.ts +17 -0
  26. package/dist/reporter.cjs +1131 -632
  27. package/dist/reporter.js +6153 -1725
  28. package/dist/test.cjs +4 -4
  29. package/dist/test.js +4 -4
  30. package/package.json +17 -1
  31. package/schemas/config.schema.json +22 -12
  32. package/schemas/outcome.schema.json +1 -1
  33. package/schemas/run-report.schema.json +16 -2
  34. package/schemas/samples.schema.json +48 -2
  35. package/dist/chunk-LTRHMBVY.js +0 -5592
  36. package/dist/perf-api-Rm1h1O_-.d.cts +0 -12
  37. package/dist/perf-api-Rm1h1O_-.d.ts +0 -12
package/dist/test.cjs CHANGED
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var chunk44ASXVQN_cjs = require('./chunk-44ASXVQN.cjs');
4
- require('./chunk-BAOTUUTV.cjs');
5
- require('./chunk-2JO5HVPC.cjs');
3
+ var chunkKELMALEG_cjs = require('./chunk-KELMALEG.cjs');
4
+ require('./chunk-IUI4AFE5.cjs');
5
+ require('./chunk-LUA4WRIQ.cjs');
6
6
  var test$1 = require('@playwright/test');
7
7
 
8
- var test = chunk44ASXVQN_cjs.withPerfFixtures(test$1.test);
8
+ var test = chunkKELMALEG_cjs.withPerfFixtures(test$1.test);
9
9
 
10
10
  Object.defineProperty(exports, "expect", {
11
11
  enumerable: true,
package/dist/test.js CHANGED
@@ -1,7 +1,7 @@
1
- import { withPerfFixtures } from './chunk-MUZFQKGQ.js';
2
- import './chunk-DYLCGMI2.js';
3
- import './chunk-DX36GFOZ.js';
4
- import './chunk-AQ2XKYNV.js';
1
+ import { withPerfFixtures } from './chunk-E2IX265O.js';
2
+ import './chunk-S6UH6QPK.js';
3
+ import './chunk-RL27E3AB.js';
4
+ import './chunk-CISGJCFW.js';
5
5
  import { test as test$1 } from '@playwright/test';
6
6
  export { expect } from '@playwright/test';
7
7
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "playwright-performance-regression",
3
- "version": "0.1.0-next.3",
3
+ "version": "0.1.0-next.4",
4
4
  "description": "Catch backend performance regressions from the Playwright tests you already have.",
5
5
  "keywords": [
6
6
  "playwright",
@@ -83,6 +83,22 @@
83
83
  "main": "./dist/index.cjs",
84
84
  "module": "./dist/index.js",
85
85
  "types": "./dist/index.d.cts",
86
+ "typesVersions": {
87
+ "*": {
88
+ "config": [
89
+ "./dist/config.d.cts"
90
+ ],
91
+ "fixture": [
92
+ "./dist/fixture.d.cts"
93
+ ],
94
+ "test": [
95
+ "./dist/test.d.cts"
96
+ ],
97
+ "reporter": [
98
+ "./dist/reporter.d.cts"
99
+ ]
100
+ }
101
+ },
86
102
  "bin": {
87
103
  "playwright-performance-regression": "dist/cli.js",
88
104
  "pw-perf": "dist/cli.js"
@@ -14,12 +14,12 @@
14
14
  "default": {},
15
15
  "properties": {
16
16
  "env": {
17
- "description": "Environment label (D-18). Overridden by PW_PERF_ENV / --env. Null: no label, one set of thresholds files.",
17
+ "description": "Environment label (D-18). Overridden by PW_PERF_ENV. Null: no label, one set of thresholds files.",
18
18
  "$ref": "common.schema.json#/$defs/envLabelOrNull",
19
19
  "default": null
20
20
  },
21
21
  "passes": {
22
- "description": "Passes of the test command (D-03, D-39): the command runs once per pass and every test runs once in each pass. Overridden by PW_PERF_PASSES / --passes for the current mode.",
22
+ "description": "Passes of the test command (D-03, D-39): the command runs once per pass and every test runs once in each pass. Overridden by PW_PERF_PASSES for the current mode.",
23
23
  "type": "object",
24
24
  "additionalProperties": false,
25
25
  "default": {},
@@ -40,13 +40,8 @@
40
40
  }
41
41
  }
42
42
  },
43
- "projects": {
44
- "description": "Which Playwright projects are measured in perf mode (D-13, D-22, D-39; behaviour: 04-REQ-18). 'auto': projects whose effective browser is Chromium (use.browserName, else use.defaultBrowserType from a device descriptor, else chromium; chrome/msedge channels count as Chromium) and which are neither a dependency nor a teardown of another project. A list: exactly these project names; a listed project that is also a dependency of another listed project is measured too.",
45
- "oneOf": [{"const": "auto"}, {"type": "array", "items": {"type": "string"}, "minItems": 1, "uniqueItems": true}],
46
- "default": "auto"
47
- },
48
43
  "grep": {
49
- "description": "Only tests whose title or tags match this regular expression run in perf mode, e.g. '@perf' (03-REQ-25). Applied case-insensitively to the measured projects only; their setup and teardown projects run in full. null: all tests.",
44
+ "description": "Only tests whose title or tags match this regular expression run in perf mode, e.g. '@perf' (03-REQ-25). Applied case-insensitively to the projects that are measured (all but setup and teardown projects, 04-REQ-18); setup and teardown projects run in full. null: all tests.",
50
45
  "oneOf": [{"type": "null"}, {"type": "string", "minLength": 1}],
51
46
  "default": null
52
47
  },
@@ -56,6 +51,11 @@
56
51
  "uniqueItems": true,
57
52
  "items": {"type": "string", "minLength": 1},
58
53
  "default": []
54
+ },
55
+ "overrideSlowMo": {
56
+ "description": "Sets use.launchOptions.slowMo to 0 in every measured project in perf mode (03-REQ-27, D-45). slowMo delays every browser action and distorts the measured times; off by default because some tests are unstable without it. false: slowMo stays and perf mode warns about it (CONFIG_SLOW_MO).",
57
+ "type": "boolean",
58
+ "default": false
59
59
  }
60
60
  }
61
61
  },
@@ -65,6 +65,11 @@
65
65
  "additionalProperties": false,
66
66
  "default": {},
67
67
  "properties": {
68
+ "api": {
69
+ "description": "Requests the browser makes to the backend and calls of the request fixture, page.request and context.request (keys with the prefix 'request '), as keys of kind 'api' (05, 15, 03-REQ-28). false: no request is measured, the api thresholds file is neither read nor written, and only test.step durations are measured; measure.api and measure.steps cannot both be off.",
70
+ "type": "boolean",
71
+ "default": true
72
+ },
68
73
  "resourceTypes": {
69
74
  "description": "Playwright resource types that are measured. WebSocket traffic is not available as Request events in Playwright and cannot be measured (05).",
70
75
  "type": "array",
@@ -140,8 +145,8 @@
140
145
  "default": ["2xx", "3xx"]
141
146
  },
142
147
  "steps": {
143
- "description": "Durations of test.step steps as keys of kind 'step' (06). false (default) disables, true enables with defaults, an object enables with settings (03-REQ-18).",
144
- "default": false,
148
+ "description": "Durations of test.step steps as keys of kind 'step' (06). true (default) enables with defaults, false disables, an object enables with settings (03-REQ-18).",
149
+ "default": true,
145
150
  "oneOf": [
146
151
  {"type": "boolean"},
147
152
  {
@@ -207,6 +212,11 @@
207
212
  "type": "boolean",
208
213
  "default": true
209
214
  },
215
+ "prefixed": {
216
+ "description": "Ids with a prefix: 2-5 capital letters, '-' and at least 3 digits (ORD-1000), or 1-8 lowercase letters, '_' and at least 2 digits or 8-32 letters and digits with a digit (inv_58) (07-REQ-08).",
217
+ "type": "boolean",
218
+ "default": true
219
+ },
210
220
  "email": {"description": "E-mail addresses, replaced with ':email' (07-REQ-08).", "type": "boolean", "default": true}
211
221
  }
212
222
  },
@@ -735,10 +745,10 @@
735
745
  "default": {},
736
746
  "properties": {
737
747
  "dir": {
738
- "description": "Directory of report.json and report.html, relative to the Playwright config directory.",
748
+ "description": "Directory of report.json and report.html, relative to the Playwright config directory. Emptied when the first test of a test or thresholds run starts; never the project directory or a folder with thresholds files.",
739
749
  "type": "string",
740
750
  "minLength": 1,
741
- "default": "pw-perf-results"
751
+ "default": "reports/pw-perf"
742
752
  },
743
753
  "html": {"description": "Write the HTML report.", "type": "boolean", "default": true},
744
754
  "rawUrls": {
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://pkg.invalid/schemas/outcome.schema.json",
4
4
  "title": "Outcome file",
5
- "description": "Small file the reporter writes at the end of onEnd to the path from PW_PERF_OUTCOME_FILE (ADR-0009). Read and deleted by the CLI. Not written when the run was started without the CLI.",
5
+ "description": "Small file the reporter writes at the end of onEnd to <report.dir>/outcome.json in test and thresholds modes (04-REQ-62); a CI job reads it. Removed at the start of a run.",
6
6
  "type": "object",
7
7
  "additionalProperties": false,
8
8
  "required": ["schemaVersion", "runId", "mode", "exitCode", "tests", "evaluation", "toolErrors", "paths"],
@@ -33,7 +33,7 @@
33
33
  "testBreakdown"
34
34
  ],
35
35
  "properties": {
36
- "schemaVersion": {"const": 3},
36
+ "schemaVersion": {"const": 4},
37
37
  "tool": {"$ref": "common.schema.json#/$defs/tool"},
38
38
  "runId": {"$ref": "common.schema.json#/$defs/runId"},
39
39
  "mode": {"$ref": "common.schema.json#/$defs/mode"},
@@ -45,6 +45,16 @@
45
45
  "type": "string",
46
46
  "minLength": 1
47
47
  },
48
+ "suite": {
49
+ "description": "What the report is about (02-REQ-42, 11-REQ-49): the name of the package.json in configDir (source package), else the Playwright config path relative to the repository root (source config). Left out when neither is known.",
50
+ "type": "object",
51
+ "additionalProperties": false,
52
+ "required": ["name", "source"],
53
+ "properties": {
54
+ "name": {"type": "string", "minLength": 1},
55
+ "source": {"enum": ["package", "config"]}
56
+ }
57
+ },
48
58
  "config": {
49
59
  "description": "Effective package config after merging with defaults (00, 4.4), in JSON form (02-REQ-17, 03).",
50
60
  "$ref": "config.schema.json"
@@ -125,7 +135,11 @@
125
135
  },
126
136
  "browserName": {"oneOf": [{"type": "string"}, {"type": "null"}]},
127
137
  "repeatEach": {"type": "integer", "minimum": 1},
128
- "retries": {"type": "integer", "minimum": 0}
138
+ "retries": {"type": "integer", "minimum": 0},
139
+ "requestOnly": {
140
+ "description": "true for a measured project that recorded request calls and no browser sample (02-REQ-42); left out otherwise.",
141
+ "const": true
142
+ }
129
143
  }
130
144
  }
131
145
  },
@@ -5,9 +5,9 @@
5
5
  "description": "Raw samples collected during one test execution, attached to the test result as the 'pw-perf-samples' attachment (ADR-0003). In perf mode every test in a measured project gets this attachment, even when it is empty (05-REQ-15). Written by the collector, read by the reporter. Test metadata is not included; the reporter adds it from TestCase/TestResult.",
6
6
  "type": "object",
7
7
  "additionalProperties": false,
8
- "required": ["schemaVersion", "collector", "requests", "diagnostics"],
8
+ "required": ["schemaVersion", "collector", "requests", "apiRequests", "diagnostics"],
9
9
  "properties": {
10
- "schemaVersion": {"const": 2},
10
+ "schemaVersion": {"const": 3},
11
11
  "collector": {
12
12
  "description": "Collector that produced the batch.",
13
13
  "type": "object",
@@ -31,6 +31,11 @@
31
31
  "type": "array",
32
32
  "items": {"$ref": "#/$defs/requestSample"}
33
33
  },
34
+ "apiRequests": {
35
+ "description": "Calls of APIRequestContext methods (request fixture, page.request, context.request, trackRequestContext; 15) in the order they finished; calls still running when the end-of-test wait ran out come last, with status PENDING. The reporter keys them with the prefix 'request ' (15-REQ-01).",
36
+ "type": "array",
37
+ "items": {"$ref": "#/$defs/apiRequestSample"}
38
+ },
34
39
  "diagnostics": {
35
40
  "description": "Collector diagnostics caught during the test (01-REQ-13, 05 §9). Repeated issues are collapsed using 'count'. The reporter turns every diagnostic into an entry in 'warnings' (09-REQ-23); none of them is a tool error.",
36
41
  "type": "array",
@@ -38,6 +43,47 @@
38
43
  }
39
44
  },
40
45
  "$defs": {
46
+ "apiRequestSample": {
47
+ "description": "One call of an APIRequestContext method, timed with the worker's clock (15-REQ-05).",
48
+ "type": "object",
49
+ "additionalProperties": false,
50
+ "required": ["method", "url", "status", "startTime", "duration", "source"],
51
+ "properties": {
52
+ "method": {"description": "HTTP method, uppercase (fetch without a method: GET).", "type": "string", "pattern": "^[A-Z]+$"},
53
+ "url": {
54
+ "description": "Called URL: absolute as given, a relative one resolved against the test's baseURL, otherwise response.url() or the text of the call (15-REQ-05). Never written to thresholds files (P-07).",
55
+ "type": "string",
56
+ "minLength": 1
57
+ },
58
+ "status": {
59
+ "description": "HTTP status code; FAILED when the call threw; PENDING when it was still running after the end-of-test wait (15-REQ-08).",
60
+ "oneOf": [{"type": "integer", "minimum": 100, "maximum": 599}, {"const": "FAILED"}, {"const": "PENDING"}]
61
+ },
62
+ "failureText": {
63
+ "description": "First line of the error message of the call. Present only when status is FAILED.",
64
+ "type": "string",
65
+ "minLength": 1
66
+ },
67
+ "startTime": {"description": "Date.now() when the method was called, whole ms.", "$ref": "common.schema.json#/$defs/epochMs"},
68
+ "duration": {
69
+ "description": "From the call to the settled promise (performance.now() in the worker), including reading the whole body. Null for FAILED and PENDING.",
70
+ "$ref": "common.schema.json#/$defs/msOrNull"
71
+ },
72
+ "source": {
73
+ "description": "request: the request fixture; context: page.request or context.request; tracked: a context passed to trackRequestContext(). Informational: all give keys with the same prefix (15-REQ-05).",
74
+ "enum": ["request", "context", "tracked"]
75
+ }
76
+ },
77
+ "if": {"properties": {"status": {"const": "FAILED"}}},
78
+ "then": {"required": ["failureText"]},
79
+ "else": {"not": {"required": ["failureText"]}},
80
+ "allOf": [
81
+ {
82
+ "if": {"properties": {"status": {"enum": ["FAILED", "PENDING"]}}},
83
+ "then": {"properties": {"duration": {"type": "null"}}}
84
+ }
85
+ ]
86
+ },
41
87
  "requestSample": {
42
88
  "description": "One backend request observed in a tracked browser context, after collector filters (05).",
43
89
  "type": "object",