@dev-blinq/bvt-playwright-js 1.0.0-dev.4.latest.138.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 +24 -0
- package/index.mjs +107 -9
- package/index.mjs.map +1 -1
- package/package.json +1 -1
package/index.d.mts
CHANGED
|
@@ -276,6 +276,14 @@ declare const elementAssertionSchema: z.ZodDiscriminatedUnion<[
|
|
|
276
276
|
z.ZodObject<{
|
|
277
277
|
type: z.ZodLiteral<"toHaveProperty">;
|
|
278
278
|
name: z.ZodString;
|
|
279
|
+
operator: z.ZodOptional<z.ZodEnum<{
|
|
280
|
+
equals: "equals";
|
|
281
|
+
notEquals: "notEquals";
|
|
282
|
+
contains: "contains";
|
|
283
|
+
lessThan: "lessThan";
|
|
284
|
+
greaterThan: "greaterThan";
|
|
285
|
+
exists: "exists";
|
|
286
|
+
}>>;
|
|
279
287
|
value: z.ZodOptional<z.ZodDiscriminatedUnion<[
|
|
280
288
|
z.ZodObject<{
|
|
281
289
|
type: z.ZodLiteral<"string">;
|
|
@@ -2011,6 +2019,14 @@ declare const CommandSchema: z.ZodDiscriminatedUnion<[
|
|
|
2011
2019
|
z.ZodObject<{
|
|
2012
2020
|
type: z.ZodLiteral<"toHaveProperty">;
|
|
2013
2021
|
name: z.ZodString;
|
|
2022
|
+
operator: z.ZodOptional<z.ZodEnum<{
|
|
2023
|
+
equals: "equals";
|
|
2024
|
+
notEquals: "notEquals";
|
|
2025
|
+
contains: "contains";
|
|
2026
|
+
lessThan: "lessThan";
|
|
2027
|
+
greaterThan: "greaterThan";
|
|
2028
|
+
exists: "exists";
|
|
2029
|
+
}>>;
|
|
2014
2030
|
value: z.ZodOptional<z.ZodDiscriminatedUnion<[
|
|
2015
2031
|
z.ZodObject<{
|
|
2016
2032
|
type: z.ZodLiteral<"string">;
|
|
@@ -5010,6 +5026,14 @@ declare const StepDefinitionSchema: z.ZodObject<{
|
|
|
5010
5026
|
z.ZodObject<{
|
|
5011
5027
|
type: z.ZodLiteral<"toHaveProperty">;
|
|
5012
5028
|
name: z.ZodString;
|
|
5029
|
+
operator: z.ZodOptional<z.ZodEnum<{
|
|
5030
|
+
equals: "equals";
|
|
5031
|
+
notEquals: "notEquals";
|
|
5032
|
+
contains: "contains";
|
|
5033
|
+
lessThan: "lessThan";
|
|
5034
|
+
greaterThan: "greaterThan";
|
|
5035
|
+
exists: "exists";
|
|
5036
|
+
}>>;
|
|
5013
5037
|
value: z.ZodOptional<z.ZodDiscriminatedUnion<[
|
|
5014
5038
|
z.ZodObject<{
|
|
5015
5039
|
type: z.ZodLiteral<"string">;
|
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);
|