Fix wallpaper transparency, Recents setup guide, and drawer animation
This commit is contained in:
1 parent
2fa7bd745b
commit
216c80252d
14 files changed
+474
-86
No files matched your search
+62
-7
@@ -28,6 +28,7 @@ const RELEASE = JSON.stringify({ tag_name: "build-9", assets: [
|
||||
p.on("pageerror", (e) => { console.error("page error:", e.message); process.exitCode = 1; });
|
||||
await p.addInitScript((release) => {
|
||||
window.__calls = [];
|
||||
window.__recentsEnabled = true;
|
||||
const rec = (n) => (...a) => { window.__calls.push([n, ...a]); };
|
||||
const disc = "data:image/svg+xml," + encodeURIComponent("<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'><circle cx='4' cy='4' r='4' fill='red'/></svg>");
|
||||
window.Android = {
|
||||
@@ -38,7 +39,11 @@ const RELEASE = JSON.stringify({ tag_name: "build-9", assets: [
|
||||
widgetLimits: () => JSON.stringify({ w: 110, minW: 64, minH: 64, maxW: 0, maxH: 0, h: true, v: true }),
|
||||
loadIcons: (json) => { rec("loadIcons")(json); const o = {}; for (const k of JSON.parse(json)) o[k] = disc; setTimeout(() => window.launcher.icons(o), 0); },
|
||||
haptic: rec("haptic"), showKeyboard: rec("showKeyboard"), hideKeyboard: rec("hideKeyboard"),
|
||||
openSettings: rec("openSettings"), pickWallpaper: rec("pickWallpaper"), openRecents: rec("openRecents"),
|
||||
openSettings: rec("openSettings"), pickWallpaper: rec("pickWallpaper"),
|
||||
recentsEnabled: () => !!window.__recentsEnabled,
|
||||
openRecents: () => { rec("openRecents")(); return !!window.__recentsEnabled; },
|
||||
openAccessibilitySettings: rec("openAccessibilitySettings"),
|
||||
openSelfAppInfo: rec("openSelfAppInfo"),
|
||||
httpGet: (url, tag) => { rec("httpGet")(url, tag);
|
||||
setTimeout(() => window.launcher.httpResult(tag, true, url.endsWith("/latest") ? release : JSON.stringify({ versionCode: 9, commit: "abc" })), 0); },
|
||||
installApk: rec("installApk"), installedVersion: () => 5, declinedVersion: () => -1,
|
||||
@@ -56,6 +61,14 @@ const RELEASE = JSON.stringify({ tag_name: "build-9", assets: [
|
||||
await p.reload();
|
||||
await p.waitForSelector(".hint");
|
||||
assert.ok(!(await p.evaluate(() => document.documentElement.classList.contains("demo"))), "no demo backdrop on a phone");
|
||||
const bg = await p.evaluate(() => ({
|
||||
htmlColor: getComputedStyle(document.documentElement).backgroundColor,
|
||||
htmlImage: getComputedStyle(document.documentElement).backgroundImage,
|
||||
bodyColor: getComputedStyle(document.body).backgroundColor,
|
||||
}));
|
||||
assert.equal(bg.htmlColor, "rgba(0, 0, 0, 0)", "html background is transparent on Android");
|
||||
assert.equal(bg.bodyColor, "rgba(0, 0, 0, 0)", "body background is transparent on Android");
|
||||
assert.equal(bg.htmlImage, "none", "no demo gradient on Android");
|
||||
|
||||
// on start the page checks for an update: release API, then version.json, then installs build 9 over 5
|
||||
await p.waitForFunction(() => window.__calls.some((c) => c[0] === "installApk"));
|
||||
@@ -64,10 +77,17 @@ const RELEASE = JSON.stringify({ tag_name: "build-9", assets: [
|
||||
assert.deepEqual((await calls("installApk"))[0].slice(1), ["https://x/a.apk", 9]);
|
||||
assert.equal(await p.textContent(".notice"), "Downloading launcher update (build 9)…");
|
||||
|
||||
// app icons are pre-warmed right after apps.json loads, before opening the drawer
|
||||
await p.waitForFunction(() => window.__calls.some((c) => c[0] === "loadIcons"));
|
||||
assert.ok((await calls("loadIcons")).length > 0, "icons are pre-warmed before opening the drawer");
|
||||
|
||||
// the drawer asks the shell for icons (batched, by key) and fills the images from its answer
|
||||
await p.evaluate(() => document.body.dispatchEvent(Object.assign(new Event("x"), {})));
|
||||
await longpress(".hint");
|
||||
await p.evaluate(() => { document.querySelector(".sheet-overlay").__tag = "overlay"; });
|
||||
await p.click(".sheet-item >> text=Add apps"); await settle();
|
||||
assert.equal(await p.$eval(".drawer", (d) => d.__tag), undefined, "drawer does not recycle sheet-overlay");
|
||||
assert.equal(await p.$eval(".drawer", (d) => getComputedStyle(d).backdropFilter), "none", "no full-screen backdrop blur");
|
||||
assert.ok((await calls("loadIcons")).length > 0, "icons are asked for");
|
||||
assert.ok(!(await calls("showKeyboard")).length, "no keyboard in pick mode");
|
||||
await p.click(".apps .tile:nth-child(4)"); await p.click(".drawer-head >> text=Done"); await settle();
|
||||
@@ -75,9 +95,28 @@ const RELEASE = JSON.stringify({ tag_name: "build-9", assets: [
|
||||
await p.click(".slots .tile"); await settle();
|
||||
assert.deepEqual((await calls("launch"))[0].slice(1), ["com.example.chrome/.MainActivity"]);
|
||||
|
||||
// Windows asks the shell for Recents; settings and wallpaper too
|
||||
// Windows asks the shell for Recents when enabled, and opens setup sheet when disabled
|
||||
await p.click(".panel-btn"); await settle();
|
||||
assert.equal((await calls("openRecents")).length, 1);
|
||||
assert.ok(!(await p.$(".sheet")), "no setup sheet when RecentsService is running");
|
||||
|
||||
await p.evaluate(() => { window.__recentsEnabled = false; });
|
||||
await p.click(".panel-btn");
|
||||
await p.waitForSelector(".sheet");
|
||||
assert.equal((await calls("openRecents")).length, 2);
|
||||
assert.equal(await p.textContent(".sheet-title"), "Enable window list");
|
||||
const setupText = await p.textContent(".sheet");
|
||||
assert.ok(setupText.includes("Restricted setting"), "explains Android 13+ Restricted setting");
|
||||
assert.ok(setupText.includes("Allow restricted settings"), "explains Allow restricted settings step");
|
||||
await p.click(".sheet button:has-text('Open Accessibility settings')"); await settle();
|
||||
assert.equal((await calls("openAccessibilitySettings")).length, 1);
|
||||
assert.ok(await p.$(".sheet"), "setup sheet stays open while user checks Settings");
|
||||
await p.click(".sheet button:has-text('Open App info')"); await settle();
|
||||
assert.equal((await calls("openSelfAppInfo")).length, 1);
|
||||
assert.ok(await p.$(".sheet"), "setup sheet stays open while user checks App info");
|
||||
await p.click(".sheet button:has-text('Close')"); await settle();
|
||||
assert.ok(!(await p.$(".sheet")), "Close dismisses setup sheet");
|
||||
await p.evaluate(() => { window.__recentsEnabled = true; });
|
||||
|
||||
// add a widget: the shell binds it and the page places it over its slot (wid, x, y, w, h, editing)
|
||||
await longpress(".home", 0.95);
|
||||
@@ -95,14 +134,17 @@ const RELEASE = JSON.stringify({ tag_name: "build-9", assets: [
|
||||
assert.ok(w < 358, "starts at its natural width, not the whole row"); // 110px natural = 2 columns
|
||||
|
||||
// opening the drawer: the shell is told to cover the widgets, the keyboard comes up, widgets are unmarked
|
||||
await p.click(".search-pill"); await settle();
|
||||
await p.click(".search-pill");
|
||||
await p.waitForSelector(".drawer");
|
||||
assert.ok((await calls("coverWidgets")).length > 0, "the shell hides widgets under the drawer");
|
||||
await settle();
|
||||
assert.equal((await calls("coverWidgets")).pop()[1], -1, "the shell hides widgets under the drawer");
|
||||
assert.ok((await calls("showKeyboard")).length > 0, "the search takes the keyboard");
|
||||
assert.equal(await p.$$eval("[data-wid]", (ws) => ws.length), 0);
|
||||
await p.click(".drawer-head >> text=Close"); await settle();
|
||||
await p.click(".drawer-head >> text=Close");
|
||||
await p.waitForSelector(".drawer.closing", { timeout: 1000 });
|
||||
assert.ok((await calls("hideKeyboard")).length > 0);
|
||||
assert.equal((await calls("coverWidgets")).pop()[1], 0, "the widgets are shown again");
|
||||
assert.equal((await calls("coverWidgets")).pop()[1], 0, "the widgets are shown again as drawer closes");
|
||||
await p.waitForSelector(".drawer", { state: "detached", timeout: 2000 });
|
||||
|
||||
// a long press on the native widget view reaches the page; letting go without moving shows handles,
|
||||
// and the shell is told to keep its edge swipes off them
|
||||
@@ -118,13 +160,26 @@ const RELEASE = JSON.stringify({ tag_name: "build-9", assets: [
|
||||
await p.click(".resize-bar >> text=Remove"); await settle();
|
||||
assert.equal((await calls("removeWidget"))[0][1], 77);
|
||||
|
||||
// opening the drawer while a notice is visible does not recycle .notice as .drawer
|
||||
await longpress(".home", 0.95);
|
||||
await p.click(".sheet-item >> text=Check for updates");
|
||||
await p.waitForSelector(".notice");
|
||||
await p.evaluate(() => { document.querySelector(".notice").__tag = "notice"; });
|
||||
await p.click(".search-pill");
|
||||
await p.waitForSelector(".drawer");
|
||||
assert.equal(await p.$eval(".drawer", (d) => d.__tag), undefined, "drawer does not recycle .notice");
|
||||
assert.equal(await p.$eval(".notice", (n) => n.__tag), "notice", ".notice keeps its DOM element");
|
||||
await p.click(".drawer-head >> text=Close");
|
||||
await p.waitForSelector(".drawer", { state: "detached", timeout: 2000 });
|
||||
|
||||
// a package change: the shell calls reload(), which fetches the app list again and re-asks for icons
|
||||
const before = (await calls("loadIcons")).length;
|
||||
await p.evaluate(() => window.launcher.reload()); await settle();
|
||||
assert.ok((await calls("loadIcons")).length > before, "icons are asked for again after a reload");
|
||||
// back and home close the drawer
|
||||
await p.click(".search-pill"); await p.waitForSelector(".drawer");
|
||||
await p.evaluate(() => window.launcher.back()); await settle();
|
||||
await p.evaluate(() => window.launcher.back());
|
||||
await p.waitForSelector(".drawer", { state: "detached", timeout: 2000 });
|
||||
assert.ok(!(await p.$(".drawer")));
|
||||
console.log("android bridge ok");
|
||||
await b.close(); srv.close();
|
||||
|
||||
Reference in new issue
Block a user