[tauri] TauriPlatforms: Read the built APK's own values, carry Rosea's launcher icon into gen/android, survive a dropped USB link
This commit is contained in:
@@ -36,6 +36,12 @@ function problems(): string[] {
|
||||
if (!existsSync(at)) found.push(`res/xml/${f} is missing`);
|
||||
else if (readFileSync(at, 'utf8') !== readFileSync(join(RES_FROM, f), 'utf8')) found.push(`res/xml/${f} differs from android/res/xml/${f}`);
|
||||
}
|
||||
// The launcher icon is Rosea's, not the Tauri logo `init` put there (scripts/icons.ts).
|
||||
const ours = join(SRC_TAURI, 'icons', 'android', 'mipmap-mdpi', 'ic_launcher.png');
|
||||
const there = join(MAIN, 'res', 'mipmap-mdpi', 'ic_launcher.png');
|
||||
if (!existsSync(ours) || !existsSync(there) || !readFileSync(ours).equals(readFileSync(there))) {
|
||||
found.push("the launcher icon is not Rosea's (run 'tsx scripts/icons.ts')");
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,24 +4,31 @@
|
||||
* the source SVG and optimised art under art/final/ (CLAUDE.md §5.2). The icon is still a
|
||||
* placeholder; the real one comes through the art pipeline (GAP_ANALYSIS G0.21).
|
||||
*
|
||||
* tsx scripts/icons.ts makes them when missing or older than the SVG
|
||||
* tsx scripts/icons.ts makes them when missing or older than the SVG, and copies the
|
||||
* Android launcher icons into gen/android when it exists
|
||||
*
|
||||
* The copy is unconditional on purpose: `tauri android init` writes Tauri's own logo into
|
||||
* gen/android, newer than any icon made before it, so a date check kept Tauri's logo in the first
|
||||
* APK (review finding). `scripts/android.ts check` compares the bytes.
|
||||
*/
|
||||
import { existsSync, statSync } from 'node:fs';
|
||||
import { cpSync, existsSync, statSync } from 'node:fs';
|
||||
import { join } from 'node:path';
|
||||
import { PACKAGE, SRC_TAURI, tauri } from './tauri.js';
|
||||
|
||||
const SOURCE = join(PACKAGE, '..', 'rosea', 'public', 'icon.svg');
|
||||
const MARK = join(SRC_TAURI, 'icons', 'icon.ico');
|
||||
const ANDROID = join(SRC_TAURI, 'gen', 'android');
|
||||
const ANDROID_MARK = join(ANDROID, 'app', 'src', 'main', 'res', 'mipmap-mdpi', 'ic_launcher.png');
|
||||
const MADE = join(SRC_TAURI, 'icons');
|
||||
export const ANDROID_ICONS = join(MADE, 'android');
|
||||
export const ANDROID_RES = join(SRC_TAURI, 'gen', 'android', 'app', 'src', 'main', 'res');
|
||||
|
||||
const stale = (file: string): boolean => !existsSync(file) || statSync(file).mtimeMs < statSync(SOURCE).mtimeMs;
|
||||
|
||||
// `tauri icon` writes the Android launcher icons into gen/android only when that exists, so it
|
||||
// runs again after `tauri android init` (which puts Tauri's own logo there).
|
||||
if (stale(MARK) || (existsSync(ANDROID) && stale(ANDROID_MARK))) {
|
||||
if (stale(join(MADE, 'icon.ico')) || stale(join(ANDROID_ICONS, 'mipmap-mdpi', 'ic_launcher.png'))) {
|
||||
tauri('icon', SOURCE);
|
||||
console.log('icons: made from apps/rosea/public/icon.svg');
|
||||
} else {
|
||||
console.log('icons: up to date');
|
||||
}
|
||||
if (existsSync(ANDROID_RES)) {
|
||||
cpSync(ANDROID_ICONS, ANDROID_RES, { recursive: true });
|
||||
console.log('icons: Android launcher icons copied into gen/android');
|
||||
}
|
||||
|
||||
@@ -156,21 +156,25 @@ export function ruleProblems(xml: string, sections: readonly string[]): string[]
|
||||
*/
|
||||
export function apkProblems(permissions: string, manifestTree: string): string[] {
|
||||
const problems: string[] = [];
|
||||
const asked = [...permissions.matchAll(/uses-permission: name='([^']+)'/g)].map((m) => m[1]!);
|
||||
// Tauri's stock app asks for nothing else today; a new one is a review question, not a pass.
|
||||
const allowed = new Set<string>([]);
|
||||
for (const name of asked) {
|
||||
if (name.endsWith('.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION')) continue; // androidx's own, signature-level
|
||||
if (!allowed.has(name)) problems.push(`the APK asks for ${name}`);
|
||||
const tree = manifestTree.replaceAll('\r\n', '\n');
|
||||
const pkg = /^package: (\S+)$/m.exec(permissions.replaceAll('\r\n', '\n'))?.[1];
|
||||
for (const m of permissions.matchAll(/uses-permission: name='([^']+)'/g)) {
|
||||
const name = m[1]!;
|
||||
// androidx's receiver guard: a signature permission the app declares for itself, granting nothing.
|
||||
if (pkg !== undefined && name === `${pkg}.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION`) continue;
|
||||
// Any other is a review question, not a pass: Rosea asks for no permission yet.
|
||||
problems.push(`the APK asks for ${name}`);
|
||||
}
|
||||
if (!/allowBackup\([^)]*\)=false/.test(manifestTree)) problems.push('the APK does not set allowBackup=false');
|
||||
if (!/:allowBackup\(0x[0-9a-f]+\)=false$/m.test(tree)) problems.push('the APK does not set allowBackup=false');
|
||||
for (const [name, value] of Object.entries(META_DATA)) {
|
||||
const at = manifestTree.indexOf(`"${name}"`);
|
||||
if (at < 0) problems.push(`the APK has no meta-data ${name}`);
|
||||
else if (!manifestTree.slice(at, at + 300).includes(value === 'true' ? '=true' : '=false') &&
|
||||
!manifestTree.slice(at, at + 300).includes(`"${value}"`)) {
|
||||
problems.push(`the APK's meta-data ${name} is not ${value}`);
|
||||
}
|
||||
// aapt2 prints a meta-data element's name attribute, then its value attribute on the next line:
|
||||
// A: http://schemas.android.com/apk/res/android:name(0x01010003)="<name>" (Raw: "<name>")
|
||||
// A: http://schemas.android.com/apk/res/android:value(0x01010024)=true
|
||||
const found = new RegExp(
|
||||
`:name\\(0x[0-9a-f]+\\)="${escape(name)}"[^\\n]*\\n\\s*A: [^\\n]*:value\\(0x[0-9a-f]+\\)=(\\S+)`
|
||||
).exec(tree);
|
||||
if (!found) problems.push(`the APK has no meta-data ${name}`);
|
||||
else if (found[1] !== value && found[1] !== `"${value}"`) problems.push(`the APK's meta-data ${name} is ${found[1]}, not ${value}`);
|
||||
}
|
||||
return problems;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import { dirname, join } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import {
|
||||
apkProblems,
|
||||
APPLICATION_ATTRS,
|
||||
DOMAINS,
|
||||
manifestProblems,
|
||||
@@ -136,3 +137,44 @@ describe('the committed rule files', () => {
|
||||
expect(DOMAINS).toHaveLength(9);
|
||||
});
|
||||
});
|
||||
|
||||
describe('apkProblems, on aapt2 output of the APK built 2026-11-17 (Tauri 2.12.5, AGP 9.3.1)', () => {
|
||||
const permissions = readFileSync(join(HERE, 'fixtures', 'apk-permissions.txt'), 'utf8');
|
||||
const tree = readFileSync(join(HERE, 'fixtures', 'apk-manifest.xmltree.txt'), 'utf8');
|
||||
|
||||
it('passes the patched APK: no permission asked but androidx own receiver guard', () => {
|
||||
expect(apkProblems(permissions, tree)).toEqual([]);
|
||||
});
|
||||
|
||||
it('names INTERNET, or any permission a library merges in', () => {
|
||||
const more = `${permissions.trimEnd()}\nuses-permission: name='android.permission.INTERNET'\nuses-permission: name='android.permission.ACCESS_NETWORK_STATE'\n`;
|
||||
expect(apkProblems(more, tree)).toEqual([
|
||||
'the APK asks for android.permission.INTERNET',
|
||||
'the APK asks for android.permission.ACCESS_NETWORK_STATE'
|
||||
]);
|
||||
});
|
||||
|
||||
it("does not let another app's receiver guard through", () => {
|
||||
const other = `${permissions.trimEnd()}\nuses-permission: name='com.example.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION'\n`;
|
||||
expect(apkProblems(other, tree)).toEqual(['the APK asks for com.example.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION']);
|
||||
});
|
||||
|
||||
it('names backup left on', () => {
|
||||
expect(apkProblems(permissions, tree.replace(/allowBackup\((0x[0-9a-f]+)\)=false/, 'allowBackup($1)=true'))).toEqual([
|
||||
'the APK does not set allowBackup=false'
|
||||
]);
|
||||
});
|
||||
|
||||
it("reads each WebView switch's own value, not its neighbour's", () => {
|
||||
const flipped = tree.replace(
|
||||
/("android\.webkit\.WebView\.EnableSafeBrowsing"[^\n]*\r?\n\s*A: [^\n]*:value\(0x[0-9a-f]+\))=false/,
|
||||
'$1=true'
|
||||
);
|
||||
expect(flipped).not.toBe(tree);
|
||||
expect(apkProblems(permissions, flipped)).toEqual([
|
||||
"the APK's meta-data android.webkit.WebView.EnableSafeBrowsing is true, not false"
|
||||
]);
|
||||
const gone = tree.replace('"android.webkit.WebView.MetricsOptOut"', '"android.webkit.WebView.Something"');
|
||||
expect(apkProblems(permissions, gone)).toEqual(['the APK has no meta-data android.webkit.WebView.MetricsOptOut']);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
N: android=http://schemas.android.com/apk/res/android (line=2)
|
||||
E: manifest (line=2)
|
||||
A: http://schemas.android.com/apk/res/android:versionCode(0x0101021b)=1000
|
||||
A: http://schemas.android.com/apk/res/android:versionName(0x0101021c)="0.1.0" (Raw: "0.1.0")
|
||||
A: http://schemas.android.com/apk/res/android:compileSdkVersion(0x01010572)=37
|
||||
A: http://schemas.android.com/apk/res/android:compileSdkVersionCodename(0x01010573)="17" (Raw: "17")
|
||||
A: package="cz.mareknovak.domi.rosea" (Raw: "cz.mareknovak.domi.rosea")
|
||||
A: platformBuildVersionCode=37
|
||||
A: platformBuildVersionName=17
|
||||
E: uses-sdk (line=7)
|
||||
A: http://schemas.android.com/apk/res/android:minSdkVersion(0x0101020c)=24
|
||||
A: http://schemas.android.com/apk/res/android:targetSdkVersion(0x01010270)=37
|
||||
E: uses-feature (line=12)
|
||||
A: http://schemas.android.com/apk/res/android:name(0x01010003)="android.software.leanback" (Raw: "android.software.leanback")
|
||||
A: http://schemas.android.com/apk/res/android:required(0x0101028e)=false
|
||||
E: permission (line=16)
|
||||
A: http://schemas.android.com/apk/res/android:name(0x01010003)="cz.mareknovak.domi.rosea.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION" (Raw: "cz.mareknovak.domi.rosea.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION")
|
||||
A: http://schemas.android.com/apk/res/android:protectionLevel(0x01010009)=0x00000002
|
||||
E: uses-permission (line=20)
|
||||
A: http://schemas.android.com/apk/res/android:name(0x01010003)="cz.mareknovak.domi.rosea.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION" (Raw: "cz.mareknovak.domi.rosea.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION")
|
||||
E: application (line=22)
|
||||
A: http://schemas.android.com/apk/res/android:theme(0x01010000)=@0x7f100274
|
||||
A: http://schemas.android.com/apk/res/android:label(0x01010001)=@0x7f0f001c
|
||||
A: http://schemas.android.com/apk/res/android:icon(0x01010002)=@0x7f0d0000
|
||||
A: http://schemas.android.com/apk/res/android:debuggable(0x0101000f)=true
|
||||
A: http://schemas.android.com/apk/res/android:allowBackup(0x01010280)=false
|
||||
A: http://schemas.android.com/apk/res/android:extractNativeLibs(0x010104ea)=false
|
||||
A: http://schemas.android.com/apk/res/android:fullBackupContent(0x010104eb)=@0x7f120001
|
||||
A: http://schemas.android.com/apk/res/android:usesCleartextTraffic(0x010104ec)=true
|
||||
A: http://schemas.android.com/apk/res/android:appComponentFactory(0x0101057a)="androidx.core.app.CoreComponentFactory" (Raw: "androidx.core.app.CoreComponentFactory")
|
||||
A: http://schemas.android.com/apk/res/android:dataExtractionRules(0x0101063e)=@0x7f120002
|
||||
E: activity (line=33)
|
||||
A: http://schemas.android.com/apk/res/android:label(0x01010001)=@0x7f0f0047
|
||||
A: http://schemas.android.com/apk/res/android:name(0x01010003)="cz.mareknovak.domi.rosea.MainActivity" (Raw: "cz.mareknovak.domi.rosea.MainActivity")
|
||||
A: http://schemas.android.com/apk/res/android:exported(0x01010010)=true
|
||||
A: http://schemas.android.com/apk/res/android:launchMode(0x0101001d)=2
|
||||
A: http://schemas.android.com/apk/res/android:configChanges(0x0101001f)=0x00000fb4
|
||||
E: intent-filter (line=39)
|
||||
E: action (line=40)
|
||||
A: http://schemas.android.com/apk/res/android:name(0x01010003)="android.intent.action.MAIN" (Raw: "android.intent.action.MAIN")
|
||||
E: category (line=42)
|
||||
A: http://schemas.android.com/apk/res/android:name(0x01010003)="android.intent.category.LAUNCHER" (Raw: "android.intent.category.LAUNCHER")
|
||||
E: category (line=44)
|
||||
A: http://schemas.android.com/apk/res/android:name(0x01010003)="android.intent.category.LEANBACK_LAUNCHER" (Raw: "android.intent.category.LEANBACK_LAUNCHER")
|
||||
E: provider (line=48)
|
||||
A: http://schemas.android.com/apk/res/android:name(0x01010003)="androidx.core.content.FileProvider" (Raw: "androidx.core.content.FileProvider")
|
||||
A: http://schemas.android.com/apk/res/android:exported(0x01010010)=false
|
||||
A: http://schemas.android.com/apk/res/android:authorities(0x01010018)="cz.mareknovak.domi.rosea.fileprovider" (Raw: "cz.mareknovak.domi.rosea.fileprovider")
|
||||
A: http://schemas.android.com/apk/res/android:grantUriPermissions(0x0101001b)=true
|
||||
E: meta-data (line=53)
|
||||
A: http://schemas.android.com/apk/res/android:name(0x01010003)="android.support.FILE_PROVIDER_PATHS" (Raw: "android.support.FILE_PROVIDER_PATHS")
|
||||
A: http://schemas.android.com/apk/res/android:resource(0x01010025)=@0x7f120000
|
||||
E: meta-data (line=58)
|
||||
A: http://schemas.android.com/apk/res/android:name(0x01010003)="android.webkit.WebView.EnableSafeBrowsing" (Raw: "android.webkit.WebView.EnableSafeBrowsing")
|
||||
A: http://schemas.android.com/apk/res/android:value(0x01010024)=false
|
||||
E: meta-data (line=61)
|
||||
A: http://schemas.android.com/apk/res/android:name(0x01010003)="android.webkit.WebView.MetricsOptOut" (Raw: "android.webkit.WebView.MetricsOptOut")
|
||||
A: http://schemas.android.com/apk/res/android:value(0x01010024)=true
|
||||
E: provider (line=65)
|
||||
A: http://schemas.android.com/apk/res/android:name(0x01010003)="androidx.startup.InitializationProvider" (Raw: "androidx.startup.InitializationProvider")
|
||||
A: http://schemas.android.com/apk/res/android:exported(0x01010010)=false
|
||||
A: http://schemas.android.com/apk/res/android:authorities(0x01010018)="cz.mareknovak.domi.rosea.androidx-startup" (Raw: "cz.mareknovak.domi.rosea.androidx-startup")
|
||||
E: meta-data (line=69)
|
||||
A: http://schemas.android.com/apk/res/android:name(0x01010003)="androidx.emoji2.text.EmojiCompatInitializer" (Raw: "androidx.emoji2.text.EmojiCompatInitializer")
|
||||
A: http://schemas.android.com/apk/res/android:value(0x01010024)="androidx.startup" (Raw: "androidx.startup")
|
||||
E: meta-data (line=72)
|
||||
A: http://schemas.android.com/apk/res/android:name(0x01010003)="androidx.lifecycle.ProcessLifecycleInitializer" (Raw: "androidx.lifecycle.ProcessLifecycleInitializer")
|
||||
A: http://schemas.android.com/apk/res/android:value(0x01010024)="androidx.startup" (Raw: "androidx.startup")
|
||||
E: meta-data (line=75)
|
||||
A: http://schemas.android.com/apk/res/android:name(0x01010003)="androidx.profileinstaller.ProfileInstallerInitializer" (Raw: "androidx.profileinstaller.ProfileInstallerInitializer")
|
||||
A: http://schemas.android.com/apk/res/android:value(0x01010024)="androidx.startup" (Raw: "androidx.startup")
|
||||
E: receiver (line=80)
|
||||
A: http://schemas.android.com/apk/res/android:name(0x01010003)="androidx.profileinstaller.ProfileInstallReceiver" (Raw: "androidx.profileinstaller.ProfileInstallReceiver")
|
||||
A: http://schemas.android.com/apk/res/android:permission(0x01010006)="android.permission.DUMP" (Raw: "android.permission.DUMP")
|
||||
A: http://schemas.android.com/apk/res/android:enabled(0x0101000e)=true
|
||||
A: http://schemas.android.com/apk/res/android:exported(0x01010010)=true
|
||||
A: http://schemas.android.com/apk/res/android:directBootAware(0x01010505)=false
|
||||
E: intent-filter (line=86)
|
||||
E: action (line=87)
|
||||
A: http://schemas.android.com/apk/res/android:name(0x01010003)="androidx.profileinstaller.action.INSTALL_PROFILE" (Raw: "androidx.profileinstaller.action.INSTALL_PROFILE")
|
||||
E: intent-filter (line=89)
|
||||
E: action (line=90)
|
||||
A: http://schemas.android.com/apk/res/android:name(0x01010003)="androidx.profileinstaller.action.SKIP_FILE" (Raw: "androidx.profileinstaller.action.SKIP_FILE")
|
||||
E: intent-filter (line=92)
|
||||
E: action (line=93)
|
||||
A: http://schemas.android.com/apk/res/android:name(0x01010003)="androidx.profileinstaller.action.SAVE_PROFILE" (Raw: "androidx.profileinstaller.action.SAVE_PROFILE")
|
||||
E: intent-filter (line=95)
|
||||
E: action (line=96)
|
||||
A: http://schemas.android.com/apk/res/android:name(0x01010003)="androidx.profileinstaller.action.BENCHMARK_OPERATION" (Raw: "androidx.profileinstaller.action.BENCHMARK_OPERATION")
|
||||
@@ -0,0 +1,3 @@
|
||||
package: cz.mareknovak.domi.rosea
|
||||
permission: cz.mareknovak.domi.rosea.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION
|
||||
uses-permission: name='cz.mareknovak.domi.rosea.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION'
|
||||
+36
-18
@@ -80,7 +80,11 @@ async function firstVisit(page: Page): Promise<void> {
|
||||
/** After the app was closed and opened again: she is still watered. */
|
||||
async function secondVisit(page: Page): Promise<void> {
|
||||
await garden(page);
|
||||
await page.getByRole('button', { name: en.rose.numbers }).click();
|
||||
// By keyboard: on the tablet a pointer click once waited 30 s for the button to stop moving
|
||||
// while the garden animated (review). Enter is a real activation, as for a keyboard player.
|
||||
const numbers = page.getByRole('button', { name: en.rose.numbers });
|
||||
await numbers.focus();
|
||||
await numbers.press('Enter');
|
||||
await expect(page.locator('#rose-numbers')).toContainText(`${en.rose.daysOfCare}1`);
|
||||
await storedCare(page, 1);
|
||||
report['afterRestart'] = 'still watered: 1 day of care, the care log kept';
|
||||
@@ -157,35 +161,49 @@ async function desktop(exe: string): Promise<void> {
|
||||
}
|
||||
|
||||
async function androidDevice(serial: string | undefined): Promise<void> {
|
||||
// The USB link to a real tablet drops now and then ("device offline"); a dropped link is waited
|
||||
// for and the command tried again, up to three times. A command that fails for another reason
|
||||
// fails the check at once.
|
||||
const adb = (...args: string[]): string => {
|
||||
const r = spawnSync('adb', [...(serial ? ['-s', serial] : []), ...args], { encoding: 'utf8' });
|
||||
if (r.status !== 0) throw new Error(`adb ${args.join(' ')} failed: ${r.stderr}`);
|
||||
return r.stdout;
|
||||
const target = serial ? ['-s', serial] : [];
|
||||
for (let attempt = 1; ; attempt++) {
|
||||
const r = spawnSync('adb', [...target, ...args], { encoding: 'utf8' });
|
||||
if (r.status === 0) return r.stdout;
|
||||
const dropped = /offline|closed|not found|no devices/i.test(r.stderr);
|
||||
if (!dropped || attempt === 3) throw new Error(`adb ${args.join(' ')} failed: ${r.stderr}`);
|
||||
spawnSync('adb', [...target, 'wait-for-device'], { timeout: 30_000 });
|
||||
}
|
||||
};
|
||||
// Playwright's handle to the device dies with the link, so it is found again for each visit.
|
||||
const open = async (): Promise<{ page: Page; close: () => Promise<void> }> => {
|
||||
adb('wait-for-device');
|
||||
const devices = await android.devices();
|
||||
const device = serial ? devices.find((d) => d.serial() === serial) : devices[0];
|
||||
if (!device) throw new Error('no Android device over adb');
|
||||
report['device'] = `${device.model()} (${device.serial()})`;
|
||||
adb('shell', 'monkey', '-p', PACKAGE_ID, '-c', 'android.intent.category.LAUNCHER', '1');
|
||||
const webView = await device.webView({ pkg: PACKAGE_ID }, { timeout: 30_000 });
|
||||
return { page: await webView.page(), close: () => device.close() };
|
||||
};
|
||||
const devices = await android.devices();
|
||||
const device = serial ? devices.find((d) => d.serial() === serial) : devices[0];
|
||||
if (!device) throw new Error('no Android device over adb');
|
||||
report['device'] = `${device.model()} (${device.serial()})`;
|
||||
const dump = adb('shell', 'dumpsys', 'package', PACKAGE_ID);
|
||||
if (!dump.includes(`Package [${PACKAGE_ID}]`)) throw new Error(`${PACKAGE_ID} is not installed; adb install -r <apk>`);
|
||||
report['internetPermission'] = /android\.permission\.INTERNET/.test(dump);
|
||||
report['allowBackupFlag'] = /flags=\[[^\]]*ALLOW_BACKUP/.test(dump);
|
||||
let session: { page: Page; close: () => Promise<void> } | undefined;
|
||||
try {
|
||||
adb('shell', 'pm', 'clear', PACKAGE_ID);
|
||||
adb('shell', 'monkey', '-p', PACKAGE_ID, '-c', 'android.intent.category.LAUNCHER', '1');
|
||||
let webView = await device.webView({ pkg: PACKAGE_ID }, { timeout: 30_000 });
|
||||
let page = await webView.page();
|
||||
await firstVisit(page);
|
||||
session = await open();
|
||||
await firstVisit(session.page);
|
||||
await session.close();
|
||||
|
||||
adb('shell', 'am', 'force-stop', PACKAGE_ID);
|
||||
await new Promise((r) => setTimeout(r, 1500));
|
||||
adb('shell', 'monkey', '-p', PACKAGE_ID, '-c', 'android.intent.category.LAUNCHER', '1');
|
||||
webView = await device.webView({ pkg: PACKAGE_ID }, { timeout: 30_000 });
|
||||
page = await webView.page();
|
||||
await secondVisit(page);
|
||||
await trySave(page);
|
||||
session = await open();
|
||||
await secondVisit(session.page);
|
||||
await trySave(session.page);
|
||||
} finally {
|
||||
adb('shell', 'am', 'force-stop', PACKAGE_ID);
|
||||
await device.close();
|
||||
await session?.close().catch((error: unknown) => console.error('check-garden: closing the device handle failed', error));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user