@seontechnologies/playwright-utils 3.10.0 → 3.11.0
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 +2 -1
- package/dist/cjs/api-request/api-request-fixture.d.ts.map +1 -1
- package/dist/cjs/api-request/api-request-fixture.js +5 -0
- package/dist/cjs/api-request/api-request-fixture.js.map +1 -1
- package/dist/cjs/api-request/schema-validation/core.d.ts +9 -0
- package/dist/cjs/api-request/schema-validation/core.d.ts.map +1 -1
- package/dist/cjs/api-request/schema-validation/core.js +53 -2
- package/dist/cjs/api-request/schema-validation/core.js.map +1 -1
- package/dist/cjs/api-request/schema-validation/fixture.d.ts +4 -2
- package/dist/cjs/api-request/schema-validation/fixture.d.ts.map +1 -1
- package/dist/cjs/api-request/schema-validation/fixture.js +9 -2
- package/dist/cjs/api-request/schema-validation/fixture.js.map +1 -1
- package/dist/cjs/api-request/schema-validation/internal/response-extension.d.ts.map +1 -1
- package/dist/cjs/api-request/schema-validation/internal/response-extension.js +5 -3
- package/dist/cjs/api-request/schema-validation/internal/response-extension.js.map +1 -1
- package/dist/cjs/api-request/ui-display.d.ts.map +1 -1
- package/dist/cjs/api-request/ui-display.js +36 -17
- package/dist/cjs/api-request/ui-display.js.map +1 -1
- package/dist/cjs/internal/index.d.ts +1 -0
- package/dist/cjs/internal/index.d.ts.map +1 -1
- package/dist/cjs/internal/index.js +1 -0
- package/dist/cjs/internal/index.js.map +1 -1
- package/dist/cjs/internal/page-context.d.ts +42 -0
- package/dist/cjs/internal/page-context.d.ts.map +1 -0
- package/dist/cjs/internal/page-context.js +58 -0
- package/dist/cjs/internal/page-context.js.map +1 -0
- package/dist/cjs/network-error-monitor/fixtures.d.ts +23 -2
- package/dist/cjs/network-error-monitor/fixtures.d.ts.map +1 -1
- package/dist/cjs/network-error-monitor/fixtures.js +30 -10
- package/dist/cjs/network-error-monitor/fixtures.js.map +1 -1
- package/dist/esm/api-request/api-request-fixture.d.ts.map +1 -1
- package/dist/esm/api-request/api-request-fixture.js +5 -0
- package/dist/esm/api-request/api-request-fixture.js.map +1 -1
- package/dist/esm/api-request/schema-validation/core.d.ts +9 -0
- package/dist/esm/api-request/schema-validation/core.d.ts.map +1 -1
- package/dist/esm/api-request/schema-validation/core.js +53 -2
- package/dist/esm/api-request/schema-validation/core.js.map +1 -1
- package/dist/esm/api-request/schema-validation/fixture.d.ts +4 -2
- package/dist/esm/api-request/schema-validation/fixture.d.ts.map +1 -1
- package/dist/esm/api-request/schema-validation/fixture.js +9 -2
- package/dist/esm/api-request/schema-validation/fixture.js.map +1 -1
- package/dist/esm/api-request/schema-validation/internal/response-extension.d.ts.map +1 -1
- package/dist/esm/api-request/schema-validation/internal/response-extension.js +5 -3
- package/dist/esm/api-request/schema-validation/internal/response-extension.js.map +1 -1
- package/dist/esm/api-request/ui-display.d.ts.map +1 -1
- package/dist/esm/api-request/ui-display.js +36 -17
- package/dist/esm/api-request/ui-display.js.map +1 -1
- package/dist/esm/internal/index.d.ts +1 -0
- package/dist/esm/internal/index.d.ts.map +1 -1
- package/dist/esm/internal/index.js +1 -0
- package/dist/esm/internal/index.js.map +1 -1
- package/dist/esm/internal/page-context.d.ts +42 -0
- package/dist/esm/internal/page-context.d.ts.map +1 -0
- package/dist/esm/internal/page-context.js +58 -0
- package/dist/esm/internal/page-context.js.map +1 -0
- package/dist/esm/network-error-monitor/fixtures.d.ts +23 -2
- package/dist/esm/network-error-monitor/fixtures.d.ts.map +1 -1
- package/dist/esm/network-error-monitor/fixtures.js +30 -10
- package/dist/esm/network-error-monitor/fixtures.js.map +1 -1
- package/dist/types/api-request/api-request-fixture.d.ts.map +1 -1
- package/dist/types/api-request/schema-validation/core.d.ts +9 -0
- package/dist/types/api-request/schema-validation/core.d.ts.map +1 -1
- package/dist/types/api-request/schema-validation/fixture.d.ts +4 -2
- package/dist/types/api-request/schema-validation/fixture.d.ts.map +1 -1
- package/dist/types/api-request/schema-validation/internal/response-extension.d.ts.map +1 -1
- package/dist/types/api-request/ui-display.d.ts.map +1 -1
- package/dist/types/internal/index.d.ts +1 -0
- package/dist/types/internal/index.d.ts.map +1 -1
- package/dist/types/internal/page-context.d.ts +42 -0
- package/dist/types/internal/page-context.d.ts.map +1 -0
- package/dist/types/network-error-monitor/fixtures.d.ts +23 -2
- package/dist/types/network-error-monitor/fixtures.d.ts.map +1 -1
- package/package.json +4 -3
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Page Context Management for Schema Validation UI
|
|
4
|
+
*
|
|
5
|
+
* This module provides a way to capture and retrieve the Playwright page context
|
|
6
|
+
* for use in standalone functions that need UI display capabilities.
|
|
7
|
+
*
|
|
8
|
+
* Similar to captureTestContext, this allows the plain validateSchema function
|
|
9
|
+
* to display validation results in the Playwright UI.
|
|
10
|
+
*
|
|
11
|
+
* @note Test Isolation: Playwright runs parallel tests in separate worker processes,
|
|
12
|
+
* so global state is isolated per-worker. Serial tests in the same worker are handled
|
|
13
|
+
* by the fixtures which call clearPageContext() after each test. For manual usage
|
|
14
|
+
* outside of fixtures, ensure you're in an isolated test context.
|
|
15
|
+
*/
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.capturePageContext = capturePageContext;
|
|
18
|
+
exports.getPageContext = getPageContext;
|
|
19
|
+
exports.clearPageContext = clearPageContext;
|
|
20
|
+
/** Current page context - captured per test */
|
|
21
|
+
let currentPage = null;
|
|
22
|
+
/**
|
|
23
|
+
* Capture the current page context for use by standalone functions.
|
|
24
|
+
* Call this in your beforeEach hook alongside captureTestContext.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* import { test } from '@playwright/test'
|
|
29
|
+
* import { captureTestContext, capturePageContext } from '@seontechnologies/playwright-utils'
|
|
30
|
+
*
|
|
31
|
+
* test.beforeEach(async ({ page }, testInfo) => {
|
|
32
|
+
* captureTestContext(testInfo)
|
|
33
|
+
* capturePageContext(page)
|
|
34
|
+
* })
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
function capturePageContext(page) {
|
|
38
|
+
currentPage = page;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Get the currently captured page context.
|
|
42
|
+
* Returns null if no page has been captured or if the page has been closed.
|
|
43
|
+
*/
|
|
44
|
+
function getPageContext() {
|
|
45
|
+
// Defensive check: clear stale reference if page was closed
|
|
46
|
+
if (currentPage && currentPage.isClosed()) {
|
|
47
|
+
currentPage = null;
|
|
48
|
+
}
|
|
49
|
+
return currentPage;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Clear the page context. Called automatically between tests
|
|
53
|
+
* but can be called manually if needed.
|
|
54
|
+
*/
|
|
55
|
+
function clearPageContext() {
|
|
56
|
+
currentPage = null;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=page-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-context.js","sourceRoot":"","sources":["../../../src/internal/page-context.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;AAsBH,gDAEC;AAMD,wCAMC;AAMD,4CAEC;AAxCD,+CAA+C;AAC/C,IAAI,WAAW,GAAgB,IAAI,CAAA;AAEnC;;;;;;;;;;;;;;GAcG;AACH,SAAgB,kBAAkB,CAAC,IAAU;IAC3C,WAAW,GAAG,IAAI,CAAA;AACpB,CAAC;AAED;;;GAGG;AACH,SAAgB,cAAc;IAC5B,4DAA4D;IAC5D,IAAI,WAAW,IAAI,WAAW,CAAC,QAAQ,EAAE,EAAE,CAAC;QAC1C,WAAW,GAAG,IAAI,CAAA;IACpB,CAAC;IACD,OAAO,WAAW,CAAA;AACpB,CAAC;AAED;;;GAGG;AACH,SAAgB,gBAAgB;IAC9B,WAAW,GAAG,IAAI,CAAA;AACpB,CAAC"}
|
|
@@ -14,17 +14,38 @@ type NetworkErrorMonitorFixture = {
|
|
|
14
14
|
/** Automatically monitors network responses for errors */
|
|
15
15
|
networkErrorMonitor: void;
|
|
16
16
|
};
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Base configuration without excludePatterns - maxTestsPerError cannot be used
|
|
19
|
+
*/
|
|
20
|
+
type BaseNetworkErrorMonitorConfig = {
|
|
21
|
+
/** Not specified - maxTestsPerError cannot be used without excludePatterns */
|
|
22
|
+
excludePatterns?: undefined;
|
|
23
|
+
/** Cannot be specified without excludePatterns */
|
|
24
|
+
maxTestsPerError?: never;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Configuration with excludePatterns - enables maxTestsPerError option
|
|
28
|
+
*/
|
|
29
|
+
type NetworkErrorMonitorConfigWithPatterns = {
|
|
18
30
|
/** Regex patterns for URLs to exclude from error monitoring */
|
|
19
|
-
excludePatterns
|
|
31
|
+
excludePatterns: RegExp[];
|
|
20
32
|
/**
|
|
21
33
|
* Maximum number of tests that can fail per unique error pattern.
|
|
22
34
|
* Once this limit is reached, subsequent tests just log the error without failing.
|
|
23
35
|
* Default: Infinity (all tests fail)
|
|
36
|
+
* Requires excludePatterns to be specified.
|
|
24
37
|
* @example maxTestsPerError: 1 // Only first test fails, rest just log
|
|
25
38
|
*/
|
|
26
39
|
maxTestsPerError?: number;
|
|
27
40
|
};
|
|
41
|
+
/**
|
|
42
|
+
* Configuration options for the network error monitor.
|
|
43
|
+
*
|
|
44
|
+
* Note: maxTestsPerError can only be used when excludePatterns is specified.
|
|
45
|
+
* This enforces a best practice where domino effect prevention is paired with
|
|
46
|
+
* known exclusion patterns.
|
|
47
|
+
*/
|
|
48
|
+
type NetworkErrorMonitorConfig = BaseNetworkErrorMonitorConfig | NetworkErrorMonitorConfigWithPatterns;
|
|
28
49
|
/**
|
|
29
50
|
* Creates a network error monitoring fixture with configurable exclusion patterns and fail-fast behavior.
|
|
30
51
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../../src/network-error-monitor/fixtures.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAY,QAAQ,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../../src/network-error-monitor/fixtures.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAY,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAwBhE,KAAK,0BAA0B,GAAG;IAChC,0DAA0D;IAC1D,mBAAmB,EAAE,IAAI,CAAA;CAC1B,CAAA;AAED;;GAEG;AACH,KAAK,6BAA6B,GAAG;IACnC,8EAA8E;IAC9E,eAAe,CAAC,EAAE,SAAS,CAAA;IAC3B,kDAAkD;IAClD,gBAAgB,CAAC,EAAE,KAAK,CAAA;CACzB,CAAA;AAED;;GAEG;AACH,KAAK,qCAAqC,GAAG;IAC3C,+DAA+D;IAC/D,eAAe,EAAE,MAAM,EAAE,CAAA;IACzB;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAC1B,CAAA;AAED;;;;;;GAMG;AACH,KAAK,yBAAyB,GAC1B,6BAA6B,GAC7B,qCAAqC,CAAA;AAyNzC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,gCAAgC,CAC9C,MAAM,GAAE,yBAA8B;sCAOtB;QAAE,IAAI,EAAE,IAAI,CAAA;KAAE,OACnB,CAAC,CAAC,CAAC,EAAE,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,YACtB,QAAQ;;;EAoFzB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,eAAO,MAAM,IAAI,0QAGhB,CAAA;AAED,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA"}
|
|
@@ -19,7 +19,12 @@ const log_1 = require("../log/log");
|
|
|
19
19
|
* Global state to track how many tests have failed per error pattern.
|
|
20
20
|
* This prevents domino effect where same backend issue fails hundreds of tests.
|
|
21
21
|
*
|
|
22
|
-
*
|
|
22
|
+
* IMPORTANT: This state is worker-scoped and persists across test files.
|
|
23
|
+
* - Parallel workers have independent state (no cross-contamination)
|
|
24
|
+
* - Sequential tests in same worker share this state
|
|
25
|
+
* - State is never reset during worker lifetime
|
|
26
|
+
*
|
|
27
|
+
* Key format: `${method}:${status}:${basePath}` (e.g., "GET:500:/api/v2/case-management")
|
|
23
28
|
* Value: number of tests that have already failed with this error pattern
|
|
24
29
|
*/
|
|
25
30
|
const errorPatternFailureCount = new Map();
|
|
@@ -66,18 +71,27 @@ function extractBasePath(url) {
|
|
|
66
71
|
return '/' + pathSegments.slice(0, 3).join('/');
|
|
67
72
|
}
|
|
68
73
|
catch {
|
|
74
|
+
// Log parsing failures to help debug issues with malformed URLs
|
|
75
|
+
log_1.log.warningSync(`Failed to parse URL for error pattern grouping: ${url}. Using full URL as pattern key.`);
|
|
69
76
|
return url;
|
|
70
77
|
}
|
|
71
78
|
}
|
|
72
79
|
/**
|
|
73
80
|
* Create error pattern key for tracking failures across tests.
|
|
81
|
+
* Includes HTTP method to distinguish between different error types on same endpoint.
|
|
74
82
|
*
|
|
75
83
|
* @example
|
|
76
|
-
* GET 500 /api/v2/case-management/cases/123 → "500:/api/v2/case-management"
|
|
84
|
+
* GET 500 /api/v2/case-management/cases/123 → "GET:500:/api/v2/case-management"
|
|
85
|
+
* POST 404 /api/v2/users → "POST:404:/api/v2/users"
|
|
86
|
+
*
|
|
87
|
+
* @rationale
|
|
88
|
+
* A GET 404 vs POST 404 on same endpoint might represent different issues:
|
|
89
|
+
* - GET 404 /api/users/123 → User not found (expected in some tests)
|
|
90
|
+
* - POST 404 /api/users → Endpoint doesn't exist (critical error)
|
|
77
91
|
*/
|
|
78
92
|
function createErrorPatternKey(error) {
|
|
79
93
|
const basePath = extractBasePath(error.url);
|
|
80
|
-
return `${error.status}:${basePath}`;
|
|
94
|
+
return `${error.method}:${error.status}:${basePath}`;
|
|
81
95
|
}
|
|
82
96
|
/**
|
|
83
97
|
* Check if we've already failed enough tests for this error pattern.
|
|
@@ -88,9 +102,9 @@ function createErrorPatternKey(error) {
|
|
|
88
102
|
*
|
|
89
103
|
* @example
|
|
90
104
|
* Test encounters 3 errors:
|
|
91
|
-
* - 500:/api/v2/cases (count: 1, limit: 1) → at limit
|
|
92
|
-
* - 404:/api/v2/users (count: 0, limit: 1) → NEW pattern
|
|
93
|
-
* - 503:/api/v2/metrics (count: 0, limit: 1) → NEW pattern
|
|
105
|
+
* - GET:500:/api/v2/cases (count: 1, limit: 1) → at limit
|
|
106
|
+
* - POST:404:/api/v2/users (count: 0, limit: 1) → NEW pattern
|
|
107
|
+
* - GET:503:/api/v2/metrics (count: 0, limit: 1) → NEW pattern
|
|
94
108
|
* Result: false (test should fail because 2 patterns are new)
|
|
95
109
|
*/
|
|
96
110
|
function shouldSkipFailureForErrorPattern(errorData, maxTestsPerError) {
|
|
@@ -115,9 +129,9 @@ function shouldSkipFailureForErrorPattern(errorData, maxTestsPerError) {
|
|
|
115
129
|
*
|
|
116
130
|
* @example
|
|
117
131
|
* Test encounters 3 errors with maxTestsPerError: 1
|
|
118
|
-
* - 500:/api/v2/old (count: 1, limit: 1) → at limit, DON'T increment
|
|
119
|
-
* - 404:/api/v2/new (count: 0, limit: 1) → new pattern, increment to 1
|
|
120
|
-
* - 503:/api/v2/other (count: 0, limit: 1) → new pattern, increment to 1
|
|
132
|
+
* - GET:500:/api/v2/old (count: 1, limit: 1) → at limit, DON'T increment
|
|
133
|
+
* - POST:404:/api/v2/new (count: 0, limit: 1) → new pattern, increment to 1
|
|
134
|
+
* - GET:503:/api/v2/other (count: 0, limit: 1) → new pattern, increment to 1
|
|
121
135
|
*/
|
|
122
136
|
function incrementErrorPatternCounts(errorData, maxTestsPerError) {
|
|
123
137
|
for (const error of errorData) {
|
|
@@ -126,7 +140,13 @@ function incrementErrorPatternCounts(errorData, maxTestsPerError) {
|
|
|
126
140
|
// Only increment if this pattern contributed to the test failing
|
|
127
141
|
// (i.e., it was below the limit and thus caused the failure)
|
|
128
142
|
if (currentCount < maxTestsPerError) {
|
|
129
|
-
|
|
143
|
+
const newCount = currentCount + 1;
|
|
144
|
+
errorPatternFailureCount.set(patternKey, newCount);
|
|
145
|
+
// Debug logging to help developers track pattern counts
|
|
146
|
+
log_1.log.debugSync(`Pattern ${patternKey} count incremented: ${currentCount} -> ${newCount} (limit: ${maxTestsPerError})`);
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
log_1.log.debugSync(`Pattern ${patternKey} already at limit: ${currentCount}/${maxTestsPerError} - not incrementing`);
|
|
130
150
|
}
|
|
131
151
|
}
|
|
132
152
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fixtures.js","sourceRoot":"","sources":["../../../src/network-error-monitor/fixtures.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;
|
|
1
|
+
{"version":3,"file":"fixtures.js","sourceRoot":"","sources":["../../../src/network-error-monitor/fixtures.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAqTH,4EA8FC;AAjZD,2CAA+C;AAE/C,oCAAgC;AAEhC;;;;;;;;;;;GAWG;AACH,MAAM,wBAAwB,GAAG,IAAI,GAAG,EAAkB,CAAA;AAmD1D;;GAEG;AACH,SAAS,gBAAgB,CAAC,GAAW,EAAE,eAAyB;IAC9D,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;AAC7D,CAAC;AAED;;GAEG;AACH,SAAS,mBAAmB,CAC1B,MAAc,EACd,GAAW,EACX,MAAc,EACd,SAAyB,EACzB,UAAuB,EACvB,eAAyB;IAEzB,oDAAoD;IACpD,IAAI,MAAM,GAAG,GAAG,IAAI,gBAAgB,CAAC,GAAG,EAAE,eAAe,CAAC,EAAE,CAAC;QAC3D,O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A8D;AAC9D,gCAAgC,EAAS,CAC1C,CAAA;AAED,yCAAyC;AAAhC,8FAAA,MAAM,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-request-fixture.d.ts","sourceRoot":"","sources":["../../../src/api-request/api-request-fixture.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AACrD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAA;
|
|
1
|
+
{"version":3,"file":"api-request-fixture.d.ts","sourceRoot":"","sources":["../../../src/api-request/api-request-fixture.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AACrD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAA;AAGxF;;;GAGG;AACH,MAAM,MAAM,uBAAuB,GAAG,IAAI,CAAC,gBAAgB,EAAE,SAAS,CAAC,CAAA;AAEvE,eAAO,MAAM,IAAI;IACf;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCG;gBACS,CAAC,CAAC,GAAG,OAAO,EACtB,MAAM,EAAE,uBAAuB,KAC5B,kBAAkB,CAAC,CAAC,CAAC;wGAqC1B,CAAA"}
|
|
@@ -9,5 +9,14 @@ export declare function validateSchema(data: unknown, schema: SupportedSchema, o
|
|
|
9
9
|
endpoint?: string;
|
|
10
10
|
method?: string;
|
|
11
11
|
status?: number;
|
|
12
|
+
/** Enable UI display for this validation (or set API_E2E_UI_MODE=true) */
|
|
13
|
+
uiMode?: boolean;
|
|
14
|
+
/** Validation mode - 'throw' (default) or 'return' */
|
|
15
|
+
mode?: 'throw' | 'return';
|
|
16
|
+
/**
|
|
17
|
+
* Internal flag to skip UI display (used by chained API to avoid duplicates).
|
|
18
|
+
* @internal Do not use directly; automatically set by response-extension.ts
|
|
19
|
+
*/
|
|
20
|
+
_skipUI?: boolean;
|
|
12
21
|
}): Promise<ValidationResult>;
|
|
13
22
|
//# sourceMappingURL=core.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../src/api-request/schema-validation/core.ts"],"names":[],"mappings":"AAAA,oCAAoC;AAGpC,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../src/api-request/schema-validation/core.ts"],"names":[],"mappings":"AAAA,oCAAoC;AAGpC,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AA2DhF,0CAA0C;AAC1C,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,eAAe,GACtB,gBAAgB,CAAC,cAAc,CAAC,CA8BlC;AAED,sDAAsD;AACtD,wBAAsB,cAAc,CAClC,IAAI,EAAE,OAAO,EACb,MAAM,EAAE,eAAe,EACvB,OAAO,GAAE;IACP,KAAK,CAAC,EAAE,cAAc,CAAA;IACtB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,0EAA0E;IAC1E,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,sDAAsD;IACtD,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAA;IACzB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;CACb,GACL,OAAO,CAAC,gBAAgB,CAAC,CAsD3B"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import type { SupportedSchema, ValidateSchemaOptions, ValidationResult } from './types';
|
|
2
2
|
/**
|
|
3
|
-
* Fixture that provides the validateSchema function for schema validation
|
|
3
|
+
* Fixture that provides the validateSchema function for schema validation.
|
|
4
|
+
* Displays validation results in Playwright UI when API_E2E_UI_MODE=true.
|
|
4
5
|
*/
|
|
5
6
|
export declare const test: import("@playwright/test").TestType<import("@playwright/test").PlaywrightTestArgs & import("@playwright/test").PlaywrightTestOptions & {
|
|
6
7
|
/**
|
|
7
|
-
* Validates data against a schema with optional shape assertions
|
|
8
|
+
* Validates data against a schema with optional shape assertions.
|
|
9
|
+
* Displays validation results in Playwright UI when API_E2E_UI_MODE=true.
|
|
8
10
|
*
|
|
9
11
|
* @example
|
|
10
12
|
* test('validate response schema', async ({ validateSchema }) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fixture.d.ts","sourceRoot":"","sources":["../../../../src/api-request/schema-validation/fixture.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fixture.d.ts","sourceRoot":"","sources":["../../../../src/api-request/schema-validation/fixture.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,eAAe,EACf,qBAAqB,EACrB,gBAAgB,EACjB,MAAM,SAAS,CAAA;AAEhB;;;GAGG;AACH,eAAO,MAAM,IAAI;IACf;;;;;;;;;;;;OAYG;oBACa,CACd,MAAM,EAAE,eAAe,EACvB,IAAI,EAAE,OAAO,EACb,OAAO,CAAC,EAAE,qBAAqB,KAC5B,OAAO,CAAC,gBAAgB,CAAC;wGAoB9B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response-extension.d.ts","sourceRoot":"","sources":["../../../../../src/api-request/schema-validation/internal/response-extension.ts"],"names":[],"mappings":"AAAA,oDAAoD;AAWpD,OAAO,KAAK,EACV,eAAe,EACf,qBAAqB,EACrB,oBAAoB,EAErB,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAM3D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAqB5C,uDAAuD;AACvD,MAAM,WAAW,mBAAmB,CAAC,CAAC,GAAG,OAAO,CAC9C,SAAQ,kBAAkB,CAAC,CAAC,CAAC;IAC7B,cAAc,CAAC,UAAU,GAAG,CAAC,EAC3B,MAAM,EAAE,eAAe,EACvB,OAAO,CAAC,EAAE,qBAAqB,GAC9B,OAAO,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC,CAAA;CAC7C;AAmID,0DAA0D;AAC1D,wBAAgB,sBAAsB,CAAC,CAAC,EACtC,gBAAgB,EAAE,kBAAkB,CAAC,CAAC,CAAC,EACvC,cAAc,CAAC,EAAE;IACf,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAChC,IAAI,CAAC,EAAE,IAAI,CAAA;IACX,MAAM,CAAC,EAAE,OAAO,CAAA;CACjB,GACA,mBAAmB,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"response-extension.d.ts","sourceRoot":"","sources":["../../../../../src/api-request/schema-validation/internal/response-extension.ts"],"names":[],"mappings":"AAAA,oDAAoD;AAWpD,OAAO,KAAK,EACV,eAAe,EACf,qBAAqB,EACrB,oBAAoB,EAErB,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAM3D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAqB5C,uDAAuD;AACvD,MAAM,WAAW,mBAAmB,CAAC,CAAC,GAAG,OAAO,CAC9C,SAAQ,kBAAkB,CAAC,CAAC,CAAC;IAC7B,cAAc,CAAC,UAAU,GAAG,CAAC,EAC3B,MAAM,EAAE,eAAe,EACvB,OAAO,CAAC,EAAE,qBAAqB,GAC9B,OAAO,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC,CAAA;CAC7C;AAmID,0DAA0D;AAC1D,wBAAgB,sBAAsB,CAAC,CAAC,EACtC,gBAAgB,EAAE,kB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MAAM,CAAA;QACf,UAAU,EAAE,MAAM,CAAA;QAClB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;QACjB,MAAM,CAAC,EAAE,MAAM,CAAA;KAChB,CAAA;CACF;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc,GACzB,aAAa,oBAAoB,EACjC,cAAc,qBAAqB,EACnC,OAAO,IAAI,EACX,SAAS,OAAO,KACf,OAAO,CAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"ui-display.d.ts","sourceRoot":"","sources":["../../../src/api-request/ui-display.ts"],"names":[],"mappings":"AACA;;;GAGG;AAEH,OAAO,EAAQ,KAAK,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAGlD,4CAA4C;AAC5C,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,GAAG,CAAA;IACV,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,cAAc,CAAC,EAAE;QACf,YAAY,EAAE,MAAM,CAAA;QACpB,cAAc,EAAE,MAAM,CAAA;QACtB,OAAO,EAAE,OAAO,CAAA;QAChB,UAAU,EAAE,MAAM,CAAA;KACnB,CAAA;CACF;AAED,6CAA6C;AAC7C,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,GAAG,CAAA;IACV,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,gBAAgB,CAAC,EAAE;QACjB,IAAI,EAAE,GAAG,GAAG,GAAG,CAAA;QACf,OAAO,EAAE,MAAM,CAAA;QACf,UAAU,EAAE,MAAM,CAAA;QAClB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;QACjB,MAAM,CAAC,EAAE,MAAM,CAAA;KAChB,CAAA;CACF;AAED;;;GAGG;AACH,eAAO,MAAM,cAAc,GACzB,aAAa,oBAAoB,EACjC,cAAc,qBAAqB,EACnC,OAAO,IAAI,EACX,SAAS,OAAO,KACf,OAAO,CAAC,IAAI,CAmCd,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/internal/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/internal/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Page Context Management for Schema Validation UI
|
|
3
|
+
*
|
|
4
|
+
* This module provides a way to capture and retrieve the Playwright page context
|
|
5
|
+
* for use in standalone functions that need UI display capabilities.
|
|
6
|
+
*
|
|
7
|
+
* Similar to captureTestContext, this allows the plain validateSchema function
|
|
8
|
+
* to display validation results in the Playwright UI.
|
|
9
|
+
*
|
|
10
|
+
* @note Test Isolation: Playwright runs parallel tests in separate worker processes,
|
|
11
|
+
* so global state is isolated per-worker. Serial tests in the same worker are handled
|
|
12
|
+
* by the fixtures which call clearPageContext() after each test. For manual usage
|
|
13
|
+
* outside of fixtures, ensure you're in an isolated test context.
|
|
14
|
+
*/
|
|
15
|
+
import type { Page } from '@playwright/test';
|
|
16
|
+
/**
|
|
17
|
+
* Capture the current page context for use by standalone functions.
|
|
18
|
+
* Call this in your beforeEach hook alongside captureTestContext.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* import { test } from '@playwright/test'
|
|
23
|
+
* import { captureTestContext, capturePageContext } from '@seontechnologies/playwright-utils'
|
|
24
|
+
*
|
|
25
|
+
* test.beforeEach(async ({ page }, testInfo) => {
|
|
26
|
+
* captureTestContext(testInfo)
|
|
27
|
+
* capturePageContext(page)
|
|
28
|
+
* })
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare function capturePageContext(page: Page): void;
|
|
32
|
+
/**
|
|
33
|
+
* Get the currently captured page context.
|
|
34
|
+
* Returns null if no page has been captured or if the page has been closed.
|
|
35
|
+
*/
|
|
36
|
+
export declare function getPageContext(): Page | null;
|
|
37
|
+
/**
|
|
38
|
+
* Clear the page context. Called automatically between tests
|
|
39
|
+
* but can be called manually if needed.
|
|
40
|
+
*/
|
|
41
|
+
export declare function clearPageContext(): void;
|
|
42
|
+
//# sourceMappingURL=page-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-context.d.ts","sourceRoot":"","sources":["../../../src/internal/page-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAK5C;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAEnD;AAED;;;GAGG;AACH,wBAAgB,cAAc,IAAI,IAAI,GAAG,IAAI,CAM5C;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAEvC"}
|
|
@@ -14,17 +14,38 @@ type NetworkErrorMonitorFixture = {
|
|
|
14
14
|
/** Automatically monitors network responses for errors */
|
|
15
15
|
networkErrorMonitor: void;
|
|
16
16
|
};
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Base configuration without excludePatterns - maxTestsPerError cannot be used
|
|
19
|
+
*/
|
|
20
|
+
type BaseNetworkErrorMonitorConfig = {
|
|
21
|
+
/** Not specified - maxTestsPerError cannot be used without excludePatterns */
|
|
22
|
+
excludePatterns?: undefined;
|
|
23
|
+
/** Cannot be specified without excludePatterns */
|
|
24
|
+
maxTestsPerError?: never;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Configuration with excludePatterns - enables maxTestsPerError option
|
|
28
|
+
*/
|
|
29
|
+
type NetworkErrorMonitorConfigWithPatterns = {
|
|
18
30
|
/** Regex patterns for URLs to exclude from error monitoring */
|
|
19
|
-
excludePatterns
|
|
31
|
+
excludePatterns: RegExp[];
|
|
20
32
|
/**
|
|
21
33
|
* Maximum number of tests that can fail per unique error pattern.
|
|
22
34
|
* Once this limit is reached, subsequent tests just log the error without failing.
|
|
23
35
|
* Default: Infinity (all tests fail)
|
|
36
|
+
* Requires excludePatterns to be specified.
|
|
24
37
|
* @example maxTestsPerError: 1 // Only first test fails, rest just log
|
|
25
38
|
*/
|
|
26
39
|
maxTestsPerError?: number;
|
|
27
40
|
};
|
|
41
|
+
/**
|
|
42
|
+
* Configuration options for the network error monitor.
|
|
43
|
+
*
|
|
44
|
+
* Note: maxTestsPerError can only be used when excludePatterns is specified.
|
|
45
|
+
* This enforces a best practice where domino effect prevention is paired with
|
|
46
|
+
* known exclusion patterns.
|
|
47
|
+
*/
|
|
48
|
+
type NetworkErrorMonitorConfig = BaseNetworkErrorMonitorConfig | NetworkErrorMonitorConfigWithPatterns;
|
|
28
49
|
/**
|
|
29
50
|
* Creates a network error monitoring fixture with configurable exclusion patterns and fail-fast behavior.
|
|
30
51
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../../src/network-error-monitor/fixtures.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAY,QAAQ,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../../src/network-error-monitor/fixtures.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAY,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAwBhE,KAAK,0BAA0B,GAAG;IAChC,0DAA0D;IAC1D,mBAAmB,EAAE,IAAI,CAAA;CAC1B,CAAA;AAED;;GAEG;AACH,KAAK,6BAA6B,GAAG;IACnC,8EAA8E;IAC9E,eAAe,CAAC,EAAE,SAAS,CAAA;IAC3B,kDAAkD;IAClD,gBAAgB,CAAC,EAAE,KAAK,CAAA;CACzB,CAAA;AAED;;GAEG;AACH,KAAK,qCAAqC,GAAG;IAC3C,+DAA+D;IAC/D,eAAe,EAAE,MAAM,EAAE,CAAA;IACzB;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAC1B,CAAA;AAED;;;;;;GAMG;AACH,KAAK,yBAAyB,GAC1B,6BAA6B,GAC7B,qCAAqC,CAAA;AAyNzC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,gCAAgC,CAC9C,MAAM,GAAE,yBAA8B;sCAOtB;QAAE,IAAI,EAAE,IAAI,CAAA;KAAE,OACnB,CAAC,CAAC,CAAC,EAAE,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,YACtB,QAAQ;;;EAoFzB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,eAAO,MAAM,IAAI,0QAGhB,CAAA;AAED,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seontechnologies/playwright-utils",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.11.0",
|
|
4
4
|
"description": "A collection of utilities for Playwright.",
|
|
5
5
|
"workspaces": [
|
|
6
6
|
"sample-app/*"
|
|
@@ -145,7 +145,7 @@
|
|
|
145
145
|
"start:frontend": "cd sample-app/frontend && npm start",
|
|
146
146
|
"start:backend": "cd sample-app/backend && npm start",
|
|
147
147
|
"prepare": "npm run build",
|
|
148
|
-
"postinstall": "git submodule update --init --recursive --force",
|
|
148
|
+
"postinstall": "[ -z \"$CI\" ] && git submodule update --init --recursive --force || true",
|
|
149
149
|
"publish:local": "./scripts/publish.sh",
|
|
150
150
|
"build": "npm run clean && npm run build:types && npm run build:cjs && npm run build:esm",
|
|
151
151
|
"clean": "rm -rf dist",
|
|
@@ -165,7 +165,8 @@
|
|
|
165
165
|
"test:pw-ui": "TEST_ENV=local npx playwright test --ui",
|
|
166
166
|
"test:pw:burn-in": "PW_BURN_IN=true npx playwright test --repeat-each=3 --retries=0",
|
|
167
167
|
"test:pw:burn-in-changed-classic": "PW_BURN_IN=true npx playwright test --only-changed=main --repeat-each=3 --retries=0",
|
|
168
|
-
"test:pw:burn-in-changed": "tsx playwright/scripts/burn-in-changed.ts"
|
|
168
|
+
"test:pw:burn-in-changed": "tsx playwright/scripts/burn-in-changed.ts",
|
|
169
|
+
"show:report": "npx playwright show-report --port 9324"
|
|
169
170
|
},
|
|
170
171
|
"peerDependencies": {
|
|
171
172
|
"@playwright/test": ">=1.54.1",
|