autokap 1.9.10 → 2.0.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.
@@ -100,6 +100,17 @@ export declare class WebPlaywrightLocal implements RuntimeAdapter {
100
100
  value?: string;
101
101
  index?: number;
102
102
  }): Promise<void>;
103
+ selectOptionByTarget(opts: ResolveOptions, option: {
104
+ label?: string;
105
+ value?: string;
106
+ index?: number;
107
+ }): Promise<void>;
108
+ checkByTarget(opts: ResolveOptions, checked: boolean, actionOpts?: {
109
+ onClick?: (timestampMs: number) => void;
110
+ }): Promise<void>;
111
+ doubleClickByTarget(opts: ResolveOptions, actionOpts?: {
112
+ onClick?: (timestampMs: number) => void;
113
+ }): Promise<void>;
103
114
  check(selector: string, checked: boolean, actionOpts?: {
104
115
  onClick?: (timestampMs: number) => void;
105
116
  }): Promise<void>;
@@ -117,6 +128,7 @@ export declare class WebPlaywrightLocal implements RuntimeAdapter {
117
128
  dx: number;
118
129
  dy: number;
119
130
  };
131
+ locale?: string;
120
132
  }): Promise<void>;
121
133
  cloneElement(opts: {
122
134
  sourceSelector: string;
@@ -892,6 +892,57 @@ export class WebPlaywrightLocal {
892
892
  optionIndex: option.index,
893
893
  });
894
894
  }
895
+ async selectOptionByTarget(opts, option) {
896
+ const page = await this.browser.currentPage;
897
+ const resolved = await resolveTarget(page, opts);
898
+ if (!resolved) {
899
+ throw new Error(`cannot find target for select: ${describeResolveOptions(opts)}`);
900
+ }
901
+ await this.moveClipCursorToLocator(resolved.locator);
902
+ const values = option.label !== undefined
903
+ ? { label: option.label }
904
+ : option.value !== undefined
905
+ ? { value: option.value }
906
+ : { index: option.index ?? 0 };
907
+ await resolved.locator.selectOption(values, { timeout: 5000 });
908
+ }
909
+ async checkByTarget(opts, checked, actionOpts) {
910
+ const page = await this.browser.currentPage;
911
+ const resolved = await resolveTarget(page, opts);
912
+ if (!resolved) {
913
+ throw new Error(`cannot find target for check: ${describeResolveOptions(opts)}`);
914
+ }
915
+ const target = await this.moveClipCursorToLocator(resolved.locator);
916
+ const position = target
917
+ ? await this.relativeClickPosition(resolved.locator, target)
918
+ : null;
919
+ const checkOpts = { timeout: 5000, ...(position ? { position } : {}) };
920
+ const dispatchedAt = Date.now();
921
+ if (checked) {
922
+ await resolved.locator.check(checkOpts);
923
+ }
924
+ else {
925
+ await resolved.locator.uncheck(checkOpts);
926
+ }
927
+ await this.reportClickSfxTimestamps(page, dispatchedAt, actionOpts?.onClick);
928
+ }
929
+ async doubleClickByTarget(opts, actionOpts) {
930
+ const page = await this.browser.currentPage;
931
+ const resolved = await resolveTarget(page, opts);
932
+ if (!resolved) {
933
+ throw new Error(`cannot find target for double-click: ${describeResolveOptions(opts)}`);
934
+ }
935
+ const target = await this.moveClipCursorToLocator(resolved.locator);
936
+ const position = target
937
+ ? await this.relativeClickPosition(resolved.locator, target)
938
+ : null;
939
+ const dispatchedAt = Date.now();
940
+ await resolved.locator.dblclick({
941
+ timeout: 5000,
942
+ ...(position ? { position } : {}),
943
+ });
944
+ await this.reportClickSfxTimestamps(page, dispatchedAt, actionOpts?.onClick);
945
+ }
895
946
  async check(selector, checked, actionOpts) {
896
947
  const page = await this.browser.currentPage;
897
948
  const locator = page.locator(selector).first();
@@ -932,6 +983,7 @@ export class WebPlaywrightLocal {
932
983
  selector: opts.selector,
933
984
  target: opts.target,
934
985
  selectorAlternates: opts.selectorAlternates,
986
+ locale: opts.locale,
935
987
  });
936
988
  if (!sourceResolved) {
937
989
  throw new Error(`cannot find drag source: ${describeResolveOptions({ selector: opts.selector, target: opts.target })}`);
@@ -952,6 +1004,7 @@ export class WebPlaywrightLocal {
952
1004
  selector: opts.toSelector,
953
1005
  target: opts.toTarget,
954
1006
  selectorAlternates: opts.toSelectorAlternates,
1007
+ locale: opts.locale,
955
1008
  });
956
1009
  if (!destResolved) {
957
1010
  throw new Error(`cannot find drag destination: ${describeResolveOptions({ selector: opts.toSelector, target: opts.toTarget })}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autokap",
3
- "version": "1.9.10",
3
+ "version": "2.0.1",
4
4
  "description": "AI-powered CLI tool for capturing clean screenshots of websites",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",