@redrockswebdevelopment/formstack-form-testing 0.1.34 → 0.1.36

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/dist/index.js CHANGED
@@ -23,8 +23,8 @@ export const liveFormFieldTypeCoverage = {
23
23
  apiWrite: true,
24
24
  domInteraction: true,
25
25
  domAssertion: true,
26
- reason: "Compound address values can be written through Live Form API, while layout and subfield UX should be asserted through DOM controls.",
27
- recommendedHelpers: ["buildLiveFormAddressValue", "setLiveFormFieldValueTransaction", "fillAddress", "readLiveFormDomFieldState"],
26
+ reason: "Compound address values can be written through Live Form API, while subfield UX should be asserted for address line, city, state, ZIP, and country controls.",
27
+ recommendedHelpers: ["buildLiveFormAddressValue", "setLiveFormAddressValue", "readLiveFormAddressState", "fillAddress"],
28
28
  },
29
29
  checkbox: {
30
30
  kind: "checkbox",
@@ -104,8 +104,8 @@ export const liveFormFieldTypeCoverage = {
104
104
  apiWrite: true,
105
105
  domInteraction: true,
106
106
  domAssertion: true,
107
- reason: "Name compound fields support direct API values and stable subfield DOM automation.",
108
- recommendedHelpers: ["buildLiveFormNameValue", "setLiveFormFieldValueTransaction", "fillName", "readLiveFormReadiness"],
107
+ reason: "Name compound fields support direct API values and should be asserted by prefix, first, middle, last, and suffix subfields.",
108
+ recommendedHelpers: ["buildLiveFormNameValue", "setLiveFormNameValue", "readLiveFormNameState", "fillName"],
109
109
  },
110
110
  number: {
111
111
  kind: "number",
@@ -895,12 +895,31 @@ export function buildLiveFormNameValue(value, current = {}) {
895
895
  ...value,
896
896
  };
897
897
  }
898
+ export function normalizeLiveFormNameValue(value, current = {}) {
899
+ return buildLiveFormNameValue({
900
+ ...(value.prefix === undefined ? {} : { prefix: String(value.prefix) }),
901
+ ...(value.first === undefined ? {} : { first: String(value.first) }),
902
+ ...(value.middle === undefined ? {} : { middle: String(value.middle) }),
903
+ ...(value.last === undefined ? {} : { last: String(value.last) }),
904
+ ...(value.suffix === undefined ? {} : { suffix: String(value.suffix) }),
905
+ }, current);
906
+ }
898
907
  export function buildLiveFormAddressValue(value, current = {}) {
899
908
  return {
900
909
  ...(current && typeof current === "object" ? current : {}),
901
910
  ...value,
902
911
  };
903
912
  }
913
+ export function normalizeLiveFormAddressValue(value, current = {}) {
914
+ return buildLiveFormAddressValue({
915
+ ...(value.address === undefined ? {} : { address: String(value.address) }),
916
+ ...(value.address2 === undefined ? {} : { address2: String(value.address2) }),
917
+ ...(value.city === undefined ? {} : { city: String(value.city) }),
918
+ ...(value.state === undefined ? {} : { state: String(value.state) }),
919
+ ...(value.zip === undefined ? {} : { zip: String(value.zip) }),
920
+ ...(value.country === undefined ? {} : { country: String(value.country) }),
921
+ }, current);
922
+ }
904
923
  export function buildLiveFormChoiceValue(value, otherValue = "") {
905
924
  return { value, otherValue };
906
925
  }
@@ -1947,6 +1966,200 @@ export async function waitForLiveFormProductState(page, options) {
1947
1966
  }
1948
1967
  return latest;
1949
1968
  }
1969
+ export async function readLiveFormAddressState(page, options) {
1970
+ if (!hasEvaluate(page)) {
1971
+ throw new Error("readLiveFormAddressState requires a Playwright page with evaluate().");
1972
+ }
1973
+ return page.evaluate((stateOptions) => {
1974
+ const normalizeText = (value) => (value ?? "").replace(/\s+/g, " ").trim();
1975
+ const inferPart = (control) => {
1976
+ const label = control.id ? document.querySelector(`label[for="${CSS.escape(control.id)}"]`) : null;
1977
+ const haystack = [
1978
+ control.name,
1979
+ control.id,
1980
+ control.className,
1981
+ control.getAttribute("placeholder"),
1982
+ control.getAttribute("aria-label"),
1983
+ label?.textContent,
1984
+ ].map(normalizeText).join(" ").toLowerCase();
1985
+ if (/\b(address line 2|address 2|address2|line 2|street 2|\[address2\]|-address2$|_address2$)/i.test(haystack))
1986
+ return "address2";
1987
+ if (/\b(address line 1|address 1|address|street|line 1|\[address\]|-address$|_address$)/i.test(haystack))
1988
+ return "address";
1989
+ if (/\b(city|\[city\]|-city$|_city$)/i.test(haystack))
1990
+ return "city";
1991
+ if (/\b(state|province|region|\[state\]|-state$|_state$)/i.test(haystack))
1992
+ return "state";
1993
+ if (/\b(zip|postal|postcode|post code|\[zip\]|-zip$|_zip$)/i.test(haystack))
1994
+ return "zip";
1995
+ if (/\b(country|\[country\]|-country$|_country$)/i.test(haystack))
1996
+ return "country";
1997
+ return null;
1998
+ };
1999
+ const root = stateOptions.selector != null
2000
+ ? document.querySelector(stateOptions.selector)
2001
+ : stateOptions.internalLabel != null
2002
+ ? document.querySelector(`[data-internal-label="${CSS.escape(stateOptions.internalLabel)}"]`)
2003
+ : stateOptions.fieldId == null
2004
+ ? null
2005
+ : document.querySelector(`#fsCell${CSS.escape(String(stateOptions.fieldId))}, #fsFieldCell${CSS.escape(String(stateOptions.fieldId))}, [data-testid="field-${CSS.escape(String(stateOptions.fieldId))}"]`);
2006
+ const nativeControls = root
2007
+ ? Array.from(root.querySelectorAll("input, textarea, select"))
2008
+ : [];
2009
+ const controls = nativeControls.map((control) => ({
2010
+ tagName: control.tagName.toLowerCase(),
2011
+ type: control.getAttribute("type"),
2012
+ id: control.getAttribute("id"),
2013
+ name: control.getAttribute("name"),
2014
+ value: control.getAttribute("value"),
2015
+ currentValue: "value" in control ? control.value : "",
2016
+ checked: control instanceof HTMLInputElement && ["checkbox", "radio"].includes(control.type) ? control.checked : null,
2017
+ part: inferPart(control),
2018
+ text: control instanceof HTMLSelectElement
2019
+ ? normalizeText(control.selectedOptions.item(0)?.textContent)
2020
+ : normalizeText(control.textContent),
2021
+ disabled: "disabled" in control ? Boolean(control.disabled) : null,
2022
+ }));
2023
+ const selectedParts = {};
2024
+ for (const control of controls) {
2025
+ if (control.part && control.disabled !== true && typeof control.currentValue === "string" && control.currentValue.length > 0) {
2026
+ selectedParts[control.part] = control.currentValue;
2027
+ }
2028
+ }
2029
+ const expected = stateOptions.expectedValue ?? {};
2030
+ const expectedEntries = Object.entries(expected).filter((entry) => typeof entry[1] === "string" && entry[1].length > 0);
2031
+ const availableParts = new Set(controls.filter((control) => control.part && control.disabled !== true).map((control) => control.part));
2032
+ const renderedExpectedEntries = expectedEntries.filter(([part]) => availableParts.has(part));
2033
+ const unavailableParts = expectedEntries
2034
+ .filter(([part]) => !availableParts.has(part))
2035
+ .map(([part]) => part);
2036
+ const missingParts = renderedExpectedEntries
2037
+ .filter(([part]) => selectedParts[part] === undefined || selectedParts[part] === "")
2038
+ .map(([part]) => part);
2039
+ const mismatchedParts = renderedExpectedEntries
2040
+ .filter(([part, value]) => selectedParts[part] !== undefined && selectedParts[part] !== "" && selectedParts[part] !== value)
2041
+ .map(([part]) => part);
2042
+ const renderedValueAvailable = Object.keys(selectedParts).length > 0;
2043
+ return {
2044
+ fieldMatched: Boolean(root),
2045
+ selectedParts,
2046
+ ...(stateOptions.expectedValue === undefined ? {} : { expectedValue: stateOptions.expectedValue }),
2047
+ renderedValueAvailable,
2048
+ unavailableParts,
2049
+ missingParts,
2050
+ mismatchedParts,
2051
+ matched: Boolean(root) && missingParts.length === 0 && mismatchedParts.length === 0,
2052
+ controls,
2053
+ };
2054
+ }, options);
2055
+ }
2056
+ export async function waitForLiveFormAddressState(page, options) {
2057
+ const timeoutMs = options.timeoutMs ?? 10_000;
2058
+ const intervalMs = options.intervalMs ?? 100;
2059
+ const startedAt = Date.now();
2060
+ let latest = await readLiveFormAddressState(page, options);
2061
+ while (!latest.matched && Date.now() - startedAt < timeoutMs) {
2062
+ await delay(intervalMs);
2063
+ latest = await readLiveFormAddressState(page, options);
2064
+ }
2065
+ return latest;
2066
+ }
2067
+ export async function readLiveFormNameState(page, options) {
2068
+ if (!hasEvaluate(page)) {
2069
+ throw new Error("readLiveFormNameState requires a Playwright page with evaluate().");
2070
+ }
2071
+ return page.evaluate((stateOptions) => {
2072
+ const normalizeText = (value) => (value ?? "").replace(/\s+/g, " ").trim();
2073
+ const inferPart = (control) => {
2074
+ const label = control.id ? document.querySelector(`label[for="${CSS.escape(control.id)}"]`) : null;
2075
+ const haystack = [
2076
+ control.name,
2077
+ control.id,
2078
+ control.className,
2079
+ control.getAttribute("placeholder"),
2080
+ control.getAttribute("aria-label"),
2081
+ label?.textContent,
2082
+ ].map(normalizeText).join(" ").toLowerCase();
2083
+ if (/\b(prefix|title|\[prefix\]|-prefix$|_prefix$)/i.test(haystack))
2084
+ return "prefix";
2085
+ if (/\b(first name|given name|first|\[first\]|-first$|_first$)/i.test(haystack))
2086
+ return "first";
2087
+ if (/\b(middle name|middle initial|middle|\[middle\]|-middle$|_middle$)/i.test(haystack))
2088
+ return "middle";
2089
+ if (/\b(last name|family name|surname|last|\[last\]|-last$|_last$)/i.test(haystack))
2090
+ return "last";
2091
+ if (/\b(suffix|\[suffix\]|-suffix$|_suffix$)/i.test(haystack))
2092
+ return "suffix";
2093
+ return null;
2094
+ };
2095
+ const root = stateOptions.selector != null
2096
+ ? document.querySelector(stateOptions.selector)
2097
+ : stateOptions.internalLabel != null
2098
+ ? document.querySelector(`[data-internal-label="${CSS.escape(stateOptions.internalLabel)}"]`)
2099
+ : stateOptions.fieldId == null
2100
+ ? null
2101
+ : document.querySelector(`#fsCell${CSS.escape(String(stateOptions.fieldId))}, #fsFieldCell${CSS.escape(String(stateOptions.fieldId))}, [data-testid="field-${CSS.escape(String(stateOptions.fieldId))}"]`);
2102
+ const nativeControls = root
2103
+ ? Array.from(root.querySelectorAll("input, textarea, select"))
2104
+ : [];
2105
+ const controls = nativeControls.map((control) => ({
2106
+ tagName: control.tagName.toLowerCase(),
2107
+ type: control.getAttribute("type"),
2108
+ id: control.getAttribute("id"),
2109
+ name: control.getAttribute("name"),
2110
+ value: control.getAttribute("value"),
2111
+ currentValue: "value" in control ? control.value : "",
2112
+ checked: control instanceof HTMLInputElement && ["checkbox", "radio"].includes(control.type) ? control.checked : null,
2113
+ part: inferPart(control),
2114
+ text: control instanceof HTMLSelectElement
2115
+ ? normalizeText(control.selectedOptions.item(0)?.textContent)
2116
+ : normalizeText(control.textContent),
2117
+ disabled: "disabled" in control ? Boolean(control.disabled) : null,
2118
+ }));
2119
+ const selectedParts = {};
2120
+ for (const control of controls) {
2121
+ if (control.part && control.disabled !== true && typeof control.currentValue === "string" && control.currentValue.length > 0) {
2122
+ selectedParts[control.part] = control.currentValue;
2123
+ }
2124
+ }
2125
+ const expected = stateOptions.expectedValue ?? {};
2126
+ const expectedEntries = Object.entries(expected).filter((entry) => typeof entry[1] === "string" && entry[1].length > 0);
2127
+ const availableParts = new Set(controls.filter((control) => control.part && control.disabled !== true).map((control) => control.part));
2128
+ const renderedExpectedEntries = expectedEntries.filter(([part]) => availableParts.has(part));
2129
+ const unavailableParts = expectedEntries
2130
+ .filter(([part]) => !availableParts.has(part))
2131
+ .map(([part]) => part);
2132
+ const missingParts = renderedExpectedEntries
2133
+ .filter(([part]) => selectedParts[part] === undefined || selectedParts[part] === "")
2134
+ .map(([part]) => part);
2135
+ const mismatchedParts = renderedExpectedEntries
2136
+ .filter(([part, value]) => selectedParts[part] !== undefined && selectedParts[part] !== "" && selectedParts[part] !== value)
2137
+ .map(([part]) => part);
2138
+ const renderedValueAvailable = Object.keys(selectedParts).length > 0;
2139
+ return {
2140
+ fieldMatched: Boolean(root),
2141
+ selectedParts,
2142
+ ...(stateOptions.expectedValue === undefined ? {} : { expectedValue: stateOptions.expectedValue }),
2143
+ renderedValueAvailable,
2144
+ unavailableParts,
2145
+ missingParts,
2146
+ mismatchedParts,
2147
+ matched: Boolean(root) && missingParts.length === 0 && mismatchedParts.length === 0,
2148
+ controls,
2149
+ };
2150
+ }, options);
2151
+ }
2152
+ export async function waitForLiveFormNameState(page, options) {
2153
+ const timeoutMs = options.timeoutMs ?? 10_000;
2154
+ const intervalMs = options.intervalMs ?? 100;
2155
+ const startedAt = Date.now();
2156
+ let latest = await readLiveFormNameState(page, options);
2157
+ while (!latest.matched && Date.now() - startedAt < timeoutMs) {
2158
+ await delay(intervalMs);
2159
+ latest = await readLiveFormNameState(page, options);
2160
+ }
2161
+ return latest;
2162
+ }
1950
2163
  export async function readLiveFormCheckboxState(page, options) {
1951
2164
  if (!hasEvaluate(page)) {
1952
2165
  throw new Error("readLiveFormCheckboxState requires a Playwright page with evaluate().");
@@ -4242,6 +4455,88 @@ export async function setLiveFormProductValue(page, options) {
4242
4455
  (visibility?.matched ?? true),
4243
4456
  };
4244
4457
  }
4458
+ export async function setLiveFormAddressValue(page, options) {
4459
+ const payload = normalizeLiveFormAddressValue(options.value, options.current);
4460
+ const transaction = await performLiveFormFieldTransaction(page, {
4461
+ write: {
4462
+ ...(options.write ?? {}),
4463
+ target: options.target,
4464
+ value: payload,
4465
+ notify: options.write?.notify ?? true,
4466
+ },
4467
+ fieldKind: "address",
4468
+ waitForEvent: options.waitForEvent ?? true,
4469
+ dispatchDomEvents: options.dispatchDomEvents ?? "auto",
4470
+ afterQuiet: options.afterQuiet ?? { quietMs: 200, timeoutMs: 5_000 },
4471
+ ...(options.afterValidation === undefined ? {} : { afterValidation: options.afterValidation }),
4472
+ });
4473
+ const dom = await waitForLiveFormAddressState(page, {
4474
+ ...options.target,
4475
+ expectedValue: payload,
4476
+ ...(options.write?.timeoutMs === undefined ? {} : { timeoutMs: options.write.timeoutMs }),
4477
+ });
4478
+ const visibilityTargets = [
4479
+ ...(options.expectVisible ?? []).map((target) => ({ ...target, visible: true })),
4480
+ ...(options.expectHidden ?? []).map((target) => ({ ...target, visible: false })),
4481
+ ];
4482
+ const visibility = visibilityTargets.length > 0
4483
+ ? await waitForLiveFormVisibility(page, { targets: visibilityTargets })
4484
+ : undefined;
4485
+ return {
4486
+ payload,
4487
+ transaction,
4488
+ dom,
4489
+ ...(visibility ? { visibility } : {}),
4490
+ ok: transaction.write.valueMatched &&
4491
+ (transaction.event?.matched ?? true) &&
4492
+ (transaction.domDispatch ? transaction.domDispatch.matchedControlCount >= 1 : true) &&
4493
+ (transaction.quiet?.quiet ?? true) &&
4494
+ ((transaction.validation?.inlineErrors.length ?? 0) === 0) &&
4495
+ dom.matched &&
4496
+ (visibility?.matched ?? true),
4497
+ };
4498
+ }
4499
+ export async function setLiveFormNameValue(page, options) {
4500
+ const payload = normalizeLiveFormNameValue(options.value, options.current);
4501
+ const transaction = await performLiveFormFieldTransaction(page, {
4502
+ write: {
4503
+ ...(options.write ?? {}),
4504
+ target: options.target,
4505
+ value: payload,
4506
+ notify: options.write?.notify ?? true,
4507
+ },
4508
+ fieldKind: "name",
4509
+ waitForEvent: options.waitForEvent ?? true,
4510
+ dispatchDomEvents: options.dispatchDomEvents ?? "auto",
4511
+ afterQuiet: options.afterQuiet ?? { quietMs: 200, timeoutMs: 5_000 },
4512
+ ...(options.afterValidation === undefined ? {} : { afterValidation: options.afterValidation }),
4513
+ });
4514
+ const dom = await waitForLiveFormNameState(page, {
4515
+ ...options.target,
4516
+ expectedValue: payload,
4517
+ ...(options.write?.timeoutMs === undefined ? {} : { timeoutMs: options.write.timeoutMs }),
4518
+ });
4519
+ const visibilityTargets = [
4520
+ ...(options.expectVisible ?? []).map((target) => ({ ...target, visible: true })),
4521
+ ...(options.expectHidden ?? []).map((target) => ({ ...target, visible: false })),
4522
+ ];
4523
+ const visibility = visibilityTargets.length > 0
4524
+ ? await waitForLiveFormVisibility(page, { targets: visibilityTargets })
4525
+ : undefined;
4526
+ return {
4527
+ payload,
4528
+ transaction,
4529
+ dom,
4530
+ ...(visibility ? { visibility } : {}),
4531
+ ok: transaction.write.valueMatched &&
4532
+ (transaction.event?.matched ?? true) &&
4533
+ (transaction.domDispatch ? transaction.domDispatch.matchedControlCount >= 1 : true) &&
4534
+ (transaction.quiet?.quiet ?? true) &&
4535
+ ((transaction.validation?.inlineErrors.length ?? 0) === 0) &&
4536
+ dom.matched &&
4537
+ (visibility?.matched ?? true),
4538
+ };
4539
+ }
4245
4540
  export async function setLiveFormRatingValue(page, options) {
4246
4541
  const payload = normalizeLiveFormRatingValue(options.value);
4247
4542
  const value = payload.value;
@@ -4372,7 +4667,29 @@ export async function answerProgressiveLiveFormField(page, options) {
4372
4667
  ...(validationOptions ? { afterValidation: validationOptions } : {}),
4373
4668
  })
4374
4669
  : undefined;
4375
- const productTransaction = !checkboxTransaction && !choiceTransaction && !selectTransaction && !matrixTransaction && options.fieldKind === "product"
4670
+ const nameTransaction = !checkboxTransaction && !choiceTransaction && !selectTransaction && !matrixTransaction && options.fieldKind === "name"
4671
+ ? await setLiveFormNameValue(page, {
4672
+ target: options.target,
4673
+ value: options.value,
4674
+ ...(options.write === undefined ? {} : { write: options.write }),
4675
+ waitForEvent: options.waitForEvent ?? true,
4676
+ dispatchDomEvents: options.dispatchDomEvents ?? "auto",
4677
+ afterQuiet: options.afterQuiet ?? true,
4678
+ ...(validationOptions ? { afterValidation: validationOptions } : {}),
4679
+ })
4680
+ : undefined;
4681
+ const addressTransaction = !checkboxTransaction && !choiceTransaction && !selectTransaction && !matrixTransaction && !nameTransaction && options.fieldKind === "address"
4682
+ ? await setLiveFormAddressValue(page, {
4683
+ target: options.target,
4684
+ value: options.value,
4685
+ ...(options.write === undefined ? {} : { write: options.write }),
4686
+ waitForEvent: options.waitForEvent ?? true,
4687
+ dispatchDomEvents: options.dispatchDomEvents ?? "auto",
4688
+ afterQuiet: options.afterQuiet ?? true,
4689
+ ...(validationOptions ? { afterValidation: validationOptions } : {}),
4690
+ })
4691
+ : undefined;
4692
+ const productTransaction = !checkboxTransaction && !choiceTransaction && !selectTransaction && !matrixTransaction && !nameTransaction && !addressTransaction && options.fieldKind === "product"
4376
4693
  ? await setLiveFormProductValue(page, {
4377
4694
  target: options.target,
4378
4695
  value: options.value,
@@ -4383,7 +4700,7 @@ export async function answerProgressiveLiveFormField(page, options) {
4383
4700
  ...(validationOptions ? { afterValidation: validationOptions } : {}),
4384
4701
  })
4385
4702
  : undefined;
4386
- const ratingTransaction = !checkboxTransaction && !choiceTransaction && !selectTransaction && !matrixTransaction && !productTransaction && options.fieldKind === "rating"
4703
+ const ratingTransaction = !checkboxTransaction && !choiceTransaction && !selectTransaction && !matrixTransaction && !nameTransaction && !addressTransaction && !productTransaction && options.fieldKind === "rating"
4387
4704
  ? await setLiveFormRatingValue(page, {
4388
4705
  target: options.target,
4389
4706
  value: options.value,
@@ -4413,25 +4730,29 @@ export async function answerProgressiveLiveFormField(page, options) {
4413
4730
  ? selectTransaction.transaction
4414
4731
  : matrixTransaction
4415
4732
  ? matrixTransaction.transaction
4416
- : productTransaction
4417
- ? productTransaction.transaction
4418
- : ratingTransaction
4419
- ? ratingTransaction.transaction
4420
- : dateTimeTransaction
4421
- ? dateTimeTransaction.transaction
4422
- : await performLiveFormFieldTransaction(page, {
4423
- write: {
4424
- ...(options.write ?? {}),
4425
- target: options.target,
4426
- value: options.value,
4427
- notify: options.write?.notify ?? true,
4428
- },
4429
- ...(options.fieldKind ? { fieldKind: options.fieldKind } : {}),
4430
- waitForEvent: options.waitForEvent ?? true,
4431
- dispatchDomEvents: options.dispatchDomEvents ?? "auto",
4432
- afterQuiet: options.afterQuiet ?? true,
4433
- ...(validationOptions ? { afterValidation: validationOptions } : {}),
4434
- });
4733
+ : nameTransaction
4734
+ ? nameTransaction.transaction
4735
+ : addressTransaction
4736
+ ? addressTransaction.transaction
4737
+ : productTransaction
4738
+ ? productTransaction.transaction
4739
+ : ratingTransaction
4740
+ ? ratingTransaction.transaction
4741
+ : dateTimeTransaction
4742
+ ? dateTimeTransaction.transaction
4743
+ : await performLiveFormFieldTransaction(page, {
4744
+ write: {
4745
+ ...(options.write ?? {}),
4746
+ target: options.target,
4747
+ value: options.value,
4748
+ notify: options.write?.notify ?? true,
4749
+ },
4750
+ ...(options.fieldKind ? { fieldKind: options.fieldKind } : {}),
4751
+ waitForEvent: options.waitForEvent ?? true,
4752
+ dispatchDomEvents: options.dispatchDomEvents ?? "auto",
4753
+ afterQuiet: options.afterQuiet ?? true,
4754
+ ...(validationOptions ? { afterValidation: validationOptions } : {}),
4755
+ });
4435
4756
  const visibilityTargets = [
4436
4757
  ...(options.expectVisible ?? []),
4437
4758
  ...(options.expectHidden ?? []).map((target) => ({ ...target, visible: false })),
@@ -6135,8 +6456,32 @@ export const liveFormFieldRecipes = {
6135
6456
  }
6136
6457
  },
6137
6458
  }),
6138
- setNameApi: (name, internalLabel, value, options) => apiRecipeStep(name, { internalLabel }, buildLiveFormNameValue(value), options),
6139
- setAddressApi: (name, internalLabel, value, options) => apiRecipeStep(name, { internalLabel }, buildLiveFormAddressValue(value), options),
6459
+ setNameApi: (name, internalLabel, value, options = {}) => ({
6460
+ name,
6461
+ run: async (harness) => {
6462
+ await setLiveFormNameValue(harness.page, {
6463
+ target: { internalLabel },
6464
+ value,
6465
+ write: { notify: options.notify ?? true },
6466
+ waitForEvent: options.waitForEvent ?? (options.notify ?? true),
6467
+ dispatchDomEvents: options.dispatchDomEvents ?? "auto",
6468
+ afterQuiet: options.waitForQuiet ?? true,
6469
+ });
6470
+ },
6471
+ }),
6472
+ setAddressApi: (name, internalLabel, value, options = {}) => ({
6473
+ name,
6474
+ run: async (harness) => {
6475
+ await setLiveFormAddressValue(harness.page, {
6476
+ target: { internalLabel },
6477
+ value,
6478
+ write: { notify: options.notify ?? true },
6479
+ waitForEvent: options.waitForEvent ?? (options.notify ?? true),
6480
+ dispatchDomEvents: options.dispatchDomEvents ?? "auto",
6481
+ afterQuiet: options.waitForQuiet ?? true,
6482
+ });
6483
+ },
6484
+ }),
6140
6485
  setChoiceApi: (name, internalLabel, value, options = {}) => ({
6141
6486
  name,
6142
6487
  run: async (harness) => {