@dev-blinq/bvt-playwright-js 1.0.0-dev.4.latest.131.1 → 1.0.0-dev.4.latest.142.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/index.d.mts +164 -140
- package/index.mjs +107 -9
- package/index.mjs.map +1 -1
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -5162,6 +5162,17 @@ const primitiveOrRegex = discriminatedUnion("type", [
|
|
|
5162
5162
|
}).strict()
|
|
5163
5163
|
]);
|
|
5164
5164
|
|
|
5165
|
+
//#endregion
|
|
5166
|
+
//#region ../../core/schemas/src/assertions/assertion-operators.ts
|
|
5167
|
+
const ASSERTION_OPERATORS = [
|
|
5168
|
+
"equals",
|
|
5169
|
+
"notEquals",
|
|
5170
|
+
"contains",
|
|
5171
|
+
"lessThan",
|
|
5172
|
+
"greaterThan",
|
|
5173
|
+
"exists"
|
|
5174
|
+
];
|
|
5175
|
+
|
|
5165
5176
|
//#endregion
|
|
5166
5177
|
//#region ../../core/schemas/src/api/api.schema.ts
|
|
5167
5178
|
const numberAssertion = object({
|
|
@@ -5393,6 +5404,7 @@ const elementAssertionSchema = discriminatedUnion("type", [
|
|
|
5393
5404
|
object({
|
|
5394
5405
|
type: literal$1("toHaveProperty"),
|
|
5395
5406
|
name: string(),
|
|
5407
|
+
operator: _enum(ASSERTION_OPERATORS).optional(),
|
|
5396
5408
|
value: primitiveOrRegex.optional(),
|
|
5397
5409
|
options: object({ timeout: number().optional() }).optional()
|
|
5398
5410
|
}),
|
|
@@ -6918,6 +6930,23 @@ const ProjectBrowserLaunchConfigurationSchema = object({
|
|
|
6918
6930
|
}).strict();
|
|
6919
6931
|
const ProjectGitCodegenFormats = ["playwright", "gherkin"];
|
|
6920
6932
|
const ProjectGitCodegenFormatSchema = _enum(ProjectGitCodegenFormats).default("playwright");
|
|
6933
|
+
/**
|
|
6934
|
+
* Personalisation inputs for the analytics dashboard.
|
|
6935
|
+
*
|
|
6936
|
+
* These values drive the "Budget Saved", "Time Saved", and
|
|
6937
|
+
* "AI Work Time Distribution" widgets. All hours are in human-hours
|
|
6938
|
+
* (the unit the modal collects). The defaults match the legacy
|
|
6939
|
+
* Metabase queries' `$ifNull` fallbacks — projects that never
|
|
6940
|
+
* customise these still get sensible numbers on day one.
|
|
6941
|
+
*/
|
|
6942
|
+
const DashboardPersonalizationSchema = object({
|
|
6943
|
+
hourlyRateForTestEngineer: number().nonnegative().default(50),
|
|
6944
|
+
avgTimeToAutomateScenario: number().nonnegative().default(4),
|
|
6945
|
+
avgTimeToAutomateScenarioUsingBlinqIO: number().nonnegative().default(.25),
|
|
6946
|
+
avgTimeToMaintainScenario: number().nonnegative().default(2),
|
|
6947
|
+
avgTimeToAnalyzeFailedScenario: number().nonnegative().default(2)
|
|
6948
|
+
}).strict();
|
|
6949
|
+
const DEFAULT_DASHBOARD_PERSONALIZATION = DashboardPersonalizationSchema.parse({});
|
|
6921
6950
|
const ProjectSettingsSchema = object({
|
|
6922
6951
|
_id: EntityIdSchema,
|
|
6923
6952
|
projectId: EntityIdSchema,
|
|
@@ -6928,11 +6957,13 @@ const ProjectSettingsSchema = object({
|
|
|
6928
6957
|
width: 1280,
|
|
6929
6958
|
height: 900
|
|
6930
6959
|
} }
|
|
6931
|
-
})
|
|
6960
|
+
}),
|
|
6961
|
+
dashboardPersonalization: DashboardPersonalizationSchema.default(DEFAULT_DASHBOARD_PERSONALIZATION)
|
|
6932
6962
|
}).strict();
|
|
6933
6963
|
const ProjectSettingsUpdatableFieldsSchema = ProjectSettingsSchema.omit({
|
|
6934
6964
|
_id: true,
|
|
6935
|
-
projectId: true
|
|
6965
|
+
projectId: true,
|
|
6966
|
+
dashboardPersonalization: true
|
|
6936
6967
|
});
|
|
6937
6968
|
const DEFAULT_PROJECT_SETTINGS = ProjectSettingsUpdatableFieldsSchema.parse({});
|
|
6938
6969
|
const GetProjectSettingsInputSchema = object({ projectId: EntityIdSchema }).strict();
|
|
@@ -27390,15 +27421,82 @@ var Tester = class {
|
|
|
27390
27421
|
else await asserter.toHaveAttribute(assertion.name, value, assertion.options);
|
|
27391
27422
|
break;
|
|
27392
27423
|
}
|
|
27393
|
-
case "toHaveProperty":
|
|
27394
|
-
|
|
27395
|
-
|
|
27396
|
-
|
|
27397
|
-
|
|
27398
|
-
|
|
27399
|
-
|
|
27424
|
+
case "toHaveProperty": {
|
|
27425
|
+
const operator = assertion.operator ?? "equals";
|
|
27426
|
+
this.obs.logger.info(`Checking property "${assertion.name}" [operator: ${operator}]...`);
|
|
27427
|
+
switch (operator) {
|
|
27428
|
+
case "equals":
|
|
27429
|
+
if (assertion.value === void 0) await asserter.toHaveJSProperty(assertion.name, assertion.options);
|
|
27430
|
+
else {
|
|
27431
|
+
const value = getValueFromPrimitiveOrRegex(assertion.value);
|
|
27432
|
+
this.obs.logger.info(`Expected: "${value}" (timeout: ${assertion.options?.timeout ?? "default"}ms)`);
|
|
27433
|
+
await asserter.toHaveJSProperty(assertion.name, value, assertion.options);
|
|
27434
|
+
}
|
|
27435
|
+
break;
|
|
27436
|
+
case "notEquals":
|
|
27437
|
+
if (assertion.value !== void 0) {
|
|
27438
|
+
const value = getValueFromPrimitiveOrRegex(assertion.value);
|
|
27439
|
+
this.obs.logger.info(`Expected NOT: "${value}"`);
|
|
27440
|
+
await expect(locator).not.toHaveJSProperty(assertion.name, value, assertion.options);
|
|
27441
|
+
}
|
|
27442
|
+
break;
|
|
27443
|
+
case "contains":
|
|
27444
|
+
if (assertion.value !== void 0) {
|
|
27445
|
+
const raw = getValueFromPrimitiveOrRegex(assertion.value);
|
|
27446
|
+
const stringValue = typeof raw === "string" ? raw : String(raw);
|
|
27447
|
+
this.obs.logger.info(`Expected to contain: "${stringValue}"`);
|
|
27448
|
+
const propName = assertion.name;
|
|
27449
|
+
const isTextProp = propName === "textContent" || propName === "innerText";
|
|
27450
|
+
const isHtmlAttr = [
|
|
27451
|
+
"href",
|
|
27452
|
+
"src",
|
|
27453
|
+
"class",
|
|
27454
|
+
"id",
|
|
27455
|
+
"placeholder",
|
|
27456
|
+
"title",
|
|
27457
|
+
"alt",
|
|
27458
|
+
"name",
|
|
27459
|
+
"type",
|
|
27460
|
+
"action",
|
|
27461
|
+
"target",
|
|
27462
|
+
"rel",
|
|
27463
|
+
"value"
|
|
27464
|
+
].includes(propName) || propName.startsWith("data-") || propName.startsWith("aria-");
|
|
27465
|
+
if (isTextProp) await expect(locator).toContainText(stringValue, assertion.options);
|
|
27466
|
+
else if (isHtmlAttr) {
|
|
27467
|
+
const attrPattern = raw instanceof RegExp ? raw : new RegExp(stringValue.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
|
|
27468
|
+
await expect(locator).toHaveAttribute(propName, attrPattern, assertion.options);
|
|
27469
|
+
} else {
|
|
27470
|
+
const actual = await locator.evaluate((el, name) => String(el[name] ?? ""), propName);
|
|
27471
|
+
if (!actual.includes(stringValue)) throw new Error(`Property "${propName}" expected to contain "${stringValue}", but got "${actual}"`);
|
|
27472
|
+
}
|
|
27473
|
+
}
|
|
27474
|
+
break;
|
|
27475
|
+
case "lessThan":
|
|
27476
|
+
if (assertion.value !== void 0) {
|
|
27477
|
+
const threshold = Number(getValueFromPrimitiveOrRegex(assertion.value));
|
|
27478
|
+
const actual = Number(await locator.evaluate((el, name) => el[name], assertion.name));
|
|
27479
|
+
this.obs.logger.info(`Expected "${assertion.name}" (${actual}) < ${threshold}`);
|
|
27480
|
+
if (!(actual < threshold)) throw new Error(`Property "${assertion.name}" expected to be less than ${threshold}, but got ${actual}`);
|
|
27481
|
+
}
|
|
27482
|
+
break;
|
|
27483
|
+
case "greaterThan":
|
|
27484
|
+
if (assertion.value !== void 0) {
|
|
27485
|
+
const threshold = Number(getValueFromPrimitiveOrRegex(assertion.value));
|
|
27486
|
+
const actual = Number(await locator.evaluate((el, name) => el[name], assertion.name));
|
|
27487
|
+
this.obs.logger.info(`Expected "${assertion.name}" (${actual}) > ${threshold}`);
|
|
27488
|
+
if (!(actual > threshold)) throw new Error(`Property "${assertion.name}" expected to be greater than ${threshold}, but got ${actual}`);
|
|
27489
|
+
}
|
|
27490
|
+
break;
|
|
27491
|
+
case "exists": {
|
|
27492
|
+
const exists = await locator.evaluate((el, name) => el[name] !== void 0, assertion.name);
|
|
27493
|
+
this.obs.logger.info(`Expected property "${assertion.name}" to exist: ${exists}`);
|
|
27494
|
+
if (!exists) throw new Error(`Property "${assertion.name}" does not exist on element`);
|
|
27495
|
+
break;
|
|
27496
|
+
}
|
|
27400
27497
|
}
|
|
27401
27498
|
break;
|
|
27499
|
+
}
|
|
27402
27500
|
case "toHaveValue": {
|
|
27403
27501
|
const value = getValueFromStringOrRegex(assertion.value);
|
|
27404
27502
|
await asserter.toHaveValue(value, assertion.options);
|