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/index.cjs CHANGED
@@ -1,14 +1,14 @@
1
1
  'use strict';
2
2
 
3
- var chunk2JO5HVPC_cjs = require('./chunk-2JO5HVPC.cjs');
3
+ var chunkLUA4WRIQ_cjs = require('./chunk-LUA4WRIQ.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "definePerfConfig", {
8
8
  enumerable: true,
9
- get: function () { return chunk2JO5HVPC_cjs.definePerfConfig; }
9
+ get: function () { return chunkLUA4WRIQ_cjs.definePerfConfig; }
10
10
  });
11
11
  Object.defineProperty(exports, "perfDefaults", {
12
12
  enumerable: true,
13
- get: function () { return chunk2JO5HVPC_cjs.perfDefaults; }
13
+ get: function () { return chunkLUA4WRIQ_cjs.perfDefaults; }
14
14
  });
package/dist/index.d.cts CHANGED
@@ -11,11 +11,11 @@ interface PackageConfig {
11
11
  */
12
12
  run?: {
13
13
  /**
14
- * Environment label (D-18). Overridden by PW_PERF_ENV / --env. Null: no label, one set of thresholds files.
14
+ * Environment label (D-18). Overridden by PW_PERF_ENV. Null: no label, one set of thresholds files.
15
15
  */
16
16
  env?: string | null;
17
17
  /**
18
- * 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.
18
+ * 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.
19
19
  */
20
20
  passes?: {
21
21
  /**
@@ -28,22 +28,26 @@ interface PackageConfig {
28
28
  thresholds?: number;
29
29
  };
30
30
  /**
31
- * 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.
32
- */
33
- projects?: 'auto' | [string, ...string[]];
34
- /**
35
- * 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.
31
+ * 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.
36
32
  */
37
33
  grep?: null | string;
38
34
  /**
39
35
  * Reporters kept in perf mode by name, as in the Playwright reporter config (e.g. 'junit', 'allure-playwright'). By default withPerf() keeps only the console reporters line, dot and github (list becomes dot; name list here to keep it) and the package reporter (D-23, 04-REQ-32).
40
36
  */
41
37
  keepReporters?: string[];
38
+ /**
39
+ * 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).
40
+ */
41
+ overrideSlowMo?: boolean;
42
42
  };
43
43
  /**
44
44
  * What the collector measures (05).
45
45
  */
46
46
  measure?: {
47
+ /**
48
+ * 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.
49
+ */
50
+ api?: boolean;
47
51
  /**
48
52
  * Playwright resource types that are measured. WebSocket traffic is not available as Request events in Playwright and cannot be measured (05).
49
53
  *
@@ -86,7 +90,7 @@ interface PackageConfig {
86
90
  */
87
91
  successStatuses?: [string, ...string[]];
88
92
  /**
89
- * 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).
93
+ * 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).
90
94
  */
91
95
  steps?: boolean | {
92
96
  /**
@@ -170,6 +174,10 @@ interface PackageConfig {
170
174
  * Random-looking ids of at least 16 characters with a digit, a lowercase and an uppercase letter, e.g. nanoid (07-REQ-08).
171
175
  */
172
176
  mixed?: boolean;
177
+ /**
178
+ * 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).
179
+ */
180
+ prefixed?: boolean;
173
181
  /**
174
182
  * E-mail addresses, replaced with ':email' (07-REQ-08).
175
183
  */
@@ -587,7 +595,7 @@ interface PackageConfig {
587
595
  */
588
596
  report?: {
589
597
  /**
590
- * Directory of report.json and report.html, relative to the Playwright config directory.
598
+ * 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.
591
599
  */
592
600
  dir?: string;
593
601
  /**
package/dist/index.d.ts CHANGED
@@ -11,11 +11,11 @@ interface PackageConfig {
11
11
  */
12
12
  run?: {
13
13
  /**
14
- * Environment label (D-18). Overridden by PW_PERF_ENV / --env. Null: no label, one set of thresholds files.
14
+ * Environment label (D-18). Overridden by PW_PERF_ENV. Null: no label, one set of thresholds files.
15
15
  */
16
16
  env?: string | null;
17
17
  /**
18
- * 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.
18
+ * 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.
19
19
  */
20
20
  passes?: {
21
21
  /**
@@ -28,22 +28,26 @@ interface PackageConfig {
28
28
  thresholds?: number;
29
29
  };
30
30
  /**
31
- * 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.
32
- */
33
- projects?: 'auto' | [string, ...string[]];
34
- /**
35
- * 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.
31
+ * 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.
36
32
  */
37
33
  grep?: null | string;
38
34
  /**
39
35
  * Reporters kept in perf mode by name, as in the Playwright reporter config (e.g. 'junit', 'allure-playwright'). By default withPerf() keeps only the console reporters line, dot and github (list becomes dot; name list here to keep it) and the package reporter (D-23, 04-REQ-32).
40
36
  */
41
37
  keepReporters?: string[];
38
+ /**
39
+ * 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).
40
+ */
41
+ overrideSlowMo?: boolean;
42
42
  };
43
43
  /**
44
44
  * What the collector measures (05).
45
45
  */
46
46
  measure?: {
47
+ /**
48
+ * 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.
49
+ */
50
+ api?: boolean;
47
51
  /**
48
52
  * Playwright resource types that are measured. WebSocket traffic is not available as Request events in Playwright and cannot be measured (05).
49
53
  *
@@ -86,7 +90,7 @@ interface PackageConfig {
86
90
  */
87
91
  successStatuses?: [string, ...string[]];
88
92
  /**
89
- * 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).
93
+ * 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).
90
94
  */
91
95
  steps?: boolean | {
92
96
  /**
@@ -170,6 +174,10 @@ interface PackageConfig {
170
174
  * Random-looking ids of at least 16 characters with a digit, a lowercase and an uppercase letter, e.g. nanoid (07-REQ-08).
171
175
  */
172
176
  mixed?: boolean;
177
+ /**
178
+ * 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).
179
+ */
180
+ prefixed?: boolean;
173
181
  /**
174
182
  * E-mail addresses, replaced with ':email' (07-REQ-08).
175
183
  */
@@ -587,7 +595,7 @@ interface PackageConfig {
587
595
  */
588
596
  report?: {
589
597
  /**
590
- * Directory of report.json and report.html, relative to the Playwright config directory.
598
+ * 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.
591
599
  */
592
600
  dir?: string;
593
601
  /**
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export { definePerfConfig, perfDefaults } from './chunk-AQ2XKYNV.js';
1
+ export { definePerfConfig, perfDefaults } from './chunk-CISGJCFW.js';
@@ -0,0 +1,17 @@
1
+ import { BrowserContext, APIRequestContext } from '@playwright/test';
2
+
3
+ interface PerfApi {
4
+ /** Tracks a browser context created in this test or in a test-scoped fixture, until test end. */
5
+ track(context: BrowserContext): void;
6
+ /**
7
+ * Measures the calls of an APIRequestContext from playwright.request.newContext() (15-REQ-03).
8
+ * Does nothing outside perf mode or in projects that are not measured.
9
+ */
10
+ trackRequestContext(requestContext: APIRequestContext): void;
11
+ }
12
+ /** Fixtures added by withPerfFixtures(). */
13
+ interface PerfFixtures {
14
+ perf: PerfApi;
15
+ }
16
+
17
+ export type { PerfFixtures as P, PerfApi as a };
@@ -0,0 +1,17 @@
1
+ import { BrowserContext, APIRequestContext } from '@playwright/test';
2
+
3
+ interface PerfApi {
4
+ /** Tracks a browser context created in this test or in a test-scoped fixture, until test end. */
5
+ track(context: BrowserContext): void;
6
+ /**
7
+ * Measures the calls of an APIRequestContext from playwright.request.newContext() (15-REQ-03).
8
+ * Does nothing outside perf mode or in projects that are not measured.
9
+ */
10
+ trackRequestContext(requestContext: APIRequestContext): void;
11
+ }
12
+ /** Fixtures added by withPerfFixtures(). */
13
+ interface PerfFixtures {
14
+ perf: PerfApi;
15
+ }
16
+
17
+ export type { PerfFixtures as P, PerfApi as a };