@gooddata/sdk-e2e-utils 11.63.0-alpha.1 → 11.63.0-alpha.3
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.
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import type { Page } from "@playwright/test";
|
|
2
2
|
import type { IFeatureHubEnvironment, IFeatureHubFeature } from "./types.js";
|
|
3
3
|
export declare function makeFeatureHubResponse(features: IFeatureHubFeature[]): IFeatureHubEnvironment[];
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* FeatureHub mock — each test gets a fresh page, so route dies with it.
|
|
6
|
+
*
|
|
7
|
+
* The app reads FeatureHub once, on first load, so the mock must be in place before the page navigates
|
|
8
|
+
* anywhere. Registering it afterwards (e.g. `featureFlags` on an inner describe/test while an outer
|
|
9
|
+
* describe's `beforeEach` already called `page.goto`) would leave the app running on the previous
|
|
10
|
+
* features, which fails in confusing ways. Fail fast instead.
|
|
11
|
+
*/
|
|
5
12
|
export declare function registerFeatureHubMock(page: Page, features: IFeatureHubFeature[]): Promise<void>;
|
|
6
13
|
/** Remove the FeatureHub mock registered by {@link registerFeatureHubMock}. */
|
|
7
14
|
export declare function unregisterFeatureHubMock(page: Page): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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;;;;;;;GAOG;AACH,wBAAsB,sBAAsB,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,kBAAkB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAmBtG;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"}
|
|
@@ -8,8 +8,20 @@ export function makeFeatureHubResponse(features) {
|
|
|
8
8
|
},
|
|
9
9
|
];
|
|
10
10
|
}
|
|
11
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* FeatureHub mock — each test gets a fresh page, so route dies with it.
|
|
13
|
+
*
|
|
14
|
+
* The app reads FeatureHub once, on first load, so the mock must be in place before the page navigates
|
|
15
|
+
* anywhere. Registering it afterwards (e.g. `featureFlags` on an inner describe/test while an outer
|
|
16
|
+
* describe's `beforeEach` already called `page.goto`) would leave the app running on the previous
|
|
17
|
+
* features, which fails in confusing ways. Fail fast instead.
|
|
18
|
+
*/
|
|
12
19
|
export async function registerFeatureHubMock(page, features) {
|
|
20
|
+
if (page.url() !== "about:blank") {
|
|
21
|
+
throw new Error(`@gooddata/sdk-e2e-utils: FeatureHub mock registered after the page navigated to "${page.url()}". ` +
|
|
22
|
+
"Features are read on first load, so the mock has no effect now. Register `featureFlags` " +
|
|
23
|
+
"on a describe/test whose hooks run before any `page.goto`, or move the navigation after it.");
|
|
24
|
+
}
|
|
13
25
|
const body = JSON.stringify(makeFeatureHubResponse(features));
|
|
14
26
|
await page.route(FEATURE_HUB_ROUTE, async (route) => {
|
|
15
27
|
await route.fulfill({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gooddata/sdk-e2e-utils",
|
|
3
|
-
"version": "11.63.0-alpha.
|
|
3
|
+
"version": "11.63.0-alpha.3",
|
|
4
4
|
"description": "GoodData utility functions for Playwright E2E tests",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "GoodData",
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
"oxlint-plugin-eslint": "1.82.0",
|
|
51
51
|
"oxlint-tsgolint": "7.0.2001",
|
|
52
52
|
"typescript": "7.0.2",
|
|
53
|
-
"@gooddata/
|
|
54
|
-
"@gooddata/
|
|
53
|
+
"@gooddata/eslint-config": "11.63.0-alpha.3",
|
|
54
|
+
"@gooddata/oxlint-config": "11.63.0-alpha.3"
|
|
55
55
|
},
|
|
56
56
|
"scripts": {
|
|
57
57
|
"_phase:build": "npm run build",
|