@gooddata/sdk-e2e-utils 11.62.0-alpha.2 → 11.62.0-alpha.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.
- package/esm/create-test/feature-hub/merge.d.ts +8 -0
- package/esm/create-test/feature-hub/merge.d.ts.map +1 -0
- package/esm/create-test/feature-hub/merge.js +19 -0
- package/esm/create-test/feature-hub/mock.d.ts +8 -3
- package/esm/create-test/feature-hub/mock.d.ts.map +1 -1
- package/esm/create-test/feature-hub/mock.js +26 -10
- package/esm/create-test/feature-hub/types.d.ts +5 -4
- package/esm/create-test/feature-hub/types.d.ts.map +1 -1
- package/esm/create-test/playwright/factory.d.ts.map +1 -1
- package/esm/create-test/playwright/factory.js +12 -8
- package/esm/create-test/playwright/flag-to-feature.d.ts +6 -0
- package/esm/create-test/playwright/flag-to-feature.d.ts.map +1 -0
- package/esm/create-test/playwright/flag-to-feature.js +27 -0
- package/esm/create-test/playwright/to-playwright-details.js +1 -1
- package/esm/create-test/playwright/types.d.ts +11 -6
- package/esm/create-test/playwright/types.d.ts.map +1 -1
- package/esm/create-test/playwright/with-describe-details.d.ts +6 -5
- package/esm/create-test/playwright/with-describe-details.d.ts.map +1 -1
- package/esm/create-test/playwright/with-describe-details.js +56 -26
- package/esm/index.d.ts +2 -2
- package/esm/index.d.ts.map +1 -1
- package/esm/sdk-e2e-utils.d.ts +20 -17
- package/package.json +5 -4
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IFeatureHubFeature } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
* Merge `overrides` into `features`: an override whose `key` already exists in `features` replaces that
|
|
5
|
+
* feature in place, any other override is appended at the end. Neither input is mutated.
|
|
6
|
+
*/
|
|
7
|
+
export declare function mergeFeatureHubFeatures(features: IFeatureHubFeature[], overrides: IFeatureHubFeature[]): IFeatureHubFeature[];
|
|
8
|
+
//# sourceMappingURL=merge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge.d.ts","sourceRoot":"","sources":["../../../src/create-test/feature-hub/merge.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD;;;;GAIG;AACH,wBAAgB,uBAAuB,CACnC,QAAQ,EAAE,kBAAkB,EAAE,EAC9B,SAAS,EAAE,kBAAkB,EAAE,GAChC,kBAAkB,EAAE,CActB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
* Merge `overrides` into `features`: an override whose `key` already exists in `features` replaces that
|
|
5
|
+
* feature in place, any other override is appended at the end. Neither input is mutated.
|
|
6
|
+
*/
|
|
7
|
+
export function mergeFeatureHubFeatures(features, overrides) {
|
|
8
|
+
const merged = [...features];
|
|
9
|
+
for (const override of overrides) {
|
|
10
|
+
const index = merged.findIndex((feature) => feature.key === override.key);
|
|
11
|
+
if (index === -1) {
|
|
12
|
+
merged.push(override);
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
merged[index] = override;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return merged;
|
|
19
|
+
}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { IFeatureHubEnvironment } from "./types.js";
|
|
1
|
+
import type { Page } from "@playwright/test";
|
|
2
|
+
import type { IFeatureHubEnvironment, IFeatureHubFeature } from "./types.js";
|
|
3
|
+
export declare function makeFeatureHubResponse(features: IFeatureHubFeature[]): IFeatureHubEnvironment[];
|
|
3
4
|
/** FeatureHub mock — each test gets a fresh page, so route dies with it. */
|
|
4
|
-
export declare function registerFeatureHubMock(
|
|
5
|
+
export declare function registerFeatureHubMock(page: Page, features: IFeatureHubFeature[]): Promise<void>;
|
|
6
|
+
/** Remove the FeatureHub mock registered by {@link registerFeatureHubMock}. */
|
|
7
|
+
export declare function unregisterFeatureHubMock(page: Page): Promise<void>;
|
|
8
|
+
/** Replace the current FeatureHub mock with one serving `featureHubResponse`. */
|
|
9
|
+
export declare function reregisterFeatureHubMock(page: Page, featureHubResponse: IFeatureHubFeature[]): Promise<void>;
|
|
5
10
|
//# sourceMappingURL=mock.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mock.d.ts","sourceRoot":"","sources":["../../../src/create-test/feature-hub/mock.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"mock.d.ts","sourceRoot":"","sources":["../../../src/create-test/feature-hub/mock.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,KAAK,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAI7E,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,kBAAkB,EAAE,GAAG,sBAAsB,EAAE,CAO/F;AAED,4EAA4E;AAC5E,wBAAsB,sBAAsB,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,kBAAkB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAWtG;AAED,+EAA+E;AAC/E,wBAAsB,wBAAwB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAExE;AAED,iFAAiF;AACjF,wBAAsB,wBAAwB,CAC1C,IAAI,EAAE,IAAI,EACV,kBAAkB,EAAE,kBAAkB,EAAE,GACzC,OAAO,CAAC,IAAI,CAAC,CAGf"}
|
|
@@ -1,15 +1,31 @@
|
|
|
1
1
|
// (C) 2026 GoodData Corporation
|
|
2
|
+
const FEATURE_HUB_ROUTE = "**/features*";
|
|
3
|
+
export function makeFeatureHubResponse(features) {
|
|
4
|
+
return [
|
|
5
|
+
{
|
|
6
|
+
id: "50e8946c-ef93-4748-bfb1-f0522214cc69",
|
|
7
|
+
features,
|
|
8
|
+
},
|
|
9
|
+
];
|
|
10
|
+
}
|
|
2
11
|
/** FeatureHub mock — each test gets a fresh page, so route dies with it. */
|
|
3
|
-
export function registerFeatureHubMock(
|
|
4
|
-
const body = JSON.stringify(
|
|
5
|
-
|
|
6
|
-
await
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
body,
|
|
12
|
-
});
|
|
12
|
+
export async function registerFeatureHubMock(page, features) {
|
|
13
|
+
const body = JSON.stringify(makeFeatureHubResponse(features));
|
|
14
|
+
await page.route(FEATURE_HUB_ROUTE, async (route) => {
|
|
15
|
+
await route.fulfill({
|
|
16
|
+
status: 200,
|
|
17
|
+
contentType: "application/json",
|
|
18
|
+
headers: { "access-control-allow-origin": "*" },
|
|
19
|
+
body,
|
|
13
20
|
});
|
|
14
21
|
});
|
|
15
22
|
}
|
|
23
|
+
/** Remove the FeatureHub mock registered by {@link registerFeatureHubMock}. */
|
|
24
|
+
export async function unregisterFeatureHubMock(page) {
|
|
25
|
+
await page.unroute(FEATURE_HUB_ROUTE);
|
|
26
|
+
}
|
|
27
|
+
/** Replace the current FeatureHub mock with one serving `featureHubResponse`. */
|
|
28
|
+
export async function reregisterFeatureHubMock(page, featureHubResponse) {
|
|
29
|
+
await unregisterFeatureHubMock(page);
|
|
30
|
+
await registerFeatureHubMock(page, featureHubResponse);
|
|
31
|
+
}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @internal
|
|
3
|
+
*/
|
|
4
|
+
export type FeatureHubFeatureValue = boolean | string | number;
|
|
1
5
|
/**
|
|
2
6
|
* @internal
|
|
3
7
|
*/
|
|
@@ -7,13 +11,10 @@ export interface IFeatureHubFeature {
|
|
|
7
11
|
l: boolean;
|
|
8
12
|
version?: number;
|
|
9
13
|
type: string;
|
|
10
|
-
value?:
|
|
14
|
+
value?: FeatureHubFeatureValue;
|
|
11
15
|
strategies?: unknown[];
|
|
12
16
|
v?: string;
|
|
13
17
|
}
|
|
14
|
-
/**
|
|
15
|
-
* @internal
|
|
16
|
-
*/
|
|
17
18
|
export interface IFeatureHubEnvironment {
|
|
18
19
|
id: string;
|
|
19
20
|
features: IFeatureHubFeature[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/create-test/feature-hub/types.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,CAAC,EAAE,OAAO,CAAC;IACX,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/create-test/feature-hub/types.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;AAE/D;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,CAAC,EAAE,OAAO,CAAC;IACX,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,sBAAsB,CAAC;IAC/B,UAAU,CAAC,EAAE,OAAO,EAAE,CAAC;IACvB,CAAC,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,sBAAsB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,kBAAkB,EAAE,CAAC;CAClC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/create-test/playwright/factory.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EACR,sBAAsB,EACtB,wBAAwB,EAE3B,MAAM,uBAAuB,CAAC;AAQ/B,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../src/create-test/playwright/factory.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EACR,sBAAsB,EACtB,wBAAwB,EAE3B,MAAM,uBAAuB,CAAC;AAQ/B,OAAO,KAAK,EAGR,kBAAkB,EAElB,IAAI,EACJ,6BAA6B,EAEhC,MAAM,YAAY,CAAC;AAGpB;;;GAGG;AACH,wBAAgB,UAAU,CACtB,mBAAmB,SAAS,6BAA6B,GAAG,KAAK,EACjE,CAAC,SAAS,EAAE,GAAG,EAAE,EACjB,CAAC,SAAS,EAAE,GAAG,EAAE,EAEjB,OAAO,EAAE,kBAAkB,CAAC,mBAAmB,EAAE,CAAC,EAAE,CAAC,CAAC,GACvD,IAAI,CAAC,mBAAmB,EAAE,sBAAsB,GAAG,CAAC,EAAE,wBAAwB,GAAG,CAAC,CAAC,CAgOrF"}
|
|
@@ -15,12 +15,14 @@ import { withDescribeDetails, withTestDetails } from "./with-describe-details.js
|
|
|
15
15
|
export function createTest(options) {
|
|
16
16
|
// Tracks whether we're inside the outermost describe of a spec file during synchronous registration.
|
|
17
17
|
let insideRootDescribe = false;
|
|
18
|
-
// Stacks track
|
|
19
|
-
//
|
|
18
|
+
// Stacks track additionalWindowProperties / feature flags hierarchy during synchronous
|
|
19
|
+
// describe registration. Each level merges on top of the parent's.
|
|
20
20
|
// The beforeEach at each level captures the fully-merged snapshot, so the
|
|
21
21
|
// innermost beforeEach (which runs last) wins.
|
|
22
|
-
|
|
22
|
+
// The flags stack holds raw flag records; they are converted to FeatureHub features and merged
|
|
23
|
+
// onto the defaults only when applied.
|
|
23
24
|
const awpStack = [];
|
|
25
|
+
const flagsStack = [];
|
|
24
26
|
// Combined test conditions and titles of the enclosing describes, during synchronous registration.
|
|
25
27
|
// Describes only feed these; each test decides for itself whether it runs (a describe whose own
|
|
26
28
|
// conditions are false may still contain tests whose combined conditions are true).
|
|
@@ -53,7 +55,7 @@ export function createTest(options) {
|
|
|
53
55
|
assertValidConditions(details.conditions, `${name}("${title}")`);
|
|
54
56
|
const pwDetails = toPlaywrightDetails(details);
|
|
55
57
|
if (insideRootDescribe) {
|
|
56
|
-
internals.describe(type, location, title, pwDetails, () => withDescribeScope(title, details, () => withDescribeDetails(testInstance,
|
|
58
|
+
internals.describe(type, location, title, pwDetails, () => withDescribeScope(title, details, () => withDescribeDetails(testInstance, options.featureHubFeatures, awpStack, flagsStack, details, callback)));
|
|
57
59
|
return;
|
|
58
60
|
}
|
|
59
61
|
// Outermost describe of the spec file: it also sets up the spec.
|
|
@@ -68,15 +70,17 @@ export function createTest(options) {
|
|
|
68
70
|
}
|
|
69
71
|
specNameFiles.set(specName, location.file);
|
|
70
72
|
internals.describe(type, location, title, pwDetails, () => {
|
|
71
|
-
|
|
73
|
+
testInstance.beforeEach(async ({ page }) => {
|
|
74
|
+
await registerFeatureHubMock(page, options.featureHubFeatures);
|
|
75
|
+
});
|
|
72
76
|
if (options.goodmock) {
|
|
73
77
|
registerGoodmockHooks(testInstance, options.goodmock, specName);
|
|
74
78
|
}
|
|
75
|
-
//
|
|
79
|
+
// Feature flags + additional window properties — merge with parent
|
|
76
80
|
// stack and inject beforeEach. Wraps the callback so nested describes inherit.
|
|
77
81
|
insideRootDescribe = true;
|
|
78
82
|
try {
|
|
79
|
-
withDescribeScope(title, details, () => withDescribeDetails(testInstance,
|
|
83
|
+
withDescribeScope(title, details, () => withDescribeDetails(testInstance, options.featureHubFeatures, awpStack, flagsStack, details, callback));
|
|
80
84
|
}
|
|
81
85
|
finally {
|
|
82
86
|
// Reset even if the body throws, so the next spec file starts outside again.
|
|
@@ -115,7 +119,7 @@ export function createTest(options) {
|
|
|
115
119
|
register(location, title, body);
|
|
116
120
|
return;
|
|
117
121
|
}
|
|
118
|
-
withTestDetails(testInstance,
|
|
122
|
+
withTestDetails(testInstance, options.featureHubFeatures, awpStack, flagsStack, location, title, details);
|
|
119
123
|
register(location, title, toPlaywrightDetails(details), body);
|
|
120
124
|
};
|
|
121
125
|
return testFunction;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type IFeatureHubFeature } from "../feature-hub/types.js";
|
|
2
|
+
import { type FeatureFlagValue, type FeatureFlags } from "./types.js";
|
|
3
|
+
export declare function flagToFeature(key: string, flagValue: FeatureFlagValue): IFeatureHubFeature;
|
|
4
|
+
/** Convert a `featureFlags` record from test details into FeatureHub features. */
|
|
5
|
+
export declare function flagsToFeatures(flags: FeatureFlags): IFeatureHubFeature[];
|
|
6
|
+
//# sourceMappingURL=flag-to-feature.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flag-to-feature.d.ts","sourceRoot":"","sources":["../../../src/create-test/playwright/flag-to-feature.ts"],"names":[],"mappings":"AAIA,OAAO,EAA+B,KAAK,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE/F,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAEtE,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,gBAAgB,GAAG,kBAAkB,CAqB1F;AAED,kFAAkF;AAClF,wBAAgB,eAAe,CAAC,KAAK,EAAE,YAAY,GAAG,kBAAkB,EAAE,CAEzE"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// (C) 2026 GoodData Corporation
|
|
2
|
+
import { v4 as uuidv4 } from "uuid";
|
|
3
|
+
export function flagToFeature(key, flagValue) {
|
|
4
|
+
const flagValueType = typeof flagValue;
|
|
5
|
+
let valueType;
|
|
6
|
+
let value;
|
|
7
|
+
if (flagValueType === "object") {
|
|
8
|
+
value = JSON.stringify(flagValue);
|
|
9
|
+
valueType = "JSON";
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
value = flagValue;
|
|
13
|
+
valueType = flagValueType.toUpperCase();
|
|
14
|
+
}
|
|
15
|
+
return {
|
|
16
|
+
id: uuidv4(),
|
|
17
|
+
key,
|
|
18
|
+
l: false,
|
|
19
|
+
version: 1,
|
|
20
|
+
type: valueType,
|
|
21
|
+
value,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/** Convert a `featureFlags` record from test details into FeatureHub features. */
|
|
25
|
+
export function flagsToFeatures(flags) {
|
|
26
|
+
return Object.entries(flags).map(([key, value]) => flagToFeature(key, value));
|
|
27
|
+
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
/** Strip custom fields before passing details to Playwright. */
|
|
3
3
|
export function toPlaywrightDetails(details) {
|
|
4
4
|
// oxlint-disable-next-line @typescript-eslint/no-unused-vars
|
|
5
|
-
const {
|
|
5
|
+
const { additionalWindowProperties: _awp, featureFlags: _ff, conditions: _c, ...rest } = details;
|
|
6
6
|
return Object.keys(rest).length > 0 ? rest : {};
|
|
7
7
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Fixtures, TestDetails } from "@playwright/test";
|
|
2
|
-
import type {
|
|
2
|
+
import type { FeatureHubFeatureValue, IFeatureHubFeature } from "../feature-hub/types.js";
|
|
3
3
|
import type { IGoodmockOptions } from "../goodmock/types.js";
|
|
4
4
|
import type { PlaywrightConditionBody, PlaywrightDescribeConfigure, PlaywrightTestBody, PlaywrightTestType } from "./playwright-types.js";
|
|
5
5
|
/**
|
|
@@ -79,7 +79,7 @@ export interface ITestConditions<TestConditionsValue extends TestConditionsValue
|
|
|
79
79
|
* @internal
|
|
80
80
|
*/
|
|
81
81
|
export interface ICustomCreateTestOptions<TestConditionsValue extends TestConditionsValueConstraint = never> {
|
|
82
|
-
|
|
82
|
+
featureHubFeatures: IFeatureHubFeature[];
|
|
83
83
|
goodmock?: IGoodmockOptions;
|
|
84
84
|
testConditions?: ITestConditions<TestConditionsValue>;
|
|
85
85
|
}
|
|
@@ -95,24 +95,29 @@ export type ICreateTestOptions<TestConditionsValue extends TestConditionsValueCo
|
|
|
95
95
|
/**
|
|
96
96
|
* @internal
|
|
97
97
|
*/
|
|
98
|
-
export type
|
|
98
|
+
export type WindowProperties = Record<string, unknown>;
|
|
99
99
|
/**
|
|
100
100
|
* @internal
|
|
101
101
|
*/
|
|
102
|
-
export type
|
|
102
|
+
export type FeatureFlagValue = FeatureHubFeatureValue | object;
|
|
103
|
+
/**
|
|
104
|
+
* @internal
|
|
105
|
+
*/
|
|
106
|
+
export type FeatureFlags = Record<string, FeatureFlagValue>;
|
|
103
107
|
/**
|
|
104
108
|
* @internal
|
|
105
109
|
*/
|
|
106
110
|
export interface ITestDetails<TestConditionsValue extends TestConditionsValueConstraint = never> extends TestDetails {
|
|
107
|
-
workspaceSettings?: WorkspaceSettings;
|
|
108
111
|
additionalWindowProperties?: WindowProperties;
|
|
112
|
+
/** Feature flags for this describe/test, merged on top of the enclosing describes' (own keys win). */
|
|
113
|
+
featureFlags?: FeatureFlags;
|
|
109
114
|
/** See {@link ITestConditions}. */
|
|
110
115
|
conditions?: TestConditionsValue;
|
|
111
116
|
}
|
|
112
117
|
/**
|
|
113
118
|
* @internal
|
|
114
119
|
* Call signatures that register a test: `test`, `test.only`, `test.fail.only`.
|
|
115
|
-
* Same as Playwright's, except `details` also accepts `
|
|
120
|
+
* Same as Playwright's, except `details` also accepts `featureFlags` / `additionalWindowProperties` / `conditions`.
|
|
116
121
|
*/
|
|
117
122
|
export interface ITestFunction<TestConditionsValue extends TestConditionsValueConstraint, TestArgs extends {}, WorkerArgs extends {}> {
|
|
118
123
|
(title: string, body: PlaywrightTestBody<TestArgs & WorkerArgs>): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/create-test/playwright/types.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE9D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","s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,IAAI,CAAC;CAC1F;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB,CAC9B,mBAAmB,SAAS,6BAA6B,EACzD,QAAQ,SAAS,EAAE,EACnB,UAAU,SAAS,EAAE,CACvB,SAAQ,qBAAqB,CAAC,mBAAmB,EAAE,QAAQ,EAAE,UAAU,CAAC;IACtE,IAAI,EAAE,aAAa,CAAC,mBAAmB,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;CAClE;AAED;;;GAGG;AACH,MAAM,MAAM,IAAI,CACZ,mBAAmB,SAAS,6BAA6B,EACzD,QAAQ,SAAS,EAAE,EACnB,UAAU,SAAS,EAAE,IACrB,aAAa,CAAC,mBAAmB,EAAE,QAAQ,EAAE,UAAU,CAAC,GACxD,IAAI,CAAC,kBAAkB,CAAC,QAAQ,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,UAAU,CAAC,GAAG;IAC9F,IAAI,EAAE,aAAa,CAAC,mBAAmB,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;IAC/D,IAAI,EAAE,qBAAqB,CAAC,mBAAmB,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;IACvE,KAAK,EAAE,qBAAqB,CAAC,mBAAmB,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;IACxE,IAAI,EAAE,iBAAiB,CAAC,mBAAmB,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;IACnE,QAAQ,EAAE,SAAS,CAAC,mBAAmB,CAAC,CAAC;CAC5C,CAAC"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
import type { IFeatureHubFeature } from "../feature-hub/types.js";
|
|
1
2
|
import type { IPlaywrightLocation } from "./playwright-internals.js";
|
|
2
3
|
import type { PlaywrightTestInstance } from "./playwright-types.js";
|
|
3
|
-
import type { Callback, ITestDetails, TestConditionsValueConstraint, WindowProperties
|
|
4
|
-
/** Push merged
|
|
5
|
-
export declare function withDescribeDetails(testInstance: PlaywrightTestInstance,
|
|
4
|
+
import type { Callback, FeatureFlags, ITestDetails, TestConditionsValueConstraint, WindowProperties } from "./types.js";
|
|
5
|
+
/** Push merged awp/flags onto stacks, register the beforeEach hooks, call fn, pop. */
|
|
6
|
+
export declare function withDescribeDetails(testInstance: PlaywrightTestInstance, defaultFeatures: IFeatureHubFeature[], awpStack: WindowProperties[], flagsStack: FeatureFlags[], details: ITestDetails<TestConditionsValueConstraint> | undefined, fn: Callback): void;
|
|
6
7
|
/**
|
|
7
|
-
* Register a single test's own
|
|
8
|
+
* Register a single test's own awp/flags, merged on top of the enclosing describes'.
|
|
8
9
|
* The beforeEach is registered next to the test, after the enclosing describes' injection hooks,
|
|
9
10
|
* so it runs last and its values win.
|
|
10
11
|
*/
|
|
11
|
-
export declare function withTestDetails(testInstance: PlaywrightTestInstance,
|
|
12
|
+
export declare function withTestDetails(testInstance: PlaywrightTestInstance, defaultFeatures: IFeatureHubFeature[], awpStack: WindowProperties[], flagsStack: FeatureFlags[], location: IPlaywrightLocation, title: string, details: ITestDetails<TestConditionsValueConstraint> | undefined): void;
|
|
12
13
|
//# sourceMappingURL=with-describe-details.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"with-describe-details.d.ts","sourceRoot":"","sources":["../../../src/create-test/playwright/with-describe-details.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"with-describe-details.d.ts","sourceRoot":"","sources":["../../../src/create-test/playwright/with-describe-details.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAGlE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,KAAK,EACR,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,6BAA6B,EAC7B,gBAAgB,EACnB,MAAM,YAAY,CAAC;AAMpB,sFAAsF;AACtF,wBAAgB,mBAAmB,CAC/B,YAAY,EAAE,sBAAsB,EACpC,eAAe,EAAE,kBAAkB,EAAE,EACrC,QAAQ,EAAE,gBAAgB,EAAE,EAC5B,UAAU,EAAE,YAAY,EAAE,EAC1B,OAAO,EAAE,YAAY,CAAC,6BAA6B,CAAC,GAAG,SAAS,EAChE,EAAE,EAAE,QAAQ,QA2Bf;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAC3B,YAAY,EAAE,sBAAsB,EACpC,eAAe,EAAE,kBAAkB,EAAE,EACrC,QAAQ,EAAE,gBAAgB,EAAE,EAC5B,UAAU,EAAE,YAAY,EAAE,EAC1B,QAAQ,EAAE,mBAAmB,EAC7B,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,YAAY,CAAC,6BAA6B,CAAC,GAAG,SAAS,GACjE,IAAI,CA2BN"}
|
|
@@ -1,46 +1,54 @@
|
|
|
1
1
|
// (C) 2026 GoodData Corporation
|
|
2
|
+
import { mergeFeatureHubFeatures } from "../feature-hub/merge.js";
|
|
3
|
+
import { reregisterFeatureHubMock } from "../feature-hub/mock.js";
|
|
4
|
+
import { flagsToFeatures } from "./flag-to-feature.js";
|
|
2
5
|
function peekOrEmpty(stack) {
|
|
3
6
|
return stack.length > 0 ? stack[stack.length - 1] : {};
|
|
4
7
|
}
|
|
5
|
-
/** Push merged
|
|
6
|
-
export function withDescribeDetails(testInstance,
|
|
7
|
-
const ws = details?.workspaceSettings;
|
|
8
|
+
/** Push merged awp/flags onto stacks, register the beforeEach hooks, call fn, pop. */
|
|
9
|
+
export function withDescribeDetails(testInstance, defaultFeatures, awpStack, flagsStack, details, fn) {
|
|
8
10
|
const awp = details?.additionalWindowProperties;
|
|
9
|
-
|
|
11
|
+
const ff = details?.featureFlags;
|
|
12
|
+
if (!awp && !ff) {
|
|
10
13
|
fn();
|
|
11
14
|
return;
|
|
12
15
|
}
|
|
13
|
-
const mergedSettings = ws ? { ...peekOrEmpty(settingsStack), ...ws } : peekOrEmpty(settingsStack);
|
|
14
16
|
const mergedAwp = awp ? { ...peekOrEmpty(awpStack), ...awp } : peekOrEmpty(awpStack);
|
|
15
|
-
|
|
16
|
-
settingsStack.push(mergedSettings);
|
|
17
|
+
const mergedFlags = ff ? { ...peekOrEmpty(flagsStack), ...ff } : peekOrEmpty(flagsStack);
|
|
17
18
|
if (awp)
|
|
18
19
|
awpStack.push(mergedAwp);
|
|
19
|
-
|
|
20
|
+
if (ff)
|
|
21
|
+
flagsStack.push(mergedFlags);
|
|
22
|
+
if (awp) {
|
|
23
|
+
injectWindowProperties(testInstance, mergedAwp);
|
|
24
|
+
}
|
|
25
|
+
if (ff) {
|
|
26
|
+
injectFeatureFlags(testInstance, defaultFeatures, mergedFlags);
|
|
27
|
+
}
|
|
20
28
|
try {
|
|
21
29
|
fn();
|
|
22
30
|
}
|
|
23
31
|
finally {
|
|
24
32
|
// Pop even if the body throws, so later describes don't inherit this level's entries.
|
|
33
|
+
if (ff)
|
|
34
|
+
flagsStack.pop();
|
|
25
35
|
if (awp)
|
|
26
36
|
awpStack.pop();
|
|
27
|
-
if (ws)
|
|
28
|
-
settingsStack.pop();
|
|
29
37
|
}
|
|
30
38
|
}
|
|
31
39
|
/**
|
|
32
|
-
* Register a single test's own
|
|
40
|
+
* Register a single test's own awp/flags, merged on top of the enclosing describes'.
|
|
33
41
|
* The beforeEach is registered next to the test, after the enclosing describes' injection hooks,
|
|
34
42
|
* so it runs last and its values win.
|
|
35
43
|
*/
|
|
36
|
-
export function withTestDetails(testInstance,
|
|
37
|
-
const ws = details?.workspaceSettings;
|
|
44
|
+
export function withTestDetails(testInstance, defaultFeatures, awpStack, flagsStack, location, title, details) {
|
|
38
45
|
const awp = details?.additionalWindowProperties;
|
|
39
|
-
|
|
46
|
+
const ff = details?.featureFlags;
|
|
47
|
+
if (!awp && !ff) {
|
|
40
48
|
return;
|
|
41
49
|
}
|
|
42
|
-
const mergedSettings = ws ? { ...peekOrEmpty(settingsStack), ...ws } : peekOrEmpty(settingsStack);
|
|
43
50
|
const mergedAwp = awp ? { ...peekOrEmpty(awpStack), ...awp } : peekOrEmpty(awpStack);
|
|
51
|
+
const mergedFlags = ff ? { ...peekOrEmpty(flagsStack), ...ff } : peekOrEmpty(flagsStack);
|
|
44
52
|
testInstance.beforeEach(async ({ page }, testInfo) => {
|
|
45
53
|
// A beforeEach applies to every test in its describe; only act for this test. Title is part
|
|
46
54
|
// of the match because tests generated in a loop share one location.
|
|
@@ -50,23 +58,45 @@ export function withTestDetails(testInstance, settingsStack, awpStack, location,
|
|
|
50
58
|
testInfo.column !== location.column) {
|
|
51
59
|
return;
|
|
52
60
|
}
|
|
53
|
-
|
|
61
|
+
if (awp) {
|
|
62
|
+
await addWindowPropertiesInitScript(page, mergedAwp);
|
|
63
|
+
}
|
|
64
|
+
if (ff) {
|
|
65
|
+
await applyFeatureFlags(page, defaultFeatures, mergedFlags);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
/** Inject additional window properties via a single addInitScript. */
|
|
70
|
+
function injectWindowProperties(testInst, awp) {
|
|
71
|
+
testInst.beforeEach(async ({ page }) => {
|
|
72
|
+
await addWindowPropertiesInitScript(page, awp);
|
|
54
73
|
});
|
|
55
74
|
}
|
|
56
|
-
/**
|
|
57
|
-
function
|
|
75
|
+
/** Apply the merged feature flags of a describe level to every test in it. */
|
|
76
|
+
function injectFeatureFlags(testInst, defaultFeatures, flags) {
|
|
58
77
|
testInst.beforeEach(async ({ page }) => {
|
|
59
|
-
await
|
|
78
|
+
await applyFeatureFlags(page, defaultFeatures, flags);
|
|
60
79
|
});
|
|
61
80
|
}
|
|
62
|
-
|
|
63
|
-
|
|
81
|
+
/**
|
|
82
|
+
* Serve `flags` on top of `defaultFeatures` from the FeatureHub mock and expose the raw flags as
|
|
83
|
+
* `window.customWorkspaceSettings`. Init scripts cannot be removed, but each one assigns the whole
|
|
84
|
+
* object, so the last registered level (the innermost) wins.
|
|
85
|
+
*/
|
|
86
|
+
async function applyFeatureFlags(page, defaultFeatures, flags) {
|
|
87
|
+
await reregisterFeatureHubMock(page, mergeFeatureHubFeatures(defaultFeatures, flagsToFeatures(flags)));
|
|
88
|
+
await addCustomWorkspaceSettingsInitScript(page, flags);
|
|
89
|
+
}
|
|
90
|
+
async function addCustomWorkspaceSettingsInitScript(page, flags) {
|
|
91
|
+
await page.addInitScript((s) => {
|
|
92
|
+
window["customWorkspaceSettings"] = s;
|
|
93
|
+
}, flags);
|
|
94
|
+
}
|
|
95
|
+
async function addWindowPropertiesInitScript(page, awp) {
|
|
96
|
+
await page.addInitScript((a) => {
|
|
64
97
|
const w = window;
|
|
65
|
-
|
|
66
|
-
w["customWorkspaceSettings"] = args.s;
|
|
67
|
-
}
|
|
68
|
-
for (const [key, value] of Object.entries(args.a)) {
|
|
98
|
+
for (const [key, value] of Object.entries(a)) {
|
|
69
99
|
w[key] = value;
|
|
70
100
|
}
|
|
71
|
-
},
|
|
101
|
+
}, awp);
|
|
72
102
|
}
|
package/esm/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { authHeader, authedRouteFetch, injectAuthHeader } from "./auth.js";
|
|
2
2
|
export { GOODMOCK_HOST, API_TOKEN, BACKEND_HOST, getBaseUrl, getEnvWithFallback, getWorkspaceId, getDangerWorkspaceId, } from "./constants.js";
|
|
3
|
-
export type {
|
|
3
|
+
export type { IFeatureHubFeature, FeatureHubFeatureValue } from "./create-test/feature-hub/types.js";
|
|
4
4
|
export type { IGoodmockMapping, ILeakPattern, ISecretMapping, IWorkspaceIdMapping, IGoodmockOptions, } from "./create-test/goodmock/types.js";
|
|
5
5
|
export { loadMappings, resetMappings, resetScenarios, mockLogRequests, startRecording, } from "./create-test/goodmock/admin.js";
|
|
6
6
|
export { goodmockMode, GoodmockMode } from "./create-test/goodmock/mode.js";
|
|
@@ -8,6 +8,6 @@ export { snapshotAndSaveRecording, type ISnapshotAndSaveRecordingOptions, } from
|
|
|
8
8
|
export { createTest } from "./create-test/playwright/factory.js";
|
|
9
9
|
export type { Fixtures } from "./create-test/playwright/fixtures.js";
|
|
10
10
|
export type { PlaywrightBaseTestArgs, PlaywrightBaseWorkerArgs, PlaywrightDescribeConfigure, PlaywrightConditionBody, PlaywrightTestBody, PlaywrightTestType, PlaywrightTestInstance, } from "./create-test/playwright/playwright-types.js";
|
|
11
|
-
export type { Callback, ICreateTestOptions, ICustomCreateTestOptions, IDescribe, IDescribeFunction, IDescribeModeFunction, ITestConditions, ITestConditionsContext, ITestDetails, ITestFailFunction, ITestFunction, ITestModifierFunction, Test, TestConditionsValueConstraint, WindowProperties,
|
|
11
|
+
export type { Callback, FeatureFlags, FeatureFlagValue, ICreateTestOptions, ICustomCreateTestOptions, IDescribe, IDescribeFunction, IDescribeModeFunction, ITestConditions, ITestConditionsContext, ITestDetails, ITestFailFunction, ITestFunction, ITestModifierFunction, Test, TestConditionsValueConstraint, WindowProperties, } from "./create-test/playwright/types.js";
|
|
12
12
|
export { clickByBoundingBox, hoverByBoundingBox } from "./helpers/mouse-actions.js";
|
|
13
13
|
//# sourceMappingURL=index.d.ts.map
|
package/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAG3E,OAAO,EACH,aAAa,EACb,SAAS,EACT,YAAY,EACZ,UAAU,EACV,kBAAkB,EAClB,cAAc,EACd,oBAAoB,GACvB,MAAM,gBAAgB,CAAC;AAGxB,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAG3E,OAAO,EACH,aAAa,EACb,SAAS,EACT,YAAY,EACZ,UAAU,EACV,kBAAkB,EAClB,cAAc,EACd,oBAAoB,GACvB,MAAM,gBAAgB,CAAC;AAGxB,YAAY,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAGrG,YAAY,EACR,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,gBAAgB,GACnB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACH,YAAY,EACZ,aAAa,EACb,cAAc,EACd,eAAe,EACf,cAAc,GACjB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC5E,OAAO,EACH,wBAAwB,EACxB,KAAK,gCAAgC,GACxC,MAAM,gEAAgE,CAAC;AAGxE,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AACjE,YAAY,EAAE,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AACrE,YAAY,EACR,sBAAsB,EACtB,wBAAwB,EACxB,2BAA2B,EAC3B,uBAAuB,EACvB,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,GACzB,MAAM,8CAA8C,CAAC;AACtD,YAAY,EACR,QAAQ,EACR,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,EAClB,wBAAwB,EACxB,SAAS,EACT,iBAAiB,EACjB,qBAAqB,EACrB,eAAe,EACf,sBAAsB,EACtB,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,qBAAqB,EACrB,IAAI,EACJ,6BAA6B,EAC7B,gBAAgB,GACnB,MAAM,mCAAmC,CAAC;AAG3C,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC"}
|
package/esm/sdk-e2e-utils.d.ts
CHANGED
|
@@ -59,6 +59,21 @@ export declare function clickByBoundingBox(page: Page, locator: Locator, options
|
|
|
59
59
|
*/
|
|
60
60
|
export declare function createTest<TestConditionsValue extends TestConditionsValueConstraint = never, T extends {} = {}, W extends {} = {}>(options: ICreateTestOptions<TestConditionsValue, T, W>): Test<TestConditionsValue, PlaywrightBaseTestArgs & T, PlaywrightBaseWorkerArgs & W>;
|
|
61
61
|
|
|
62
|
+
/**
|
|
63
|
+
* @internal
|
|
64
|
+
*/
|
|
65
|
+
export declare type FeatureFlags = Record<string, FeatureFlagValue>;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* @internal
|
|
69
|
+
*/
|
|
70
|
+
export declare type FeatureFlagValue = FeatureHubFeatureValue | object;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* @internal
|
|
74
|
+
*/
|
|
75
|
+
export declare type FeatureHubFeatureValue = boolean | string | number;
|
|
76
|
+
|
|
62
77
|
/**
|
|
63
78
|
* @internal
|
|
64
79
|
*/
|
|
@@ -127,7 +142,7 @@ export declare type ICreateTestOptions<TestConditionsValue extends TestCondition
|
|
|
127
142
|
* @internal
|
|
128
143
|
*/
|
|
129
144
|
export declare interface ICustomCreateTestOptions<TestConditionsValue extends TestConditionsValueConstraint = never> {
|
|
130
|
-
|
|
145
|
+
featureHubFeatures: IFeatureHubFeature[];
|
|
131
146
|
goodmock?: IGoodmockOptions;
|
|
132
147
|
testConditions?: ITestConditions<TestConditionsValue>;
|
|
133
148
|
}
|
|
@@ -161,14 +176,6 @@ export declare interface IDescribeModeFunction<TestConditionsValue extends TestC
|
|
|
161
176
|
only: IDescribeFunction<TestConditionsValue>;
|
|
162
177
|
}
|
|
163
178
|
|
|
164
|
-
/**
|
|
165
|
-
* @internal
|
|
166
|
-
*/
|
|
167
|
-
export declare interface IFeatureHubEnvironment {
|
|
168
|
-
id: string;
|
|
169
|
-
features: IFeatureHubFeature[];
|
|
170
|
-
}
|
|
171
|
-
|
|
172
179
|
/**
|
|
173
180
|
* @internal
|
|
174
181
|
*/
|
|
@@ -178,7 +185,7 @@ export declare interface IFeatureHubFeature {
|
|
|
178
185
|
l: boolean;
|
|
179
186
|
version?: number;
|
|
180
187
|
type: string;
|
|
181
|
-
value?:
|
|
188
|
+
value?: FeatureHubFeatureValue;
|
|
182
189
|
strategies?: unknown[];
|
|
183
190
|
v?: string;
|
|
184
191
|
}
|
|
@@ -328,8 +335,9 @@ export declare interface ITestConditionsContext {
|
|
|
328
335
|
* @internal
|
|
329
336
|
*/
|
|
330
337
|
export declare interface ITestDetails<TestConditionsValue extends TestConditionsValueConstraint = never> extends TestDetails {
|
|
331
|
-
workspaceSettings?: WorkspaceSettings;
|
|
332
338
|
additionalWindowProperties?: WindowProperties;
|
|
339
|
+
/** Feature flags for this describe/test, merged on top of the enclosing describes' (own keys win). */
|
|
340
|
+
featureFlags?: FeatureFlags;
|
|
333
341
|
/** See {@link ITestConditions}. */
|
|
334
342
|
conditions?: TestConditionsValue;
|
|
335
343
|
}
|
|
@@ -345,7 +353,7 @@ export declare interface ITestFailFunction<TestConditionsValue extends TestCondi
|
|
|
345
353
|
/**
|
|
346
354
|
* @internal
|
|
347
355
|
* Call signatures that register a test: `test`, `test.only`, `test.fail.only`.
|
|
348
|
-
* Same as Playwright's, except `details` also accepts `
|
|
356
|
+
* Same as Playwright's, except `details` also accepts `featureFlags` / `additionalWindowProperties` / `conditions`.
|
|
349
357
|
*/
|
|
350
358
|
export declare interface ITestFunction<TestConditionsValue extends TestConditionsValueConstraint, TestArgs extends {}, WorkerArgs extends {}> {
|
|
351
359
|
(title: string, body: PlaywrightTestBody<TestArgs & WorkerArgs>): void;
|
|
@@ -484,9 +492,4 @@ export declare type TestConditionsValueConstraint = object | string | number;
|
|
|
484
492
|
*/
|
|
485
493
|
export declare type WindowProperties = Record<string, unknown>;
|
|
486
494
|
|
|
487
|
-
/**
|
|
488
|
-
* @internal
|
|
489
|
-
*/
|
|
490
|
-
export declare type WorkspaceSettings = Record<string, unknown>;
|
|
491
|
-
|
|
492
495
|
export { }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gooddata/sdk-e2e-utils",
|
|
3
|
-
"version": "11.62.0-alpha.
|
|
3
|
+
"version": "11.62.0-alpha.4",
|
|
4
4
|
"description": "GoodData utility functions for Playwright E2E tests",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "GoodData",
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@playwright/test": "1.62.1"
|
|
26
|
+
"@playwright/test": "1.62.1",
|
|
27
|
+
"uuid": "11.1.1"
|
|
27
28
|
},
|
|
28
29
|
"devDependencies": {
|
|
29
30
|
"@microsoft/api-documenter": "7.30.16",
|
|
@@ -49,8 +50,8 @@
|
|
|
49
50
|
"oxlint-plugin-eslint": "1.82.0",
|
|
50
51
|
"oxlint-tsgolint": "7.0.2001",
|
|
51
52
|
"typescript": "7.0.2",
|
|
52
|
-
"@gooddata/eslint-config": "11.62.0-alpha.
|
|
53
|
-
"@gooddata/oxlint-config": "11.62.0-alpha.
|
|
53
|
+
"@gooddata/eslint-config": "11.62.0-alpha.4",
|
|
54
|
+
"@gooddata/oxlint-config": "11.62.0-alpha.4"
|
|
54
55
|
},
|
|
55
56
|
"scripts": {
|
|
56
57
|
"_phase:build": "npm run build",
|