@ai-ecoverse/slicc-browsers 1.20.1 → 1.20.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.
@@ -198,12 +198,45 @@ async function sendPair(client, session, method, down, up) {
198
198
  return [first, await outcome(client.send(method, up, session))];
199
199
  }
200
200
 
201
- async function inputMethods(client, session, methods, point, missing, side) {
201
+ const POINTER_METHODS = new Set([
202
+ 'Input.dispatchMouseEvent',
203
+ 'Input.dispatchTouchEvent',
204
+ 'Input.dispatchDragEvent',
205
+ 'Input.emulateTouchFromMouseEvent',
206
+ 'Input.synthesizePinchGesture',
207
+ 'Input.synthesizeScrollGesture',
208
+ 'Input.synthesizeTapGesture',
209
+ ]);
210
+
211
+ async function pageFocus(reader, observer) {
212
+ await observe(
213
+ reader,
214
+ observer,
215
+ '(() => { window.focus(); const i = document.getElementById("typed"); if (i) i.focus(); return true; })()'
216
+ );
217
+ }
218
+
219
+ async function inputMethods(
220
+ client,
221
+ session,
222
+ methods,
223
+ point,
224
+ missing,
225
+ side,
226
+ reader,
227
+ observer,
228
+ mode
229
+ ) {
202
230
  const results = {};
203
231
  const { x, y } = point;
204
232
  const drag = { items: [], files: [], dragOperationsMask: 1 };
205
- for (const method of methods) {
233
+ const ordered = [
234
+ ...methods.filter((method) => method !== 'Input.dispatchKeyEvent'),
235
+ ...methods.filter((method) => method === 'Input.dispatchKeyEvent'),
236
+ ];
237
+ for (const method of ordered) {
206
238
  const name = method.slice('Input.'.length);
239
+ if (mode !== 'focused' && POINTER_METHODS.has(method)) await pageFocus(reader, observer);
207
240
  let outs;
208
241
  if (method === 'Input.dispatchKeyEvent')
209
242
  outs = [
@@ -833,7 +866,17 @@ async function driveInput(client, reader, page, observer, inputList, mode, frame
833
866
  await refocus();
834
867
  const typed = await key(client, reader, page, observer, refocus, mode !== 'focused');
835
868
  await refocus();
836
- const inputs = await inputMethods(client, page, inputList, point, missing, side);
869
+ const inputs = await inputMethods(
870
+ client,
871
+ page,
872
+ inputList,
873
+ point,
874
+ missing,
875
+ side,
876
+ reader,
877
+ observer,
878
+ mode
879
+ );
837
880
  await refocus();
838
881
  const focusedKey = await outcome(
839
882
  client.send('Input.dispatchKeyEvent', { type: 'keyDown', key: 'a', code: 'KeyA' }, page)
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
- "setVersion": "1.20.1",
3
+ "setVersion": "1.20.2",
4
4
  "sources": [
5
5
  {
6
6
  "repo": "ai-ecoverse/slicc-cli",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-ecoverse/slicc-browsers",
3
- "version": "1.20.1",
3
+ "version": "1.20.2",
4
4
  "description": "SLICC's shared browser catalog, JSON schemas and discovery conformance corpus",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -84,7 +84,7 @@
84
84
  "test:unit:guard": "mkdir -p coverage/unit && node --experimental-vm-modules --no-warnings --experimental-test-coverage --test --test-concurrency=1 --test-coverage-include=guard-runner.mjs --test-coverage-include=guard-driver.mjs --test-coverage-include=extension-frame.mjs --test-coverage-include=fixture-server.mjs --test-coverage-include=fixture-client.mjs --test-coverage-include=observer-target.mjs --test-coverage-include=frame-read.mjs --test-coverage-include=bfcache-restore.mjs --test-coverage-include=protected-error-page.mjs --test-coverage-include=unparseable-url.mjs --test-coverage-include=scripts/browser-runner.mjs --test-coverage-include=scripts/validate.mjs --test-reporter=lcov --test-reporter-destination=coverage/unit/guard.lcov test/unit/guard-*.test.mjs && slicc-diff-cover coverage/unit/guard.lcov"
85
85
  },
86
86
  "devDependencies": {
87
- "@ai-ecoverse/slicc-cdp": "1.45.2",
87
+ "@ai-ecoverse/slicc-cdp": "1.46.1",
88
88
  "@ai-ecoverse/slicc-shared-web": "2.13.10",
89
89
  "@biomejs/biome": "2.6.4",
90
90
  "ajv": "8.20.0",