@gooddata/sdk-e2e-utils 11.61.0-alpha.0 → 11.61.0-alpha.2
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/mock.d.ts +2 -2
- package/esm/create-test/feature-hub/mock.d.ts.map +1 -1
- package/esm/create-test/goodmock/snapshot/sanitize-organization.d.ts +12 -0
- package/esm/create-test/goodmock/snapshot/sanitize-organization.d.ts.map +1 -0
- package/esm/create-test/goodmock/snapshot/sanitize-organization.js +28 -0
- package/esm/create-test/goodmock/snapshot/snapshot-and-save-recording.d.ts +6 -0
- package/esm/create-test/goodmock/snapshot/snapshot-and-save-recording.d.ts.map +1 -1
- package/esm/create-test/goodmock/snapshot/snapshot-and-save-recording.js +4 -2
- package/esm/create-test/playwright/factory.d.ts +8 -0
- package/esm/create-test/playwright/factory.d.ts.map +1 -0
- package/esm/create-test/playwright/factory.js +143 -0
- package/esm/create-test/playwright/fixtures.d.ts +2 -2
- package/esm/create-test/playwright/fixtures.d.ts.map +1 -1
- package/esm/create-test/playwright/playwright-internals.d.ts +38 -0
- package/esm/create-test/playwright/playwright-internals.d.ts.map +1 -0
- package/esm/create-test/playwright/playwright-internals.js +60 -0
- package/esm/create-test/playwright/playwright-types.d.ts +12 -20
- package/esm/create-test/playwright/playwright-types.d.ts.map +1 -1
- package/esm/create-test/playwright/test-conditions.d.ts +25 -0
- package/esm/create-test/playwright/test-conditions.d.ts.map +1 -0
- package/esm/create-test/playwright/test-conditions.js +76 -0
- package/esm/create-test/playwright/to-playwright-details.d.ts +5 -0
- package/esm/create-test/playwright/to-playwright-details.d.ts.map +1 -0
- package/esm/create-test/playwright/to-playwright-details.js +7 -0
- package/esm/create-test/playwright/types.d.ts +133 -2
- package/esm/create-test/playwright/types.d.ts.map +1 -1
- package/esm/create-test/playwright/with-describe-details.d.ts +10 -4
- package/esm/create-test/playwright/with-describe-details.d.ts.map +1 -1
- package/esm/create-test/playwright/with-describe-details.js +47 -14
- package/esm/index.d.ts +3 -7
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +2 -1
- package/esm/sdk-e2e-utils.d.ts +144 -70
- package/package.json +3 -3
- package/esm/create-test/playwright/call-original-fn.d.ts +0 -17
- package/esm/create-test/playwright/call-original-fn.d.ts.map +0 -1
- package/esm/create-test/playwright/call-original-fn.js +0 -25
- package/esm/create-test/playwright/describe/factory.d.ts +0 -27
- package/esm/create-test/playwright/describe/factory.d.ts.map +0 -1
- package/esm/create-test/playwright/describe/factory.js +0 -18
- package/esm/create-test/playwright/test/factory.d.ts +0 -7
- package/esm/create-test/playwright/test/factory.d.ts.map +0 -1
- package/esm/create-test/playwright/test/factory.js +0 -42
- package/esm/create-test/playwright/test/types.d.ts +0 -27
- package/esm/create-test/playwright/test/types.d.ts.map +0 -1
- package/esm/create-test/playwright/test/types.js +0 -2
- package/esm/create-test/playwright/top-level-describe/build-suite-callback.d.ts +0 -9
- package/esm/create-test/playwright/top-level-describe/build-suite-callback.d.ts.map +0 -1
- package/esm/create-test/playwright/top-level-describe/build-suite-callback.js +0 -17
- package/esm/create-test/playwright/top-level-describe/factory.d.ts +0 -8
- package/esm/create-test/playwright/top-level-describe/factory.d.ts.map +0 -1
- package/esm/create-test/playwright/top-level-describe/factory.js +0 -12
- package/esm/create-test/playwright/top-level-describe/types.d.ts +0 -17
- package/esm/create-test/playwright/top-level-describe/types.d.ts.map +0 -1
- package/esm/create-test/playwright/top-level-describe/types.js +0 -2
|
@@ -1,4 +1,97 @@
|
|
|
1
|
-
import type { TestDetails } from "@playwright/test";
|
|
1
|
+
import type { Fixtures, TestDetails } from "@playwright/test";
|
|
2
|
+
import type { IFeatureHubEnvironment } from "../feature-hub/types.js";
|
|
3
|
+
import type { IGoodmockOptions } from "../goodmock/types.js";
|
|
4
|
+
import type { PlaywrightConditionBody, PlaywrightDescribeConfigure, PlaywrightTestBody, PlaywrightTestType } from "./playwright-types.js";
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export type Callback = () => void;
|
|
9
|
+
/**
|
|
10
|
+
* @internal
|
|
11
|
+
* Call signatures of the overridden `test.describe` and its variants (`.only`, `.skip`, `.fixme`, `.serial`, `.parallel`, ...).
|
|
12
|
+
* The outermost describe of a spec file also sets up the spec (FeatureHub mock, goodmock hooks).
|
|
13
|
+
*/
|
|
14
|
+
export interface IDescribeFunction<TestConditionsValue extends TestConditionsValueConstraint = never> {
|
|
15
|
+
(title: string, details: ITestDetails<TestConditionsValue>, callback: Callback): void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* @internal
|
|
19
|
+
* `test.describe.serial` / `test.describe.parallel`, with their `.only`.
|
|
20
|
+
*/
|
|
21
|
+
export interface IDescribeModeFunction<TestConditionsValue extends TestConditionsValueConstraint = never> extends IDescribeFunction<TestConditionsValue> {
|
|
22
|
+
only: IDescribeFunction<TestConditionsValue>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
export interface IDescribe<TestConditionsValue extends TestConditionsValueConstraint = never> extends IDescribeFunction<TestConditionsValue> {
|
|
28
|
+
skip: IDescribeFunction<TestConditionsValue>;
|
|
29
|
+
only: IDescribeFunction<TestConditionsValue>;
|
|
30
|
+
configure: PlaywrightDescribeConfigure;
|
|
31
|
+
fixme: IDescribeFunction<TestConditionsValue>;
|
|
32
|
+
serial: IDescribeModeFunction<TestConditionsValue>;
|
|
33
|
+
parallel: IDescribeModeFunction<TestConditionsValue>;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* @internal
|
|
37
|
+
* Allowed types for the consumer's conditions value: objects (including arrays), strings and numbers.
|
|
38
|
+
* Not `boolean`, `null` or `undefined` (nor unions containing them). Only the top level is restricted,
|
|
39
|
+
* an object may contain booleans. Without conditions configured, the conditions type is `never`.
|
|
40
|
+
*/
|
|
41
|
+
export type TestConditionsValueConstraint = object | string | number;
|
|
42
|
+
/**
|
|
43
|
+
* @internal
|
|
44
|
+
* Context passed to {@link ITestConditions.shouldRun}, for the test being registered.
|
|
45
|
+
*/
|
|
46
|
+
export interface ITestConditionsContext {
|
|
47
|
+
/** Absolute path of the spec file. */
|
|
48
|
+
file: string;
|
|
49
|
+
/** Titles of the enclosing describes, outermost first, followed by the test's own title. */
|
|
50
|
+
titlePath: string[];
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* @internal
|
|
54
|
+
* Consumer-defined conditions deciding which tests run. `TestConditionsValue` is the consumer's own type (e.g. a list
|
|
55
|
+
* of products). Describes and tests set it via `details.conditions`; nested values are combined with
|
|
56
|
+
* {@link ITestConditions.merge}. Each test is evaluated once, while tests are being registered.
|
|
57
|
+
*/
|
|
58
|
+
export interface ITestConditions<TestConditionsValue extends TestConditionsValueConstraint> {
|
|
59
|
+
/**
|
|
60
|
+
* Whether a test with these (already combined) conditions runs. When `false`, the test is registered
|
|
61
|
+
* as skipped. Not called when neither the test nor any enclosing describe sets conditions.
|
|
62
|
+
*
|
|
63
|
+
* Called while tests are being registered, in every Playwright process: it must be synchronous and
|
|
64
|
+
* return the same answer every time (env vars and config are fine; async or runtime state are not).
|
|
65
|
+
*/
|
|
66
|
+
shouldRun: (conditions: TestConditionsValue, context: ITestConditionsContext) => boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Combine a describe's or test's conditions with those inherited from its enclosing describes.
|
|
69
|
+
* Defaults to `child` replacing `parent`.
|
|
70
|
+
*/
|
|
71
|
+
merge?: (parent: TestConditionsValue | undefined, child: TestConditionsValue) => TestConditionsValue;
|
|
72
|
+
/**
|
|
73
|
+
* When `true`, every test must end up with conditions: set on the test itself or inherited from an
|
|
74
|
+
* enclosing describe. Registering a test without any throws. Defaults to `false`.
|
|
75
|
+
*/
|
|
76
|
+
required?: boolean;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* @internal
|
|
80
|
+
*/
|
|
81
|
+
export interface ICustomCreateTestOptions<TestConditionsValue extends TestConditionsValueConstraint = never> {
|
|
82
|
+
featureHubResponse: IFeatureHubEnvironment[];
|
|
83
|
+
goodmock?: IGoodmockOptions;
|
|
84
|
+
testConditions?: ITestConditions<TestConditionsValue>;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* @internal
|
|
88
|
+
* `testConditions` is required when the conditions type `TestConditionsValue` is given (or inferred from it).
|
|
89
|
+
*/
|
|
90
|
+
export type ICreateTestOptions<TestConditionsValue extends TestConditionsValueConstraint = never, T extends {} = {}, W extends {} = {}> = ICustomCreateTestOptions<TestConditionsValue> & {
|
|
91
|
+
fixtures?: Fixtures<T, W>;
|
|
92
|
+
} & ([TestConditionsValue] extends [never] ? {} : {
|
|
93
|
+
testConditions: ITestConditions<TestConditionsValue>;
|
|
94
|
+
});
|
|
2
95
|
/**
|
|
3
96
|
* @internal
|
|
4
97
|
*/
|
|
@@ -10,8 +103,46 @@ export type WindowProperties = Record<string, unknown>;
|
|
|
10
103
|
/**
|
|
11
104
|
* @internal
|
|
12
105
|
*/
|
|
13
|
-
export interface ITestDetails extends TestDetails {
|
|
106
|
+
export interface ITestDetails<TestConditionsValue extends TestConditionsValueConstraint = never> extends TestDetails {
|
|
14
107
|
workspaceSettings?: WorkspaceSettings;
|
|
15
108
|
additionalWindowProperties?: WindowProperties;
|
|
109
|
+
/** See {@link ITestConditions}. */
|
|
110
|
+
conditions?: TestConditionsValue;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* @internal
|
|
114
|
+
* Call signatures that register a test: `test`, `test.only`, `test.fail.only`.
|
|
115
|
+
* Same as Playwright's, except `details` also accepts `workspaceSettings` / `additionalWindowProperties` / `conditions`.
|
|
116
|
+
*/
|
|
117
|
+
export interface ITestFunction<TestConditionsValue extends TestConditionsValueConstraint, TestArgs extends {}, WorkerArgs extends {}> {
|
|
118
|
+
(title: string, body: PlaywrightTestBody<TestArgs & WorkerArgs>): void;
|
|
119
|
+
(title: string, details: ITestDetails<TestConditionsValue>, body: PlaywrightTestBody<TestArgs & WorkerArgs>): void;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* @internal
|
|
123
|
+
* `test.skip` / `test.fixme`: register a skipped test (title forms), or mark the current test or describe.
|
|
124
|
+
*/
|
|
125
|
+
export interface ITestModifierFunction<TestConditionsValue extends TestConditionsValueConstraint, TestArgs extends {}, WorkerArgs extends {}> extends ITestFunction<TestConditionsValue, TestArgs, WorkerArgs> {
|
|
126
|
+
(): void;
|
|
127
|
+
(condition: boolean, description?: string): void;
|
|
128
|
+
(callback: PlaywrightConditionBody<TestArgs & WorkerArgs>, description?: string): void;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* @internal
|
|
132
|
+
* `test.fail`, with its `.only`.
|
|
133
|
+
*/
|
|
134
|
+
export interface ITestFailFunction<TestConditionsValue extends TestConditionsValueConstraint, TestArgs extends {}, WorkerArgs extends {}> extends ITestModifierFunction<TestConditionsValue, TestArgs, WorkerArgs> {
|
|
135
|
+
only: ITestFunction<TestConditionsValue, TestArgs, WorkerArgs>;
|
|
16
136
|
}
|
|
137
|
+
/**
|
|
138
|
+
* @internal
|
|
139
|
+
* Playwright's `TestType<TestArgs, WorkerArgs>`, with our `test` / `only` / `skip` / `fixme` / `fail` / `describe`.
|
|
140
|
+
*/
|
|
141
|
+
export type Test<TestConditionsValue extends TestConditionsValueConstraint, TestArgs extends {}, WorkerArgs extends {}> = ITestFunction<TestConditionsValue, TestArgs, WorkerArgs> & Omit<PlaywrightTestType<TestArgs, WorkerArgs>, "only" | "skip" | "fixme" | "fail" | "describe"> & {
|
|
142
|
+
only: ITestFunction<TestConditionsValue, TestArgs, WorkerArgs>;
|
|
143
|
+
skip: ITestModifierFunction<TestConditionsValue, TestArgs, WorkerArgs>;
|
|
144
|
+
fixme: ITestModifierFunction<TestConditionsValue, TestArgs, WorkerArgs>;
|
|
145
|
+
fail: ITestFailFunction<TestConditionsValue, TestArgs, WorkerArgs>;
|
|
146
|
+
describe: IDescribe<TestConditionsValue>;
|
|
147
|
+
};
|
|
17
148
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/create-test/playwright/types.ts"],"names":[],"mappings":"
|
|
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;AACtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,OAAO,KAAK,EACR,uBAAuB,EACvB,2BAA2B,EAC3B,kBAAkB,EAClB,kBAAkB,EACrB,MAAM,uBAAuB,CAAC;AAE/B;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC;AAElC;;;;GAIG;AACH,MAAM,WAAW,iBAAiB,CAAC,mBAAmB,SAAS,6BAA6B,GAAG,KAAK;IAChG,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,CAAC,mBAAmB,CAAC,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;CACzF;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAqB,CAClC,mBAAmB,SAAS,6BAA6B,GAAG,KAAK,CACnE,SAAQ,iBAAiB,CAAC,mBAAmB,CAAC;IAC5C,IAAI,EAAE,iBAAiB,CAAC,mBAAmB,CAAC,CAAC;CAChD;AAED;;GAEG;AACH,MAAM,WAAW,SAAS,CACtB,mBAAmB,SAAS,6BAA6B,GAAG,KAAK,CACnE,SAAQ,iBAAiB,CAAC,mBAAmB,CAAC;IAC5C,IAAI,EAAE,iBAAiB,CAAC,mBAAmB,CAAC,CAAC;IAC7C,IAAI,EAAE,iBAAiB,CAAC,mBAAmB,CAAC,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laywrightLocation } from "./playwright-internals.js";
|
|
2
|
+
import type { PlaywrightTestInstance } from "./playwright-types.js";
|
|
3
|
+
import type { Callback, ITestDetails, TestConditionsValueConstraint, WindowProperties, WorkspaceSettings } from "./types.js";
|
|
4
4
|
/** Push merged settings/awp onto stacks, register a single beforeEach, call fn, pop. */
|
|
5
|
-
export declare function withDescribeDetails(testInstance:
|
|
5
|
+
export declare function withDescribeDetails(testInstance: PlaywrightTestInstance, settingsStack: WorkspaceSettings[], awpStack: WindowProperties[], details: ITestDetails<TestConditionsValueConstraint> | undefined, fn: Callback): void;
|
|
6
|
+
/**
|
|
7
|
+
* Register a single test's own settings/awp, merged on top of the enclosing describes'.
|
|
8
|
+
* The beforeEach is registered next to the test, after the enclosing describes' injection hooks,
|
|
9
|
+
* so it runs last and its values win.
|
|
10
|
+
*/
|
|
11
|
+
export declare function withTestDetails(testInstance: PlaywrightTestInstance, settingsStack: WorkspaceSettings[], awpStack: WindowProperties[], location: IPlaywrightLocation, title: string, details: ITestDetails<TestConditionsValueConstraint> | undefined): void;
|
|
6
12
|
//# 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":"AAIA,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,6BAA6B,EAC7B,gBAAgB,EAChB,iBAAiB,EACpB,MAAM,YAAY,CAAC;AAMpB,wFAAwF;AACxF,wBAAgB,mBAAmB,CAC/B,YAAY,EAAE,sBAAsB,EACpC,aAAa,EAAE,iBAAiB,EAAE,EAClC,QAAQ,EAAE,gBAAgB,EAAE,EAC5B,OAAO,EAAE,YAAY,CAAC,6BAA6B,CAAC,GAAG,SAAS,EAChE,EAAE,EAAE,QAAQ,QAsBf;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAC3B,YAAY,EAAE,sBAAsB,EACpC,aAAa,EAAE,iBAAiB,EAAE,EAClC,QAAQ,EAAE,gBAAgB,EAAE,EAC5B,QAAQ,EAAE,mBAAmB,EAC7B,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,YAAY,CAAC,6BAA6B,CAAC,GAAG,SAAS,GACjE,IAAI,CAsBN"}
|
|
@@ -17,23 +17,56 @@ export function withDescribeDetails(testInstance, settingsStack, awpStack, detai
|
|
|
17
17
|
if (awp)
|
|
18
18
|
awpStack.push(mergedAwp);
|
|
19
19
|
injectWindowProperties(testInstance, mergedSettings, mergedAwp);
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
try {
|
|
21
|
+
fn();
|
|
22
|
+
}
|
|
23
|
+
finally {
|
|
24
|
+
// Pop even if the body throws, so later describes don't inherit this level's entries.
|
|
25
|
+
if (awp)
|
|
26
|
+
awpStack.pop();
|
|
27
|
+
if (ws)
|
|
28
|
+
settingsStack.pop();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Register a single test's own settings/awp, merged on top of the enclosing describes'.
|
|
33
|
+
* The beforeEach is registered next to the test, after the enclosing describes' injection hooks,
|
|
34
|
+
* so it runs last and its values win.
|
|
35
|
+
*/
|
|
36
|
+
export function withTestDetails(testInstance, settingsStack, awpStack, location, title, details) {
|
|
37
|
+
const ws = details?.workspaceSettings;
|
|
38
|
+
const awp = details?.additionalWindowProperties;
|
|
39
|
+
if (!ws && !awp) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const mergedSettings = ws ? { ...peekOrEmpty(settingsStack), ...ws } : peekOrEmpty(settingsStack);
|
|
43
|
+
const mergedAwp = awp ? { ...peekOrEmpty(awpStack), ...awp } : peekOrEmpty(awpStack);
|
|
44
|
+
testInstance.beforeEach(async ({ page }, testInfo) => {
|
|
45
|
+
// A beforeEach applies to every test in its describe; only act for this test. Title is part
|
|
46
|
+
// of the match because tests generated in a loop share one location.
|
|
47
|
+
if (testInfo.title !== title ||
|
|
48
|
+
testInfo.file !== location.file ||
|
|
49
|
+
testInfo.line !== location.line ||
|
|
50
|
+
testInfo.column !== location.column) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
await addWindowPropertiesInitScript(page, mergedSettings, mergedAwp);
|
|
54
|
+
});
|
|
25
55
|
}
|
|
26
56
|
/** Inject workspace settings and additional window properties via a single addInitScript. */
|
|
27
57
|
function injectWindowProperties(testInst, settings, awp) {
|
|
28
58
|
testInst.beforeEach(async ({ page }) => {
|
|
29
|
-
await page
|
|
30
|
-
const w = window;
|
|
31
|
-
if (Object.keys(args.s).length > 0) {
|
|
32
|
-
w["customWorkspaceSettings"] = args.s;
|
|
33
|
-
}
|
|
34
|
-
for (const [key, value] of Object.entries(args.a)) {
|
|
35
|
-
w[key] = value;
|
|
36
|
-
}
|
|
37
|
-
}, { s: settings, a: awp });
|
|
59
|
+
await addWindowPropertiesInitScript(page, settings, awp);
|
|
38
60
|
});
|
|
39
61
|
}
|
|
62
|
+
async function addWindowPropertiesInitScript(page, settings, awp) {
|
|
63
|
+
await page.addInitScript((args) => {
|
|
64
|
+
const w = window;
|
|
65
|
+
if (Object.keys(args.s).length > 0) {
|
|
66
|
+
w["customWorkspaceSettings"] = args.s;
|
|
67
|
+
}
|
|
68
|
+
for (const [key, value] of Object.entries(args.a)) {
|
|
69
|
+
w[key] = value;
|
|
70
|
+
}
|
|
71
|
+
}, { s: settings, a: awp });
|
|
72
|
+
}
|
package/esm/index.d.ts
CHANGED
|
@@ -5,13 +5,9 @@ export type { IGoodmockMapping, ILeakPattern, ISecretMapping, IWorkspaceIdMappin
|
|
|
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";
|
|
7
7
|
export { snapshotAndSaveRecording, type ISnapshotAndSaveRecordingOptions, } from "./create-test/goodmock/snapshot/snapshot-and-save-recording.js";
|
|
8
|
-
export
|
|
9
|
-
export type { IDescribe, IDescribeFunction } from "./create-test/playwright/describe/factory.js";
|
|
8
|
+
export { createTest } from "./create-test/playwright/factory.js";
|
|
10
9
|
export type { Fixtures } from "./create-test/playwright/fixtures.js";
|
|
11
|
-
export type {
|
|
12
|
-
export {
|
|
13
|
-
export type { ICreateTestOptions, ICustomCreateTestOptions, ITest, } from "./create-test/playwright/test/types.js";
|
|
14
|
-
export type { ITestDetails, WindowProperties, WorkspaceSettings } from "./create-test/playwright/types.js";
|
|
15
|
-
export type { ITopLevelDescribe, ITopLevelDescribeFunction, } from "./create-test/playwright/top-level-describe/types.js";
|
|
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, WorkspaceSettings, } from "./create-test/playwright/types.js";
|
|
16
12
|
export { clickByBoundingBox, hoverByBoundingBox } from "./helpers/mouse-actions.js";
|
|
17
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,gBA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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,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,EAChB,iBAAiB,GACpB,MAAM,mCAAmC,CAAC;AAG3C,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC"}
|
package/esm/index.js
CHANGED
|
@@ -7,6 +7,7 @@ export { GOODMOCK_HOST, API_TOKEN, BACKEND_HOST, getBaseUrl, getEnvWithFallback,
|
|
|
7
7
|
export { loadMappings, resetMappings, resetScenarios, mockLogRequests, startRecording, } from "./create-test/goodmock/admin.js";
|
|
8
8
|
export { goodmockMode, GoodmockMode } from "./create-test/goodmock/mode.js";
|
|
9
9
|
export { snapshotAndSaveRecording, } from "./create-test/goodmock/snapshot/snapshot-and-save-recording.js";
|
|
10
|
-
|
|
10
|
+
// create-test - playwright
|
|
11
|
+
export { createTest } from "./create-test/playwright/factory.js";
|
|
11
12
|
// helpers
|
|
12
13
|
export { clickByBoundingBox, hoverByBoundingBox } from "./helpers/mouse-actions.js";
|
package/esm/sdk-e2e-utils.d.ts
CHANGED
|
@@ -4,11 +4,12 @@ import { Locator } from '@playwright/test';
|
|
|
4
4
|
import { Page } from '@playwright/test';
|
|
5
5
|
import type { PlaywrightTestArgs } from '@playwright/test';
|
|
6
6
|
import type { PlaywrightTestOptions } from '@playwright/test';
|
|
7
|
+
import type { TestType as PlaywrightTestType } from '@playwright/test';
|
|
7
8
|
import type { PlaywrightWorkerArgs } from '@playwright/test';
|
|
8
9
|
import type { PlaywrightWorkerOptions } from '@playwright/test';
|
|
9
10
|
import { Route } from '@playwright/test';
|
|
10
|
-
import type { test } from '@playwright/test';
|
|
11
11
|
import type { TestDetails } from '@playwright/test';
|
|
12
|
+
import type { TestInfo } from '@playwright/test';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* @internal
|
|
@@ -35,16 +36,6 @@ export declare const authHeader: (token: string) => {
|
|
|
35
36
|
*/
|
|
36
37
|
export declare const BACKEND_HOST: string;
|
|
37
38
|
|
|
38
|
-
/**
|
|
39
|
-
* @internal
|
|
40
|
-
*/
|
|
41
|
-
export declare type BaseTestArgs = PlaywrightTestArgs & PlaywrightTestOptions;
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* @internal
|
|
45
|
-
*/
|
|
46
|
-
export declare type BaseWorkerArgs = PlaywrightWorkerArgs & PlaywrightWorkerOptions;
|
|
47
|
-
|
|
48
39
|
/**
|
|
49
40
|
* @internal
|
|
50
41
|
*/
|
|
@@ -66,42 +57,12 @@ export declare function clickByBoundingBox(page: Page, locator: Locator, options
|
|
|
66
57
|
* @internal
|
|
67
58
|
* @param options -
|
|
68
59
|
*/
|
|
69
|
-
export declare function createTest<T extends {} = {}, W extends {} = {}>(options: ICreateTestOptions<T, W>):
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* @internal
|
|
73
|
-
*/
|
|
74
|
-
export declare type DescribeConfigure = typeof test.describe.configure;
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* @internal
|
|
78
|
-
*/
|
|
79
|
-
export declare type DescribeFixme = typeof test.describe.fixme;
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* @internal
|
|
83
|
-
*/
|
|
84
|
-
export declare type DescribeOnly = typeof test.describe.only;
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* @internal
|
|
88
|
-
*/
|
|
89
|
-
export declare type DescribeParallel = typeof test.describe.parallel;
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* @internal
|
|
93
|
-
*/
|
|
94
|
-
export declare type DescribeSerial = typeof test.describe.serial;
|
|
60
|
+
export declare function createTest<TestConditionsValue extends TestConditionsValueConstraint = never, T extends {} = {}, W extends {} = {}>(options: ICreateTestOptions<TestConditionsValue, T, W>): Test<TestConditionsValue, PlaywrightBaseTestArgs & T, PlaywrightBaseWorkerArgs & W>;
|
|
95
61
|
|
|
96
62
|
/**
|
|
97
63
|
* @internal
|
|
98
64
|
*/
|
|
99
|
-
export declare type
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* @internal
|
|
103
|
-
*/
|
|
104
|
-
export declare type Fixtures<T extends {} = {}, W extends {} = {}> = Fixtures_2<T, W, BaseTestArgs, BaseWorkerArgs>;
|
|
65
|
+
export declare type Fixtures<T extends {} = {}, W extends {} = {}> = Fixtures_2<T, W, PlaywrightBaseTestArgs, PlaywrightBaseWorkerArgs>;
|
|
105
66
|
|
|
106
67
|
/**
|
|
107
68
|
* @internal
|
|
@@ -154,38 +115,50 @@ export declare function hoverByBoundingBox(page: Page, locator: Locator, options
|
|
|
154
115
|
|
|
155
116
|
/**
|
|
156
117
|
* @internal
|
|
118
|
+
* `testConditions` is required when the conditions type `TestConditionsValue` is given (or inferred from it).
|
|
157
119
|
*/
|
|
158
|
-
export declare
|
|
159
|
-
fixtures?:
|
|
160
|
-
}
|
|
120
|
+
export declare type ICreateTestOptions<TestConditionsValue extends TestConditionsValueConstraint = never, T extends {} = {}, W extends {} = {}> = ICustomCreateTestOptions<TestConditionsValue> & {
|
|
121
|
+
fixtures?: Fixtures_2<T, W>;
|
|
122
|
+
} & ([TestConditionsValue] extends [never] ? {} : {
|
|
123
|
+
testConditions: ITestConditions<TestConditionsValue>;
|
|
124
|
+
});
|
|
161
125
|
|
|
162
126
|
/**
|
|
163
127
|
* @internal
|
|
164
128
|
*/
|
|
165
|
-
export declare interface ICustomCreateTestOptions {
|
|
129
|
+
export declare interface ICustomCreateTestOptions<TestConditionsValue extends TestConditionsValueConstraint = never> {
|
|
166
130
|
featureHubResponse: IFeatureHubEnvironment[];
|
|
167
131
|
goodmock?: IGoodmockOptions;
|
|
132
|
+
testConditions?: ITestConditions<TestConditionsValue>;
|
|
168
133
|
}
|
|
169
134
|
|
|
170
135
|
/**
|
|
171
136
|
* @internal
|
|
172
137
|
*/
|
|
173
|
-
export declare interface IDescribe extends IDescribeFunction {
|
|
174
|
-
skip: IDescribeFunction
|
|
175
|
-
only:
|
|
176
|
-
configure:
|
|
177
|
-
fixme:
|
|
178
|
-
serial:
|
|
179
|
-
parallel:
|
|
138
|
+
export declare interface IDescribe<TestConditionsValue extends TestConditionsValueConstraint = never> extends IDescribeFunction<TestConditionsValue> {
|
|
139
|
+
skip: IDescribeFunction<TestConditionsValue>;
|
|
140
|
+
only: IDescribeFunction<TestConditionsValue>;
|
|
141
|
+
configure: PlaywrightDescribeConfigure;
|
|
142
|
+
fixme: IDescribeFunction<TestConditionsValue>;
|
|
143
|
+
serial: IDescribeModeFunction<TestConditionsValue>;
|
|
144
|
+
parallel: IDescribeModeFunction<TestConditionsValue>;
|
|
180
145
|
}
|
|
181
146
|
|
|
182
147
|
/**
|
|
183
148
|
* @internal
|
|
184
|
-
* Call signatures of the overridden `test.describe` and
|
|
149
|
+
* Call signatures of the overridden `test.describe` and its variants (`.only`, `.skip`, `.fixme`, `.serial`, `.parallel`, ...).
|
|
150
|
+
* The outermost describe of a spec file also sets up the spec (FeatureHub mock, goodmock hooks).
|
|
185
151
|
*/
|
|
186
|
-
export declare interface IDescribeFunction {
|
|
187
|
-
(title: string, callback: Callback): void;
|
|
188
|
-
|
|
152
|
+
export declare interface IDescribeFunction<TestConditionsValue extends TestConditionsValueConstraint = never> {
|
|
153
|
+
(title: string, details: ITestDetails<TestConditionsValue>, callback: Callback): void;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* @internal
|
|
158
|
+
* `test.describe.serial` / `test.describe.parallel`, with their `.only`.
|
|
159
|
+
*/
|
|
160
|
+
export declare interface IDescribeModeFunction<TestConditionsValue extends TestConditionsValueConstraint = never> extends IDescribeFunction<TestConditionsValue> {
|
|
161
|
+
only: IDescribeFunction<TestConditionsValue>;
|
|
189
162
|
}
|
|
190
163
|
|
|
191
164
|
/**
|
|
@@ -278,6 +251,12 @@ export declare interface ISecretMapping {
|
|
|
278
251
|
export declare interface ISnapshotAndSaveRecordingOptions {
|
|
279
252
|
/** Source/target workspace ID rewrite(s) applied before mappings are saved. */
|
|
280
253
|
workspaceIdMappings?: IWorkspaceIdMapping | IWorkspaceIdMapping[];
|
|
254
|
+
/**
|
|
255
|
+
* Template organization name. Every ephemeral organization name in the saved mappings
|
|
256
|
+
* (`ephemeral-{templateOrganization}-{hex}`) is replaced with this bare name so re-recording
|
|
257
|
+
* against a fresh ephemeral org does not churn the recordings. Defaults to "automation".
|
|
258
|
+
*/
|
|
259
|
+
templateOrganization?: string;
|
|
281
260
|
/**
|
|
282
261
|
* Real backend URL (e.g. "https://example.gooddata.com"). When provided together with
|
|
283
262
|
* baseUrl, all occurrences are replaced in the saved mappings so that recorded responses
|
|
@@ -309,34 +288,78 @@ export declare interface ISnapshotAndSaveRecordingOptions {
|
|
|
309
288
|
|
|
310
289
|
/**
|
|
311
290
|
* @internal
|
|
291
|
+
* Consumer-defined conditions deciding which tests run. `TestConditionsValue` is the consumer's own type (e.g. a list
|
|
292
|
+
* of products). Describes and tests set it via `details.conditions`; nested values are combined with
|
|
293
|
+
* {@link ITestConditions.merge}. Each test is evaluated once, while tests are being registered.
|
|
312
294
|
*/
|
|
313
|
-
export declare
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
295
|
+
export declare interface ITestConditions<TestConditionsValue extends TestConditionsValueConstraint> {
|
|
296
|
+
/**
|
|
297
|
+
* Whether a test with these (already combined) conditions runs. When `false`, the test is registered
|
|
298
|
+
* as skipped. Not called when neither the test nor any enclosing describe sets conditions.
|
|
299
|
+
*
|
|
300
|
+
* Called while tests are being registered, in every Playwright process: it must be synchronous and
|
|
301
|
+
* return the same answer every time (env vars and config are fine; async or runtime state are not).
|
|
302
|
+
*/
|
|
303
|
+
shouldRun: (conditions: TestConditionsValue, context: ITestConditionsContext) => boolean;
|
|
304
|
+
/**
|
|
305
|
+
* Combine a describe's or test's conditions with those inherited from its enclosing describes.
|
|
306
|
+
* Defaults to `child` replacing `parent`.
|
|
307
|
+
*/
|
|
308
|
+
merge?: (parent: TestConditionsValue | undefined, child: TestConditionsValue) => TestConditionsValue;
|
|
309
|
+
/**
|
|
310
|
+
* When `true`, every test must end up with conditions: set on the test itself or inherited from an
|
|
311
|
+
* enclosing describe. Registering a test without any throws. Defaults to `false`.
|
|
312
|
+
*/
|
|
313
|
+
required?: boolean;
|
|
314
|
+
}
|
|
317
315
|
|
|
318
316
|
/**
|
|
319
317
|
* @internal
|
|
318
|
+
* Context passed to {@link ITestConditions.shouldRun}, for the test being registered.
|
|
320
319
|
*/
|
|
321
|
-
export declare interface
|
|
320
|
+
export declare interface ITestConditionsContext {
|
|
321
|
+
/** Absolute path of the spec file. */
|
|
322
|
+
file: string;
|
|
323
|
+
/** Titles of the enclosing describes, outermost first, followed by the test's own title. */
|
|
324
|
+
titlePath: string[];
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* @internal
|
|
329
|
+
*/
|
|
330
|
+
export declare interface ITestDetails<TestConditionsValue extends TestConditionsValueConstraint = never> extends TestDetails {
|
|
322
331
|
workspaceSettings?: WorkspaceSettings;
|
|
323
332
|
additionalWindowProperties?: WindowProperties;
|
|
333
|
+
/** See {@link ITestConditions}. */
|
|
334
|
+
conditions?: TestConditionsValue;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* @internal
|
|
339
|
+
* `test.fail`, with its `.only`.
|
|
340
|
+
*/
|
|
341
|
+
export declare interface ITestFailFunction<TestConditionsValue extends TestConditionsValueConstraint, TestArgs extends {}, WorkerArgs extends {}> extends ITestModifierFunction<TestConditionsValue, TestArgs, WorkerArgs> {
|
|
342
|
+
only: ITestFunction<TestConditionsValue, TestArgs, WorkerArgs>;
|
|
324
343
|
}
|
|
325
344
|
|
|
326
345
|
/**
|
|
327
346
|
* @internal
|
|
347
|
+
* Call signatures that register a test: `test`, `test.only`, `test.fail.only`.
|
|
348
|
+
* Same as Playwright's, except `details` also accepts `workspaceSettings` / `additionalWindowProperties` / `conditions`.
|
|
328
349
|
*/
|
|
329
|
-
export declare interface
|
|
330
|
-
|
|
350
|
+
export declare interface ITestFunction<TestConditionsValue extends TestConditionsValueConstraint, TestArgs extends {}, WorkerArgs extends {}> {
|
|
351
|
+
(title: string, body: PlaywrightTestBody<TestArgs & WorkerArgs>): void;
|
|
352
|
+
(title: string, details: ITestDetails<TestConditionsValue>, body: PlaywrightTestBody<TestArgs & WorkerArgs>): void;
|
|
331
353
|
}
|
|
332
354
|
|
|
333
355
|
/**
|
|
334
356
|
* @internal
|
|
335
|
-
*
|
|
357
|
+
* `test.skip` / `test.fixme`: register a skipped test (title forms), or mark the current test or describe.
|
|
336
358
|
*/
|
|
337
|
-
export declare interface
|
|
338
|
-
(
|
|
339
|
-
(
|
|
359
|
+
export declare interface ITestModifierFunction<TestConditionsValue extends TestConditionsValueConstraint, TestArgs extends {}, WorkerArgs extends {}> extends ITestFunction<TestConditionsValue, TestArgs, WorkerArgs> {
|
|
360
|
+
(): void;
|
|
361
|
+
(condition: boolean, description?: string): void;
|
|
362
|
+
(callback: PlaywrightConditionBody<TestArgs & WorkerArgs>, description?: string): void;
|
|
340
363
|
}
|
|
341
364
|
|
|
342
365
|
/**
|
|
@@ -363,6 +386,42 @@ export declare function loadMappings(host: string, mappingFilePath: string): Pro
|
|
|
363
386
|
*/
|
|
364
387
|
export declare function mockLogRequests(host: string): Promise<void>;
|
|
365
388
|
|
|
389
|
+
/**
|
|
390
|
+
* @internal
|
|
391
|
+
*/
|
|
392
|
+
export declare type PlaywrightBaseTestArgs = PlaywrightTestArgs & PlaywrightTestOptions;
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* @internal
|
|
396
|
+
*/
|
|
397
|
+
export declare type PlaywrightBaseWorkerArgs = PlaywrightWorkerArgs & PlaywrightWorkerOptions;
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* @internal
|
|
401
|
+
* Condition callback of `test.skip(callback, description?)` and friends. Mirrors Playwright's internal
|
|
402
|
+
* `ConditionBody<TestArgs>`, which `@playwright/test` doesn't export.
|
|
403
|
+
*/
|
|
404
|
+
export declare type PlaywrightConditionBody<TestArgs> = (args: TestArgs) => boolean;
|
|
405
|
+
|
|
406
|
+
/**
|
|
407
|
+
* @internal
|
|
408
|
+
*/
|
|
409
|
+
export declare type PlaywrightDescribeConfigure = PlaywrightTestInstance["describe"]["configure"];
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* @internal
|
|
413
|
+
* Body of a test: `(fixtures, testInfo) => ...`. Mirrors Playwright's internal `TestBody<TestArgs>`,
|
|
414
|
+
* which `@playwright/test` doesn't export.
|
|
415
|
+
*/
|
|
416
|
+
export declare type PlaywrightTestBody<TestArgs> = (args: TestArgs, testInfo: TestInfo) => Promise<unknown> | unknown;
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* @internal
|
|
420
|
+
*/
|
|
421
|
+
export declare type PlaywrightTestInstance = PlaywrightTestType<PlaywrightTestArgs & PlaywrightTestOptions, PlaywrightWorkerArgs & PlaywrightWorkerOptions>;
|
|
422
|
+
|
|
423
|
+
export { PlaywrightTestType }
|
|
424
|
+
|
|
366
425
|
/**
|
|
367
426
|
* @internal
|
|
368
427
|
* Clear all goodmock stub mappings.
|
|
@@ -402,8 +461,23 @@ export declare function startRecording(host: string, backendHost: string): Promi
|
|
|
402
461
|
|
|
403
462
|
/**
|
|
404
463
|
* @internal
|
|
464
|
+
* Playwright's `TestType<TestArgs, WorkerArgs>`, with our `test` / `only` / `skip` / `fixme` / `fail` / `describe`.
|
|
465
|
+
*/
|
|
466
|
+
export declare type Test<TestConditionsValue extends TestConditionsValueConstraint, TestArgs extends {}, WorkerArgs extends {}> = ITestFunction<TestConditionsValue, TestArgs, WorkerArgs> & Omit<PlaywrightTestType<TestArgs, WorkerArgs>, "only" | "skip" | "fixme" | "fail" | "describe"> & {
|
|
467
|
+
only: ITestFunction<TestConditionsValue, TestArgs, WorkerArgs>;
|
|
468
|
+
skip: ITestModifierFunction<TestConditionsValue, TestArgs, WorkerArgs>;
|
|
469
|
+
fixme: ITestModifierFunction<TestConditionsValue, TestArgs, WorkerArgs>;
|
|
470
|
+
fail: ITestFailFunction<TestConditionsValue, TestArgs, WorkerArgs>;
|
|
471
|
+
describe: IDescribe<TestConditionsValue>;
|
|
472
|
+
};
|
|
473
|
+
|
|
474
|
+
/**
|
|
475
|
+
* @internal
|
|
476
|
+
* Allowed types for the consumer's conditions value: objects (including arrays), strings and numbers.
|
|
477
|
+
* Not `boolean`, `null` or `undefined` (nor unions containing them). Only the top level is restricted,
|
|
478
|
+
* an object may contain booleans. Without conditions configured, the conditions type is `never`.
|
|
405
479
|
*/
|
|
406
|
-
export declare type
|
|
480
|
+
export declare type TestConditionsValueConstraint = object | string | number;
|
|
407
481
|
|
|
408
482
|
/**
|
|
409
483
|
* @internal
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gooddata/sdk-e2e-utils",
|
|
3
|
-
"version": "11.61.0-alpha.
|
|
3
|
+
"version": "11.61.0-alpha.2",
|
|
4
4
|
"description": "GoodData utility functions for Playwright E2E tests",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "GoodData",
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"oxlint-plugin-eslint": "1.82.0",
|
|
50
50
|
"oxlint-tsgolint": "7.0.2001",
|
|
51
51
|
"typescript": "7.0.2",
|
|
52
|
-
"@gooddata/eslint-config": "11.61.0-alpha.
|
|
53
|
-
"@gooddata/oxlint-config": "11.61.0-alpha.
|
|
52
|
+
"@gooddata/eslint-config": "11.61.0-alpha.2",
|
|
53
|
+
"@gooddata/oxlint-config": "11.61.0-alpha.2"
|
|
54
54
|
},
|
|
55
55
|
"scripts": {
|
|
56
56
|
"_phase:build": "npm run build",
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { TestDetails } from "@playwright/test";
|
|
2
|
-
import type { Describe, DescribeFixme, DescribeOnly, DescribeSkip } from "./playwright-types.js";
|
|
3
|
-
import type { ITestDetails } from "./types.js";
|
|
4
|
-
/**
|
|
5
|
-
* @internal
|
|
6
|
-
*/
|
|
7
|
-
export type Callback = () => void;
|
|
8
|
-
export type OriginalFn = Describe | DescribeFixme | DescribeOnly | DescribeSkip;
|
|
9
|
-
/** Call a Playwright describe function, passing details only when there are any. */
|
|
10
|
-
export declare function callOriginalFn(originalFn: OriginalFn, title: string, pwDetails: TestDetails | undefined, callback: Callback): void;
|
|
11
|
-
/** Strip custom fields before passing details to Playwright. */
|
|
12
|
-
export declare function toPlaywrightDetails(details: ITestDetails | undefined): TestDetails | undefined;
|
|
13
|
-
export declare function parseArgs(detailsOrFn: ITestDetails | Callback, func?: Callback): {
|
|
14
|
-
details: ITestDetails | undefined;
|
|
15
|
-
fn: Callback;
|
|
16
|
-
};
|
|
17
|
-
//# sourceMappingURL=call-original-fn.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"call-original-fn.d.ts","sourceRoot":"","sources":["../../../src/create-test/playwright/call-original-fn.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACjG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC;AAElC,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,aAAa,GAAG,YAAY,GAAG,YAAY,CAAC;AAEhF,oFAAoF;AACpF,wBAAgB,cAAc,CAC1B,UAAU,EAAE,UAAU,EACtB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,WAAW,GAAG,SAAS,EAClC,QAAQ,EAAE,QAAQ,GACnB,IAAI,CAMN;AAED,gEAAgE;AAChE,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,YAAY,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,CAK9F;AAED,wBAAgB,SAAS,CACrB,WAAW,EAAE,YAAY,GAAG,QAAQ,EACpC,IAAI,CAAC,EAAE,QAAQ,GAChB;IAAE,OAAO,EAAE,YAAY,GAAG,SAAS,CAAC;IAAC,EAAE,EAAE,QAAQ,CAAA;CAAE,CAMrD"}
|