Skip to content

Commit 8304dda

Browse files
CodeGhost21claude
andcommitted
style: apply prettier to app-lifecycle spec
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 91cba0c commit 8304dda

1 file changed

Lines changed: 19 additions & 41 deletions

File tree

app/test/e2e/specs/app-lifecycle.spec.ts

Lines changed: 19 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
* - macOS: `yarn tauri build --debug --bundles app,dmg` → .app + .dmg in target/debug/bundle/
3333
* - App must be built with VITE_BACKEND_URL=http://127.0.0.1:18473 (mock server).
3434
*/
35-
3635
import * as fs from 'fs';
3736
import * as os from 'os';
3837
import * as path from 'path';
@@ -120,11 +119,7 @@ function safeExec(cmd: string): { stdout: string; stderr: string; success: boole
120119
const stdout = execSync(cmd, { encoding: 'utf8', stdio: ['pipe', 'pipe', 'pipe'] });
121120
return { stdout: stdout.trim(), stderr: '', success: true };
122121
} catch (err: any) {
123-
return {
124-
stdout: (err.stdout || '').trim(),
125-
stderr: (err.stderr || '').trim(),
126-
success: false,
127-
};
122+
return { stdout: (err.stdout || '').trim(), stderr: (err.stderr || '').trim(), success: false };
128123
}
129124
}
130125

@@ -284,9 +279,7 @@ describe('0.1 Application Download', () => {
284279
}
285280

286281
// Snapshot current auth state so we can restore it after the test
287-
const priorAuth = await browser.execute(
288-
() => localStorage.getItem('persist:auth') ?? null
289-
);
282+
const priorAuth = await browser.execute(() => localStorage.getItem('persist:auth') ?? null);
290283

291284
try {
292285
// Write intentionally malformed data simulating a corrupted installer payload
@@ -306,9 +299,7 @@ describe('0.1 Application Download', () => {
306299
expect(appAlive).toBe(true);
307300

308301
// Verify corrupted auth was cleared / reset rather than retained
309-
const authAfter = await browser.execute(
310-
() => localStorage.getItem('persist:auth') ?? null
311-
);
302+
const authAfter = await browser.execute(() => localStorage.getItem('persist:auth') ?? null);
312303
console.log(
313304
'[AppLifecycle][0.1.3] Auth after reload:',
314305
authAfter ? authAfter.slice(0, 100) : '(null)'
@@ -489,9 +480,7 @@ describe('0.2 Installation & Launch', () => {
489480

490481
// spctl will reject unsigned/ad-hoc binaries — log result without failing the test,
491482
// since debug builds are not notarized. This test records Gatekeeper disposition.
492-
const { stdout, stderr, success } = safeExec(
493-
`spctl -a -vvv -t exec "${appPath}" 2>&1`
494-
);
483+
const { stdout, stderr, success } = safeExec(`spctl -a -vvv -t exec "${appPath}" 2>&1`);
495484
console.log(
496485
`[AppLifecycle][0.2.2] spctl: success=${success} output=${(stdout + stderr).slice(0, 400)}`
497486
);
@@ -535,9 +524,7 @@ describe('0.2 Installation & Launch', () => {
535524
const appPath = resolveAppArtifact();
536525
if (!appPath) return;
537526

538-
const { stdout, stderr } = safeExec(
539-
`codesign -d --entitlements :- "${appPath}" 2>&1`
540-
);
527+
const { stdout, stderr } = safeExec(`codesign -d --entitlements :- "${appPath}" 2>&1`);
541528
const combined = stdout + stderr;
542529
console.log(
543530
`[AppLifecycle][0.2.3] codesign entitlements output (first 400 chars): ${combined.slice(0, 400)}`
@@ -608,10 +595,10 @@ describe('0.2 Installation & Launch', () => {
608595
// We verify the permissions-related text exists somewhere in the onboarding DOM,
609596
// OR that the app has already passed this step (home is visible).
610597
const permissionsIndicators = [
611-
'Screen', // ScreenPermissionsStep heading
612-
'Permission', // generic permissions text
598+
'Screen', // ScreenPermissionsStep heading
599+
'Permission', // generic permissions text
613600
'Continue Without', // "Continue Without Permission" CTA
614-
'Accessibility', // accessibility permission request
601+
'Accessibility', // accessibility permission request
615602
// Post-onboarding indicators (user has already passed the permissions step)
616603
'Home',
617604
'Skills',
@@ -758,9 +745,7 @@ describe('0.3 Updates & Reinstallation', () => {
758745

759746
// The app's updater is active:false so it won't call this automatically.
760747
// We verify the mock server itself can serve a properly shaped response.
761-
const resp = await fetch(
762-
'http://127.0.0.1:18473/__admin/health'
763-
).catch(() => null);
748+
const resp = await fetch('http://127.0.0.1:18473/__admin/health').catch(() => null);
764749
console.log(`[AppLifecycle][0.3.1] Mock server health: ${resp?.status ?? 'unreachable'}`);
765750
// Mock server is running if this test suite reached here
766751
expect(resp).not.toBeNull();
@@ -821,7 +806,9 @@ describe('0.3 Updates & Reinstallation', () => {
821806
return (window as any).__APP_VERSION__ ?? null;
822807
});
823808

824-
console.log(`[AppLifecycle][0.3.2] Detected app version in DOM: ${versionInfo ?? '(not exposed — normal for production builds)'}`);
809+
console.log(
810+
`[AppLifecycle][0.3.2] Detected app version in DOM: ${versionInfo ?? '(not exposed — normal for production builds)'}`
811+
);
825812
// Not exposing version in DOM is acceptable; the test passes as long as the app is alive.
826813
expect(await hasAppChrome()).toBe(true);
827814
});
@@ -871,9 +858,7 @@ describe('0.3 Updates & Reinstallation', () => {
871858
it('redux-persist auth state is restored after reload', async () => {
872859
if (!isTauriDriver()) return;
873860

874-
const authBefore = await browser.execute(
875-
() => localStorage.getItem('persist:auth') ?? null
876-
);
861+
const authBefore = await browser.execute(() => localStorage.getItem('persist:auth') ?? null);
877862
console.log(
878863
`[AppLifecycle][0.3.3] Auth before reload: ${authBefore ? authBefore.slice(0, 80) + '…' : '(null)'}`
879864
);
@@ -882,9 +867,7 @@ describe('0.3 Updates & Reinstallation', () => {
882867
await browser.pause(3_000);
883868
await waitForAppReady(20_000);
884869

885-
const authAfter = await browser.execute(
886-
() => localStorage.getItem('persist:auth') ?? null
887-
);
870+
const authAfter = await browser.execute(() => localStorage.getItem('persist:auth') ?? null);
888871
console.log(
889872
`[AppLifecycle][0.3.3] Auth after reload: ${authAfter ? authAfter.slice(0, 80) + '…' : '(null)'}`
890873
);
@@ -904,7 +887,9 @@ describe('0.3 Updates & Reinstallation', () => {
904887
// Data directory is created on first launch; the app has been running, so it should exist.
905888
// Non-fatal if it doesn't — some Tauri sandboxing configurations may differ.
906889
if (!exists) {
907-
console.log('[AppLifecycle][0.3.3] Data dir not yet created (first-run or sandboxed build)');
890+
console.log(
891+
'[AppLifecycle][0.3.3] Data dir not yet created (first-run or sandboxed build)'
892+
);
908893
}
909894
});
910895
});
@@ -963,9 +948,7 @@ describe('0.3 Updates & Reinstallation', () => {
963948
'com.openhuman.app.plist'
964949
);
965950
const exists = fs.existsSync(launchAgentPath);
966-
console.log(
967-
`[AppLifecycle][0.3.4] LaunchAgent plist: ${launchAgentPath} — exists=${exists}`
968-
);
951+
console.log(`[AppLifecycle][0.3.4] LaunchAgent plist: ${launchAgentPath} — exists=${exists}`);
969952
// LaunchAgent only exists if autostart was enabled by the user — non-fatal absence.
970953
});
971954

@@ -983,12 +966,7 @@ describe('0.3 Updates & Reinstallation', () => {
983966
it('macOS: WebKit cache directory is identifiable for removal', function () {
984967
if (process.platform !== 'darwin') return;
985968

986-
const webkitCache = path.join(
987-
os.homedir(),
988-
'Library',
989-
'WebKit',
990-
'com.openhuman.app'
991-
);
969+
const webkitCache = path.join(os.homedir(), 'Library', 'WebKit', 'com.openhuman.app');
992970
const exists = fs.existsSync(webkitCache);
993971
console.log(`[AppLifecycle][0.3.4] WebKit cache: ${webkitCache} — exists=${exists}`);
994972
// Cache may not exist if no web content has been loaded yet — informational.

0 commit comments

Comments
 (0)