pomwright 1.4.0 → 1.5.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/AGENTS.md +37 -0
- package/CHANGELOG.md +193 -0
- package/README.md +316 -34
- package/dist/index.d.mts +1049 -30
- package/dist/index.d.ts +1049 -30
- package/dist/index.js +2290 -65
- package/dist/index.mjs +2287 -67
- package/docs/v1-to-v2-migration/bridge-migration-guide.md +159 -0
- package/docs/v1-to-v2-migration/direct-migration-guide.md +238 -0
- package/docs/v1-to-v2-migration/v1-to-v2-comparison.md +547 -0
- package/docs/v2/PageObject.md +293 -0
- package/docs/v2/composing-locator-modules.md +93 -0
- package/docs/v2/locator-registry.md +695 -0
- package/docs/v2/logging.md +168 -0
- package/docs/v2/overview.md +515 -0
- package/docs/v2/session-storage.md +160 -0
- package/index.ts +61 -9
- package/intTestV2/.env +0 -0
- package/intTestV2/fixtures/testApp.fixtures.ts +43 -0
- package/intTestV2/package.json +22 -0
- package/intTestV2/page-object-models/testApp/pages/iframe/iframe.locatorSchema.ts +24 -0
- package/intTestV2/page-object-models/testApp/pages/iframe/iframe.page.ts +17 -0
- package/intTestV2/page-object-models/testApp/pages/testPage.locatorSchema.ts +32 -0
- package/intTestV2/page-object-models/testApp/pages/testPage.page.ts +119 -0
- package/intTestV2/page-object-models/testApp/pages/testPath/[color]/color.locatorSchema.ts +29 -0
- package/intTestV2/page-object-models/testApp/pages/testPath/[color]/color.page.ts +48 -0
- package/intTestV2/page-object-models/testApp/pages/testPath/testPath.locatorSchema.ts +9 -0
- package/intTestV2/page-object-models/testApp/pages/testPath/testPath.page.ts +23 -0
- package/intTestV2/page-object-models/testApp/pages/testfilters/testfilters.locatorSchema.ts +114 -0
- package/intTestV2/page-object-models/testApp/pages/testfilters/testfilters.page.ts +23 -0
- package/intTestV2/page-object-models/testApp/testApp.base.ts +20 -0
- package/intTestV2/playwright.config.ts +54 -0
- package/intTestV2/server.js +216 -0
- package/intTestV2/test-data/staticPage/index.html +280 -0
- package/intTestV2/test-data/staticPage/w3images/avatar2.png +0 -0
- package/intTestV2/test-data/staticPage/w3images/avatar3.png +0 -0
- package/intTestV2/test-data/staticPage/w3images/avatar5.png +0 -0
- package/intTestV2/test-data/staticPage/w3images/avatar6.png +0 -0
- package/intTestV2/test-data/staticPage/w3images/forest.jpg +0 -0
- package/intTestV2/test-data/staticPage/w3images/lights.jpg +0 -0
- package/intTestV2/test-data/staticPage/w3images/mountains.jpg +0 -0
- package/intTestV2/test-data/staticPage/w3images/nature.jpg +0 -0
- package/intTestV2/test-data/staticPage/w3images/snow.jpg +0 -0
- package/intTestV2/tests/locatorRegistry/add/add.describe.spec.ts +54 -0
- package/intTestV2/tests/locatorRegistry/add/add.filter.spec.ts +143 -0
- package/intTestV2/tests/locatorRegistry/add/add.frameLocator.spec.ts +23 -0
- package/intTestV2/tests/locatorRegistry/add/add.get.clone.spec.ts +76 -0
- package/intTestV2/tests/locatorRegistry/add/add.getByAltText.spec.ts +23 -0
- package/intTestV2/tests/locatorRegistry/add/add.getById.spec.ts +45 -0
- package/intTestV2/tests/locatorRegistry/add/add.getByLabel.spec.ts +23 -0
- package/intTestV2/tests/locatorRegistry/add/add.getByPlaceholder.spec.ts +23 -0
- package/intTestV2/tests/locatorRegistry/add/add.getByRole.spec.ts +23 -0
- package/intTestV2/tests/locatorRegistry/add/add.getByTestId.spec.ts +23 -0
- package/intTestV2/tests/locatorRegistry/add/add.getByText.spec.ts +23 -0
- package/intTestV2/tests/locatorRegistry/add/add.getByTitle.spec.ts +23 -0
- package/intTestV2/tests/locatorRegistry/add/add.locator.spec.ts +23 -0
- package/intTestV2/tests/locatorRegistry/add/add.reuseExisting.spec.ts +107 -0
- package/intTestV2/tests/locatorRegistry/add/add.reuseReusable.spec.ts +311 -0
- package/intTestV2/tests/locatorRegistry/add/add.spec.ts +159 -0
- package/intTestV2/tests/locatorRegistry/filter.cycle.spec.ts +39 -0
- package/intTestV2/tests/locatorRegistry/getLocator/getLocator.spec.ts +253 -0
- package/intTestV2/tests/locatorRegistry/getLocatorSchema/getLocatorSchema.clearSteps.spec.ts +105 -0
- package/intTestV2/tests/locatorRegistry/getLocatorSchema/getLocatorSchema.describe.spec.ts +23 -0
- package/intTestV2/tests/locatorRegistry/getLocatorSchema/getLocatorSchema.filter.spec.ts +368 -0
- package/intTestV2/tests/locatorRegistry/getLocatorSchema/getLocatorSchema.getLocator.spec.ts +56 -0
- package/intTestV2/tests/locatorRegistry/getLocatorSchema/getLocatorSchema.getNestedLocator.spec.ts +175 -0
- package/intTestV2/tests/locatorRegistry/getLocatorSchema/getLocatorSchema.nth.spec.ts +60 -0
- package/intTestV2/tests/locatorRegistry/getLocatorSchema/getLocatorSchema.remove.spec.ts +32 -0
- package/intTestV2/tests/locatorRegistry/getLocatorSchema/getLocatorSchema.replace.spec.ts +24 -0
- package/intTestV2/tests/locatorRegistry/getLocatorSchema/getLocatorSchema.spec.ts +110 -0
- package/intTestV2/tests/locatorRegistry/getLocatorSchema/getLocatorSchema.update.spec.ts +322 -0
- package/intTestV2/tests/locatorRegistry/getNestedLocator/getNestedLocator.spec.ts +412 -0
- package/intTestV2/tests/locatorRegistry/registry/registry.binding.spec.ts +50 -0
- package/intTestV2/tests/locatorRegistry/validation/validation.locatorSchemaPath.spec.ts +115 -0
- package/intTestV2/tests/locatorRegistry/validation/validation.locatorSchemaPath.typecheck.ts +86 -0
- package/intTestV2/tests/locatorRegistry/validation/validation.sub-path.spec.ts +45 -0
- package/intTestV2/tests/step/step.spec.ts +49 -0
- package/intTestV2/tests/testApp/color.spec.ts +15 -0
- package/intTestV2/tests/testApp/iframe.spec.ts +57 -0
- package/intTestV2/tests/testApp/testFilters.spec.ts +24 -0
- package/intTestV2/tests/testApp/testPage.spec.ts +161 -0
- package/intTestV2/tests/testApp/testPath.spec.ts +18 -0
- package/pack-build.sh +11 -0
- package/pack-test-v2.sh +36 -0
- package/package.json +10 -3
- package/playwright.base.ts +42 -0
- package/skills/README.md +56 -0
- package/skills/pomwright-v1-5-bridge-migration/SKILL.md +40 -0
- package/skills/pomwright-v1-5-bridge-migration/references/call-site-migration.md +178 -0
- package/skills/pomwright-v1-5-bridge-migration/references/schema-translation.md +183 -0
- package/skills/pomwright-v2-migration/SKILL.md +63 -0
- package/skills/pomwright-v2-migration/references/call-site-migration.md +265 -0
- package/skills/pomwright-v2-migration/references/class-migration.md +266 -0
- package/skills/pomwright-v2-migration/references/fixture-and-helpers.md +423 -0
- package/skills/pomwright-v2-migration/references/locator-registration.md +344 -0
- package/srcV2/fixture/base.fixtures.ts +23 -0
- package/srcV2/helpers/navigation.ts +153 -0
- package/srcV2/helpers/playwrightReportLogger.ts +196 -0
- package/srcV2/helpers/sessionStorage.ts +251 -0
- package/srcV2/helpers/stepDecorator.ts +106 -0
- package/srcV2/locators/index.ts +15 -0
- package/srcV2/locators/locatorQueryBuilder.ts +427 -0
- package/srcV2/locators/locatorRegistrationBuilder.ts +558 -0
- package/srcV2/locators/locatorRegistry.ts +583 -0
- package/srcV2/locators/locatorUpdateBuilder.ts +602 -0
- package/srcV2/locators/reusableLocatorBuilder.ts +200 -0
- package/srcV2/locators/types.ts +256 -0
- package/srcV2/locators/utils.ts +309 -0
- package/srcV2/locators/v1SchemaTranslator.ts +178 -0
- package/srcV2/pageObject.ts +105 -0
- /package/docs/{BaseApi-explanation.md → v1/BaseApi-explanation.md} +0 -0
- /package/docs/{BasePage-explanation.md → v1/BasePage-explanation.md} +0 -0
- /package/docs/{LocatorSchema-explanation.md → v1/LocatorSchema-explanation.md} +0 -0
- /package/docs/{LocatorSchemaPath-explanation.md → v1/LocatorSchemaPath-explanation.md} +0 -0
- /package/docs/{PlaywrightReportLogger-explanation.md → v1/PlaywrightReportLogger-explanation.md} +0 -0
- /package/docs/{get-locator-methods-explanation.md → v1/get-locator-methods-explanation.md} +0 -0
- /package/docs/{intro-to-using-pomwright.md → v1/intro-to-using-pomwright.md} +0 -0
- /package/docs/{sessionStorage-methods-explanation.md → v1/sessionStorage-methods-explanation.md} +0 -0
- /package/docs/{tips-folder-structure.md → v1/tips-folder-structure.md} +0 -0
package/dist/index.js
CHANGED
|
@@ -22,19 +22,18 @@ var index_exports = {};
|
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
BaseApi: () => BaseApi,
|
|
24
24
|
BasePage: () => BasePage,
|
|
25
|
+
BasePageV1toV2: () => BasePageV1toV2,
|
|
25
26
|
GetByMethod: () => GetByMethod,
|
|
26
27
|
GetLocatorBase: () => GetLocatorBase,
|
|
28
|
+
PageObject: () => PageObject,
|
|
27
29
|
PlaywrightReportLogger: () => PlaywrightReportLogger,
|
|
28
|
-
|
|
30
|
+
SessionStorage: () => SessionStorage2,
|
|
31
|
+
createRegistryWithAccessors: () => createRegistryWithAccessors,
|
|
32
|
+
step: () => step,
|
|
33
|
+
test: () => test5
|
|
29
34
|
});
|
|
30
35
|
module.exports = __toCommonJS(index_exports);
|
|
31
36
|
|
|
32
|
-
// src/basePage.ts
|
|
33
|
-
var import_test3 = require("@playwright/test");
|
|
34
|
-
|
|
35
|
-
// src/helpers/getLocatorBase.ts
|
|
36
|
-
var import_test = require("@playwright/test");
|
|
37
|
-
|
|
38
37
|
// src/helpers/locatorSchema.interface.ts
|
|
39
38
|
var GetByMethod = /* @__PURE__ */ ((GetByMethod2) => {
|
|
40
39
|
GetByMethod2["role"] = "role";
|
|
@@ -107,6 +106,414 @@ function getLocatorSchemaDummy() {
|
|
|
107
106
|
return locatorSchemaDummy;
|
|
108
107
|
}
|
|
109
108
|
|
|
109
|
+
// src/helpers/deprecationWarnings.ts
|
|
110
|
+
var warnedDeprecationsByScope = /* @__PURE__ */ new WeakMap();
|
|
111
|
+
var getWarningScope = (logger) => {
|
|
112
|
+
if (!logger) {
|
|
113
|
+
return globalThis;
|
|
114
|
+
}
|
|
115
|
+
const maybeSharedLogEntries = logger.sharedLogEntry;
|
|
116
|
+
if (Array.isArray(maybeSharedLogEntries)) {
|
|
117
|
+
return maybeSharedLogEntries;
|
|
118
|
+
}
|
|
119
|
+
return logger;
|
|
120
|
+
};
|
|
121
|
+
var warnDeprecationOncePerTest = (key, message, logger) => {
|
|
122
|
+
const warningScope = getWarningScope(logger);
|
|
123
|
+
const warnedDeprecations = warnedDeprecationsByScope.get(warningScope) ?? /* @__PURE__ */ new Set();
|
|
124
|
+
if (warnedDeprecations.has(key)) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
warnedDeprecations.add(key);
|
|
128
|
+
warnedDeprecationsByScope.set(warningScope, warnedDeprecations);
|
|
129
|
+
logger?.warn(message);
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
// src/api/baseApi.ts
|
|
133
|
+
var BaseApi = class {
|
|
134
|
+
baseUrl;
|
|
135
|
+
apiName;
|
|
136
|
+
log;
|
|
137
|
+
request;
|
|
138
|
+
constructor(baseUrl, apiName, context, pwrl) {
|
|
139
|
+
this.baseUrl = baseUrl;
|
|
140
|
+
this.apiName = apiName;
|
|
141
|
+
this.log = pwrl.getNewChildLogger(apiName);
|
|
142
|
+
this.request = context;
|
|
143
|
+
const classDeprecationMessage = "[POMWright] BaseApi is depricated and will be removed in 2.0.0 with no replacement. If you need a base API class, you can use the v1 pomwright/src/api/baseApi.ts implementation for reference to implement your own.";
|
|
144
|
+
warnDeprecationOncePerTest(`${this.constructor.name}-class-deprecation`, classDeprecationMessage, this.log);
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
// src/basePage.ts
|
|
149
|
+
var import_test3 = require("@playwright/test");
|
|
150
|
+
|
|
151
|
+
// src/helpers/getLocatorBase.ts
|
|
152
|
+
var import_test = require("@playwright/test");
|
|
153
|
+
|
|
154
|
+
// srcV2/locators/utils.ts
|
|
155
|
+
var formatLocatorSchemaPathForError = (path) => {
|
|
156
|
+
const json = JSON.stringify(path);
|
|
157
|
+
return json.slice(1, -1);
|
|
158
|
+
};
|
|
159
|
+
var RUNTIME_WHITESPACE_REGEX = /[\s\u0085]/u;
|
|
160
|
+
var validateLocatorSchemaPath = (path) => {
|
|
161
|
+
if (!path) {
|
|
162
|
+
throw new Error("LocatorSchemaPath string cannot be empty");
|
|
163
|
+
}
|
|
164
|
+
if (RUNTIME_WHITESPACE_REGEX.test(path)) {
|
|
165
|
+
const escaped = formatLocatorSchemaPathForError(path);
|
|
166
|
+
throw new Error(`LocatorSchemaPath string cannot contain whitespace chars: ${escaped}`);
|
|
167
|
+
}
|
|
168
|
+
if (path.startsWith(".")) {
|
|
169
|
+
throw new Error(`LocatorSchemaPath string cannot start with a dot: ${path}`);
|
|
170
|
+
}
|
|
171
|
+
if (path.endsWith(".")) {
|
|
172
|
+
throw new Error(`LocatorSchemaPath string cannot end with a dot: ${path}`);
|
|
173
|
+
}
|
|
174
|
+
if (path.includes("..")) {
|
|
175
|
+
throw new Error(`LocatorSchemaPath string cannot contain consecutive dots: ${path}`);
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
var expandSchemaPath = (path) => {
|
|
179
|
+
validateLocatorSchemaPath(path);
|
|
180
|
+
const parts = path.split(".");
|
|
181
|
+
return parts.map((_part, index) => parts.slice(0, index + 1).join("."));
|
|
182
|
+
};
|
|
183
|
+
var cssEscape = (value) => {
|
|
184
|
+
return value.replace(/([\\"'#.:;,?*+<>{}[\\]()])/g, "\\$1");
|
|
185
|
+
};
|
|
186
|
+
var normalizeSteps = (steps) => steps ? steps.map((step2) => ({ ...step2 })) : [];
|
|
187
|
+
function normalizeIdValue(id) {
|
|
188
|
+
if (typeof id !== "string") {
|
|
189
|
+
return id;
|
|
190
|
+
}
|
|
191
|
+
if (id.startsWith("#")) {
|
|
192
|
+
return id.slice(1);
|
|
193
|
+
}
|
|
194
|
+
if (id.startsWith("id=")) {
|
|
195
|
+
return id.slice("id=".length);
|
|
196
|
+
}
|
|
197
|
+
return id;
|
|
198
|
+
}
|
|
199
|
+
var stringifyForLog = (value) => {
|
|
200
|
+
const seen = /* @__PURE__ */ new WeakSet();
|
|
201
|
+
return JSON.stringify(
|
|
202
|
+
value,
|
|
203
|
+
(_key, current) => {
|
|
204
|
+
if (typeof current === "object" && current !== null) {
|
|
205
|
+
if (seen.has(current)) {
|
|
206
|
+
return "[Circular]";
|
|
207
|
+
}
|
|
208
|
+
seen.add(current);
|
|
209
|
+
}
|
|
210
|
+
if (current instanceof RegExp) {
|
|
211
|
+
return { type: "RegExp", source: current.source, flags: current.flags };
|
|
212
|
+
}
|
|
213
|
+
return current;
|
|
214
|
+
},
|
|
215
|
+
2
|
|
216
|
+
);
|
|
217
|
+
};
|
|
218
|
+
var applyIndexSelector = (locator, selector) => {
|
|
219
|
+
if (selector === void 0 || selector === null) {
|
|
220
|
+
return locator;
|
|
221
|
+
}
|
|
222
|
+
if (selector === "first") {
|
|
223
|
+
return locator.first();
|
|
224
|
+
}
|
|
225
|
+
if (selector === "last") {
|
|
226
|
+
return locator.last();
|
|
227
|
+
}
|
|
228
|
+
return locator.nth(selector);
|
|
229
|
+
};
|
|
230
|
+
var createLocator = (target, definition) => {
|
|
231
|
+
switch (definition.type) {
|
|
232
|
+
case "role":
|
|
233
|
+
return target.getByRole(definition.role, definition.options);
|
|
234
|
+
case "text":
|
|
235
|
+
return target.getByText(definition.text, definition.options);
|
|
236
|
+
case "label":
|
|
237
|
+
return target.getByLabel(definition.text, definition.options);
|
|
238
|
+
case "placeholder":
|
|
239
|
+
return target.getByPlaceholder(definition.text, definition.options);
|
|
240
|
+
case "altText":
|
|
241
|
+
return target.getByAltText(definition.text, definition.options);
|
|
242
|
+
case "title":
|
|
243
|
+
return target.getByTitle(definition.text, definition.options);
|
|
244
|
+
case "locator":
|
|
245
|
+
return target.locator(definition.selector, definition.options);
|
|
246
|
+
case "frameLocator":
|
|
247
|
+
return target.frameLocator(definition.selector);
|
|
248
|
+
case "testId":
|
|
249
|
+
return target.getByTestId(definition.testId);
|
|
250
|
+
case "id": {
|
|
251
|
+
if (typeof definition.id === "string") {
|
|
252
|
+
const normalized = normalizeIdValue(definition.id);
|
|
253
|
+
return target.locator(`#${cssEscape(normalized ?? "")}`);
|
|
254
|
+
}
|
|
255
|
+
const pattern = definition.id.source;
|
|
256
|
+
const safePattern = cssEscape(pattern);
|
|
257
|
+
return target.locator(`[id*="${safePattern}"]`);
|
|
258
|
+
}
|
|
259
|
+
default: {
|
|
260
|
+
const exhaustive = definition;
|
|
261
|
+
return exhaustive;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
var cloneLocatorStrategyDefinition = (definition) => {
|
|
266
|
+
switch (definition.type) {
|
|
267
|
+
case "role":
|
|
268
|
+
return {
|
|
269
|
+
type: "role",
|
|
270
|
+
role: definition.role,
|
|
271
|
+
...definition.options ? { options: { ...definition.options } } : {}
|
|
272
|
+
};
|
|
273
|
+
case "text":
|
|
274
|
+
return {
|
|
275
|
+
type: "text",
|
|
276
|
+
text: definition.text,
|
|
277
|
+
...definition.options ? { options: { ...definition.options } } : {}
|
|
278
|
+
};
|
|
279
|
+
case "label":
|
|
280
|
+
return {
|
|
281
|
+
type: "label",
|
|
282
|
+
text: definition.text,
|
|
283
|
+
...definition.options ? { options: { ...definition.options } } : {}
|
|
284
|
+
};
|
|
285
|
+
case "placeholder":
|
|
286
|
+
return {
|
|
287
|
+
type: "placeholder",
|
|
288
|
+
text: definition.text,
|
|
289
|
+
...definition.options ? { options: { ...definition.options } } : {}
|
|
290
|
+
};
|
|
291
|
+
case "altText":
|
|
292
|
+
return {
|
|
293
|
+
type: "altText",
|
|
294
|
+
text: definition.text,
|
|
295
|
+
...definition.options ? { options: { ...definition.options } } : {}
|
|
296
|
+
};
|
|
297
|
+
case "title":
|
|
298
|
+
return {
|
|
299
|
+
type: "title",
|
|
300
|
+
text: definition.text,
|
|
301
|
+
...definition.options ? { options: { ...definition.options } } : {}
|
|
302
|
+
};
|
|
303
|
+
case "locator":
|
|
304
|
+
return {
|
|
305
|
+
type: "locator",
|
|
306
|
+
selector: definition.selector,
|
|
307
|
+
...definition.options ? { options: { ...definition.options } } : {}
|
|
308
|
+
};
|
|
309
|
+
case "frameLocator":
|
|
310
|
+
return { type: "frameLocator", selector: definition.selector };
|
|
311
|
+
case "testId":
|
|
312
|
+
return { type: "testId", testId: definition.testId };
|
|
313
|
+
case "id":
|
|
314
|
+
return { type: "id", id: definition.id };
|
|
315
|
+
default: {
|
|
316
|
+
const exhaustive = definition;
|
|
317
|
+
return exhaustive;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
};
|
|
321
|
+
var applyDefinitionPatch = (seed, patch) => {
|
|
322
|
+
const base2 = cloneLocatorStrategyDefinition(seed);
|
|
323
|
+
switch (patch.type) {
|
|
324
|
+
case "locator": {
|
|
325
|
+
const selector = patch.selector !== void 0 ? patch.selector : base2.selector;
|
|
326
|
+
const options = patch.options || base2.options ? { ...base2.options, ...patch.options } : void 0;
|
|
327
|
+
return { type: "locator", selector, ...options ? { options } : {} };
|
|
328
|
+
}
|
|
329
|
+
case "role": {
|
|
330
|
+
const role = patch.role ?? base2.role;
|
|
331
|
+
const options = patch.options || base2.options ? { ...base2.options, ...patch.options } : void 0;
|
|
332
|
+
return { type: "role", role, ...options ? { options } : {} };
|
|
333
|
+
}
|
|
334
|
+
case "text": {
|
|
335
|
+
const text = patch.text ?? base2.text;
|
|
336
|
+
const options = patch.options || base2.options ? { ...base2.options, ...patch.options } : void 0;
|
|
337
|
+
return { type: "text", text, ...options ? { options } : {} };
|
|
338
|
+
}
|
|
339
|
+
case "label": {
|
|
340
|
+
const text = patch.text ?? base2.text;
|
|
341
|
+
const options = patch.options || base2.options ? { ...base2.options, ...patch.options } : void 0;
|
|
342
|
+
return { type: "label", text, ...options ? { options } : {} };
|
|
343
|
+
}
|
|
344
|
+
case "placeholder": {
|
|
345
|
+
const text = patch.text ?? base2.text;
|
|
346
|
+
const options = patch.options || base2.options ? { ...base2.options, ...patch.options } : void 0;
|
|
347
|
+
return { type: "placeholder", text, ...options ? { options } : {} };
|
|
348
|
+
}
|
|
349
|
+
case "altText": {
|
|
350
|
+
const text = patch.text ?? base2.text;
|
|
351
|
+
const options = patch.options || base2.options ? { ...base2.options, ...patch.options } : void 0;
|
|
352
|
+
return { type: "altText", text, ...options ? { options } : {} };
|
|
353
|
+
}
|
|
354
|
+
case "title": {
|
|
355
|
+
const text = patch.text ?? base2.text;
|
|
356
|
+
const options = patch.options || base2.options ? { ...base2.options, ...patch.options } : void 0;
|
|
357
|
+
return { type: "title", text, ...options ? { options } : {} };
|
|
358
|
+
}
|
|
359
|
+
case "frameLocator": {
|
|
360
|
+
const selector = patch.selector !== void 0 ? patch.selector : base2.selector;
|
|
361
|
+
return { type: "frameLocator", selector };
|
|
362
|
+
}
|
|
363
|
+
case "testId": {
|
|
364
|
+
const testId = patch.testId !== void 0 ? patch.testId : base2.testId;
|
|
365
|
+
return { type: "testId", testId };
|
|
366
|
+
}
|
|
367
|
+
case "id": {
|
|
368
|
+
const id = patch.id !== void 0 ? normalizeIdValue(patch.id) ?? base2.id : base2.id;
|
|
369
|
+
return { type: "id", id };
|
|
370
|
+
}
|
|
371
|
+
default: {
|
|
372
|
+
const exhaustive = patch;
|
|
373
|
+
return exhaustive;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
};
|
|
377
|
+
var isFrameLocatorDefinition = (definition) => definition.type === "frameLocator";
|
|
378
|
+
var isLocatorInstance = (value) => {
|
|
379
|
+
return !!value && typeof value === "object" && typeof value.filter === "function";
|
|
380
|
+
};
|
|
381
|
+
|
|
382
|
+
// srcV2/locators/v1SchemaTranslator.ts
|
|
383
|
+
var getRegistryLookup = (registry) => registry;
|
|
384
|
+
var logMissingDefinition = (path, field) => {
|
|
385
|
+
console.warn(
|
|
386
|
+
`[POMWright] Skipping v2 translation for "${path}" because "${field}" is missing. Rewrite this locator in defineLocators() using the v2 registry.`
|
|
387
|
+
);
|
|
388
|
+
};
|
|
389
|
+
var logLocatorInstanceWarning = (path) => {
|
|
390
|
+
console.warn(
|
|
391
|
+
`[POMWright] Skipping v2 translation for "${path}" because v1 LocatorSchema.locator is a Locator instance. Rewrite this path in defineLocators() to avoid runtime gaps during migration.`
|
|
392
|
+
);
|
|
393
|
+
};
|
|
394
|
+
var addV1SchemaToV2Registry = (registry, locatorSchema) => {
|
|
395
|
+
const path = locatorSchema.locatorSchemaPath;
|
|
396
|
+
validateLocatorSchemaPath(path);
|
|
397
|
+
const registryWithLookup = getRegistryLookup(registry);
|
|
398
|
+
const existing = registryWithLookup.getIfExists?.(path);
|
|
399
|
+
if (existing) {
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
console.info(
|
|
403
|
+
`[POMWright] LocatorSchemaPath "${path}" is not registered in the v2 registry. Translating and adding v1 schema to v2 Locator Registry; update this path to use registry.add in defineLocators().`
|
|
404
|
+
);
|
|
405
|
+
const registration = registry.add(path);
|
|
406
|
+
if (!registration) {
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
409
|
+
let postDefinition = null;
|
|
410
|
+
switch (locatorSchema.locatorMethod) {
|
|
411
|
+
case "role" /* role */: {
|
|
412
|
+
if (!locatorSchema.role) {
|
|
413
|
+
logMissingDefinition(path, "role");
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
postDefinition = registration.getByRole(locatorSchema.role, locatorSchema.roleOptions);
|
|
417
|
+
break;
|
|
418
|
+
}
|
|
419
|
+
case "text" /* text */: {
|
|
420
|
+
if (!locatorSchema.text) {
|
|
421
|
+
logMissingDefinition(path, "text");
|
|
422
|
+
return;
|
|
423
|
+
}
|
|
424
|
+
postDefinition = registration.getByText(locatorSchema.text, locatorSchema.textOptions);
|
|
425
|
+
break;
|
|
426
|
+
}
|
|
427
|
+
case "label" /* label */: {
|
|
428
|
+
if (!locatorSchema.label) {
|
|
429
|
+
logMissingDefinition(path, "label");
|
|
430
|
+
return;
|
|
431
|
+
}
|
|
432
|
+
postDefinition = registration.getByLabel(locatorSchema.label, locatorSchema.labelOptions);
|
|
433
|
+
break;
|
|
434
|
+
}
|
|
435
|
+
case "placeholder" /* placeholder */: {
|
|
436
|
+
if (!locatorSchema.placeholder) {
|
|
437
|
+
logMissingDefinition(path, "placeholder");
|
|
438
|
+
return;
|
|
439
|
+
}
|
|
440
|
+
postDefinition = registration.getByPlaceholder(locatorSchema.placeholder, locatorSchema.placeholderOptions);
|
|
441
|
+
break;
|
|
442
|
+
}
|
|
443
|
+
case "altText" /* altText */: {
|
|
444
|
+
if (!locatorSchema.altText) {
|
|
445
|
+
logMissingDefinition(path, "altText");
|
|
446
|
+
return;
|
|
447
|
+
}
|
|
448
|
+
postDefinition = registration.getByAltText(locatorSchema.altText, locatorSchema.altTextOptions);
|
|
449
|
+
break;
|
|
450
|
+
}
|
|
451
|
+
case "title" /* title */: {
|
|
452
|
+
if (!locatorSchema.title) {
|
|
453
|
+
logMissingDefinition(path, "title");
|
|
454
|
+
return;
|
|
455
|
+
}
|
|
456
|
+
postDefinition = registration.getByTitle(locatorSchema.title, locatorSchema.titleOptions);
|
|
457
|
+
break;
|
|
458
|
+
}
|
|
459
|
+
case "locator" /* locator */: {
|
|
460
|
+
if (!locatorSchema.locator) {
|
|
461
|
+
logMissingDefinition(path, "locator");
|
|
462
|
+
return;
|
|
463
|
+
}
|
|
464
|
+
if (isLocatorInstance(locatorSchema.locator)) {
|
|
465
|
+
logLocatorInstanceWarning(path);
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
postDefinition = registration.locator(locatorSchema.locator, locatorSchema.locatorOptions);
|
|
469
|
+
break;
|
|
470
|
+
}
|
|
471
|
+
case "frameLocator" /* frameLocator */: {
|
|
472
|
+
if (!locatorSchema.frameLocator) {
|
|
473
|
+
logMissingDefinition(path, "frameLocator");
|
|
474
|
+
return;
|
|
475
|
+
}
|
|
476
|
+
postDefinition = registration.frameLocator(locatorSchema.frameLocator);
|
|
477
|
+
break;
|
|
478
|
+
}
|
|
479
|
+
case "testId" /* testId */: {
|
|
480
|
+
if (!locatorSchema.testId) {
|
|
481
|
+
logMissingDefinition(path, "testId");
|
|
482
|
+
return;
|
|
483
|
+
}
|
|
484
|
+
postDefinition = registration.getByTestId(locatorSchema.testId);
|
|
485
|
+
break;
|
|
486
|
+
}
|
|
487
|
+
case "dataCy" /* dataCy */: {
|
|
488
|
+
if (!locatorSchema.dataCy) {
|
|
489
|
+
logMissingDefinition(path, "dataCy");
|
|
490
|
+
return;
|
|
491
|
+
}
|
|
492
|
+
postDefinition = registration.locator(`[data-cy="${locatorSchema.dataCy}"]`);
|
|
493
|
+
break;
|
|
494
|
+
}
|
|
495
|
+
case "id" /* id */: {
|
|
496
|
+
if (!locatorSchema.id) {
|
|
497
|
+
logMissingDefinition(path, "id");
|
|
498
|
+
return;
|
|
499
|
+
}
|
|
500
|
+
postDefinition = registration.getById(locatorSchema.id);
|
|
501
|
+
break;
|
|
502
|
+
}
|
|
503
|
+
default: {
|
|
504
|
+
const exhaustive = locatorSchema.locatorMethod;
|
|
505
|
+
return exhaustive;
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
if (!postDefinition) {
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
511
|
+
if (locatorSchema.filter && locatorSchema.locatorMethod !== "frameLocator" /* frameLocator */) {
|
|
512
|
+
const filter = locatorSchema.filter;
|
|
513
|
+
postDefinition.filter(filter);
|
|
514
|
+
}
|
|
515
|
+
};
|
|
516
|
+
|
|
110
517
|
// src/helpers/getBy.locator.ts
|
|
111
518
|
var GetBy = class {
|
|
112
519
|
constructor(page, pwrl) {
|
|
@@ -407,6 +814,10 @@ Attempted to Add Schema: ${JSON.stringify(newLocatorSchema, null, 2)}`
|
|
|
407
814
|
);
|
|
408
815
|
}
|
|
409
816
|
this.locatorSchemas.set(locatorSchemaPath, () => newLocatorSchema);
|
|
817
|
+
const v2Registry = this.pageObjectClass.locatorRegistry;
|
|
818
|
+
if (v2Registry) {
|
|
819
|
+
addV1SchemaToV2Registry(v2Registry, newLocatorSchema);
|
|
820
|
+
}
|
|
410
821
|
}
|
|
411
822
|
/**
|
|
412
823
|
* safeGetLocatorSchema:
|
|
@@ -913,6 +1324,8 @@ var BasePage = class {
|
|
|
913
1324
|
this.fullUrl = this.constructFullUrl(baseUrl, urlPath);
|
|
914
1325
|
this.pocName = pocName;
|
|
915
1326
|
this.log = pwrl.getNewChildLogger(pocName);
|
|
1327
|
+
const classDeprecationMessage = "[POMWright] BasePage is depricated and will be removed in 2.0.0. Migrate to v2, preferably directly to PageObject or through the transitional bridge BasePageV1toV2 and then to PageObject.";
|
|
1328
|
+
warnDeprecationOncePerTest(`${this.constructor.name}-class-deprecation`, classDeprecationMessage, this.log);
|
|
916
1329
|
this.locators = new GetLocatorBase(
|
|
917
1330
|
this,
|
|
918
1331
|
this.log.getNewChildLogger("GetLocator"),
|
|
@@ -1033,71 +1446,1854 @@ var WithSubPathValidation = class extends GetLocatorBase {
|
|
|
1033
1446
|
}
|
|
1034
1447
|
};
|
|
1035
1448
|
|
|
1036
|
-
// src/
|
|
1449
|
+
// src/basePageV1toV2.ts
|
|
1037
1450
|
var import_test4 = require("@playwright/test");
|
|
1038
1451
|
|
|
1039
|
-
//
|
|
1040
|
-
var
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1452
|
+
// srcV2/locators/locatorUpdateBuilder.ts
|
|
1453
|
+
var parseUpdateArguments = (primaryOrOptions, options, optionsProvided) => {
|
|
1454
|
+
let primary;
|
|
1455
|
+
let parsedOptions;
|
|
1456
|
+
let hasOptions = optionsProvided ?? false;
|
|
1457
|
+
if (options !== void 0) {
|
|
1458
|
+
parsedOptions = options;
|
|
1459
|
+
hasOptions = true;
|
|
1460
|
+
}
|
|
1461
|
+
if (primaryOrOptions !== void 0) {
|
|
1462
|
+
const treatAsOptions = !hasOptions && options === void 0 && typeof primaryOrOptions === "object" && !(primaryOrOptions instanceof RegExp);
|
|
1463
|
+
if (treatAsOptions) {
|
|
1464
|
+
parsedOptions = primaryOrOptions;
|
|
1465
|
+
hasOptions = true;
|
|
1466
|
+
} else {
|
|
1467
|
+
primary = primaryOrOptions;
|
|
1468
|
+
}
|
|
1469
|
+
}
|
|
1470
|
+
return { primary, options: parsedOptions, hasOptions };
|
|
1471
|
+
};
|
|
1472
|
+
var mergeOptions = (currentOptions, updates) => {
|
|
1473
|
+
if (updates && "options" in updates) {
|
|
1474
|
+
const updateOptions = updates.options;
|
|
1475
|
+
if (updateOptions && typeof updateOptions === "object") {
|
|
1476
|
+
return {
|
|
1477
|
+
...typeof currentOptions === "object" && currentOptions !== null ? currentOptions : {},
|
|
1478
|
+
...updateOptions
|
|
1479
|
+
};
|
|
1480
|
+
}
|
|
1481
|
+
return updateOptions;
|
|
1482
|
+
}
|
|
1483
|
+
return currentOptions;
|
|
1484
|
+
};
|
|
1485
|
+
var mergeLocatorDefinition = (current, updates, path, preferredSource, baseline) => {
|
|
1486
|
+
if (!updates || typeof updates !== "object" || !("type" in updates)) {
|
|
1487
|
+
throw new Error(`Locator update for "${path}" requires a "type" property.`);
|
|
1488
|
+
}
|
|
1489
|
+
const source = (targetType) => {
|
|
1490
|
+
if (current.type === targetType) {
|
|
1491
|
+
return current;
|
|
1492
|
+
}
|
|
1493
|
+
if (preferredSource?.type === targetType) {
|
|
1494
|
+
return preferredSource;
|
|
1495
|
+
}
|
|
1496
|
+
if (baseline?.type === targetType) {
|
|
1497
|
+
return baseline;
|
|
1498
|
+
}
|
|
1499
|
+
return void 0;
|
|
1500
|
+
};
|
|
1501
|
+
switch (updates.type) {
|
|
1502
|
+
case "role": {
|
|
1503
|
+
const roleSource = source("role");
|
|
1504
|
+
const role = updates.role ?? roleSource?.role;
|
|
1505
|
+
if (role === void 0) {
|
|
1506
|
+
throw new Error(`Locator update for "${path}" of type "role" requires a "role" value.`);
|
|
1507
|
+
}
|
|
1508
|
+
const options = mergeOptions(roleSource?.options, updates);
|
|
1509
|
+
return options !== void 0 ? { type: "role", role, options } : { type: "role", role };
|
|
1510
|
+
}
|
|
1511
|
+
case "text": {
|
|
1512
|
+
const textSource = source("text");
|
|
1513
|
+
const text = updates.text ?? textSource?.text;
|
|
1514
|
+
if (text === void 0) {
|
|
1515
|
+
throw new Error(`Locator update for "${path}" of type "text" requires a "text" value.`);
|
|
1516
|
+
}
|
|
1517
|
+
const options = mergeOptions(textSource?.options, updates);
|
|
1518
|
+
return options !== void 0 ? { type: "text", text, options } : { type: "text", text };
|
|
1519
|
+
}
|
|
1520
|
+
case "label": {
|
|
1521
|
+
const textSource = source("label");
|
|
1522
|
+
const text = updates.text ?? textSource?.text;
|
|
1523
|
+
if (text === void 0) {
|
|
1524
|
+
throw new Error(`Locator update for "${path}" of type "label" requires a "text" value.`);
|
|
1525
|
+
}
|
|
1526
|
+
const options = mergeOptions(textSource?.options, updates);
|
|
1527
|
+
return options !== void 0 ? { type: "label", text, options } : { type: "label", text };
|
|
1528
|
+
}
|
|
1529
|
+
case "placeholder": {
|
|
1530
|
+
const textSource = source("placeholder");
|
|
1531
|
+
const text = updates.text ?? textSource?.text;
|
|
1532
|
+
if (text === void 0) {
|
|
1533
|
+
throw new Error(`Locator update for "${path}" of type "placeholder" requires a "text" value.`);
|
|
1534
|
+
}
|
|
1535
|
+
const options = mergeOptions(textSource?.options, updates);
|
|
1536
|
+
return options !== void 0 ? { type: "placeholder", text, options } : { type: "placeholder", text };
|
|
1537
|
+
}
|
|
1538
|
+
case "altText": {
|
|
1539
|
+
const textSource = source("altText");
|
|
1540
|
+
const text = updates.text ?? textSource?.text;
|
|
1541
|
+
if (text === void 0) {
|
|
1542
|
+
throw new Error(`Locator update for "${path}" of type "altText" requires a "text" value.`);
|
|
1543
|
+
}
|
|
1544
|
+
const options = mergeOptions(textSource?.options, updates);
|
|
1545
|
+
return options !== void 0 ? { type: "altText", text, options } : { type: "altText", text };
|
|
1546
|
+
}
|
|
1547
|
+
case "title": {
|
|
1548
|
+
const textSource = source("title");
|
|
1549
|
+
const text = updates.text ?? textSource?.text;
|
|
1550
|
+
if (text === void 0) {
|
|
1551
|
+
throw new Error(`Locator update for "${path}" of type "title" requires a "text" value.`);
|
|
1552
|
+
}
|
|
1553
|
+
const options = mergeOptions(textSource?.options, updates);
|
|
1554
|
+
return options !== void 0 ? { type: "title", text, options } : { type: "title", text };
|
|
1555
|
+
}
|
|
1556
|
+
case "locator": {
|
|
1557
|
+
const selectorSource = source("locator");
|
|
1558
|
+
const selector = updates.selector ?? selectorSource?.selector;
|
|
1559
|
+
if (selector === void 0) {
|
|
1560
|
+
throw new Error(`Locator update for "${path}" of type "locator" requires a "selector" value.`);
|
|
1561
|
+
}
|
|
1562
|
+
const options = mergeOptions(selectorSource?.options, updates);
|
|
1563
|
+
return options !== void 0 ? { type: "locator", selector, options } : { type: "locator", selector };
|
|
1564
|
+
}
|
|
1565
|
+
case "frameLocator": {
|
|
1566
|
+
const selectorSource = source("frameLocator");
|
|
1567
|
+
const selector = updates.selector ?? selectorSource?.selector;
|
|
1568
|
+
if (selector === void 0) {
|
|
1569
|
+
throw new Error(`Locator update for "${path}" of type "frameLocator" requires a "selector" value.`);
|
|
1570
|
+
}
|
|
1571
|
+
return { type: "frameLocator", selector };
|
|
1572
|
+
}
|
|
1573
|
+
case "testId": {
|
|
1574
|
+
const testIdSource = source("testId");
|
|
1575
|
+
const testId = updates.testId ?? testIdSource?.testId;
|
|
1576
|
+
if (testId === void 0) {
|
|
1577
|
+
throw new Error(`Locator update for "${path}" of type "testId" requires a "testId" value.`);
|
|
1578
|
+
}
|
|
1579
|
+
return { type: "testId", testId };
|
|
1580
|
+
}
|
|
1581
|
+
case "id": {
|
|
1582
|
+
const idSource = source("id");
|
|
1583
|
+
const rawId = updates.id ?? idSource?.id;
|
|
1584
|
+
const id = normalizeIdValue(rawId);
|
|
1585
|
+
if (id === void 0) {
|
|
1586
|
+
throw new Error(`Locator update for "${path}" of type "id" requires an "id" value.`);
|
|
1587
|
+
}
|
|
1588
|
+
return { type: "id", id };
|
|
1589
|
+
}
|
|
1590
|
+
default: {
|
|
1591
|
+
const exhaustive = updates;
|
|
1592
|
+
return exhaustive;
|
|
1593
|
+
}
|
|
1594
|
+
}
|
|
1595
|
+
};
|
|
1596
|
+
var buildReplacementDefinition = (updates, path) => {
|
|
1597
|
+
if (!updates || typeof updates !== "object" || !("type" in updates)) {
|
|
1598
|
+
throw new Error(`Locator replace for "${path}" requires a "type" property.`);
|
|
1599
|
+
}
|
|
1600
|
+
switch (updates.type) {
|
|
1601
|
+
case "role": {
|
|
1602
|
+
const { role, options } = updates;
|
|
1603
|
+
if (role === void 0) {
|
|
1604
|
+
throw new Error(`Locator replace for "${path}" of type "role" requires a "role" value.`);
|
|
1605
|
+
}
|
|
1606
|
+
return options !== void 0 ? { type: "role", role, options } : { type: "role", role };
|
|
1607
|
+
}
|
|
1608
|
+
case "text": {
|
|
1609
|
+
const { text, options } = updates;
|
|
1610
|
+
if (text === void 0) {
|
|
1611
|
+
throw new Error(`Locator replace for "${path}" of type "text" requires a "text" value.`);
|
|
1612
|
+
}
|
|
1613
|
+
return options !== void 0 ? { type: "text", text, options } : { type: "text", text };
|
|
1614
|
+
}
|
|
1615
|
+
case "label": {
|
|
1616
|
+
const { text, options } = updates;
|
|
1617
|
+
if (text === void 0) {
|
|
1618
|
+
throw new Error(`Locator replace for "${path}" of type "label" requires a "text" value.`);
|
|
1619
|
+
}
|
|
1620
|
+
return options !== void 0 ? { type: "label", text, options } : { type: "label", text };
|
|
1621
|
+
}
|
|
1622
|
+
case "placeholder": {
|
|
1623
|
+
const { text, options } = updates;
|
|
1624
|
+
if (text === void 0) {
|
|
1625
|
+
throw new Error(`Locator replace for "${path}" of type "placeholder" requires a "text" value.`);
|
|
1626
|
+
}
|
|
1627
|
+
return options !== void 0 ? { type: "placeholder", text, options } : { type: "placeholder", text };
|
|
1628
|
+
}
|
|
1629
|
+
case "altText": {
|
|
1630
|
+
const { text, options } = updates;
|
|
1631
|
+
if (text === void 0) {
|
|
1632
|
+
throw new Error(`Locator replace for "${path}" of type "altText" requires a "text" value.`);
|
|
1633
|
+
}
|
|
1634
|
+
return options !== void 0 ? { type: "altText", text, options } : { type: "altText", text };
|
|
1635
|
+
}
|
|
1636
|
+
case "title": {
|
|
1637
|
+
const { text, options } = updates;
|
|
1638
|
+
if (text === void 0) {
|
|
1639
|
+
throw new Error(`Locator replace for "${path}" of type "title" requires a "text" value.`);
|
|
1640
|
+
}
|
|
1641
|
+
return options !== void 0 ? { type: "title", text, options } : { type: "title", text };
|
|
1642
|
+
}
|
|
1643
|
+
case "locator": {
|
|
1644
|
+
const { selector, options } = updates;
|
|
1645
|
+
if (selector === void 0) {
|
|
1646
|
+
throw new Error(`Locator replace for "${path}" of type "locator" requires a "selector" value.`);
|
|
1647
|
+
}
|
|
1648
|
+
return options !== void 0 ? { type: "locator", selector, options } : { type: "locator", selector };
|
|
1649
|
+
}
|
|
1650
|
+
case "frameLocator": {
|
|
1651
|
+
const { selector } = updates;
|
|
1652
|
+
if (selector === void 0) {
|
|
1653
|
+
throw new Error(`Locator replace for "${path}" of type "frameLocator" requires a "selector" value.`);
|
|
1654
|
+
}
|
|
1655
|
+
return { type: "frameLocator", selector };
|
|
1656
|
+
}
|
|
1657
|
+
case "testId": {
|
|
1658
|
+
const { testId } = updates;
|
|
1659
|
+
if (testId === void 0) {
|
|
1660
|
+
throw new Error(`Locator replace for "${path}" of type "testId" requires a "testId" value.`);
|
|
1661
|
+
}
|
|
1662
|
+
return { type: "testId", testId };
|
|
1663
|
+
}
|
|
1664
|
+
case "id": {
|
|
1665
|
+
const rawId = updates.id;
|
|
1666
|
+
const id = normalizeIdValue(rawId);
|
|
1667
|
+
if (id === void 0) {
|
|
1668
|
+
throw new Error(`Locator replace for "${path}" of type "id" requires an "id" value.`);
|
|
1669
|
+
}
|
|
1670
|
+
return { type: "id", id };
|
|
1671
|
+
}
|
|
1672
|
+
default: {
|
|
1673
|
+
const exhaustive = updates;
|
|
1674
|
+
return exhaustive;
|
|
1675
|
+
}
|
|
1676
|
+
}
|
|
1677
|
+
};
|
|
1678
|
+
var LocatorUpdateBuilder = class {
|
|
1679
|
+
constructor(parent, subPath, mode = "update") {
|
|
1680
|
+
this.parent = parent;
|
|
1681
|
+
this.subPath = subPath;
|
|
1682
|
+
this.mode = mode;
|
|
1046
1683
|
}
|
|
1047
|
-
contextName;
|
|
1048
|
-
logLevels = ["debug", "info", "warn", "error"];
|
|
1049
1684
|
/**
|
|
1050
|
-
*
|
|
1685
|
+
* Defines or patches a `getByRole` locator strategy for the target subpath. In `update` mode the
|
|
1686
|
+
* `role` and `options` arguments are optional (PATCH semantics); in `replace` mode they follow
|
|
1687
|
+
* Playwright requirements (POST semantics) and `role` is required.
|
|
1051
1688
|
*
|
|
1052
|
-
*
|
|
1053
|
-
*
|
|
1689
|
+
* @example
|
|
1690
|
+
* ```ts
|
|
1691
|
+
* getLocatorSchema("form.button")
|
|
1692
|
+
* .update("form.button")
|
|
1693
|
+
* .getByRole({ name: "Save" })
|
|
1694
|
+
* .getNestedLocator();
|
|
1695
|
+
* ```
|
|
1054
1696
|
*/
|
|
1055
|
-
|
|
1056
|
-
|
|
1697
|
+
getByRole(...args) {
|
|
1698
|
+
const [roleOrOptions, options] = args;
|
|
1699
|
+
const {
|
|
1700
|
+
primary: role,
|
|
1701
|
+
options: parsedOptions,
|
|
1702
|
+
hasOptions
|
|
1703
|
+
} = parseUpdateArguments(
|
|
1704
|
+
roleOrOptions,
|
|
1705
|
+
options,
|
|
1706
|
+
args.length >= 2
|
|
1707
|
+
);
|
|
1708
|
+
const definition = {
|
|
1709
|
+
type: "role",
|
|
1710
|
+
...role !== void 0 ? { role } : {},
|
|
1711
|
+
...hasOptions ? { options: parsedOptions } : {}
|
|
1712
|
+
};
|
|
1713
|
+
return this.commit(definition);
|
|
1057
1714
|
}
|
|
1058
1715
|
/**
|
|
1059
|
-
*
|
|
1716
|
+
* Defines or patches a `getByText` locator strategy for the target subpath. In `update` mode,
|
|
1717
|
+
* text/options are optional; in `replace` mode text is required.
|
|
1718
|
+
*
|
|
1719
|
+
* @example
|
|
1720
|
+
* ```ts
|
|
1721
|
+
* getLocatorSchema("banner.message")
|
|
1722
|
+
* .replace("banner.message")
|
|
1723
|
+
* .getByText(/Updated/, { exact: false })
|
|
1724
|
+
* .getNestedLocator();
|
|
1725
|
+
* ```
|
|
1060
1726
|
*/
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
const
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1727
|
+
getByText(...args) {
|
|
1728
|
+
const [textOrOptions, options] = args;
|
|
1729
|
+
const {
|
|
1730
|
+
primary: text,
|
|
1731
|
+
options: parsedOptions,
|
|
1732
|
+
hasOptions
|
|
1733
|
+
} = parseUpdateArguments(
|
|
1734
|
+
textOrOptions,
|
|
1735
|
+
options,
|
|
1736
|
+
args.length >= 2
|
|
1737
|
+
);
|
|
1738
|
+
const definition = {
|
|
1739
|
+
type: "text",
|
|
1740
|
+
...text !== void 0 ? { text } : {},
|
|
1741
|
+
...hasOptions ? { options: parsedOptions } : {}
|
|
1742
|
+
};
|
|
1743
|
+
return this.commit(definition);
|
|
1075
1744
|
}
|
|
1076
1745
|
/**
|
|
1077
|
-
*
|
|
1746
|
+
* Defines or patches a `getByLabel` locator strategy for the target subpath. In `update` mode the
|
|
1747
|
+
* label text/options are optional; in `replace` mode text is required.
|
|
1748
|
+
*
|
|
1749
|
+
* @example
|
|
1750
|
+
* ```ts
|
|
1751
|
+
* getLocatorSchema("form.email").update("form.email").getByLabel({ exact: true }).getNestedLocator();
|
|
1752
|
+
* ```
|
|
1078
1753
|
*/
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1754
|
+
getByLabel(...args) {
|
|
1755
|
+
const [textOrOptions, options] = args;
|
|
1756
|
+
const {
|
|
1757
|
+
primary: text,
|
|
1758
|
+
options: parsedOptions,
|
|
1759
|
+
hasOptions
|
|
1760
|
+
} = parseUpdateArguments(
|
|
1761
|
+
textOrOptions,
|
|
1762
|
+
options,
|
|
1763
|
+
args.length >= 2
|
|
1764
|
+
);
|
|
1765
|
+
const definition = {
|
|
1766
|
+
type: "label",
|
|
1767
|
+
...text !== void 0 ? { text } : {},
|
|
1768
|
+
...hasOptions ? { options: parsedOptions } : {}
|
|
1769
|
+
};
|
|
1770
|
+
return this.commit(definition);
|
|
1082
1771
|
}
|
|
1083
1772
|
/**
|
|
1084
|
-
*
|
|
1773
|
+
* Defines or patches a `getByPlaceholder` locator strategy for the target subpath. In `update`
|
|
1774
|
+
* mode text/options are optional; in `replace` mode text is required.
|
|
1775
|
+
*
|
|
1776
|
+
* @example
|
|
1777
|
+
* ```ts
|
|
1778
|
+
* getLocatorSchema("form.search").update("form.search").getByPlaceholder({ exact: true }).getNestedLocator();
|
|
1779
|
+
* ```
|
|
1085
1780
|
*/
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1781
|
+
getByPlaceholder(...args) {
|
|
1782
|
+
const [textOrOptions, options] = args;
|
|
1783
|
+
const {
|
|
1784
|
+
primary: text,
|
|
1785
|
+
options: parsedOptions,
|
|
1786
|
+
hasOptions
|
|
1787
|
+
} = parseUpdateArguments(
|
|
1788
|
+
textOrOptions,
|
|
1789
|
+
options,
|
|
1790
|
+
args.length >= 2
|
|
1791
|
+
);
|
|
1792
|
+
const definition = {
|
|
1793
|
+
type: "placeholder",
|
|
1794
|
+
...text !== void 0 ? { text } : {},
|
|
1795
|
+
...hasOptions ? { options: parsedOptions } : {}
|
|
1796
|
+
};
|
|
1797
|
+
return this.commit(definition);
|
|
1089
1798
|
}
|
|
1090
1799
|
/**
|
|
1091
|
-
*
|
|
1800
|
+
* Defines or patches a `getByAltText` locator strategy for the target subpath. In `update` mode
|
|
1801
|
+
* text/options are optional; in `replace` mode text is required.
|
|
1802
|
+
*
|
|
1803
|
+
* @example
|
|
1804
|
+
* ```ts
|
|
1805
|
+
* getLocatorSchema("image.logo").replace("image.logo").getByAltText("Logo").getNestedLocator();
|
|
1806
|
+
* ```
|
|
1092
1807
|
*/
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1808
|
+
getByAltText(...args) {
|
|
1809
|
+
const [textOrOptions, options] = args;
|
|
1810
|
+
const {
|
|
1811
|
+
primary: text,
|
|
1812
|
+
options: parsedOptions,
|
|
1813
|
+
hasOptions
|
|
1814
|
+
} = parseUpdateArguments(
|
|
1815
|
+
textOrOptions,
|
|
1816
|
+
options,
|
|
1817
|
+
args.length >= 2
|
|
1818
|
+
);
|
|
1819
|
+
const definition = {
|
|
1820
|
+
type: "altText",
|
|
1821
|
+
...text !== void 0 ? { text } : {},
|
|
1822
|
+
...hasOptions ? { options: parsedOptions } : {}
|
|
1823
|
+
};
|
|
1824
|
+
return this.commit(definition);
|
|
1096
1825
|
}
|
|
1097
1826
|
/**
|
|
1098
|
-
*
|
|
1827
|
+
* Defines or patches a `getByTitle` locator strategy for the target subpath. In `update` mode
|
|
1828
|
+
* text/options are optional; in `replace` mode text is required.
|
|
1829
|
+
*
|
|
1830
|
+
* @example
|
|
1831
|
+
* ```ts
|
|
1832
|
+
* getLocatorSchema("icon.info").update("icon.info").getByTitle({ exact: true }).getNestedLocator();
|
|
1833
|
+
* ```
|
|
1099
1834
|
*/
|
|
1100
|
-
|
|
1835
|
+
getByTitle(...args) {
|
|
1836
|
+
const [textOrOptions, options] = args;
|
|
1837
|
+
const {
|
|
1838
|
+
primary: text,
|
|
1839
|
+
options: parsedOptions,
|
|
1840
|
+
hasOptions
|
|
1841
|
+
} = parseUpdateArguments(
|
|
1842
|
+
textOrOptions,
|
|
1843
|
+
options,
|
|
1844
|
+
args.length >= 2
|
|
1845
|
+
);
|
|
1846
|
+
const definition = {
|
|
1847
|
+
type: "title",
|
|
1848
|
+
...text !== void 0 ? { text } : {},
|
|
1849
|
+
...hasOptions ? { options: parsedOptions } : {}
|
|
1850
|
+
};
|
|
1851
|
+
return this.commit(definition);
|
|
1852
|
+
}
|
|
1853
|
+
/**
|
|
1854
|
+
* Defines or patches a `locator` strategy for the target subpath. In `update` mode selector and
|
|
1855
|
+
* options are optional and merge with the existing definition; in `replace` mode selector is
|
|
1856
|
+
* required.
|
|
1857
|
+
*
|
|
1858
|
+
* @example
|
|
1859
|
+
* ```ts
|
|
1860
|
+
* getLocatorSchema("list.items")
|
|
1861
|
+
* .replace("list.items")
|
|
1862
|
+
* .locator("ul > li", { hasText: /Row/ })
|
|
1863
|
+
* .getNestedLocator();
|
|
1864
|
+
* ```
|
|
1865
|
+
*/
|
|
1866
|
+
locator(...args) {
|
|
1867
|
+
const [selectorOrOptions, options] = args;
|
|
1868
|
+
const {
|
|
1869
|
+
primary: selector,
|
|
1870
|
+
options: parsedOptions,
|
|
1871
|
+
hasOptions
|
|
1872
|
+
} = parseUpdateArguments(
|
|
1873
|
+
selectorOrOptions,
|
|
1874
|
+
options,
|
|
1875
|
+
args.length >= 2
|
|
1876
|
+
);
|
|
1877
|
+
const definition = {
|
|
1878
|
+
type: "locator",
|
|
1879
|
+
...selector !== void 0 ? { selector } : {},
|
|
1880
|
+
...hasOptions ? { options: parsedOptions } : {}
|
|
1881
|
+
};
|
|
1882
|
+
return this.commit(definition);
|
|
1883
|
+
}
|
|
1884
|
+
/**
|
|
1885
|
+
* Defines or patches a `frameLocator` strategy for the target subpath. In `update` mode the
|
|
1886
|
+
* selector is optional and, when omitted, inherits the existing selector; in `replace` mode the
|
|
1887
|
+
* selector is required.
|
|
1888
|
+
*
|
|
1889
|
+
* @example
|
|
1890
|
+
* ```ts
|
|
1891
|
+
* getLocatorSchema("frame.login").replace("frame.login").frameLocator("iframe.auth").getNestedLocator();
|
|
1892
|
+
* ```
|
|
1893
|
+
*/
|
|
1894
|
+
frameLocator(...args) {
|
|
1895
|
+
const [selector] = args;
|
|
1896
|
+
const definition = {
|
|
1897
|
+
type: "frameLocator",
|
|
1898
|
+
...selector !== void 0 ? { selector } : {}
|
|
1899
|
+
};
|
|
1900
|
+
return this.commit(definition);
|
|
1901
|
+
}
|
|
1902
|
+
/**
|
|
1903
|
+
* Defines or patches a `getByTestId` locator strategy for the target subpath. In `update` mode
|
|
1904
|
+
* `testId` is optional and merges with existing options; in `replace` mode it is required.
|
|
1905
|
+
*
|
|
1906
|
+
* @example
|
|
1907
|
+
* ```ts
|
|
1908
|
+
* getLocatorSchema("card.title").update("card.title").getByTestId().getNestedLocator();
|
|
1909
|
+
* ```
|
|
1910
|
+
*/
|
|
1911
|
+
getByTestId(...args) {
|
|
1912
|
+
const [testId] = args;
|
|
1913
|
+
const definition = {
|
|
1914
|
+
type: "testId",
|
|
1915
|
+
...testId !== void 0 ? { testId } : {}
|
|
1916
|
+
};
|
|
1917
|
+
return this.commit(definition);
|
|
1918
|
+
}
|
|
1919
|
+
/**
|
|
1920
|
+
* Defines or patches an `id` locator strategy for the target subpath. In `update` mode the id is
|
|
1921
|
+
* optional and will be normalized if provided; in `replace` mode the id is required.
|
|
1922
|
+
*
|
|
1923
|
+
* @example
|
|
1924
|
+
* ```ts
|
|
1925
|
+
* getLocatorSchema("modal.close").update("modal.close").getById().getNestedLocator();
|
|
1926
|
+
* ```
|
|
1927
|
+
*/
|
|
1928
|
+
getById(...args) {
|
|
1929
|
+
const [idValue] = args;
|
|
1930
|
+
const id = idValue !== void 0 ? normalizeIdValue(idValue) : void 0;
|
|
1931
|
+
const definition = {
|
|
1932
|
+
type: "id",
|
|
1933
|
+
...id !== void 0 ? { id } : {}
|
|
1934
|
+
};
|
|
1935
|
+
return this.commit(definition);
|
|
1936
|
+
}
|
|
1937
|
+
commit(definition) {
|
|
1938
|
+
return this.mode === "replace" ? this.parent.applyReplacement(this.subPath, definition) : this.parent.applyUpdate(this.subPath, definition);
|
|
1939
|
+
}
|
|
1940
|
+
};
|
|
1941
|
+
|
|
1942
|
+
// srcV2/locators/locatorQueryBuilder.ts
|
|
1943
|
+
var LocatorQueryBuilder = class {
|
|
1944
|
+
constructor(registry, path) {
|
|
1945
|
+
this.registry = registry;
|
|
1946
|
+
this.path = path;
|
|
1947
|
+
const chain = expandSchemaPath(path);
|
|
1948
|
+
let hasTerminal = false;
|
|
1949
|
+
for (const part of chain) {
|
|
1950
|
+
const record = this.registry.getIfExists(part);
|
|
1951
|
+
if (!record) {
|
|
1952
|
+
continue;
|
|
1953
|
+
}
|
|
1954
|
+
const clonedDefinition = cloneLocatorStrategyDefinition(record.definition);
|
|
1955
|
+
this.definitions.set(part, clonedDefinition);
|
|
1956
|
+
this.ensureTypeCache(part, clonedDefinition);
|
|
1957
|
+
const recordSteps = normalizeSteps(
|
|
1958
|
+
record.steps
|
|
1959
|
+
);
|
|
1960
|
+
this.steps.set(part, recordSteps);
|
|
1961
|
+
if (record.description !== void 0) {
|
|
1962
|
+
this.descriptions.set(part, record.description);
|
|
1963
|
+
}
|
|
1964
|
+
if (part === path) {
|
|
1965
|
+
hasTerminal = true;
|
|
1966
|
+
}
|
|
1967
|
+
}
|
|
1968
|
+
if (!hasTerminal) {
|
|
1969
|
+
throw new Error(`No locator schema registered for path "${path}".`);
|
|
1970
|
+
}
|
|
1971
|
+
}
|
|
1972
|
+
definitions = /* @__PURE__ */ new Map();
|
|
1973
|
+
perPathTypeCache = /* @__PURE__ */ new Map();
|
|
1974
|
+
steps = /* @__PURE__ */ new Map();
|
|
1975
|
+
descriptions = /* @__PURE__ */ new Map();
|
|
1976
|
+
tombstones = /* @__PURE__ */ new Set();
|
|
1977
|
+
update(subPath) {
|
|
1978
|
+
const resolvedSubPath = subPath ?? this.path;
|
|
1979
|
+
this.ensureSubPath(resolvedSubPath);
|
|
1980
|
+
return new LocatorUpdateBuilder(
|
|
1981
|
+
this,
|
|
1982
|
+
resolvedSubPath
|
|
1983
|
+
);
|
|
1984
|
+
}
|
|
1985
|
+
filter(...args) {
|
|
1986
|
+
const hasExplicitSubPath = args.length === 2;
|
|
1987
|
+
const [subPathOrFilter, maybeFilter] = args;
|
|
1988
|
+
const resolvedSubPath = hasExplicitSubPath ? subPathOrFilter : this.path;
|
|
1989
|
+
const filter = hasExplicitSubPath ? maybeFilter : subPathOrFilter;
|
|
1990
|
+
this.ensureSubPath(resolvedSubPath);
|
|
1991
|
+
const existing = this.steps.get(resolvedSubPath) ?? [];
|
|
1992
|
+
existing.push({ kind: "filter", filter });
|
|
1993
|
+
this.steps.set(resolvedSubPath, existing);
|
|
1994
|
+
return this;
|
|
1995
|
+
}
|
|
1996
|
+
clearSteps(subPath) {
|
|
1997
|
+
const resolvedSubPath = subPath ?? this.path;
|
|
1998
|
+
this.ensureSubPath(resolvedSubPath);
|
|
1999
|
+
this.steps.set(resolvedSubPath, []);
|
|
2000
|
+
return this;
|
|
2001
|
+
}
|
|
2002
|
+
nth(...args) {
|
|
2003
|
+
const hasExplicitSubPath = args.length === 2;
|
|
2004
|
+
const [subPathOrIndex, maybeIndex] = args;
|
|
2005
|
+
const resolvedSubPath = hasExplicitSubPath ? subPathOrIndex : this.path;
|
|
2006
|
+
const index = hasExplicitSubPath ? maybeIndex : subPathOrIndex;
|
|
2007
|
+
this.ensureSubPath(resolvedSubPath);
|
|
2008
|
+
const existing = this.steps.get(resolvedSubPath) ?? [];
|
|
2009
|
+
existing.push({ kind: "index", index });
|
|
2010
|
+
this.steps.set(resolvedSubPath, existing);
|
|
2011
|
+
return this;
|
|
2012
|
+
}
|
|
2013
|
+
/**
|
|
2014
|
+
* Adds or overrides the description for the terminal path of this builder. The description is
|
|
2015
|
+
* applied only to the resolved terminal locator and does not mutate registry state.
|
|
2016
|
+
*
|
|
2017
|
+
* @example
|
|
2018
|
+
* ```ts
|
|
2019
|
+
* getLocatorSchema("section.button")
|
|
2020
|
+
* .describe("Save button")
|
|
2021
|
+
* .getNestedLocator();
|
|
2022
|
+
* ```
|
|
2023
|
+
*/
|
|
2024
|
+
describe(description) {
|
|
2025
|
+
this.ensureSubPath(this.path);
|
|
2026
|
+
this.descriptions.set(this.path, description);
|
|
2027
|
+
return this;
|
|
2028
|
+
}
|
|
2029
|
+
/** @internal */
|
|
2030
|
+
applyUpdate(subPath, updates) {
|
|
2031
|
+
this.ensureSubPath(subPath);
|
|
2032
|
+
if (!this.definitions.has(subPath) && this.tombstones.has(subPath)) {
|
|
2033
|
+
const baseline2 = this.registry.get(subPath).definition;
|
|
2034
|
+
const baselineClone = cloneLocatorStrategyDefinition(baseline2);
|
|
2035
|
+
this.definitions.set(subPath, baselineClone);
|
|
2036
|
+
this.steps.set(subPath, []);
|
|
2037
|
+
this.tombstones.delete(subPath);
|
|
2038
|
+
}
|
|
2039
|
+
const current = this.definitions.get(subPath);
|
|
2040
|
+
if (!current) {
|
|
2041
|
+
throw new Error(`No locator schema registered for sub-path "${subPath}".`);
|
|
2042
|
+
}
|
|
2043
|
+
const baseline = this.registry.get(subPath).definition;
|
|
2044
|
+
const cacheForPath = this.ensureTypeCache(subPath, cloneLocatorStrategyDefinition(baseline));
|
|
2045
|
+
const cachedDefinition = cacheForPath.get(updates.type);
|
|
2046
|
+
const merged = mergeLocatorDefinition(current, updates, subPath, cachedDefinition, baseline);
|
|
2047
|
+
const mergedClone = cloneLocatorStrategyDefinition(merged);
|
|
2048
|
+
cacheForPath.set(mergedClone.type, mergedClone);
|
|
2049
|
+
this.definitions.set(subPath, mergedClone);
|
|
2050
|
+
return this;
|
|
2051
|
+
}
|
|
2052
|
+
replace(subPath) {
|
|
2053
|
+
const resolvedSubPath = subPath ?? this.path;
|
|
2054
|
+
this.ensureSubPath(resolvedSubPath);
|
|
2055
|
+
return new LocatorUpdateBuilder(
|
|
2056
|
+
this,
|
|
2057
|
+
resolvedSubPath,
|
|
2058
|
+
"replace"
|
|
2059
|
+
);
|
|
2060
|
+
}
|
|
2061
|
+
/** @internal */
|
|
2062
|
+
applyReplacement(subPath, updates) {
|
|
2063
|
+
this.ensureSubPath(subPath);
|
|
2064
|
+
if (this.tombstones.has(subPath) && !this.definitions.has(subPath)) {
|
|
2065
|
+
this.steps.set(subPath, []);
|
|
2066
|
+
this.tombstones.delete(subPath);
|
|
2067
|
+
}
|
|
2068
|
+
const nextDefinition = buildReplacementDefinition(updates, subPath);
|
|
2069
|
+
const cloned = cloneLocatorStrategyDefinition(nextDefinition);
|
|
2070
|
+
const cacheForPath = this.ensureTypeCache(subPath, cloned);
|
|
2071
|
+
cacheForPath.set(cloned.type, cloneLocatorStrategyDefinition(cloned));
|
|
2072
|
+
this.definitions.set(subPath, cloned);
|
|
2073
|
+
return this;
|
|
2074
|
+
}
|
|
2075
|
+
remove(subPath) {
|
|
2076
|
+
const resolvedSubPath = subPath ?? this.path;
|
|
2077
|
+
this.ensureSubPath(resolvedSubPath);
|
|
2078
|
+
this.definitions.delete(resolvedSubPath);
|
|
2079
|
+
this.steps.delete(resolvedSubPath);
|
|
2080
|
+
this.perPathTypeCache.delete(resolvedSubPath);
|
|
2081
|
+
this.descriptions.delete(resolvedSubPath);
|
|
2082
|
+
this.tombstones.add(resolvedSubPath);
|
|
2083
|
+
return this;
|
|
2084
|
+
}
|
|
2085
|
+
/**
|
|
2086
|
+
* Resolves and returns the Playwright {@link Locator} for the terminal path of this builder,
|
|
2087
|
+
* applying only the terminal definition and its steps. Throws if the terminal path has been
|
|
2088
|
+
* removed or is otherwise missing.
|
|
2089
|
+
*
|
|
2090
|
+
* @example
|
|
2091
|
+
* ```ts
|
|
2092
|
+
* const locator = getLocatorSchema("form.submit").getLocator();
|
|
2093
|
+
* ```
|
|
2094
|
+
*/
|
|
2095
|
+
getLocator() {
|
|
2096
|
+
const definition = this.definitions.get(this.path);
|
|
2097
|
+
if (!definition) {
|
|
2098
|
+
throw new Error(`No locator schema registered for path "${this.path}".`);
|
|
2099
|
+
}
|
|
2100
|
+
const stepsForPath = this.steps.get(this.path) ?? [];
|
|
2101
|
+
const definitions = /* @__PURE__ */ new Map([[this.path, definition]]);
|
|
2102
|
+
const steps = /* @__PURE__ */ new Map([
|
|
2103
|
+
[
|
|
2104
|
+
this.path,
|
|
2105
|
+
normalizeSteps(stepsForPath)
|
|
2106
|
+
]
|
|
2107
|
+
]);
|
|
2108
|
+
const { locator } = this.registry.buildLocatorChain(
|
|
2109
|
+
this.path,
|
|
2110
|
+
definitions,
|
|
2111
|
+
steps,
|
|
2112
|
+
this.tombstones,
|
|
2113
|
+
this.descriptions.get(this.path)
|
|
2114
|
+
);
|
|
2115
|
+
if (!locator) {
|
|
2116
|
+
throw new Error(`Unable to resolve direct locator for path "${this.path}".`);
|
|
2117
|
+
}
|
|
2118
|
+
return locator;
|
|
2119
|
+
}
|
|
2120
|
+
/**
|
|
2121
|
+
* Resolves the chained Playwright {@link Locator} for this builder’s root path, traversing each
|
|
2122
|
+
* registered segment and applying recorded steps. Throws if any required segment is missing.
|
|
2123
|
+
*
|
|
2124
|
+
* @example
|
|
2125
|
+
* ```ts
|
|
2126
|
+
* const nested = getLocatorSchema("list.item")
|
|
2127
|
+
* .filter("list", { hasText: "List" })
|
|
2128
|
+
* .getNestedLocator();
|
|
2129
|
+
* ```
|
|
2130
|
+
*/
|
|
2131
|
+
getNestedLocator() {
|
|
2132
|
+
const { locator } = this.resolve();
|
|
2133
|
+
if (!locator) {
|
|
2134
|
+
throw new Error(`Unable to resolve nested locator for path "${this.path}".`);
|
|
2135
|
+
}
|
|
2136
|
+
return locator;
|
|
2137
|
+
}
|
|
2138
|
+
ensureSubPath(subPath) {
|
|
2139
|
+
if (!this.definitions.has(subPath) && !this.tombstones.has(subPath)) {
|
|
2140
|
+
throw new Error(`"${subPath}" is not a valid sub-path of "${this.path}".`);
|
|
2141
|
+
}
|
|
2142
|
+
}
|
|
2143
|
+
resolve() {
|
|
2144
|
+
return this.registry.buildLocatorChain(
|
|
2145
|
+
this.path,
|
|
2146
|
+
this.definitions,
|
|
2147
|
+
this.steps,
|
|
2148
|
+
this.tombstones,
|
|
2149
|
+
this.descriptions.get(this.path)
|
|
2150
|
+
);
|
|
2151
|
+
}
|
|
2152
|
+
ensureTypeCache(subPath, baseline) {
|
|
2153
|
+
if (!this.perPathTypeCache.has(subPath)) {
|
|
2154
|
+
this.perPathTypeCache.set(
|
|
2155
|
+
subPath,
|
|
2156
|
+
/* @__PURE__ */ new Map([
|
|
2157
|
+
[baseline.type, cloneLocatorStrategyDefinition(baseline)]
|
|
2158
|
+
])
|
|
2159
|
+
);
|
|
2160
|
+
}
|
|
2161
|
+
return this.perPathTypeCache.get(subPath);
|
|
2162
|
+
}
|
|
2163
|
+
};
|
|
2164
|
+
|
|
2165
|
+
// srcV2/locators/locatorRegistrationBuilder.ts
|
|
2166
|
+
var LocatorRegistrationBuilder = class {
|
|
2167
|
+
constructor(registry, path, seed) {
|
|
2168
|
+
this.registry = registry;
|
|
2169
|
+
this.path = path;
|
|
2170
|
+
if (seed?.initialSteps) {
|
|
2171
|
+
this.steps = normalizeSteps(seed.initialSteps);
|
|
2172
|
+
}
|
|
2173
|
+
if (seed?.initialDefinition) {
|
|
2174
|
+
this.definition = seed.initialDefinition;
|
|
2175
|
+
this.seededDefinition = true;
|
|
2176
|
+
} else {
|
|
2177
|
+
this.seededDefinition = false;
|
|
2178
|
+
}
|
|
2179
|
+
this.reuseType = seed?.reuseType;
|
|
2180
|
+
this.description = seed?.initialDescription;
|
|
2181
|
+
}
|
|
2182
|
+
steps = [];
|
|
2183
|
+
definition;
|
|
2184
|
+
description;
|
|
2185
|
+
registered = false;
|
|
2186
|
+
reuseType;
|
|
2187
|
+
seededDefinition;
|
|
2188
|
+
overrideApplied = false;
|
|
2189
|
+
postDefinitionView;
|
|
2190
|
+
persistSeededDefinition() {
|
|
2191
|
+
if (this.seededDefinition && !this.registered) {
|
|
2192
|
+
this.persist();
|
|
2193
|
+
}
|
|
2194
|
+
return this;
|
|
2195
|
+
}
|
|
2196
|
+
/**
|
|
2197
|
+
* Records a Playwright-style filter on the locator being registered. Filters are applied in the
|
|
2198
|
+
* order they are chained and can include `has`/`hasNot` locator references. Requires that a
|
|
2199
|
+
* locator strategy has already been set for this registration.
|
|
2200
|
+
*
|
|
2201
|
+
* @example
|
|
2202
|
+
* ```ts
|
|
2203
|
+
* registry.add("list.item").locator("li").filter({ hasText: /Row/ });
|
|
2204
|
+
* ```
|
|
2205
|
+
*/
|
|
2206
|
+
filter(filter) {
|
|
2207
|
+
this.applyFilter(filter);
|
|
2208
|
+
return this.getPostDefinitionView();
|
|
2209
|
+
}
|
|
2210
|
+
/**
|
|
2211
|
+
* Adds an index selector for the locator being registered. Indices are applied in the order they
|
|
2212
|
+
* are chained and require a locator definition to have been set first.
|
|
2213
|
+
*
|
|
2214
|
+
* @example
|
|
2215
|
+
* ```ts
|
|
2216
|
+
* registry.add("table.rows").locator("tr").nth(0);
|
|
2217
|
+
* ```
|
|
2218
|
+
*/
|
|
2219
|
+
nth(index) {
|
|
2220
|
+
this.applyIndex(index);
|
|
2221
|
+
return this.getPostDefinitionView();
|
|
2222
|
+
}
|
|
2223
|
+
describe(description) {
|
|
2224
|
+
this.description = description;
|
|
2225
|
+
this.persist();
|
|
2226
|
+
return this.getPostDefinitionView();
|
|
2227
|
+
}
|
|
2228
|
+
getByRole(roleOrOptions, options) {
|
|
2229
|
+
const definition = typeof roleOrOptions === "string" ? options !== void 0 ? { type: "role", role: roleOrOptions, options } : { type: "role", role: roleOrOptions } : { type: "role", options: roleOrOptions };
|
|
2230
|
+
return this.commit(definition);
|
|
2231
|
+
}
|
|
2232
|
+
getByText(textOrOptions, options) {
|
|
2233
|
+
const definition = typeof textOrOptions === "string" || textOrOptions instanceof RegExp ? options !== void 0 ? { type: "text", text: textOrOptions, options } : { type: "text", text: textOrOptions } : { type: "text", options: textOrOptions };
|
|
2234
|
+
return this.commit(definition);
|
|
2235
|
+
}
|
|
2236
|
+
getByLabel(textOrOptions, options) {
|
|
2237
|
+
const definition = typeof textOrOptions === "string" || textOrOptions instanceof RegExp ? options !== void 0 ? { type: "label", text: textOrOptions, options } : { type: "label", text: textOrOptions } : { type: "label", options: textOrOptions };
|
|
2238
|
+
return this.commit(definition);
|
|
2239
|
+
}
|
|
2240
|
+
getByPlaceholder(textOrOptions, options) {
|
|
2241
|
+
const definition = typeof textOrOptions === "string" || textOrOptions instanceof RegExp ? options !== void 0 ? { type: "placeholder", text: textOrOptions, options } : { type: "placeholder", text: textOrOptions } : { type: "placeholder", options: textOrOptions };
|
|
2242
|
+
return this.commit(definition);
|
|
2243
|
+
}
|
|
2244
|
+
getByAltText(textOrOptions, options) {
|
|
2245
|
+
const definition = typeof textOrOptions === "string" || textOrOptions instanceof RegExp ? options !== void 0 ? { type: "altText", text: textOrOptions, options } : { type: "altText", text: textOrOptions } : { type: "altText", options: textOrOptions };
|
|
2246
|
+
return this.commit(definition);
|
|
2247
|
+
}
|
|
2248
|
+
getByTitle(textOrOptions, options) {
|
|
2249
|
+
const definition = typeof textOrOptions === "string" || textOrOptions instanceof RegExp ? options !== void 0 ? { type: "title", text: textOrOptions, options } : { type: "title", text: textOrOptions } : { type: "title", options: textOrOptions };
|
|
2250
|
+
return this.commit(definition);
|
|
2251
|
+
}
|
|
2252
|
+
locator(selectorOrOptions, options) {
|
|
2253
|
+
const definition = typeof selectorOrOptions === "string" ? options !== void 0 ? { type: "locator", selector: selectorOrOptions, options } : { type: "locator", selector: selectorOrOptions } : { type: "locator", options: selectorOrOptions };
|
|
2254
|
+
return this.commit(definition);
|
|
2255
|
+
}
|
|
2256
|
+
/**
|
|
2257
|
+
* Uses Playwright `frameLocator` semantics to define the locator strategy, entering the targeted
|
|
2258
|
+
* frame for subsequent chained locators. When seeded, `selector` may be omitted to retain the
|
|
2259
|
+
* existing selector while overriding options elsewhere.
|
|
2260
|
+
*
|
|
2261
|
+
* @example
|
|
2262
|
+
* ```ts
|
|
2263
|
+
* registry.add("frame.login").frameLocator("iframe.auth");
|
|
2264
|
+
* ```
|
|
2265
|
+
*/
|
|
2266
|
+
frameLocator(selector) {
|
|
2267
|
+
const definition = selector ? { type: "frameLocator", selector } : { type: "frameLocator" };
|
|
2268
|
+
return this.commit(definition);
|
|
2269
|
+
}
|
|
2270
|
+
/**
|
|
2271
|
+
* Uses Playwright `getByTestId` semantics to define the locator strategy. When seeded, omitting
|
|
2272
|
+
* the argument inherits the seeded `testId` while allowing options from other overrides.
|
|
2273
|
+
*
|
|
2274
|
+
* @example
|
|
2275
|
+
* ```ts
|
|
2276
|
+
* registry.add("card.title").getByTestId("card-title");
|
|
2277
|
+
* ```
|
|
2278
|
+
*/
|
|
2279
|
+
getByTestId(testId) {
|
|
2280
|
+
const definition = testId ? { type: "testId", testId } : { type: "testId" };
|
|
2281
|
+
return this.commit(definition);
|
|
2282
|
+
}
|
|
2283
|
+
/**
|
|
2284
|
+
* Targets elements by `id`, normalizing string or RegExp input. When seeded, the argument can be
|
|
2285
|
+
* omitted to inherit the seeded id.
|
|
2286
|
+
*
|
|
2287
|
+
* @example
|
|
2288
|
+
* ```ts
|
|
2289
|
+
* registry.add("modal.close").getById("close-modal");
|
|
2290
|
+
* ```
|
|
2291
|
+
*/
|
|
2292
|
+
getById(id) {
|
|
2293
|
+
const definition = id ? { type: "id", id: normalizeIdValue(id) } : { type: "id" };
|
|
2294
|
+
return this.commit(definition);
|
|
2295
|
+
}
|
|
2296
|
+
commit(definition) {
|
|
2297
|
+
this.ensureDefinitionAllowedWithRollback(definition);
|
|
2298
|
+
const mergedDefinition = this.seededDefinition ? applyDefinitionPatch(this.definition, definition) : definition;
|
|
2299
|
+
this.definition = mergedDefinition;
|
|
2300
|
+
if (this.reuseType && this.seededDefinition) {
|
|
2301
|
+
this.overrideApplied = true;
|
|
2302
|
+
}
|
|
2303
|
+
this.persist();
|
|
2304
|
+
return this.getPostDefinitionView();
|
|
2305
|
+
}
|
|
2306
|
+
applyFilter(filter) {
|
|
2307
|
+
this.ensureDefinition();
|
|
2308
|
+
this.steps.push({ kind: "filter", filter });
|
|
2309
|
+
this.persist();
|
|
2310
|
+
}
|
|
2311
|
+
applyIndex(index) {
|
|
2312
|
+
this.ensureDefinition();
|
|
2313
|
+
this.steps.push({ kind: "index", index });
|
|
2314
|
+
this.persist();
|
|
2315
|
+
}
|
|
2316
|
+
ensureDefinitionAllowedWithRollback(definition) {
|
|
2317
|
+
if (this.seededDefinition) {
|
|
2318
|
+
if (definition.type !== this.reuseType) {
|
|
2319
|
+
this.rollbackSeededRegistration();
|
|
2320
|
+
throw new Error(
|
|
2321
|
+
`The locator definition for "${this.path}" must use the "${this.reuseType}" strategy when reusing a locator.`
|
|
2322
|
+
);
|
|
2323
|
+
}
|
|
2324
|
+
if (this.overrideApplied) {
|
|
2325
|
+
throw new Error(
|
|
2326
|
+
`A locator definition for "${this.path}" was already provided from reuse; only one matching override is allowed.`
|
|
2327
|
+
);
|
|
2328
|
+
}
|
|
2329
|
+
return;
|
|
2330
|
+
}
|
|
2331
|
+
if (this.definition) {
|
|
2332
|
+
throw new Error(
|
|
2333
|
+
`A locator definition for "${this.path}" has already been provided; only one locator type can be set for a registration.`
|
|
2334
|
+
);
|
|
2335
|
+
}
|
|
2336
|
+
}
|
|
2337
|
+
ensureDefinition() {
|
|
2338
|
+
if (!this.definition) {
|
|
2339
|
+
throw new Error(`A locator definition must be provided before applying filters or indices for "${this.path}".`);
|
|
2340
|
+
}
|
|
2341
|
+
}
|
|
2342
|
+
persist() {
|
|
2343
|
+
if (!this.definition) {
|
|
2344
|
+
throw new Error(`No locator schema definition provided for path "${this.path}".`);
|
|
2345
|
+
}
|
|
2346
|
+
const record = {
|
|
2347
|
+
locatorSchemaPath: this.path,
|
|
2348
|
+
definition: this.definition,
|
|
2349
|
+
steps: normalizeSteps(this.steps),
|
|
2350
|
+
...this.description !== void 0 ? { description: this.description } : {}
|
|
2351
|
+
};
|
|
2352
|
+
if (this.registered) {
|
|
2353
|
+
this.registry.replace(this.path, record);
|
|
2354
|
+
} else {
|
|
2355
|
+
this.registry.register(this.path, record);
|
|
2356
|
+
this.registered = true;
|
|
2357
|
+
}
|
|
2358
|
+
}
|
|
2359
|
+
rollbackSeededRegistration() {
|
|
2360
|
+
if (this.seededDefinition && this.registered) {
|
|
2361
|
+
this.registry.unregister(this.path);
|
|
2362
|
+
this.registered = false;
|
|
2363
|
+
}
|
|
2364
|
+
}
|
|
2365
|
+
getPostDefinitionView() {
|
|
2366
|
+
if (this.postDefinitionView) {
|
|
2367
|
+
return this.postDefinitionView;
|
|
2368
|
+
}
|
|
2369
|
+
const view = {
|
|
2370
|
+
filter: (filter) => {
|
|
2371
|
+
this.applyFilter(filter);
|
|
2372
|
+
return view;
|
|
2373
|
+
},
|
|
2374
|
+
nth: (index) => {
|
|
2375
|
+
this.applyIndex(index);
|
|
2376
|
+
return view;
|
|
2377
|
+
},
|
|
2378
|
+
describe: (description) => {
|
|
2379
|
+
this.description = description;
|
|
2380
|
+
this.persist();
|
|
2381
|
+
return view;
|
|
2382
|
+
}
|
|
2383
|
+
};
|
|
2384
|
+
this.postDefinitionView = view;
|
|
2385
|
+
return view;
|
|
2386
|
+
}
|
|
2387
|
+
};
|
|
2388
|
+
|
|
2389
|
+
// srcV2/locators/reusableLocatorBuilder.ts
|
|
2390
|
+
var ReusableLocatorBuilder = class {
|
|
2391
|
+
stepsList;
|
|
2392
|
+
definitionValue;
|
|
2393
|
+
descriptionValue;
|
|
2394
|
+
type;
|
|
2395
|
+
constructor(definition, steps = []) {
|
|
2396
|
+
this.definitionValue = definition;
|
|
2397
|
+
this.type = definition.type;
|
|
2398
|
+
this.stepsList = normalizeSteps(steps);
|
|
2399
|
+
}
|
|
2400
|
+
filter(filter) {
|
|
2401
|
+
this.stepsList.push({ kind: "filter", filter });
|
|
2402
|
+
return this;
|
|
2403
|
+
}
|
|
2404
|
+
nth(index) {
|
|
2405
|
+
this.stepsList.push({ kind: "index", index });
|
|
2406
|
+
return this;
|
|
2407
|
+
}
|
|
2408
|
+
describe(description) {
|
|
2409
|
+
this.descriptionValue = description;
|
|
2410
|
+
return this;
|
|
2411
|
+
}
|
|
2412
|
+
get definition() {
|
|
2413
|
+
return this.definitionValue;
|
|
2414
|
+
}
|
|
2415
|
+
get steps() {
|
|
2416
|
+
return normalizeSteps(this.stepsList);
|
|
2417
|
+
}
|
|
2418
|
+
get description() {
|
|
2419
|
+
return this.descriptionValue;
|
|
2420
|
+
}
|
|
2421
|
+
};
|
|
2422
|
+
var ReusableLocatorFactory = class {
|
|
2423
|
+
getByRole(role, options) {
|
|
2424
|
+
const definition = options !== void 0 ? { type: "role", role, options } : { type: "role", role };
|
|
2425
|
+
return this.create(definition);
|
|
2426
|
+
}
|
|
2427
|
+
getByText(text, options) {
|
|
2428
|
+
const definition = options !== void 0 ? { type: "text", text, options } : { type: "text", text };
|
|
2429
|
+
return this.create(definition);
|
|
2430
|
+
}
|
|
2431
|
+
getByLabel(text, options) {
|
|
2432
|
+
const definition = options !== void 0 ? { type: "label", text, options } : { type: "label", text };
|
|
2433
|
+
return this.create(definition);
|
|
2434
|
+
}
|
|
2435
|
+
getByPlaceholder(text, options) {
|
|
2436
|
+
const definition = options !== void 0 ? { type: "placeholder", text, options } : { type: "placeholder", text };
|
|
2437
|
+
return this.create(definition);
|
|
2438
|
+
}
|
|
2439
|
+
getByAltText(text, options) {
|
|
2440
|
+
const definition = options !== void 0 ? { type: "altText", text, options } : { type: "altText", text };
|
|
2441
|
+
return this.create(definition);
|
|
2442
|
+
}
|
|
2443
|
+
getByTitle(text, options) {
|
|
2444
|
+
const definition = options !== void 0 ? { type: "title", text, options } : { type: "title", text };
|
|
2445
|
+
return this.create(definition);
|
|
2446
|
+
}
|
|
2447
|
+
locator(selector, options) {
|
|
2448
|
+
const definition = options !== void 0 ? { type: "locator", selector, options } : { type: "locator", selector };
|
|
2449
|
+
return this.create(definition);
|
|
2450
|
+
}
|
|
2451
|
+
frameLocator(selector) {
|
|
2452
|
+
return this.create({ type: "frameLocator", selector });
|
|
2453
|
+
}
|
|
2454
|
+
getByTestId(testId) {
|
|
2455
|
+
return this.create({ type: "testId", testId });
|
|
2456
|
+
}
|
|
2457
|
+
getById(id) {
|
|
2458
|
+
return this.create({ type: "id", id: normalizeIdValue(id) });
|
|
2459
|
+
}
|
|
2460
|
+
create(definition) {
|
|
2461
|
+
return new ReusableLocatorBuilder(definition);
|
|
2462
|
+
}
|
|
2463
|
+
};
|
|
2464
|
+
|
|
2465
|
+
// srcV2/locators/locatorRegistry.ts
|
|
2466
|
+
var LocatorRegistryInternal = class {
|
|
2467
|
+
constructor(page) {
|
|
2468
|
+
this.page = page;
|
|
2469
|
+
this.createReusable = new ReusableLocatorFactory();
|
|
2470
|
+
}
|
|
2471
|
+
schemas = /* @__PURE__ */ new Map();
|
|
2472
|
+
/**
|
|
2473
|
+
* Factory for reusable locator seeds that capture a locator strategy plus any chained
|
|
2474
|
+
* `filter`/`nth` steps without registering them. Pass the resulting seed to
|
|
2475
|
+
* {@link LocatorRegistryInternal.add} via `{ reuse }` to register a path that inherits the
|
|
2476
|
+
* stored definition and steps.
|
|
2477
|
+
*
|
|
2478
|
+
* @example
|
|
2479
|
+
* ```ts
|
|
2480
|
+
* const seed = registry.createReusable.getByRole("heading", { level: 2 }).filter({ hasText: /Summary/ });
|
|
2481
|
+
* registry.add("hero.title", { reuse: seed }).getByRole({ name: "Summary" });
|
|
2482
|
+
* ```
|
|
2483
|
+
*/
|
|
2484
|
+
createReusable;
|
|
2485
|
+
normalizeRecord(record) {
|
|
2486
|
+
return {
|
|
2487
|
+
locatorSchemaPath: record.locatorSchemaPath,
|
|
2488
|
+
definition: record.definition,
|
|
2489
|
+
steps: normalizeSteps(record.steps),
|
|
2490
|
+
...record.description !== void 0 ? { description: record.description } : {}
|
|
2491
|
+
};
|
|
2492
|
+
}
|
|
2493
|
+
cloneRecordForReuse(record, path) {
|
|
2494
|
+
return {
|
|
2495
|
+
locatorSchemaPath: path,
|
|
2496
|
+
definition: cloneLocatorStrategyDefinition(record.definition),
|
|
2497
|
+
steps: normalizeSteps(record.steps),
|
|
2498
|
+
...record.description !== void 0 ? { description: record.description } : {}
|
|
2499
|
+
};
|
|
2500
|
+
}
|
|
2501
|
+
/**
|
|
2502
|
+
* Registers a locator schema at the provided dot-delimited path.
|
|
2503
|
+
* Accepts exactly one locator strategy (`getByRole`, `locator`, etc.) and any number of
|
|
2504
|
+
* `filter`/`nth` steps chained in call order. When `{ reuse }` is supplied, the seeded
|
|
2505
|
+
* definition is applied first and one matching override is allowed as a PATCH of the seed;
|
|
2506
|
+
* otherwise, calling multiple locator strategies will throw.
|
|
2507
|
+
*
|
|
2508
|
+
* @example
|
|
2509
|
+
* ```ts
|
|
2510
|
+
* registry
|
|
2511
|
+
* .add("list.item")
|
|
2512
|
+
* .getByRole("listitem", { name: /Row/ })
|
|
2513
|
+
* .filter({ hasText: "Row" })
|
|
2514
|
+
* .nth("last");
|
|
2515
|
+
* ```
|
|
2516
|
+
*/
|
|
2517
|
+
add(path, ...args) {
|
|
2518
|
+
const options = args[0];
|
|
2519
|
+
const reuse = options?.reuse;
|
|
2520
|
+
if (reuse === void 0) {
|
|
2521
|
+
return new LocatorRegistrationBuilder(
|
|
2522
|
+
this,
|
|
2523
|
+
path
|
|
2524
|
+
);
|
|
2525
|
+
}
|
|
2526
|
+
if (typeof reuse === "string") {
|
|
2527
|
+
const targetPath = path;
|
|
2528
|
+
if (reuse === targetPath) {
|
|
2529
|
+
throw new Error(`Locator reuse path cannot be the same as registration path: "${targetPath}".`);
|
|
2530
|
+
}
|
|
2531
|
+
const sourceRecord = this.get(reuse);
|
|
2532
|
+
const cloned = this.cloneRecordForReuse(sourceRecord, targetPath);
|
|
2533
|
+
this.register(targetPath, cloned);
|
|
2534
|
+
return void 0;
|
|
2535
|
+
}
|
|
2536
|
+
if (Array.isArray(reuse)) {
|
|
2537
|
+
const [reason] = reuse;
|
|
2538
|
+
throw new Error(`Invalid reuse path configuration for "${path}": ${reason}`);
|
|
2539
|
+
}
|
|
2540
|
+
const reusedRecord = this.cloneRecordForReuse(
|
|
2541
|
+
{
|
|
2542
|
+
locatorSchemaPath: path,
|
|
2543
|
+
definition: reuse.definition,
|
|
2544
|
+
steps: reuse.steps,
|
|
2545
|
+
description: reuse.description
|
|
2546
|
+
},
|
|
2547
|
+
path
|
|
2548
|
+
);
|
|
2549
|
+
return new LocatorRegistrationBuilder(
|
|
2550
|
+
this,
|
|
2551
|
+
path,
|
|
2552
|
+
{
|
|
2553
|
+
initialDefinition: reusedRecord.definition,
|
|
2554
|
+
initialSteps: reusedRecord.steps,
|
|
2555
|
+
reuseType: reusedRecord.definition.type,
|
|
2556
|
+
initialDescription: reusedRecord.description
|
|
2557
|
+
}
|
|
2558
|
+
).persistSeededDefinition();
|
|
2559
|
+
}
|
|
2560
|
+
register(path, record) {
|
|
2561
|
+
validateLocatorSchemaPath(path);
|
|
2562
|
+
if (this.schemas.has(path)) {
|
|
2563
|
+
const existing = this.schemas.get(path);
|
|
2564
|
+
if (!existing) {
|
|
2565
|
+
throw new Error(`A locator schema with the path "${path}" already exists.`);
|
|
2566
|
+
}
|
|
2567
|
+
const errorDetails = stringifyForLog({
|
|
2568
|
+
existing,
|
|
2569
|
+
attempted: record
|
|
2570
|
+
});
|
|
2571
|
+
throw new Error(`A locator schema with the path "${path}" already exists.
|
|
2572
|
+
Existing Schema: ${errorDetails}`);
|
|
2573
|
+
}
|
|
2574
|
+
this.schemas.set(path, this.normalizeRecord(record));
|
|
2575
|
+
}
|
|
2576
|
+
replace(path, record) {
|
|
2577
|
+
validateLocatorSchemaPath(path);
|
|
2578
|
+
if (!this.schemas.has(path)) {
|
|
2579
|
+
throw new Error(`No locator schema registered for path "${path}".`);
|
|
2580
|
+
}
|
|
2581
|
+
this.schemas.set(path, this.normalizeRecord(record));
|
|
2582
|
+
}
|
|
2583
|
+
get(path) {
|
|
2584
|
+
const record = this.schemas.get(path);
|
|
2585
|
+
if (!record) {
|
|
2586
|
+
throw new Error(`No locator schema registered for path "${path}".`);
|
|
2587
|
+
}
|
|
2588
|
+
return {
|
|
2589
|
+
locatorSchemaPath: record.locatorSchemaPath,
|
|
2590
|
+
definition: cloneLocatorStrategyDefinition(record.definition),
|
|
2591
|
+
steps: normalizeSteps(record.steps),
|
|
2592
|
+
...record.description !== void 0 ? { description: record.description } : {}
|
|
2593
|
+
};
|
|
2594
|
+
}
|
|
2595
|
+
unregister(path) {
|
|
2596
|
+
this.schemas.delete(path);
|
|
2597
|
+
}
|
|
2598
|
+
getIfExists(path) {
|
|
2599
|
+
const record = this.schemas.get(path);
|
|
2600
|
+
if (!record) {
|
|
2601
|
+
return void 0;
|
|
2602
|
+
}
|
|
2603
|
+
return {
|
|
2604
|
+
locatorSchemaPath: record.locatorSchemaPath,
|
|
2605
|
+
definition: cloneLocatorStrategyDefinition(record.definition),
|
|
2606
|
+
steps: normalizeSteps(record.steps),
|
|
2607
|
+
...record.description !== void 0 ? { description: record.description } : {}
|
|
2608
|
+
};
|
|
2609
|
+
}
|
|
2610
|
+
resolveFilterLocator(locatorReference, context) {
|
|
2611
|
+
if (isLocatorInstance(locatorReference)) {
|
|
2612
|
+
return locatorReference;
|
|
2613
|
+
}
|
|
2614
|
+
if (typeof locatorReference === "string") {
|
|
2615
|
+
return this.getLocatorWithContext(locatorReference, context);
|
|
2616
|
+
}
|
|
2617
|
+
throw new Error(
|
|
2618
|
+
`Unsupported filter reference while resolving "${context.rootPath}". Filter has/hasNot supports Playwright Locator instances or registry path strings.`
|
|
2619
|
+
);
|
|
2620
|
+
}
|
|
2621
|
+
createResolutionContext(rootPath) {
|
|
2622
|
+
return {
|
|
2623
|
+
rootPath,
|
|
2624
|
+
resolvingPaths: /* @__PURE__ */ new Set()
|
|
2625
|
+
};
|
|
2626
|
+
}
|
|
2627
|
+
getLocatorWithContext(path, context) {
|
|
2628
|
+
if (context.resolvingPaths.has(path)) {
|
|
2629
|
+
throw new Error(`Detected cyclic filter reference while resolving "${context.rootPath}": "${path}".`);
|
|
2630
|
+
}
|
|
2631
|
+
context.resolvingPaths.add(path);
|
|
2632
|
+
try {
|
|
2633
|
+
const record = this.get(path);
|
|
2634
|
+
const definitions = /* @__PURE__ */ new Map([[path, record.definition]]);
|
|
2635
|
+
const steps = /* @__PURE__ */ new Map([[path, normalizeSteps(record.steps)]]);
|
|
2636
|
+
const { locator } = this.buildLocatorChain(path, definitions, steps, void 0, record.description, context);
|
|
2637
|
+
if (!locator) {
|
|
2638
|
+
throw new Error(`Unable to resolve direct locator for path "${path}".`);
|
|
2639
|
+
}
|
|
2640
|
+
return locator;
|
|
2641
|
+
} finally {
|
|
2642
|
+
context.resolvingPaths.delete(path);
|
|
2643
|
+
}
|
|
2644
|
+
}
|
|
2645
|
+
resolveFiltersForTarget(filters, context) {
|
|
2646
|
+
if (!filters || filters.length === 0) {
|
|
2647
|
+
return [];
|
|
2648
|
+
}
|
|
2649
|
+
const resolved = [];
|
|
2650
|
+
for (const filter of filters) {
|
|
2651
|
+
if (filter && typeof filter === "object" && ("has" in filter || "hasNot" in filter)) {
|
|
2652
|
+
const { has, hasNot, ...rest } = filter;
|
|
2653
|
+
const normalizedFilter = {
|
|
2654
|
+
...rest
|
|
2655
|
+
};
|
|
2656
|
+
if (has !== void 0) {
|
|
2657
|
+
normalizedFilter.has = this.resolveFilterLocator(has, context);
|
|
2658
|
+
}
|
|
2659
|
+
if (hasNot !== void 0) {
|
|
2660
|
+
normalizedFilter.hasNot = this.resolveFilterLocator(hasNot, context);
|
|
2661
|
+
}
|
|
2662
|
+
resolved.push(normalizedFilter);
|
|
2663
|
+
continue;
|
|
2664
|
+
}
|
|
2665
|
+
resolved.push(filter);
|
|
2666
|
+
}
|
|
2667
|
+
return resolved;
|
|
2668
|
+
}
|
|
2669
|
+
/**
|
|
2670
|
+
* Returns a mutable query builder clone for the provided path. Use the builder to add or clear
|
|
2671
|
+
* `filter`/`nth` steps, or to `update`/`replace` locator definitions before resolving locators.
|
|
2672
|
+
* Changes affect only the builder clone; the registry’s stored schema remains untouched.
|
|
2673
|
+
*
|
|
2674
|
+
* @example
|
|
2675
|
+
* ```ts
|
|
2676
|
+
* const builder = registry
|
|
2677
|
+
* .getLocatorSchema("section.button")
|
|
2678
|
+
* .filter("section.button", { hasText: /Save/ })
|
|
2679
|
+
* .nth("section", 0);
|
|
2680
|
+
* const locator = builder.getNestedLocator();
|
|
2681
|
+
* ```
|
|
2682
|
+
*/
|
|
2683
|
+
getLocatorSchema(path) {
|
|
2684
|
+
return new LocatorQueryBuilder(
|
|
2685
|
+
this,
|
|
2686
|
+
path
|
|
2687
|
+
);
|
|
2688
|
+
}
|
|
2689
|
+
/**
|
|
2690
|
+
* Resolves the Playwright {@link Locator} for the provided path, applying only the terminal
|
|
2691
|
+
* definition and its recorded steps (no ancestor chaining). Throws if the path is not registered.
|
|
2692
|
+
*
|
|
2693
|
+
* @example
|
|
2694
|
+
* ```ts
|
|
2695
|
+
* const button = registry.getLocator("form.submit");
|
|
2696
|
+
* await button.click();
|
|
2697
|
+
* ```
|
|
2698
|
+
*/
|
|
2699
|
+
getLocator(path) {
|
|
2700
|
+
return this.getLocatorSchema(path).getLocator();
|
|
2701
|
+
}
|
|
2702
|
+
/**
|
|
2703
|
+
* Resolves a chained Playwright {@link Locator} for a nested path, traversing each registered
|
|
2704
|
+
* segment and applying their steps in order. Throws if any segment in the chain is missing.
|
|
2705
|
+
*
|
|
2706
|
+
* @example
|
|
2707
|
+
* ```ts
|
|
2708
|
+
* const nested = registry.getNestedLocator("list.item");
|
|
2709
|
+
* await expect(nested).toBeVisible();
|
|
2710
|
+
* ```
|
|
2711
|
+
*/
|
|
2712
|
+
getNestedLocator(path) {
|
|
2713
|
+
return this.getLocatorSchema(path).getNestedLocator();
|
|
2714
|
+
}
|
|
2715
|
+
buildLocatorChain(path, definitions, steps, tombstones, terminalDescription, context) {
|
|
2716
|
+
const resolutionContext = context ?? this.createResolutionContext(path);
|
|
2717
|
+
const chain = expandSchemaPath(path);
|
|
2718
|
+
const registeredChain = chain.filter((part) => definitions.has(part));
|
|
2719
|
+
if (tombstones?.has(path) || !definitions.has(path)) {
|
|
2720
|
+
throw new Error(`No locator schema registered for path "${path}".`);
|
|
2721
|
+
}
|
|
2722
|
+
let currentTarget = this.page;
|
|
2723
|
+
let lastLocator = null;
|
|
2724
|
+
const debugSteps = [];
|
|
2725
|
+
const lastIndex = registeredChain.length - 1;
|
|
2726
|
+
for (const [index, part] of registeredChain.entries()) {
|
|
2727
|
+
const isTerminalStep = index === lastIndex;
|
|
2728
|
+
const definition = definitions.get(part);
|
|
2729
|
+
if (tombstones?.has(part)) {
|
|
2730
|
+
if (isTerminalStep) {
|
|
2731
|
+
throw new Error(`No locator schema registered for path "${path}".`);
|
|
2732
|
+
}
|
|
2733
|
+
continue;
|
|
2734
|
+
}
|
|
2735
|
+
if (!definition) {
|
|
2736
|
+
throw new Error(`Missing locator definition for "${part}" while resolving "${path}".`);
|
|
2737
|
+
}
|
|
2738
|
+
if (isFrameLocatorDefinition(definition)) {
|
|
2739
|
+
const frameLocator = createLocator(currentTarget, definition);
|
|
2740
|
+
const isTerminalStep2 = index === lastIndex;
|
|
2741
|
+
if (isTerminalStep2) {
|
|
2742
|
+
const ownerLocator = frameLocator.owner();
|
|
2743
|
+
currentTarget = ownerLocator;
|
|
2744
|
+
lastLocator = ownerLocator;
|
|
2745
|
+
} else {
|
|
2746
|
+
currentTarget = frameLocator;
|
|
2747
|
+
lastLocator = frameLocator;
|
|
2748
|
+
}
|
|
2749
|
+
if (isTerminalStep2 && terminalDescription && isLocatorInstance(lastLocator)) {
|
|
2750
|
+
lastLocator = lastLocator.describe(terminalDescription);
|
|
2751
|
+
currentTarget = lastLocator;
|
|
2752
|
+
}
|
|
2753
|
+
debugSteps.push({ path: part, definition, appliedFilters: [], recordedSteps: [] });
|
|
2754
|
+
continue;
|
|
2755
|
+
}
|
|
2756
|
+
const locatorResult = createLocator(currentTarget, definition);
|
|
2757
|
+
const recordedSteps = steps.get(part) ?? [];
|
|
2758
|
+
let resolvedLocator = locatorResult;
|
|
2759
|
+
const appliedFilters = [];
|
|
2760
|
+
let appliedIndex;
|
|
2761
|
+
for (const step2 of recordedSteps) {
|
|
2762
|
+
if (step2.kind === "filter") {
|
|
2763
|
+
const [resolvedFilter] = this.resolveFiltersForTarget([step2.filter], resolutionContext);
|
|
2764
|
+
if (resolvedFilter) {
|
|
2765
|
+
resolvedLocator = resolvedLocator.filter(resolvedFilter);
|
|
2766
|
+
appliedFilters.push(resolvedFilter);
|
|
2767
|
+
}
|
|
2768
|
+
} else {
|
|
2769
|
+
appliedIndex = step2.index ?? null;
|
|
2770
|
+
resolvedLocator = applyIndexSelector(resolvedLocator, appliedIndex ?? void 0);
|
|
2771
|
+
}
|
|
2772
|
+
}
|
|
2773
|
+
if (isTerminalStep && terminalDescription) {
|
|
2774
|
+
resolvedLocator = resolvedLocator.describe(terminalDescription);
|
|
2775
|
+
}
|
|
2776
|
+
currentTarget = resolvedLocator;
|
|
2777
|
+
lastLocator = resolvedLocator;
|
|
2778
|
+
debugSteps.push({
|
|
2779
|
+
path: part,
|
|
2780
|
+
definition,
|
|
2781
|
+
appliedFilters,
|
|
2782
|
+
index: appliedIndex,
|
|
2783
|
+
recordedSteps
|
|
2784
|
+
});
|
|
2785
|
+
}
|
|
2786
|
+
return { locator: lastLocator, steps: debugSteps };
|
|
2787
|
+
}
|
|
2788
|
+
};
|
|
2789
|
+
var createRegistryWithAccessors = (page) => {
|
|
2790
|
+
const registryInstance = new LocatorRegistryInternal(page);
|
|
2791
|
+
const add = registryInstance.add.bind(registryInstance);
|
|
2792
|
+
const getLocator = registryInstance.getLocator.bind(registryInstance);
|
|
2793
|
+
const getNestedLocator = registryInstance.getNestedLocator.bind(registryInstance);
|
|
2794
|
+
const getLocatorSchema = registryInstance.getLocatorSchema.bind(registryInstance);
|
|
2795
|
+
const registry = registryInstance;
|
|
2796
|
+
return { registry, add, getLocator, getNestedLocator, getLocatorSchema };
|
|
2797
|
+
};
|
|
2798
|
+
|
|
2799
|
+
// src/basePageV1toV2.ts
|
|
2800
|
+
var BasePageV1toV2 = class {
|
|
2801
|
+
/** Provides Playwright page methods */
|
|
2802
|
+
page;
|
|
2803
|
+
/** Playwright TestInfo contains information about currently running test, available to any test function */
|
|
2804
|
+
testInfo;
|
|
2805
|
+
/** Selectors can be used to install custom selector engines.*/
|
|
2806
|
+
selector;
|
|
2807
|
+
/** The base URL of the Page Object Class */
|
|
2808
|
+
baseUrl;
|
|
2809
|
+
/** The URL path of the Page Object Class */
|
|
2810
|
+
urlPath;
|
|
2811
|
+
/** The full URL of the Page Object Class */
|
|
2812
|
+
fullUrl;
|
|
2813
|
+
/** The name of the Page Object Class */
|
|
2814
|
+
pocName;
|
|
2815
|
+
/** The Page Object Class' PlaywrightReportLogger instance, prefixed with its name. Log levels: debug, info, warn, and error. */
|
|
2816
|
+
log;
|
|
2817
|
+
/** The SessionStorage class provides methods for setting and getting session storage data in Playwright.*/
|
|
2818
|
+
sessionStorage;
|
|
2819
|
+
/**
|
|
2820
|
+
* locators:
|
|
2821
|
+
* An instance of GetLocatorBase that handles schema management and provides getLocatorSchema calls.
|
|
2822
|
+
* Initially, LocatorSubstring is undefined. Once getLocatorSchema(path) is called,
|
|
2823
|
+
* we get a chainable object typed with LocatorSubstring = P.
|
|
2824
|
+
*/
|
|
2825
|
+
locators;
|
|
2826
|
+
/**
|
|
2827
|
+
* v2 locator registry and accessors, used for migration to the fluent registry DSL.
|
|
2828
|
+
*/
|
|
2829
|
+
locatorRegistry;
|
|
2830
|
+
add;
|
|
2831
|
+
getLocator;
|
|
2832
|
+
getLocatorSchema;
|
|
2833
|
+
getNestedLocator;
|
|
2834
|
+
constructor(page, testInfo, baseUrl, urlPath, pocName, pwrl, locatorSubstring) {
|
|
2835
|
+
this.page = page;
|
|
2836
|
+
this.testInfo = testInfo;
|
|
2837
|
+
this.selector = import_test4.selectors;
|
|
2838
|
+
this.baseUrl = baseUrl;
|
|
2839
|
+
this.urlPath = urlPath;
|
|
2840
|
+
this.fullUrl = this.constructFullUrl(baseUrl, urlPath);
|
|
2841
|
+
this.pocName = pocName;
|
|
2842
|
+
this.log = pwrl.getNewChildLogger(pocName);
|
|
2843
|
+
const classDeprecationMessage = "[POMWright] BasePageV1toV2 is a transitional bridge and will be removed in 2.0.0. Prefer PageObject for new work and migrate existing classes to PageObject.";
|
|
2844
|
+
warnDeprecationOncePerTest(`${this.constructor.name}-class-deprecation`, classDeprecationMessage, this.log);
|
|
2845
|
+
const { registry, add, getLocator, getNestedLocator, getLocatorSchema } = createRegistryWithAccessors(page);
|
|
2846
|
+
this.locatorRegistry = registry;
|
|
2847
|
+
this.add = add;
|
|
2848
|
+
this.getLocator = getLocator;
|
|
2849
|
+
this.getLocatorSchema = getLocatorSchema;
|
|
2850
|
+
this.getNestedLocator = getNestedLocator;
|
|
2851
|
+
this.defineLocators();
|
|
2852
|
+
this.locators = new GetLocatorBase(
|
|
2853
|
+
this,
|
|
2854
|
+
this.log.getNewChildLogger("GetLocator"),
|
|
2855
|
+
locatorSubstring
|
|
2856
|
+
);
|
|
2857
|
+
const initLocatorSchemasDeprecationMessage = "[POMWright] initLocatorSchemas is deprecated and will be removed in 2.0.0. Define locators with the v2 registry DSL in defineLocators instead.";
|
|
2858
|
+
warnDeprecationOncePerTest(
|
|
2859
|
+
`${this.constructor.name}-initLocatorSchemas-deprecation`,
|
|
2860
|
+
initLocatorSchemasDeprecationMessage,
|
|
2861
|
+
this.log
|
|
2862
|
+
);
|
|
2863
|
+
this.initLocatorSchemas();
|
|
2864
|
+
this.sessionStorage = new SessionStorage(this.page, this.pocName);
|
|
2865
|
+
}
|
|
2866
|
+
/**
|
|
2867
|
+
* constructFullUrl:
|
|
2868
|
+
* Combines baseUrl and urlPath, handling both strings and RegExps.
|
|
2869
|
+
* Ensures a flexible approach to URL matching (string or regex-based).
|
|
2870
|
+
*/
|
|
2871
|
+
constructFullUrl(baseUrl, urlPath) {
|
|
2872
|
+
const escapeStringForRegExp = (str) => str.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
|
|
2873
|
+
if (typeof baseUrl === "string" && typeof urlPath === "string") {
|
|
2874
|
+
return `${baseUrl}${urlPath}`;
|
|
2875
|
+
}
|
|
2876
|
+
if (typeof baseUrl === "string" && urlPath instanceof RegExp) {
|
|
2877
|
+
return new RegExp(`^${escapeStringForRegExp(baseUrl)}${urlPath.source}`);
|
|
2878
|
+
}
|
|
2879
|
+
if (baseUrl instanceof RegExp && typeof urlPath === "string") {
|
|
2880
|
+
return new RegExp(`${baseUrl.source}${escapeStringForRegExp(urlPath)}$`);
|
|
2881
|
+
}
|
|
2882
|
+
if (baseUrl instanceof RegExp && urlPath instanceof RegExp) {
|
|
2883
|
+
return new RegExp(`${baseUrl.source}${urlPath.source}`);
|
|
2884
|
+
}
|
|
2885
|
+
throw new Error("Invalid baseUrl or urlPath types. Expected string or RegExp.");
|
|
2886
|
+
}
|
|
2887
|
+
};
|
|
2888
|
+
|
|
2889
|
+
// srcV2/helpers/navigation.ts
|
|
2890
|
+
var import_test5 = require("@playwright/test");
|
|
2891
|
+
var DEFAULT_WAIT_UNTIL = "load";
|
|
2892
|
+
var DEFAULT_LOAD_STATE = "load";
|
|
2893
|
+
var Navigation = class {
|
|
2894
|
+
constructor(page, baseUrl, urlPath, fullUrl, label, actions = null, defaultOptions) {
|
|
2895
|
+
this.page = page;
|
|
2896
|
+
this.baseUrl = baseUrl;
|
|
2897
|
+
this.urlPath = urlPath;
|
|
2898
|
+
this.fullUrl = fullUrl;
|
|
2899
|
+
this.label = label;
|
|
2900
|
+
this.pageActionsToPerform = actions ?? [];
|
|
2901
|
+
this.defaultOptions = defaultOptions;
|
|
2902
|
+
}
|
|
2903
|
+
pageActionsToPerform;
|
|
2904
|
+
defaultOptions;
|
|
2905
|
+
resolveWaitUntil(options) {
|
|
2906
|
+
return options?.waitUntil ?? this.defaultOptions?.waitUntil ?? DEFAULT_WAIT_UNTIL;
|
|
2907
|
+
}
|
|
2908
|
+
resolveWaitForLoadState(options) {
|
|
2909
|
+
return options?.waitForLoadState ?? this.defaultOptions?.waitForLoadState ?? DEFAULT_LOAD_STATE;
|
|
2910
|
+
}
|
|
2911
|
+
async executeActions() {
|
|
2912
|
+
for (const action of this.pageActionsToPerform) {
|
|
2913
|
+
await action();
|
|
2914
|
+
}
|
|
2915
|
+
}
|
|
2916
|
+
/**
|
|
2917
|
+
* Navigate to a provided URL or URL path. If the input starts with "/", the POC's baseUrl is used as a prefix.
|
|
2918
|
+
* Available only when baseUrl and urlPath are strings.
|
|
2919
|
+
*/
|
|
2920
|
+
async goto(urlPathOrUrl, options) {
|
|
2921
|
+
const waitUntil = this.resolveWaitUntil(options);
|
|
2922
|
+
if (typeof this.baseUrl !== "string" || typeof this.urlPath !== "string") {
|
|
2923
|
+
throw new Error("goto() is not supported when baseUrl or urlPath is a RegExp.");
|
|
2924
|
+
}
|
|
2925
|
+
await import_test5.test.step(`${this.label}: Navigate to the provided URL or URL Path`, async () => {
|
|
2926
|
+
const targetUrl = urlPathOrUrl.startsWith("/") ? `${this.baseUrl}${urlPathOrUrl}` : urlPathOrUrl;
|
|
2927
|
+
await this.page.goto(targetUrl, { waitUntil });
|
|
2928
|
+
});
|
|
2929
|
+
}
|
|
2930
|
+
/**
|
|
2931
|
+
* Navigate to this page's fullUrl and run any post-navigation actions.
|
|
2932
|
+
* Available only when fullUrl is a string.
|
|
2933
|
+
*/
|
|
2934
|
+
async gotoThisPage(options) {
|
|
2935
|
+
if (typeof this.fullUrl !== "string") {
|
|
2936
|
+
throw new Error("gotoThisPage() is not supported when fullUrl is a RegExp.");
|
|
2937
|
+
}
|
|
2938
|
+
const waitUntil = this.resolveWaitUntil(options);
|
|
2939
|
+
const fullUrl = this.fullUrl;
|
|
2940
|
+
await import_test5.test.step(`${this.label}: Navigate to this Page`, async () => {
|
|
2941
|
+
await this.page.goto(fullUrl, { waitUntil });
|
|
2942
|
+
await this.executeActions();
|
|
2943
|
+
});
|
|
2944
|
+
}
|
|
2945
|
+
/**
|
|
2946
|
+
* Expect to be on this page. Works with both string and RegExp fullUrl values.
|
|
2947
|
+
* Uses waitUntil from navigation options when waiting for URL.
|
|
2948
|
+
*/
|
|
2949
|
+
async expectThisPage(options) {
|
|
2950
|
+
const waitUntil = this.resolveWaitUntil(options);
|
|
2951
|
+
await import_test5.test.step(`${this.label}: Expect this Page`, async () => {
|
|
2952
|
+
await this.page.waitForURL(this.fullUrl, { waitUntil });
|
|
2953
|
+
await (0, import_test5.expect)(async () => {
|
|
2954
|
+
if (this.fullUrl instanceof RegExp) {
|
|
2955
|
+
(0, import_test5.expect)(this.page.url(), `expected '${this.fullUrl}', found '${this.page.url()}'`).toMatch(this.fullUrl);
|
|
2956
|
+
} else {
|
|
2957
|
+
(0, import_test5.expect)(this.page.url(), `expected '${this.fullUrl}', found '${this.page.url()}'`).toBe(this.fullUrl);
|
|
2958
|
+
}
|
|
2959
|
+
}).toPass();
|
|
2960
|
+
await this.executeActions();
|
|
2961
|
+
});
|
|
2962
|
+
}
|
|
2963
|
+
/**
|
|
2964
|
+
* Expect to be on any other page (i.e. not this page).
|
|
2965
|
+
* Uses waitForLoadState from navigation options before validating URL.
|
|
2966
|
+
*/
|
|
2967
|
+
async expectAnotherPage(options) {
|
|
2968
|
+
const waitForLoadState = this.resolveWaitForLoadState(options);
|
|
2969
|
+
await import_test5.test.step(`${this.label}: Expect any other Page`, async () => {
|
|
2970
|
+
await this.page.waitForLoadState(waitForLoadState);
|
|
2971
|
+
if (this.fullUrl instanceof RegExp) {
|
|
2972
|
+
await import_test5.expect.poll(async () => this.page.url(), {
|
|
2973
|
+
message: `expected url to not match '${this.fullUrl}'`
|
|
2974
|
+
}).not.toMatch(this.fullUrl);
|
|
2975
|
+
} else {
|
|
2976
|
+
await import_test5.expect.poll(async () => this.page.url(), {
|
|
2977
|
+
message: `expected url to not be '${this.fullUrl}', found '${this.page.url()}'`
|
|
2978
|
+
}).not.toBe(this.fullUrl);
|
|
2979
|
+
}
|
|
2980
|
+
});
|
|
2981
|
+
}
|
|
2982
|
+
};
|
|
2983
|
+
function createNavigation(page, baseUrl, urlPath, fullUrl, label, actions = null, defaultOptions) {
|
|
2984
|
+
const navigation = new Navigation(page, baseUrl, urlPath, fullUrl, label, actions, defaultOptions);
|
|
2985
|
+
return navigation;
|
|
2986
|
+
}
|
|
2987
|
+
|
|
2988
|
+
// srcV2/helpers/sessionStorage.ts
|
|
2989
|
+
var import_test6 = require("@playwright/test");
|
|
2990
|
+
var SessionStorage2 = class {
|
|
2991
|
+
// Initializes the class with a Playwright Page object and an optional label for step titles.
|
|
2992
|
+
constructor(page, options = {}) {
|
|
2993
|
+
this.page = page;
|
|
2994
|
+
this.options = options;
|
|
2995
|
+
}
|
|
2996
|
+
// Defines an object to hold states to be set in session storage, allowing any value type.
|
|
2997
|
+
queuedStates = {};
|
|
2998
|
+
// Indicates if the session storage manipulation has been initiated.
|
|
2999
|
+
isInitiated = false;
|
|
3000
|
+
getStepLabel(methodName) {
|
|
3001
|
+
const prefix = this.options.label ? `${this.options.label}.` : "";
|
|
3002
|
+
return `${prefix}SessionStorage.${methodName}:`;
|
|
3003
|
+
}
|
|
3004
|
+
async hasContext() {
|
|
3005
|
+
return await this.page.evaluate(() => {
|
|
3006
|
+
return typeof window !== "undefined" && window.sessionStorage !== void 0;
|
|
3007
|
+
});
|
|
3008
|
+
}
|
|
3009
|
+
async waitForContextAvailability() {
|
|
3010
|
+
try {
|
|
3011
|
+
const contextExists = await this.hasContext();
|
|
3012
|
+
if (contextExists) {
|
|
3013
|
+
return;
|
|
3014
|
+
}
|
|
3015
|
+
} catch (_e) {
|
|
3016
|
+
}
|
|
3017
|
+
await new Promise((resolve) => {
|
|
3018
|
+
const handler = async (frame) => {
|
|
3019
|
+
if (frame !== this.page.mainFrame()) {
|
|
3020
|
+
return;
|
|
3021
|
+
}
|
|
3022
|
+
try {
|
|
3023
|
+
const contextExists = await this.hasContext();
|
|
3024
|
+
if (!contextExists) {
|
|
3025
|
+
return;
|
|
3026
|
+
}
|
|
3027
|
+
} catch (_e) {
|
|
3028
|
+
return;
|
|
3029
|
+
}
|
|
3030
|
+
this.page.off("framenavigated", handler);
|
|
3031
|
+
resolve();
|
|
3032
|
+
};
|
|
3033
|
+
this.page.on("framenavigated", handler);
|
|
3034
|
+
});
|
|
3035
|
+
}
|
|
3036
|
+
async ensureContext({ waitForContext = false } = {}) {
|
|
3037
|
+
try {
|
|
3038
|
+
const contextExists = await this.hasContext();
|
|
3039
|
+
if (contextExists) {
|
|
3040
|
+
return;
|
|
3041
|
+
}
|
|
3042
|
+
} catch (_e) {
|
|
3043
|
+
}
|
|
3044
|
+
if (!waitForContext) {
|
|
3045
|
+
throw new Error("SessionStorage context is not available.");
|
|
3046
|
+
}
|
|
3047
|
+
await this.waitForContextAvailability();
|
|
3048
|
+
}
|
|
3049
|
+
/** Writes states to session storage. Accepts an object with key-value pairs representing the states. */
|
|
3050
|
+
async writeToSessionStorage(states) {
|
|
3051
|
+
await this.page.evaluate((storage) => {
|
|
3052
|
+
for (const [key, value] of Object.entries(storage)) {
|
|
3053
|
+
window.sessionStorage.setItem(key, JSON.stringify(value));
|
|
3054
|
+
}
|
|
3055
|
+
}, states);
|
|
3056
|
+
}
|
|
3057
|
+
/** Reads all states from session storage and returns them as an object. */
|
|
3058
|
+
async readFromSessionStorage() {
|
|
3059
|
+
const storage = await this.page.evaluate(() => {
|
|
3060
|
+
const storage2 = {};
|
|
3061
|
+
for (let i = 0; i < sessionStorage.length; i++) {
|
|
3062
|
+
const key = sessionStorage.key(i);
|
|
3063
|
+
if (key !== null) {
|
|
3064
|
+
const item = sessionStorage.getItem(key);
|
|
3065
|
+
try {
|
|
3066
|
+
storage2[key] = item ? JSON.parse(item) : null;
|
|
3067
|
+
} catch (_e) {
|
|
3068
|
+
storage2[key] = item;
|
|
3069
|
+
}
|
|
3070
|
+
}
|
|
3071
|
+
}
|
|
3072
|
+
return storage2;
|
|
3073
|
+
});
|
|
3074
|
+
return storage;
|
|
3075
|
+
}
|
|
3076
|
+
/**
|
|
3077
|
+
* Sets the specified states in session storage.
|
|
3078
|
+
* Optionally waits for the next main-frame navigation to establish a valid context before writing,
|
|
3079
|
+
* and reloads the page after setting the data.
|
|
3080
|
+
*
|
|
3081
|
+
* Parameters:
|
|
3082
|
+
* states: Object representing the states to set in session storage.
|
|
3083
|
+
* reload: Boolean indicating whether to reload the page after setting the session storage data.
|
|
3084
|
+
* waitForContext: Boolean indicating whether to wait for a main-frame navigation and a valid context.
|
|
3085
|
+
*/
|
|
3086
|
+
async set(states, options = {}) {
|
|
3087
|
+
await import_test6.test.step(this.getStepLabel("set"), async () => {
|
|
3088
|
+
await this.ensureContext({ waitForContext: options.waitForContext });
|
|
3089
|
+
await this.writeToSessionStorage(states);
|
|
3090
|
+
if (options.reload) {
|
|
3091
|
+
await this.page.reload();
|
|
3092
|
+
}
|
|
3093
|
+
});
|
|
3094
|
+
}
|
|
3095
|
+
/**
|
|
3096
|
+
* Queues states to be set in the sessionStorage before the next navigation occurs.
|
|
3097
|
+
* Handles different scenarios based on multiple calls made before the navigation occurs.
|
|
3098
|
+
*
|
|
3099
|
+
* 1. No Context, Single Call: Queues and sets states upon the next navigation.
|
|
3100
|
+
* 2. No Context, Multiple Calls: Merges states from multiple calls and sets them upon the next navigation.
|
|
3101
|
+
* 3. With Context: Still queues until the next navigation.
|
|
3102
|
+
*
|
|
3103
|
+
* Parameters:
|
|
3104
|
+
* states: Object representing the states to queue for setting in session storage.
|
|
3105
|
+
*/
|
|
3106
|
+
async setOnNextNavigation(states) {
|
|
3107
|
+
this.queuedStates = { ...this.queuedStates, ...states };
|
|
3108
|
+
const populateStorage = async () => {
|
|
3109
|
+
await import_test6.test.step(this.getStepLabel("setOnNextNavigation"), async () => {
|
|
3110
|
+
await this.writeToSessionStorage(this.queuedStates);
|
|
3111
|
+
});
|
|
3112
|
+
this.queuedStates = {};
|
|
3113
|
+
};
|
|
3114
|
+
if (!this.isInitiated) {
|
|
3115
|
+
this.isInitiated = true;
|
|
3116
|
+
const handler = async (frame) => {
|
|
3117
|
+
if (frame !== this.page.mainFrame()) {
|
|
3118
|
+
return;
|
|
3119
|
+
}
|
|
3120
|
+
await populateStorage();
|
|
3121
|
+
this.page.off("framenavigated", handler);
|
|
3122
|
+
this.isInitiated = false;
|
|
3123
|
+
};
|
|
3124
|
+
this.page.on("framenavigated", handler);
|
|
3125
|
+
}
|
|
3126
|
+
}
|
|
3127
|
+
async get(keys, options = {}) {
|
|
3128
|
+
let result = {};
|
|
3129
|
+
await import_test6.test.step(this.getStepLabel("get"), async () => {
|
|
3130
|
+
await this.ensureContext(options);
|
|
3131
|
+
const allData = await this.readFromSessionStorage();
|
|
3132
|
+
if (keys && keys.length > 0) {
|
|
3133
|
+
for (const key of keys) {
|
|
3134
|
+
if (Object.hasOwn(allData, key)) {
|
|
3135
|
+
const value = allData[key];
|
|
3136
|
+
if (value !== void 0) {
|
|
3137
|
+
result[key] = value;
|
|
3138
|
+
}
|
|
3139
|
+
}
|
|
3140
|
+
}
|
|
3141
|
+
} else {
|
|
3142
|
+
result = allData;
|
|
3143
|
+
}
|
|
3144
|
+
});
|
|
3145
|
+
return result;
|
|
3146
|
+
}
|
|
3147
|
+
async clear(keyOrOptions, options = {}) {
|
|
3148
|
+
const { keys, waitForContext } = (() => {
|
|
3149
|
+
if (Array.isArray(keyOrOptions)) {
|
|
3150
|
+
return { keys: keyOrOptions, waitForContext: options.waitForContext };
|
|
3151
|
+
}
|
|
3152
|
+
if (typeof keyOrOptions === "string") {
|
|
3153
|
+
return { keys: [keyOrOptions], waitForContext: options.waitForContext };
|
|
3154
|
+
}
|
|
3155
|
+
if (keyOrOptions) {
|
|
3156
|
+
return { keys: void 0, waitForContext: keyOrOptions.waitForContext };
|
|
3157
|
+
}
|
|
3158
|
+
return { keys: void 0, waitForContext: options.waitForContext };
|
|
3159
|
+
})();
|
|
3160
|
+
await import_test6.test.step(this.getStepLabel("clear"), async () => {
|
|
3161
|
+
await this.ensureContext({ waitForContext });
|
|
3162
|
+
if (!keys || keys.length === 0) {
|
|
3163
|
+
await this.page.evaluate(() => sessionStorage.clear());
|
|
3164
|
+
return;
|
|
3165
|
+
}
|
|
3166
|
+
await this.page.evaluate((keysToClear) => {
|
|
3167
|
+
for (const key of keysToClear) {
|
|
3168
|
+
sessionStorage.removeItem(key);
|
|
3169
|
+
}
|
|
3170
|
+
}, keys);
|
|
3171
|
+
});
|
|
3172
|
+
}
|
|
3173
|
+
};
|
|
3174
|
+
|
|
3175
|
+
// srcV2/pageObject.ts
|
|
3176
|
+
var PageObject = class {
|
|
3177
|
+
page;
|
|
3178
|
+
baseUrl;
|
|
3179
|
+
urlPath;
|
|
3180
|
+
fullUrl;
|
|
3181
|
+
label;
|
|
3182
|
+
sessionStorage;
|
|
3183
|
+
navigation;
|
|
3184
|
+
locatorRegistry;
|
|
3185
|
+
add;
|
|
3186
|
+
getLocator;
|
|
3187
|
+
getLocatorSchema;
|
|
3188
|
+
getNestedLocator;
|
|
3189
|
+
constructor(page, baseUrl, urlPath, options) {
|
|
3190
|
+
this.page = page;
|
|
3191
|
+
this.baseUrl = baseUrl;
|
|
3192
|
+
this.urlPath = urlPath;
|
|
3193
|
+
this.fullUrl = this.composeFullUrl(baseUrl, urlPath);
|
|
3194
|
+
const label = options?.label ?? this.constructor.name;
|
|
3195
|
+
this.label = label;
|
|
3196
|
+
const { registry, add, getLocator, getNestedLocator, getLocatorSchema } = createRegistryWithAccessors(page);
|
|
3197
|
+
this.locatorRegistry = registry;
|
|
3198
|
+
this.add = add;
|
|
3199
|
+
this.getLocator = getLocator;
|
|
3200
|
+
this.getLocatorSchema = getLocatorSchema;
|
|
3201
|
+
this.getNestedLocator = getNestedLocator;
|
|
3202
|
+
this.sessionStorage = new SessionStorage2(page, { label });
|
|
3203
|
+
this.defineLocators();
|
|
3204
|
+
this.navigation = createNavigation(
|
|
3205
|
+
this.page,
|
|
3206
|
+
this.baseUrl,
|
|
3207
|
+
this.urlPath,
|
|
3208
|
+
this.fullUrl,
|
|
3209
|
+
this.label,
|
|
3210
|
+
this.pageActionsToPerformAfterNavigation(),
|
|
3211
|
+
options?.navOptions
|
|
3212
|
+
);
|
|
3213
|
+
}
|
|
3214
|
+
composeFullUrl(baseUrl, urlPath) {
|
|
3215
|
+
const escapeRegex = (value) => value.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
|
|
3216
|
+
if (typeof baseUrl === "string" && typeof urlPath === "string") {
|
|
3217
|
+
return `${baseUrl}${urlPath}`;
|
|
3218
|
+
}
|
|
3219
|
+
if (typeof baseUrl === "string" && urlPath instanceof RegExp) {
|
|
3220
|
+
return new RegExp(`^${escapeRegex(baseUrl)}${urlPath.source}`);
|
|
3221
|
+
}
|
|
3222
|
+
if (baseUrl instanceof RegExp && typeof urlPath === "string") {
|
|
3223
|
+
return new RegExp(`${baseUrl.source}${escapeRegex(urlPath)}$`);
|
|
3224
|
+
}
|
|
3225
|
+
if (baseUrl instanceof RegExp && urlPath instanceof RegExp) {
|
|
3226
|
+
return new RegExp(`${baseUrl.source}${urlPath.source}`);
|
|
3227
|
+
}
|
|
3228
|
+
throw new Error("Invalid baseUrl or urlPath types. Expected string or RegExp.");
|
|
3229
|
+
}
|
|
3230
|
+
};
|
|
3231
|
+
|
|
3232
|
+
// srcV2/fixture/base.fixtures.ts
|
|
3233
|
+
var import_test7 = require("@playwright/test");
|
|
3234
|
+
|
|
3235
|
+
// srcV2/helpers/playwrightReportLogger.ts
|
|
3236
|
+
var PlaywrightReportLogger = class _PlaywrightReportLogger {
|
|
3237
|
+
// Initializes the logger with shared log level, log entries, and a context name.
|
|
3238
|
+
constructor(sharedLogLevel, sharedLogEntry, contextName) {
|
|
3239
|
+
this.sharedLogLevel = sharedLogLevel;
|
|
3240
|
+
this.sharedLogEntry = sharedLogEntry;
|
|
3241
|
+
this.contextName = contextName;
|
|
3242
|
+
}
|
|
3243
|
+
contextName;
|
|
3244
|
+
logLevels = ["debug", "info", "warn", "error"];
|
|
3245
|
+
/**
|
|
3246
|
+
* Creates a child logger with a new contextual name, sharing the same log level and log entries with the parent logger.
|
|
3247
|
+
*
|
|
3248
|
+
* The root loggers log "level" is referenced by all child loggers and their child loggers and so on...
|
|
3249
|
+
* Changing the log "level" of one, will change it for all.
|
|
3250
|
+
*/
|
|
3251
|
+
getNewChildLogger(prefix) {
|
|
3252
|
+
return new _PlaywrightReportLogger(this.sharedLogLevel, this.sharedLogEntry, `${this.contextName} -> ${prefix}`);
|
|
3253
|
+
}
|
|
3254
|
+
/**
|
|
3255
|
+
* Logs a message with the specified log level, prefix, and additional arguments if the current log level permits.
|
|
3256
|
+
*/
|
|
3257
|
+
// biome-ignore lint/suspicious/noExplicitAny: logger accepts arbitrary payloads for debug output.
|
|
3258
|
+
log(level, message, ...args) {
|
|
3259
|
+
const logLevelIndex = this.logLevels.indexOf(level);
|
|
3260
|
+
if (logLevelIndex < this.getCurrentLogLevelIndex()) {
|
|
3261
|
+
return;
|
|
3262
|
+
}
|
|
3263
|
+
this.sharedLogEntry.push({
|
|
3264
|
+
timestamp: /* @__PURE__ */ new Date(),
|
|
3265
|
+
logLevel: level,
|
|
3266
|
+
prefix: this.contextName,
|
|
3267
|
+
message: `${message}
|
|
3268
|
+
|
|
3269
|
+
${args.join("\n\n")}`
|
|
3270
|
+
});
|
|
3271
|
+
}
|
|
3272
|
+
/**
|
|
3273
|
+
* Logs a debug-level message with the specified message and arguments.
|
|
3274
|
+
*/
|
|
3275
|
+
// biome-ignore lint/suspicious/noExplicitAny: logger accepts arbitrary payloads for debug output.
|
|
3276
|
+
debug(message, ...args) {
|
|
3277
|
+
this.log("debug", message, ...args);
|
|
3278
|
+
}
|
|
3279
|
+
/**
|
|
3280
|
+
* Logs a info-level message with the specified message and arguments.
|
|
3281
|
+
*/
|
|
3282
|
+
// biome-ignore lint/suspicious/noExplicitAny: logger accepts arbitrary payloads for debug output.
|
|
3283
|
+
info(message, ...args) {
|
|
3284
|
+
this.log("info", message, ...args);
|
|
3285
|
+
}
|
|
3286
|
+
/**
|
|
3287
|
+
* Logs a warn-level message with the specified message and arguments.
|
|
3288
|
+
*/
|
|
3289
|
+
// biome-ignore lint/suspicious/noExplicitAny: logger accepts arbitrary payloads for debug output.
|
|
3290
|
+
warn(message, ...args) {
|
|
3291
|
+
this.log("warn", message, ...args);
|
|
3292
|
+
}
|
|
3293
|
+
/**
|
|
3294
|
+
* Logs a error-level message with the specified message and arguments.
|
|
3295
|
+
*/
|
|
3296
|
+
// biome-ignore lint/suspicious/noExplicitAny: logger accepts arbitrary payloads for debug output.
|
|
1101
3297
|
error(message, ...args) {
|
|
1102
3298
|
this.log("error", message, ...args);
|
|
1103
3299
|
}
|
|
@@ -1177,9 +3373,9 @@ ${args.join("\n\n")}`
|
|
|
1177
3373
|
}
|
|
1178
3374
|
};
|
|
1179
3375
|
|
|
1180
|
-
//
|
|
1181
|
-
var
|
|
1182
|
-
// biome-ignore lint/correctness/noEmptyPattern:
|
|
3376
|
+
// srcV2/fixture/base.fixtures.ts
|
|
3377
|
+
var test5 = import_test7.test.extend({
|
|
3378
|
+
// biome-ignore lint/correctness/noEmptyPattern: Playwright does not support the use of _
|
|
1183
3379
|
log: async ({}, use, testInfo) => {
|
|
1184
3380
|
const contextName = "TestCase";
|
|
1185
3381
|
const sharedLogEntry = [];
|
|
@@ -1190,25 +3386,54 @@ var test3 = import_test4.test.extend({
|
|
|
1190
3386
|
}
|
|
1191
3387
|
});
|
|
1192
3388
|
|
|
1193
|
-
//
|
|
1194
|
-
var
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
3389
|
+
// srcV2/helpers/stepDecorator.ts
|
|
3390
|
+
var import_test8 = require("@playwright/test");
|
|
3391
|
+
var isMethodDecoratorArgs = (args) => args.length === 3 && typeof args[0] === "object" && (typeof args[1] === "string" || typeof args[1] === "symbol");
|
|
3392
|
+
var isStage3MethodDecoratorArgs = (args) => args.length === 2 && typeof args[0] === "function" && args[1] !== null && typeof args[1] === "object";
|
|
3393
|
+
var normalizeStepArguments = (args) => {
|
|
3394
|
+
const [titleOrOptions, maybeOptions] = args;
|
|
3395
|
+
const title = typeof titleOrOptions === "string" ? titleOrOptions : void 0;
|
|
3396
|
+
const options = typeof titleOrOptions === "string" ? maybeOptions : titleOrOptions;
|
|
3397
|
+
return { title, options };
|
|
3398
|
+
};
|
|
3399
|
+
var createWrappedMethod = (original, methodName, title, options) => function(...methodArgs) {
|
|
3400
|
+
const rawClassName = this.constructor?.name ?? "";
|
|
3401
|
+
const className = rawClassName && rawClassName !== "Object" ? rawClassName : "Anonymous";
|
|
3402
|
+
const resolvedTitle = title ?? `${className}.${String(methodName)}`;
|
|
3403
|
+
return import_test8.test.step(resolvedTitle, () => original.apply(this, methodArgs), options);
|
|
3404
|
+
};
|
|
3405
|
+
var createStepDecorator = ({ title, options }) => (valueOrTarget, contextOrKey, descriptor) => {
|
|
3406
|
+
if (typeof valueOrTarget === "function" && isStage3MethodDecoratorArgs([valueOrTarget, contextOrKey])) {
|
|
3407
|
+
const [original2, context] = [valueOrTarget, contextOrKey];
|
|
3408
|
+
return createWrappedMethod(original2, context.name, title, options);
|
|
1204
3409
|
}
|
|
3410
|
+
if (!descriptor || typeof descriptor.value !== "function") {
|
|
3411
|
+
throw new Error("@step decorator can only be applied to methods.");
|
|
3412
|
+
}
|
|
3413
|
+
const original = descriptor.value;
|
|
3414
|
+
descriptor.value = createWrappedMethod(original, contextOrKey, title, options);
|
|
3415
|
+
return descriptor;
|
|
1205
3416
|
};
|
|
3417
|
+
function step(...args) {
|
|
3418
|
+
if (isStage3MethodDecoratorArgs(args)) {
|
|
3419
|
+
return createStepDecorator(normalizeStepArguments([]))(...args);
|
|
3420
|
+
}
|
|
3421
|
+
if (isMethodDecoratorArgs(args)) {
|
|
3422
|
+
return createStepDecorator(normalizeStepArguments([]))(...args);
|
|
3423
|
+
}
|
|
3424
|
+
return createStepDecorator(normalizeStepArguments(args));
|
|
3425
|
+
}
|
|
1206
3426
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1207
3427
|
0 && (module.exports = {
|
|
1208
3428
|
BaseApi,
|
|
1209
3429
|
BasePage,
|
|
3430
|
+
BasePageV1toV2,
|
|
1210
3431
|
GetByMethod,
|
|
1211
3432
|
GetLocatorBase,
|
|
3433
|
+
PageObject,
|
|
1212
3434
|
PlaywrightReportLogger,
|
|
3435
|
+
SessionStorage,
|
|
3436
|
+
createRegistryWithAccessors,
|
|
3437
|
+
step,
|
|
1213
3438
|
test
|
|
1214
3439
|
});
|