gestament 0.1.0 → 0.2.0

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.
Files changed (36) hide show
  1. package/dist/element.d.ts +2 -2
  2. package/dist/errors.d.ts +2 -2
  3. package/dist/generated/packageMetadata.d.ts +4 -4
  4. package/dist/gestament-config.d.ts +2 -2
  5. package/dist/gestament-tray-host.cjs +1 -1
  6. package/dist/gestament-tray-host.d.ts +2 -2
  7. package/dist/gestament-tray-host.mjs +1 -1
  8. package/dist/gestament-xvfb-worker.d.ts +2 -2
  9. package/dist/gestament-xvfb.d.ts +2 -2
  10. package/dist/index.cjs +74 -1
  11. package/dist/index.cjs.map +1 -1
  12. package/dist/index.d.ts +2 -2
  13. package/dist/index.mjs +74 -1
  14. package/dist/index.mjs.map +1 -1
  15. package/dist/launchGtkApp.d.ts +2 -2
  16. package/dist/launchGtkApp.d.ts.map +1 -1
  17. package/dist/{native-DAhTiLnf.js → native-DUeVYIBs.js} +2 -2
  18. package/dist/{native-DAhTiLnf.js.map → native-DUeVYIBs.js.map} +1 -1
  19. package/dist/{native-BRnrsqMn.cjs → native-ie_XIt1J.cjs} +4 -4
  20. package/dist/{native-BRnrsqMn.cjs.map → native-ie_XIt1J.cjs.map} +1 -1
  21. package/dist/native.d.ts +2 -2
  22. package/dist/testing.d.ts +2 -2
  23. package/dist/tray.d.ts +2 -2
  24. package/dist/types.d.ts +22 -2
  25. package/dist/types.d.ts.map +1 -1
  26. package/package.json +8 -8
  27. package/prebuilds/linux-arm/gtk3/node.napi.armv7.glibc.node +0 -0
  28. package/prebuilds/linux-arm/gtk4/node.napi.armv7.glibc.node +0 -0
  29. package/prebuilds/linux-arm64/gtk3/node.napi.glibc.node +0 -0
  30. package/prebuilds/linux-arm64/gtk4/node.napi.glibc.node +0 -0
  31. package/prebuilds/linux-ia32/gtk3/node.napi.glibc.node +0 -0
  32. package/prebuilds/linux-ia32/gtk4/node.napi.glibc.node +0 -0
  33. package/prebuilds/linux-riscv64/gtk3/node.napi.glibc.node +0 -0
  34. package/prebuilds/linux-riscv64/gtk4/node.napi.glibc.node +0 -0
  35. package/prebuilds/linux-x64/gtk3/node.napi.glibc.node +0 -0
  36. package/prebuilds/linux-x64/gtk4/node.napi.glibc.node +0 -0
package/dist/element.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  /*!
2
2
  * name: gestament
3
- * version: 0.1.0
3
+ * version: 0.2.0
4
4
  * description: TypeScript based test driver for GTK
5
5
  * author: Kouji Matsui (@kekyo@mi.kekyo.net)
6
6
  * license: MIT
7
7
  * repository.url: https://github.com/kekyo/gestament.git
8
- * git.commit.hash: 2e2298272ff7a9fff6945b8d87de6223ac4d7847
8
+ * git.commit.hash: 82eaccb340f7304524549a1f95888845deb4a156
9
9
  */
10
10
 
11
11
  import { NativeElementHandle } from './native.js';
package/dist/errors.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  /*!
2
2
  * name: gestament
3
- * version: 0.1.0
3
+ * version: 0.2.0
4
4
  * description: TypeScript based test driver for GTK
5
5
  * author: Kouji Matsui (@kekyo@mi.kekyo.net)
6
6
  * license: MIT
7
7
  * repository.url: https://github.com/kekyo/gestament.git
8
- * git.commit.hash: 2e2298272ff7a9fff6945b8d87de6223ac4d7847
8
+ * git.commit.hash: 82eaccb340f7304524549a1f95888845deb4a156
9
9
  */
10
10
 
11
11
  import { GtkAutomationError } from './types.js';
@@ -1,18 +1,18 @@
1
1
  /*!
2
2
  * name: gestament
3
- * version: 0.1.0
3
+ * version: 0.2.0
4
4
  * description: TypeScript based test driver for GTK
5
5
  * author: Kouji Matsui (@kekyo@mi.kekyo.net)
6
6
  * license: MIT
7
7
  * repository.url: https://github.com/kekyo/gestament.git
8
- * git.commit.hash: 2e2298272ff7a9fff6945b8d87de6223ac4d7847
8
+ * git.commit.hash: 82eaccb340f7304524549a1f95888845deb4a156
9
9
  */
10
10
 
11
11
  export declare const name = "gestament";
12
- export declare const version = "0.1.0";
12
+ export declare const version = "0.2.0";
13
13
  export declare const description = "TypeScript based test driver for GTK";
14
14
  export declare const author = "Kouji Matsui (@kekyo@mi.kekyo.net)";
15
15
  export declare const license = "MIT";
16
16
  export declare const repository_url = "https://github.com/kekyo/gestament.git";
17
- export declare const git_commit_hash = "2e2298272ff7a9fff6945b8d87de6223ac4d7847";
17
+ export declare const git_commit_hash = "82eaccb340f7304524549a1f95888845deb4a156";
18
18
  //# sourceMappingURL=packageMetadata.d.ts.map
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  /*!
3
3
  * name: gestament
4
- * version: 0.1.0
4
+ * version: 0.2.0
5
5
  * description: TypeScript based test driver for GTK
6
6
  * author: Kouji Matsui (@kekyo@mi.kekyo.net)
7
7
  * license: MIT
8
8
  * repository.url: https://github.com/kekyo/gestament.git
9
- * git.commit.hash: 2e2298272ff7a9fff6945b8d87de6223ac4d7847
9
+ * git.commit.hash: 82eaccb340f7304524549a1f95888845deb4a156
10
10
  */
11
11
 
12
12
  export interface GestamentConfigOutput {
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
- const native = require("./native-BRnrsqMn.cjs");
3
+ const native = require("./native-ie_XIt1J.cjs");
4
4
  try {
5
5
  native.nativeRunTrayHost();
6
6
  } catch (error) {
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  /*!
3
3
  * name: gestament
4
- * version: 0.1.0
4
+ * version: 0.2.0
5
5
  * description: TypeScript based test driver for GTK
6
6
  * author: Kouji Matsui (@kekyo@mi.kekyo.net)
7
7
  * license: MIT
8
8
  * repository.url: https://github.com/kekyo/gestament.git
9
- * git.commit.hash: 2e2298272ff7a9fff6945b8d87de6223ac4d7847
9
+ * git.commit.hash: 82eaccb340f7304524549a1f95888845deb4a156
10
10
  */
11
11
 
12
12
  export {};
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { S as nativeRunTrayHost } from "./native-DAhTiLnf.js";
2
+ import { S as nativeRunTrayHost } from "./native-DUeVYIBs.js";
3
3
  try {
4
4
  nativeRunTrayHost();
5
5
  } catch (error) {
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  /*!
3
3
  * name: gestament
4
- * version: 0.1.0
4
+ * version: 0.2.0
5
5
  * description: TypeScript based test driver for GTK
6
6
  * author: Kouji Matsui (@kekyo@mi.kekyo.net)
7
7
  * license: MIT
8
8
  * repository.url: https://github.com/kekyo/gestament.git
9
- * git.commit.hash: 2e2298272ff7a9fff6945b8d87de6223ac4d7847
9
+ * git.commit.hash: 82eaccb340f7304524549a1f95888845deb4a156
10
10
  */
11
11
 
12
12
  export {};
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  /*!
3
3
  * name: gestament
4
- * version: 0.1.0
4
+ * version: 0.2.0
5
5
  * description: TypeScript based test driver for GTK
6
6
  * author: Kouji Matsui (@kekyo@mi.kekyo.net)
7
7
  * license: MIT
8
8
  * repository.url: https://github.com/kekyo/gestament.git
9
- * git.commit.hash: 2e2298272ff7a9fff6945b8d87de6223ac4d7847
9
+ * git.commit.hash: 82eaccb340f7304524549a1f95888845deb4a156
10
10
  */
11
11
 
12
12
  export {};
package/dist/index.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const node_child_process = require("node:child_process");
4
- const native = require("./native-BRnrsqMn.cjs");
4
+ const native = require("./native-ie_XIt1J.cjs");
5
5
  /*!
6
6
  * name: async-primitives
7
7
  * version: 1.7.0
@@ -852,6 +852,33 @@ const assertNonNegativeIndex = (name, index) => {
852
852
  );
853
853
  }
854
854
  };
855
+ const parseElementPath = (path) => {
856
+ const segments = path.split(/[.:;,]/u);
857
+ const id = segments[0];
858
+ if (id === void 0 || id.length === 0) {
859
+ throw native.createGtkInvalidArgumentError(
860
+ "path must start with an accessible id."
861
+ );
862
+ }
863
+ const childIndexes = [];
864
+ for (let index = 1; index < segments.length; index += 1) {
865
+ const segment = segments[index];
866
+ if (segment === void 0 || !/^\d+$/u.test(segment)) {
867
+ throw native.createGtkInvalidArgumentError(
868
+ "path child indexes must be non-negative decimal integers."
869
+ );
870
+ }
871
+ const childIndex = Number(segment);
872
+ if (!Number.isSafeInteger(childIndex)) {
873
+ throw native.createGtkInvalidArgumentError(
874
+ "path child indexes must be safe non-negative integers."
875
+ );
876
+ }
877
+ childIndexes.push(childIndex);
878
+ }
879
+ return { id, childIndexes };
880
+ };
881
+ const isPathChildContainer = (element) => "childAt" in element;
855
882
  const waitForAtspiReady = async (state, command, timeoutMs, startedAt) => {
856
883
  if (state.atspiReady) {
857
884
  return assertProcessRunning(state, command);
@@ -946,6 +973,50 @@ const launchGtkApp = (appPath, args, options) => {
946
973
  }
947
974
  return element;
948
975
  };
976
+ const findByPath = async (path) => {
977
+ const parsedPath = parseElementPath(path);
978
+ const startedAt = Date.now();
979
+ await waitForAtspiReady(state, appPath, _timeoutMs, startedAt);
980
+ while (Date.now() - startedAt <= _timeoutMs) {
981
+ const processId = assertProcessRunning(state, appPath);
982
+ try {
983
+ const handle = native.nativeFindById(processId, parsedPath.id);
984
+ if (handle !== void 0) {
985
+ let element = createGtkElement(handle);
986
+ let resolved = true;
987
+ for (const childIndex of parsedPath.childIndexes) {
988
+ if (!isPathChildContainer(element)) {
989
+ resolved = false;
990
+ break;
991
+ }
992
+ const child2 = await element.childAt(childIndex);
993
+ if (child2 === void 0) {
994
+ resolved = false;
995
+ break;
996
+ }
997
+ element = child2;
998
+ }
999
+ if (resolved) {
1000
+ return element;
1001
+ }
1002
+ }
1003
+ } catch (error) {
1004
+ throw native.normalizeNativeError(error);
1005
+ }
1006
+ await delay(50);
1007
+ }
1008
+ assertProcessRunning(state, appPath);
1009
+ return void 0;
1010
+ };
1011
+ const getByPath = async (path) => {
1012
+ const element = await findByPath(path);
1013
+ if (element === void 0) {
1014
+ throw native.createGtkElementNotFoundError(
1015
+ `Element path was not found: ${path}`
1016
+ );
1017
+ }
1018
+ return element;
1019
+ };
949
1020
  const findTrayItem = async (selector) => {
950
1021
  const startedAt = Date.now();
951
1022
  while (Date.now() - startedAt <= _timeoutMs) {
@@ -989,7 +1060,9 @@ const launchGtkApp = (appPath, args, options) => {
989
1060
  }
990
1061
  },
991
1062
  findById,
1063
+ findByPath,
992
1064
  getById,
1065
+ getByPath,
993
1066
  windowAt: async (index) => {
994
1067
  assertNonNegativeIndex("index", index);
995
1068
  const processId = await waitForAtspiReady(