@ripplo/testing 0.0.1
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 +386 -0
- package/dist/actions.d.ts +233 -0
- package/dist/actions.js +116 -0
- package/dist/assert.d.ts +182 -0
- package/dist/assert.js +83 -0
- package/dist/builder-DTWMrbuv.d.ts +133 -0
- package/dist/chunk-2VUWFRR5.js +20 -0
- package/dist/chunk-DCJBLS2U.js +26 -0
- package/dist/chunk-KWUKVAGI.js +227 -0
- package/dist/chunk-MGATMMCZ.js +16 -0
- package/dist/chunk-X2FROZPN.js +149 -0
- package/dist/compiler.d.ts +22 -0
- package/dist/compiler.js +7 -0
- package/dist/control.d.ts +24 -0
- package/dist/control.js +27 -0
- package/dist/express.d.ts +12 -0
- package/dist/express.js +102 -0
- package/dist/fastify.d.ts +12 -0
- package/dist/fastify.js +72 -0
- package/dist/index.d.ts +56 -0
- package/dist/index.js +464 -0
- package/dist/locators.d.ts +30 -0
- package/dist/locators.js +10 -0
- package/dist/nextjs.d.ts +12 -0
- package/dist/nextjs.js +105 -0
- package/dist/step-DLfkKI3V.d.ts +19 -0
- package/package.json +94 -0
package/dist/actions.js
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import {
|
|
2
|
+
toSpecLocator
|
|
3
|
+
} from "./chunk-2VUWFRR5.js";
|
|
4
|
+
import {
|
|
5
|
+
createStep
|
|
6
|
+
} from "./chunk-MGATMMCZ.js";
|
|
7
|
+
import "./chunk-DCJBLS2U.js";
|
|
8
|
+
|
|
9
|
+
// src/steps/actions.ts
|
|
10
|
+
function navigate(url) {
|
|
11
|
+
return createStep({ type: "goto", url: { type: "static", value: url } });
|
|
12
|
+
}
|
|
13
|
+
function click(locator) {
|
|
14
|
+
return createStep({ locator: toSpecLocator(locator), type: "click" });
|
|
15
|
+
}
|
|
16
|
+
function fill(locator, value) {
|
|
17
|
+
return createStep({
|
|
18
|
+
locator: toSpecLocator(locator),
|
|
19
|
+
type: "fill",
|
|
20
|
+
value: { type: "static", value }
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
function select(locator, value) {
|
|
24
|
+
return createStep({
|
|
25
|
+
locator: toSpecLocator(locator),
|
|
26
|
+
type: "select",
|
|
27
|
+
value: { type: "static", value }
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
function check(locator) {
|
|
31
|
+
return createStep({ locator: toSpecLocator(locator), type: "check" });
|
|
32
|
+
}
|
|
33
|
+
function uncheck(locator) {
|
|
34
|
+
return createStep({ locator: toSpecLocator(locator), type: "uncheck" });
|
|
35
|
+
}
|
|
36
|
+
function hover(locator) {
|
|
37
|
+
return createStep({ locator: toSpecLocator(locator), type: "hover" });
|
|
38
|
+
}
|
|
39
|
+
function press(key) {
|
|
40
|
+
return createStep({ key, type: "press" });
|
|
41
|
+
}
|
|
42
|
+
function upload(locator, path) {
|
|
43
|
+
return createStep({
|
|
44
|
+
files: [path],
|
|
45
|
+
locator: toSpecLocator(locator),
|
|
46
|
+
type: "upload"
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function dblclick(locator) {
|
|
50
|
+
return createStep({ locator: toSpecLocator(locator), type: "dblclick" });
|
|
51
|
+
}
|
|
52
|
+
function focus(locator) {
|
|
53
|
+
return createStep({ locator: toSpecLocator(locator), type: "focus" });
|
|
54
|
+
}
|
|
55
|
+
function clear(locator) {
|
|
56
|
+
return createStep({ locator: toSpecLocator(locator), type: "clear" });
|
|
57
|
+
}
|
|
58
|
+
function typeText(locator, value) {
|
|
59
|
+
return createStep({
|
|
60
|
+
locator: toSpecLocator(locator),
|
|
61
|
+
type: "type",
|
|
62
|
+
value: { type: "static", value }
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
function rightClick(locator) {
|
|
66
|
+
return createStep({ locator: toSpecLocator(locator), type: "rightClick" });
|
|
67
|
+
}
|
|
68
|
+
function scrollIntoView(locator) {
|
|
69
|
+
return createStep({ locator: toSpecLocator(locator), type: "scrollIntoView" });
|
|
70
|
+
}
|
|
71
|
+
function drag(source, target) {
|
|
72
|
+
return createStep({
|
|
73
|
+
source: toSpecLocator(source),
|
|
74
|
+
target: toSpecLocator(target),
|
|
75
|
+
type: "drag"
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
function handleDialog({ action, promptText }) {
|
|
79
|
+
return createStep({ action, promptText, type: "handleDialog" });
|
|
80
|
+
}
|
|
81
|
+
function clipboard({ action, value, variable }) {
|
|
82
|
+
return createStep({
|
|
83
|
+
action,
|
|
84
|
+
type: "clipboard",
|
|
85
|
+
value: value == null ? void 0 : { type: "static", value },
|
|
86
|
+
variable
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
function setPermission({ permission, state }) {
|
|
90
|
+
return createStep({ permission, state, type: "setPermission" });
|
|
91
|
+
}
|
|
92
|
+
function setViewport({ height, width }) {
|
|
93
|
+
return createStep({ height, type: "setViewport", width });
|
|
94
|
+
}
|
|
95
|
+
export {
|
|
96
|
+
check,
|
|
97
|
+
clear,
|
|
98
|
+
click,
|
|
99
|
+
clipboard,
|
|
100
|
+
dblclick,
|
|
101
|
+
drag,
|
|
102
|
+
fill,
|
|
103
|
+
focus,
|
|
104
|
+
handleDialog,
|
|
105
|
+
hover,
|
|
106
|
+
navigate,
|
|
107
|
+
press,
|
|
108
|
+
rightClick,
|
|
109
|
+
scrollIntoView,
|
|
110
|
+
select,
|
|
111
|
+
setPermission,
|
|
112
|
+
setViewport,
|
|
113
|
+
typeText,
|
|
114
|
+
uncheck,
|
|
115
|
+
upload
|
|
116
|
+
};
|
package/dist/assert.d.ts
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { U as UnlabeledStep } from './step-DLfkKI3V.js';
|
|
2
|
+
import { CheckLocator, AnyLocator } from './locators.js';
|
|
3
|
+
import '@ripplo/spec';
|
|
4
|
+
|
|
5
|
+
declare const assert: {
|
|
6
|
+
not: {
|
|
7
|
+
checked(locator: CheckLocator): UnlabeledStep<{
|
|
8
|
+
locator: {
|
|
9
|
+
by: "testId";
|
|
10
|
+
value: string;
|
|
11
|
+
} | {
|
|
12
|
+
by: "role";
|
|
13
|
+
role: string;
|
|
14
|
+
name?: string | undefined;
|
|
15
|
+
};
|
|
16
|
+
type: "assertNotChecked";
|
|
17
|
+
}>;
|
|
18
|
+
enabled(locator: AnyLocator): UnlabeledStep<{
|
|
19
|
+
locator: {
|
|
20
|
+
by: "testId";
|
|
21
|
+
value: string;
|
|
22
|
+
} | {
|
|
23
|
+
by: "role";
|
|
24
|
+
role: string;
|
|
25
|
+
name?: string | undefined;
|
|
26
|
+
};
|
|
27
|
+
type: "assertDisabled";
|
|
28
|
+
}>;
|
|
29
|
+
focused(locator: AnyLocator): UnlabeledStep<{
|
|
30
|
+
locator: {
|
|
31
|
+
by: "testId";
|
|
32
|
+
value: string;
|
|
33
|
+
} | {
|
|
34
|
+
by: "role";
|
|
35
|
+
role: string;
|
|
36
|
+
name?: string | undefined;
|
|
37
|
+
};
|
|
38
|
+
type: "assertNotFocused";
|
|
39
|
+
}>;
|
|
40
|
+
visible(locator: AnyLocator): UnlabeledStep<{
|
|
41
|
+
locator: {
|
|
42
|
+
by: "testId";
|
|
43
|
+
value: string;
|
|
44
|
+
} | {
|
|
45
|
+
by: "role";
|
|
46
|
+
role: string;
|
|
47
|
+
name?: string | undefined;
|
|
48
|
+
};
|
|
49
|
+
type: "assertNotVisible";
|
|
50
|
+
}>;
|
|
51
|
+
};
|
|
52
|
+
attribute(locator: AnyLocator, attribute: string, expected: string): UnlabeledStep<{
|
|
53
|
+
attribute: string;
|
|
54
|
+
expected: {
|
|
55
|
+
type: "static";
|
|
56
|
+
value: string;
|
|
57
|
+
};
|
|
58
|
+
locator: {
|
|
59
|
+
by: "testId";
|
|
60
|
+
value: string;
|
|
61
|
+
} | {
|
|
62
|
+
by: "role";
|
|
63
|
+
role: string;
|
|
64
|
+
name?: string | undefined;
|
|
65
|
+
};
|
|
66
|
+
operator: "equals";
|
|
67
|
+
type: "assertAttribute";
|
|
68
|
+
}>;
|
|
69
|
+
checked(locator: CheckLocator): UnlabeledStep<{
|
|
70
|
+
locator: {
|
|
71
|
+
by: "testId";
|
|
72
|
+
value: string;
|
|
73
|
+
} | {
|
|
74
|
+
by: "role";
|
|
75
|
+
role: string;
|
|
76
|
+
name?: string | undefined;
|
|
77
|
+
};
|
|
78
|
+
type: "assertChecked";
|
|
79
|
+
}>;
|
|
80
|
+
count(locator: AnyLocator, expected: number): UnlabeledStep<{
|
|
81
|
+
expected: {
|
|
82
|
+
type: "static";
|
|
83
|
+
value: number;
|
|
84
|
+
};
|
|
85
|
+
locator: {
|
|
86
|
+
by: "testId";
|
|
87
|
+
value: string;
|
|
88
|
+
} | {
|
|
89
|
+
by: "role";
|
|
90
|
+
role: string;
|
|
91
|
+
name?: string | undefined;
|
|
92
|
+
};
|
|
93
|
+
operator: "equals";
|
|
94
|
+
type: "assertCount";
|
|
95
|
+
}>;
|
|
96
|
+
disabled(locator: AnyLocator): UnlabeledStep<{
|
|
97
|
+
locator: {
|
|
98
|
+
by: "testId";
|
|
99
|
+
value: string;
|
|
100
|
+
} | {
|
|
101
|
+
by: "role";
|
|
102
|
+
role: string;
|
|
103
|
+
name?: string | undefined;
|
|
104
|
+
};
|
|
105
|
+
type: "assertDisabled";
|
|
106
|
+
}>;
|
|
107
|
+
enabled(locator: AnyLocator): UnlabeledStep<{
|
|
108
|
+
locator: {
|
|
109
|
+
by: "testId";
|
|
110
|
+
value: string;
|
|
111
|
+
} | {
|
|
112
|
+
by: "role";
|
|
113
|
+
role: string;
|
|
114
|
+
name?: string | undefined;
|
|
115
|
+
};
|
|
116
|
+
type: "assertEnabled";
|
|
117
|
+
}>;
|
|
118
|
+
focused(locator: AnyLocator): UnlabeledStep<{
|
|
119
|
+
locator: {
|
|
120
|
+
by: "testId";
|
|
121
|
+
value: string;
|
|
122
|
+
} | {
|
|
123
|
+
by: "role";
|
|
124
|
+
role: string;
|
|
125
|
+
name?: string | undefined;
|
|
126
|
+
};
|
|
127
|
+
type: "assertFocused";
|
|
128
|
+
}>;
|
|
129
|
+
text(locator: AnyLocator, expected: string): UnlabeledStep<{
|
|
130
|
+
expected: {
|
|
131
|
+
type: "static";
|
|
132
|
+
value: string;
|
|
133
|
+
};
|
|
134
|
+
locator: {
|
|
135
|
+
by: "testId";
|
|
136
|
+
value: string;
|
|
137
|
+
} | {
|
|
138
|
+
by: "role";
|
|
139
|
+
role: string;
|
|
140
|
+
name?: string | undefined;
|
|
141
|
+
};
|
|
142
|
+
operator: "equals";
|
|
143
|
+
type: "assertText";
|
|
144
|
+
}>;
|
|
145
|
+
url(expected: string): UnlabeledStep<{
|
|
146
|
+
expected: {
|
|
147
|
+
type: "static";
|
|
148
|
+
value: string;
|
|
149
|
+
};
|
|
150
|
+
operator: "contains";
|
|
151
|
+
type: "assertUrl";
|
|
152
|
+
}>;
|
|
153
|
+
value(locator: AnyLocator, expected: string): UnlabeledStep<{
|
|
154
|
+
expected: {
|
|
155
|
+
type: "static";
|
|
156
|
+
value: string;
|
|
157
|
+
};
|
|
158
|
+
locator: {
|
|
159
|
+
by: "testId";
|
|
160
|
+
value: string;
|
|
161
|
+
} | {
|
|
162
|
+
by: "role";
|
|
163
|
+
role: string;
|
|
164
|
+
name?: string | undefined;
|
|
165
|
+
};
|
|
166
|
+
operator: "equals";
|
|
167
|
+
type: "assertValue";
|
|
168
|
+
}>;
|
|
169
|
+
visible(locator: AnyLocator): UnlabeledStep<{
|
|
170
|
+
locator: {
|
|
171
|
+
by: "testId";
|
|
172
|
+
value: string;
|
|
173
|
+
} | {
|
|
174
|
+
by: "role";
|
|
175
|
+
role: string;
|
|
176
|
+
name?: string | undefined;
|
|
177
|
+
};
|
|
178
|
+
type: "assertVisible";
|
|
179
|
+
}>;
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
export { assert };
|
package/dist/assert.js
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import {
|
|
2
|
+
toSpecLocator
|
|
3
|
+
} from "./chunk-2VUWFRR5.js";
|
|
4
|
+
import {
|
|
5
|
+
createStep
|
|
6
|
+
} from "./chunk-MGATMMCZ.js";
|
|
7
|
+
import "./chunk-DCJBLS2U.js";
|
|
8
|
+
|
|
9
|
+
// src/steps/assert.ts
|
|
10
|
+
var assert = {
|
|
11
|
+
not: {
|
|
12
|
+
checked(locator) {
|
|
13
|
+
return createStep({ locator: toSpecLocator(locator), type: "assertNotChecked" });
|
|
14
|
+
},
|
|
15
|
+
enabled(locator) {
|
|
16
|
+
return createStep({ locator: toSpecLocator(locator), type: "assertDisabled" });
|
|
17
|
+
},
|
|
18
|
+
focused(locator) {
|
|
19
|
+
return createStep({ locator: toSpecLocator(locator), type: "assertNotFocused" });
|
|
20
|
+
},
|
|
21
|
+
visible(locator) {
|
|
22
|
+
return createStep({ locator: toSpecLocator(locator), type: "assertNotVisible" });
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
attribute(locator, attribute, expected) {
|
|
26
|
+
return createStep({
|
|
27
|
+
attribute,
|
|
28
|
+
expected: { type: "static", value: expected },
|
|
29
|
+
locator: toSpecLocator(locator),
|
|
30
|
+
operator: "equals",
|
|
31
|
+
type: "assertAttribute"
|
|
32
|
+
});
|
|
33
|
+
},
|
|
34
|
+
checked(locator) {
|
|
35
|
+
return createStep({ locator: toSpecLocator(locator), type: "assertChecked" });
|
|
36
|
+
},
|
|
37
|
+
count(locator, expected) {
|
|
38
|
+
return createStep({
|
|
39
|
+
expected: { type: "static", value: expected },
|
|
40
|
+
locator: toSpecLocator(locator),
|
|
41
|
+
operator: "equals",
|
|
42
|
+
type: "assertCount"
|
|
43
|
+
});
|
|
44
|
+
},
|
|
45
|
+
disabled(locator) {
|
|
46
|
+
return createStep({ locator: toSpecLocator(locator), type: "assertDisabled" });
|
|
47
|
+
},
|
|
48
|
+
enabled(locator) {
|
|
49
|
+
return createStep({ locator: toSpecLocator(locator), type: "assertEnabled" });
|
|
50
|
+
},
|
|
51
|
+
focused(locator) {
|
|
52
|
+
return createStep({ locator: toSpecLocator(locator), type: "assertFocused" });
|
|
53
|
+
},
|
|
54
|
+
text(locator, expected) {
|
|
55
|
+
return createStep({
|
|
56
|
+
expected: { type: "static", value: expected },
|
|
57
|
+
locator: toSpecLocator(locator),
|
|
58
|
+
operator: "equals",
|
|
59
|
+
type: "assertText"
|
|
60
|
+
});
|
|
61
|
+
},
|
|
62
|
+
url(expected) {
|
|
63
|
+
return createStep({
|
|
64
|
+
expected: { type: "static", value: expected },
|
|
65
|
+
operator: "contains",
|
|
66
|
+
type: "assertUrl"
|
|
67
|
+
});
|
|
68
|
+
},
|
|
69
|
+
value(locator, expected) {
|
|
70
|
+
return createStep({
|
|
71
|
+
expected: { type: "static", value: expected },
|
|
72
|
+
locator: toSpecLocator(locator),
|
|
73
|
+
operator: "equals",
|
|
74
|
+
type: "assertValue"
|
|
75
|
+
});
|
|
76
|
+
},
|
|
77
|
+
visible(locator) {
|
|
78
|
+
return createStep({ locator: toSpecLocator(locator), type: "assertVisible" });
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
export {
|
|
82
|
+
assert
|
|
83
|
+
};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { S as Step } from './step-DLfkKI3V.js';
|
|
3
|
+
|
|
4
|
+
declare const dslConfigSchema: z.ZodObject<{
|
|
5
|
+
appUrl: z.ZodString;
|
|
6
|
+
preconditionsUrl: z.ZodString;
|
|
7
|
+
projectId: z.ZodString;
|
|
8
|
+
webhookSecret: z.ZodString;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
type DslConfig = z.infer<typeof dslConfigSchema>;
|
|
11
|
+
interface CookieOptions {
|
|
12
|
+
readonly domain: string | undefined;
|
|
13
|
+
readonly expires: number | undefined;
|
|
14
|
+
readonly httpOnly: boolean | undefined;
|
|
15
|
+
readonly path: string | undefined;
|
|
16
|
+
readonly sameSite: "lax" | "none" | "strict" | undefined;
|
|
17
|
+
readonly secure: boolean | undefined;
|
|
18
|
+
}
|
|
19
|
+
interface CookieEntry {
|
|
20
|
+
readonly name: string;
|
|
21
|
+
readonly options: CookieOptions | undefined;
|
|
22
|
+
readonly value: string;
|
|
23
|
+
}
|
|
24
|
+
declare const TEST_VALUE_BRAND: unique symbol;
|
|
25
|
+
interface TestValue {
|
|
26
|
+
readonly [TEST_VALUE_BRAND]: true;
|
|
27
|
+
}
|
|
28
|
+
interface SetupContext {
|
|
29
|
+
readonly runId: string;
|
|
30
|
+
fixed(value: string): TestValue;
|
|
31
|
+
setCookie(name: string, value: string, options?: CookieOptions): void;
|
|
32
|
+
uniqueEmail(): TestValue;
|
|
33
|
+
uniqueId(prefix: string): TestValue;
|
|
34
|
+
}
|
|
35
|
+
interface TeardownContext<TData extends Record<string, string>> {
|
|
36
|
+
readonly data: TData;
|
|
37
|
+
}
|
|
38
|
+
declare const PRECONDITION_DATA: unique symbol;
|
|
39
|
+
declare const PRECONDITION_DEPS: unique symbol;
|
|
40
|
+
declare const PRECONDITION_NAME: unique symbol;
|
|
41
|
+
interface Precondition<TData extends Record<string, string> = Record<string, string>, TDeps extends Record<string, Record<string, string>> = Record<string, Record<string, string>>> {
|
|
42
|
+
readonly [PRECONDITION_DATA]: TData;
|
|
43
|
+
readonly [PRECONDITION_DEPS]: TDeps;
|
|
44
|
+
readonly [PRECONDITION_NAME]: string;
|
|
45
|
+
}
|
|
46
|
+
type PreconditionData<T extends Precondition> = T[typeof PRECONDITION_DATA];
|
|
47
|
+
type PreconditionDeps<T extends Precondition> = T[typeof PRECONDITION_DEPS];
|
|
48
|
+
interface PreconditionDefinition {
|
|
49
|
+
readonly dependsOn: ReadonlyArray<string>;
|
|
50
|
+
readonly depMapping: ReadonlyArray<readonly [string, string]>;
|
|
51
|
+
readonly description: string;
|
|
52
|
+
readonly implemented: boolean;
|
|
53
|
+
readonly name: string;
|
|
54
|
+
readonly returns: ReadonlyArray<string>;
|
|
55
|
+
readonly teardown: ((ctx: TeardownContext<Record<string, string>>) => Promise<void>) | undefined;
|
|
56
|
+
readonly setup: (ctx: SetupContext, deps: Record<string, Record<string, string>>) => Promise<Record<string, TestValue>>;
|
|
57
|
+
}
|
|
58
|
+
type VarsFn<T> = (vars: Record<string, Record<string, string>>) => T;
|
|
59
|
+
interface TestDefinition {
|
|
60
|
+
readonly description: string;
|
|
61
|
+
readonly expectedOutcome: string;
|
|
62
|
+
readonly id: string;
|
|
63
|
+
readonly implemented: boolean;
|
|
64
|
+
readonly name: string;
|
|
65
|
+
readonly requires: ReadonlyArray<string>;
|
|
66
|
+
readonly requiresKeys: Record<string, string>;
|
|
67
|
+
readonly startsAtFn: VarsFn<string> | undefined;
|
|
68
|
+
readonly stepsFn: VarsFn<ReadonlyArray<Step>> | undefined;
|
|
69
|
+
}
|
|
70
|
+
interface UnimplementedItems {
|
|
71
|
+
readonly preconditions: ReadonlyArray<string>;
|
|
72
|
+
readonly tests: ReadonlyArray<string>;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
type PreconditionRecord = Record<string, Precondition>;
|
|
76
|
+
type ResolveDeps<TDeps extends PreconditionRecord> = {
|
|
77
|
+
readonly [K in keyof TDeps]: PreconditionData<TDeps[K]>;
|
|
78
|
+
};
|
|
79
|
+
type ResolveData<T extends Record<string, TestValue>> = {
|
|
80
|
+
readonly [K in keyof T]: string;
|
|
81
|
+
};
|
|
82
|
+
interface PreconditionNeedsSetup {
|
|
83
|
+
readonly contract: <TData extends Record<string, string>>() => Precondition<TData>;
|
|
84
|
+
readonly description: (text: string) => PreconditionNeedsSetup;
|
|
85
|
+
readonly notImplemented: () => Precondition<Record<string, never>>;
|
|
86
|
+
readonly requires: <TDeps extends PreconditionRecord>(deps: TDeps) => PreconditionNeedsSetupWithDeps<TDeps>;
|
|
87
|
+
readonly setup: <TData extends Record<string, TestValue>>(fn: (ctx: SetupContext) => Promise<TData>) => PreconditionHasSetup<ResolveData<TData>>;
|
|
88
|
+
}
|
|
89
|
+
interface PreconditionNeedsSetupWithDeps<TDeps extends PreconditionRecord> {
|
|
90
|
+
readonly contract: <TData extends Record<string, string>>() => Precondition<TData, ResolveDeps<TDeps>>;
|
|
91
|
+
readonly description: (text: string) => PreconditionNeedsSetupWithDeps<TDeps>;
|
|
92
|
+
readonly notImplemented: () => Precondition<Record<string, never>>;
|
|
93
|
+
readonly requires: <TDeps2 extends PreconditionRecord>(deps: TDeps2) => PreconditionNeedsSetupWithDeps<TDeps2>;
|
|
94
|
+
readonly setup: <TData extends Record<string, TestValue>>(fn: (ctx: SetupContext, deps: ResolveDeps<TDeps>) => Promise<TData>) => PreconditionHasSetup<ResolveData<TData>>;
|
|
95
|
+
}
|
|
96
|
+
interface PreconditionHasSetup<TData extends Record<string, string>> {
|
|
97
|
+
readonly teardown: (fn: (ctx: TeardownContext<TData>) => Promise<void>) => Precondition<TData>;
|
|
98
|
+
}
|
|
99
|
+
interface TestNeedsName {
|
|
100
|
+
readonly name: (displayName: string) => TestNeedsRequires;
|
|
101
|
+
}
|
|
102
|
+
interface TestNeedsRequires {
|
|
103
|
+
readonly description: (text: string) => TestNeedsRequires;
|
|
104
|
+
readonly requires: <TReqs extends PreconditionRecord>(reqs: TReqs) => TestNeedsOutcome<ResolveDeps<TReqs>>;
|
|
105
|
+
}
|
|
106
|
+
interface TestNeedsOutcome<TVars extends Record<string, Record<string, string>>> {
|
|
107
|
+
readonly description: (text: string) => TestNeedsOutcome<TVars>;
|
|
108
|
+
readonly expectedOutcome: (text: string) => TestNeedsStartsAt<TVars>;
|
|
109
|
+
}
|
|
110
|
+
interface TestNeedsStartsAt<TVars extends Record<string, Record<string, string>>> {
|
|
111
|
+
readonly notImplemented: () => void;
|
|
112
|
+
readonly startsAt: (fn: (vars: TVars) => string) => TestNeedsSteps<TVars>;
|
|
113
|
+
}
|
|
114
|
+
interface TestNeedsSteps<TVars extends Record<string, Record<string, string>>> {
|
|
115
|
+
readonly steps: (fn: (vars: TVars) => ReadonlyArray<Step>) => void;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
interface PreconditionImpl<TData extends Record<string, string>, TDeps extends Record<string, Record<string, string>>> {
|
|
119
|
+
readonly setup: (ctx: SetupContext, deps: TDeps) => Promise<Record<string, TestValue>>;
|
|
120
|
+
readonly teardown: (ctx: TeardownContext<TData>) => Promise<void>;
|
|
121
|
+
}
|
|
122
|
+
interface RipploBuilder {
|
|
123
|
+
readonly getConfig: () => DslConfig;
|
|
124
|
+
readonly getPreconditions: () => ReadonlyArray<PreconditionDefinition>;
|
|
125
|
+
readonly getTests: () => ReadonlyArray<TestDefinition>;
|
|
126
|
+
readonly getUnimplemented: () => UnimplementedItems;
|
|
127
|
+
readonly implement: <TData extends Record<string, string>, TDeps extends Record<string, Record<string, string>>>(handle: Precondition<TData, TDeps>, impl: PreconditionImpl<TData, TDeps>) => void;
|
|
128
|
+
readonly precondition: (name: string) => PreconditionNeedsSetup;
|
|
129
|
+
readonly test: (id: string) => TestNeedsName;
|
|
130
|
+
}
|
|
131
|
+
declare function createRipplo(rawConfig: DslConfig): RipploBuilder;
|
|
132
|
+
|
|
133
|
+
export { type CookieEntry as C, type DslConfig as D, type Precondition as P, type RipploBuilder as R, type SetupContext as S, type TeardownContext as T, type CookieOptions as a, type PreconditionDeps as b, type PreconditionImpl as c, type PreconditionRecord as d, type ResolveDeps as e, createRipplo as f };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
readLocator
|
|
3
|
+
} from "./chunk-DCJBLS2U.js";
|
|
4
|
+
|
|
5
|
+
// src/steps/to-spec-locator.ts
|
|
6
|
+
function toSpecLocator(loc) {
|
|
7
|
+
const spec = readLocator(loc);
|
|
8
|
+
switch (spec.by) {
|
|
9
|
+
case "role": {
|
|
10
|
+
return { by: "role", name: spec.name, role: spec.role };
|
|
11
|
+
}
|
|
12
|
+
case "testId": {
|
|
13
|
+
return { by: "testId", value: spec.value };
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export {
|
|
19
|
+
toSpecLocator
|
|
20
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// src/locators.ts
|
|
2
|
+
function readLocator(loc) {
|
|
3
|
+
return loc.spec;
|
|
4
|
+
}
|
|
5
|
+
function makeLocator(spec) {
|
|
6
|
+
return { spec };
|
|
7
|
+
}
|
|
8
|
+
function role(ariaRole, name) {
|
|
9
|
+
return makeLocator({
|
|
10
|
+
by: "role",
|
|
11
|
+
name: name ?? void 0,
|
|
12
|
+
role: ariaRole
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
function testId(id) {
|
|
16
|
+
return makeLocator({
|
|
17
|
+
by: "testId",
|
|
18
|
+
value: id
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export {
|
|
23
|
+
readLocator,
|
|
24
|
+
role,
|
|
25
|
+
testId
|
|
26
|
+
};
|