Everything written this session that has not been through the device: rounds 43 to 48 (each patch adversarially verified, 43's transient-notice expectation fixed), a partial round 49, the pipeline scripts, the Android Auto design and the icon comparison mock. Also the two harness changes that were never A/B'd — adaptive waits, which may only shorten a declared wait and never lengthen it, and a ship that runs the mock walk and the deploy at the same time. The A/B and its 255-step baseline are in handoff/tools; main stays at what the phone has actually walked.
41 lines
2.4 KiB
Plaintext
41 lines
2.4 KiB
Plaintext
/* a drag, as the events a finger sends: press, hold past the action's own
|
|
320ms, walk down (or up) to just past the target row's middle, let go.
|
|
Both rows are measured BEFORE the press, because the action takes its
|
|
own snapshot at the lift and that is the geometry it will compare
|
|
against. Returns false when the list is too short to drag — a real
|
|
library is not obliged to hold three rows — so a thin walk says so in
|
|
its expectation rather than dying here. cdp.evaluate awaits promises. */
|
|
window.__drag = function (sel, from, to, holdMs) {
|
|
var rows = document.querySelectorAll(sel);
|
|
var a = rows[from], b = rows[to];
|
|
if (rows.length < 2 || !a || !b) return false;
|
|
var ra = a.getBoundingClientRect(), rb = b.getBoundingClientRect();
|
|
var x = Math.round(ra.left + Math.min(40, ra.width / 2));
|
|
var y0 = Math.round(ra.top + ra.height / 2);
|
|
var y1 = Math.round(rb.top + rb.height / 2 + (to > from ? 4 : -4));
|
|
function ev(type, cy) {
|
|
a.dispatchEvent(new PointerEvent(type, { bubbles: true, cancelable: true, composed: true, pointerId: 7, pointerType: 'touch', isPrimary: true, button: 0, buttons: type === 'pointerup' ? 0 : 1, clientX: x, clientY: cy }));
|
|
}
|
|
var nap = function (ms) { return new Promise(function (r) { setTimeout(r, ms); }); };
|
|
return (async function () {
|
|
ev('pointerdown', y0);
|
|
await nap(holdMs || 420);
|
|
for (var i = 1; i <= 8; i++) { ev('pointermove', Math.round(y0 + (y1 - y0) * (i / 8))); await nap(24); }
|
|
await nap(60);
|
|
ev('pointerup', y1);
|
|
return true;
|
|
})();
|
|
};
|
|
/* the other half of the same gesture: pressed and released without moving,
|
|
which is still the row's sheet */
|
|
window.__hold = function (sel, i, holdMs) {
|
|
var a = document.querySelectorAll(sel)[i || 0];
|
|
if (!a) throw new Error('no row to hold for ' + sel);
|
|
var r = a.getBoundingClientRect();
|
|
var x = Math.round(r.left + Math.min(40, r.width / 2)), y = Math.round(r.top + r.height / 2);
|
|
function ev(type) {
|
|
a.dispatchEvent(new PointerEvent(type, { bubbles: true, cancelable: true, composed: true, pointerId: 8, pointerType: 'touch', isPrimary: true, button: 0, buttons: type === 'pointerup' ? 0 : 1, clientX: x, clientY: y }));
|
|
}
|
|
return new Promise(function (res) { ev('pointerdown'); setTimeout(function () { ev('pointerup'); res(true); }, holdMs || 420); });
|
|
};
|