touchpress 0.1.1 → 0.1.2

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.
@@ -1,2 +1,2 @@
1
- import { A as normalizeText, C as parseScreen, D as deviceNameForSlot, E as TOUCHPRESS_DEFAULTS, M as TouchpressError, O as parseDeviceOptions, S as silentSink, T as resolve, a as sizeOf, d as createScrollSearch, f as directionToward, g as evaluate, h as describeCheck, i as relativeTo, j as textMatch, k as describeQuery, l as captureEvidence, m as probe, n as compareScreenshot, o as toPixelBox, p as formatFailure, r as cropScreenshot, t as preflight, u as createDevice, v as openSession, w as renderScreen, x as renderTitle, y as sessionName } from "../preflight-aUba9u1k.mjs";
1
+ import { A as normalizeText, C as parseScreen, D as deviceNameForSlot, E as TOUCHPRESS_DEFAULTS, M as TouchpressError, O as parseDeviceOptions, S as silentSink, T as resolve, a as sizeOf, d as createScrollSearch, f as directionToward, g as evaluate, h as describeCheck, i as relativeTo, j as textMatch, k as describeQuery, l as captureEvidence, m as probe, n as compareScreenshot, o as toPixelBox, p as formatFailure, r as cropScreenshot, t as preflight, u as createDevice, v as openSession, w as renderScreen, x as renderTitle, y as sessionName } from "../preflight-CWeJYtS7.mjs";
2
2
  export { TOUCHPRESS_DEFAULTS, TouchpressError, captureEvidence, compareScreenshot, createDevice, createScrollSearch, cropScreenshot, describeCheck, describeQuery, deviceNameForSlot, directionToward, evaluate, formatFailure, normalizeText, openSession, parseDeviceOptions, parseScreen, preflight, probe, relativeTo, renderScreen, renderTitle, resolve, sessionName, silentSink, sizeOf, textMatch, toPixelBox };
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { C as parseScreen, E as TOUCHPRESS_DEFAULTS, M as TouchpressError, O as parseDeviceOptions, S as silentSink, T as resolve, _ as createQueue, a as sizeOf, b as sleep, c as createClient, i as relativeTo, j as textMatch, l as captureEvidence, n as compareScreenshot, o as toPixelBox, r as cropScreenshot, s as createAgentDeviceDriver, t as preflight, u as createDevice, v as openSession, w as renderScreen, x as renderTitle } from "./preflight-aUba9u1k.mjs";
1
+ import { C as parseScreen, E as TOUCHPRESS_DEFAULTS, M as TouchpressError, O as parseDeviceOptions, S as silentSink, T as resolve, _ as createQueue, a as sizeOf, b as sleep, c as createClient, i as relativeTo, j as textMatch, l as captureEvidence, n as compareScreenshot, o as toPixelBox, r as cropScreenshot, s as createAgentDeviceDriver, t as preflight, u as createDevice, v as openSession, w as renderScreen, x as renderTitle } from "./preflight-CWeJYtS7.mjs";
2
2
  import { expect as expect$1, test as test$1 } from "@playwright/test";
3
3
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
4
4
  import { dirname } from "node:path";
@@ -419,7 +419,9 @@ const IOS_ROLES = {
419
419
  * Native 0.86 sample app, except the trailing widget block, which this app never
420
420
  * renders and stays a plausible guess. `android.view.ViewGroup` is what every
421
421
  * React Native `View` reports, testID containers included, so it is stated here
422
- * rather than left to the `other` fall-through in `roleOf`.
422
+ * rather than left to the `other` fall-through in `roleOf`. A password field is
423
+ * an `EditText` too. agent-device 0.20.10 parses the tree's `password` flag but
424
+ * does not emit it, so once it does, map it to `secure-text-field` here.
423
425
  */
424
426
  const ANDROID_ROLES = {
425
427
  "android.widget.Button": "button",
@@ -1393,27 +1395,37 @@ function ambiguous(locator, nodes, screen) {
1393
1395
  });
1394
1396
  }
1395
1397
  function confirmationOf(role, write) {
1398
+ const length = write.text.length;
1396
1399
  if (role === "secure-text-field") return {
1397
1400
  kind: "mask",
1398
- length: write.text.length
1401
+ length
1399
1402
  };
1400
1403
  const value = normalizeText(write.text);
1401
1404
  return write.secret ? {
1402
1405
  kind: "secret",
1403
- value
1406
+ value,
1407
+ length
1404
1408
  } : {
1405
1409
  kind: "open",
1406
- value
1410
+ value,
1411
+ length
1407
1412
  };
1408
1413
  }
1409
1414
  function holds(confirmation, actual) {
1410
1415
  switch (confirmation.kind) {
1411
- case "mask": return actual.length === confirmation.length && new Set(actual).size <= 1;
1416
+ case "mask": return isMask(actual, confirmation.length);
1412
1417
  case "secret":
1413
- case "open": return actual === confirmation.value;
1418
+ case "open": return actual === confirmation.value || isMask(actual, confirmation.length);
1414
1419
  default: throw new Error(`unhandled confirmation ${JSON.stringify(confirmation)}`);
1415
1420
  }
1416
1421
  }
1422
+ /**
1423
+ * Requiring one repeated character stops a placeholder of the right length, which
1424
+ * is what an untouched password field reports, from passing as a landed write.
1425
+ */
1426
+ function isMask(actual, length) {
1427
+ return actual.length === length && new Set(actual).size <= 1;
1428
+ }
1417
1429
  function expectedOf(confirmation) {
1418
1430
  switch (confirmation.kind) {
1419
1431
  case "mask": return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "touchpress",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "End-to-end testing for mobile apps.",
5
5
  "homepage": "https://github.com/wobsoriano/touchpress#readme",
6
6
  "bugs": {