mirror of
https://github.com/getpaseo/paseo.git
synced 2026-10-30 05:02:58 +00:00
The wide sidebar reserved only the top safe area, leaving its footer under Android navigation UI. Apply the existing bottom inset to the same interior and add a native geometry regression check. Co-authored-by: paseo-bot[bot] <266920839+paseo-bot[bot]@users.noreply.github.com>
41 lines
1.7 KiB
JavaScript
41 lines
1.7 KiB
JavaScript
// Open a connected host with the wide sidebar visible, keyboard closed, and
|
|
// three-button navigation enabled on an Android tablet. Run against a fresh build:
|
|
// node packages/app/e2e/mobile/sidebar-system-insets/android.mjs <session> <adb-serial>
|
|
import assert from "node:assert/strict";
|
|
import { execFileSync } from "node:child_process";
|
|
|
|
const [, , session, serial] = process.argv;
|
|
assert(session && serial, "Pass the agent-device session and adb serial");
|
|
const windowState = execFileSync("adb", ["-s", serial, "shell", "dumpsys", "window"], {
|
|
encoding: "utf8",
|
|
timeout: 10_000,
|
|
});
|
|
const navBar = windowState.match(/type=navigationBars frame=\[0,(\d+)\]\[\d+,\d+\] visible=true/);
|
|
assert(navBar, "A visible bottom navigation bar is required");
|
|
assert(!/type=ime .*visible=true/.test(windowState), "Close the keyboard first");
|
|
const navigationTop = Number(navBar[1]);
|
|
const { data } = JSON.parse(
|
|
execFileSync("agent-device", ["snapshot", "--raw", "--json", "--session", session], {
|
|
encoding: "utf8",
|
|
timeout: 60_000,
|
|
}),
|
|
);
|
|
const focusedApp = windowState.match(/mCurrentFocus=.*? u\d+ ([^/\s]+)\//)?.[1];
|
|
assert.equal(
|
|
focusedApp,
|
|
data.appBundleId,
|
|
"Snapshot must belong to the focused app on this device",
|
|
);
|
|
for (const id of [
|
|
"sidebar-add-project",
|
|
"sidebar-hosts-trigger",
|
|
"sidebar-help",
|
|
"sidebar-settings",
|
|
]) {
|
|
const button = data.nodes.find((node) => node.identifier === id);
|
|
assert(button?.rect, `${id} must be visible above the system navigation bar`);
|
|
const bottom = button.rect.y + button.rect.height;
|
|
assert(bottom <= navigationTop, `${id} ends at ${bottom}, below navigation top ${navigationTop}`);
|
|
console.log(`PASS: ${id} bottom=${bottom}, navigationTop=${navigationTop}`);
|
|
}
|