Skip to content

Commit 8540ed4

Browse files
CodeGhost21claude
andcommitted
fix(e2e): resolve typecheck failures and apply prettier formatting
- Remove duplicate local waitForHomePage in gmail-flow.spec.ts (shadowed the shared-flows import, caused prettier parse error) - Apply prettier formatting to all modified E2E spec and helper files - Format tauri-commands.spec.ts and telegram-flow.spec.ts Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent ea23d2b commit 8540ed4

10 files changed

Lines changed: 93 additions & 112 deletions

‎app/test/e2e/helpers/shared-flows.ts‎

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ export async function clickFirstMatch(candidates, timeout = 5_000) {
7777

7878
export async function navigateViaHash(hash) {
7979
try {
80-
await browser.execute((h) => { window.location.hash = h; }, hash);
80+
await browser.execute(h => {
81+
window.location.hash = h;
82+
}, hash);
8183
await browser.pause(2_000);
8284
const currentHash = await browser.execute(() => window.location.hash);
8385
console.log(`[E2E] Navigated to ${hash} (current: ${currentHash})`);
@@ -91,8 +93,12 @@ export async function navigateToHome() {
9193
const homeText = await waitForHomePage(10_000);
9294
if (!homeText) {
9395
try {
94-
await browser.execute(() => { window.location.hash = '/home'; });
95-
} catch { /* ignore */ }
96+
await browser.execute(() => {
97+
window.location.hash = '/home';
98+
});
99+
} catch {
100+
/* ignore */
101+
}
96102
await browser.pause(2_000);
97103
await waitForHomePage(10_000);
98104
}
@@ -108,7 +114,8 @@ export async function navigateToBilling() {
108114
const deadline = Date.now() + 15_000;
109115
let hasBilling = false;
110116
while (Date.now() < deadline) {
111-
hasBilling = (await textExists('Current Plan')) ||
117+
hasBilling =
118+
(await textExists('Current Plan')) ||
112119
(await textExists('FREE')) ||
113120
(await textExists('Upgrade'));
114121
if (hasBilling) break;
@@ -131,8 +138,10 @@ export async function navigateToBilling() {
131138
const allText = document.querySelectorAll('*');
132139
for (const el of allText) {
133140
const text = el.textContent?.trim() || '';
134-
if ((text === 'Billing & Usage' || text === 'Billing') &&
135-
el.closest('button, [role="button"], a, [class*="MenuItem"]')) {
141+
if (
142+
(text === 'Billing & Usage' || text === 'Billing') &&
143+
el.closest('button, [role="button"], a, [class*="MenuItem"]')
144+
) {
136145
(el.closest('button, [role="button"], a, [class*="MenuItem"]') as HTMLElement).click();
137146
return 'clicked';
138147
}
@@ -144,7 +153,8 @@ export async function navigateToBilling() {
144153
await browser.pause(3_000);
145154

146155
// Verify billing actually loaded after fallback
147-
const finalCheck = (await textExists('Current Plan')) ||
156+
const finalCheck =
157+
(await textExists('Current Plan')) ||
148158
(await textExists('FREE')) ||
149159
(await textExists('Upgrade'));
150160
if (!finalCheck) {
@@ -187,7 +197,8 @@ export async function navigateToConversations() {
187197
export async function walkOnboarding(logPrefix = '[E2E]') {
188198
// Detect onboarding overlay. The Onboarding.tsx parent renders a "Skip" defer
189199
// button (top-right), and step 0 is WelcomeStep with "Continue".
190-
const onboardingVisible = (await textExists('Welcome')) ||
200+
const onboardingVisible =
201+
(await textExists('Welcome')) ||
191202
(await textExists('Skip')) ||
192203
(await textExists('Use Local Models')) ||
193204
(await textExists('Continue'));
@@ -283,7 +294,7 @@ export async function walkOnboarding(logPrefix = '[E2E]') {
283294
export async function performFullLogin(
284295
token = 'e2e-test-token',
285296
logPrefix = '[E2E]',
286-
postLoginVerifier?: (logPrefix: string) => Promise<void>,
297+
postLoginVerifier?: (logPrefix: string) => Promise<void>
287298
) {
288299
await triggerAuthDeepLink(token);
289300
await waitForWindowVisible(25_000);

‎app/test/e2e/specs/auth-access-control.spec.ts‎

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ import {
3838
waitForWindowVisible,
3939
} from '../helpers/element-helpers';
4040
import {
41+
navigateToBilling,
4142
navigateToHome,
4243
navigateToSettings,
43-
navigateToBilling,
4444
waitForHomePage,
4545
} from '../helpers/shared-flows';
4646
import {
@@ -125,9 +125,7 @@ async function walkOnboarding() {
125125
}
126126

127127
if (!onboardingVisible) {
128-
console.log(
129-
'[AuthAccess] Onboarding overlay not visible after polling — skipping'
130-
);
128+
console.log('[AuthAccess] Onboarding overlay not visible after polling — skipping');
131129
await browser.pause(2_000);
132130
return;
133131
}
@@ -141,10 +139,7 @@ async function walkOnboarding() {
141139

142140
// Step 1: LocalAIStep — only has "Use Local Models" button now
143141
{
144-
const clicked = await clickFirstMatch(
145-
['Use Local Models', 'Continue'],
146-
10_000
147-
);
142+
const clicked = await clickFirstMatch(['Use Local Models', 'Continue'], 10_000);
148143
if (clicked) {
149144
console.log(`[AuthAccess] LocalAIStep: clicked "${clicked}"`);
150145
await browser.pause(2_000);
@@ -153,10 +148,7 @@ async function walkOnboarding() {
153148

154149
// Step 2: ScreenPermissionsStep — click "Continue Without Permission"
155150
{
156-
const clicked = await clickFirstMatch(
157-
['Continue Without Permission', 'Continue'],
158-
10_000
159-
);
151+
const clicked = await clickFirstMatch(['Continue Without Permission', 'Continue'], 10_000);
160152
if (clicked) {
161153
console.log(`[AuthAccess] ScreenPermissionsStep: clicked "${clicked}"`);
162154
await browser.pause(2_000);
@@ -192,7 +184,9 @@ async function walkOnboarding() {
192184
{
193185
const mnemonicVisible = await textExists('Your Recovery Phrase');
194186
if (mnemonicVisible) {
195-
console.log('[AuthAccess] MnemonicStep: visible [tree dump redacted — contains recovery phrase]');
187+
console.log(
188+
'[AuthAccess] MnemonicStep: visible [tree dump redacted — contains recovery phrase]'
189+
);
196190
try {
197191
await browser.execute(() => {
198192
const checkbox = document.querySelector('input[type="checkbox"]') as HTMLInputElement;
@@ -463,7 +457,9 @@ describe('Auth & Access Control', () => {
463457
for (const el of allElements) {
464458
const text = el.textContent?.trim() || '';
465459
if (text === 'Log out') {
466-
const clickable = el.closest('button, [role="button"], a, [class*="MenuItem"]') as HTMLElement;
460+
const clickable = el.closest(
461+
'button, [role="button"], a, [class*="MenuItem"]'
462+
) as HTMLElement;
467463
if (clickable) {
468464
clickable.click();
469465
return 'clicked-parent';
@@ -536,11 +532,11 @@ describe('Auth & Access Control', () => {
536532
if (!persisted) return false;
537533
try {
538534
const parsed = JSON.parse(persisted);
539-
const token = typeof parsed.token === 'string'
540-
? parsed.token.replace(/^"|"$/g, '')
541-
: null;
535+
const token = typeof parsed.token === 'string' ? parsed.token.replace(/^"|"$/g, '') : null;
542536
return !!token && token !== 'null';
543-
} catch { return false; }
537+
} catch {
538+
return false;
539+
}
544540
});
545541

546542
// Must see logged-out UI or token must be cleared (or both)

‎app/test/e2e/specs/card-payment-flow.spec.ts‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,11 @@
1212
* 5.3.2 Manage Subscription opens Stripe portal
1313
*/
1414
import { waitForApp } from '../helpers/app-helpers';
15+
import { clickText, textExists } from '../helpers/element-helpers';
1516
import {
16-
clickText,
17-
textExists,
18-
} from '../helpers/element-helpers';
19-
import {
20-
performFullLogin,
21-
navigateToHome,
2217
navigateToBilling,
18+
navigateToHome,
19+
performFullLogin,
2320
waitForTextToDisappear,
2421
} from '../helpers/shared-flows';
2522
import {

‎app/test/e2e/specs/conversations-web-channel-flow.spec.ts‎

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
waitForWebView,
1010
waitForWindowVisible,
1111
} from '../helpers/element-helpers';
12-
import { walkOnboarding, navigateToConversations, navigateViaHash } from '../helpers/shared-flows';
12+
import { navigateToConversations, navigateViaHash, walkOnboarding } from '../helpers/shared-flows';
1313
import { clearRequestLog, getRequestLog, startMockServer, stopMockServer } from '../mock-server';
1414

1515
function stepLog(message: string, context?: unknown) {
@@ -93,7 +93,9 @@ suiteRunner('Conversations web channel flow', () => {
9393
// The chat input uses a textarea with placeholder attribute — not visible as text content.
9494
// Use browser.execute to find and focus it, then type.
9595
const foundInput = await browser.execute(() => {
96-
const textarea = document.querySelector('textarea[placeholder*="Type a message"]') as HTMLTextAreaElement;
96+
const textarea = document.querySelector(
97+
'textarea[placeholder*="Type a message"]'
98+
) as HTMLTextAreaElement;
9799
if (textarea) {
98100
textarea.focus();
99101
textarea.click();
@@ -118,10 +120,13 @@ suiteRunner('Conversations web channel flow', () => {
118120

119121
// Set value via JS and dispatch input event (browser.keys unreliable on tauri-driver)
120122
await browser.execute(() => {
121-
const textarea = document.querySelector('textarea[placeholder*="Type a message"]') as HTMLTextAreaElement;
123+
const textarea = document.querySelector(
124+
'textarea[placeholder*="Type a message"]'
125+
) as HTMLTextAreaElement;
122126
if (!textarea) return;
123127
const nativeInputValueSetter = Object.getOwnPropertyDescriptor(
124-
window.HTMLTextAreaElement.prototype, 'value'
128+
window.HTMLTextAreaElement.prototype,
129+
'value'
125130
)?.set;
126131
nativeInputValueSetter?.call(textarea, 'hello from e2e web channel');
127132
textarea.dispatchEvent(new Event('input', { bubbles: true }));
@@ -131,9 +136,13 @@ suiteRunner('Conversations web channel flow', () => {
131136

132137
// Submit by pressing Enter via JS (simulates form submission)
133138
await browser.execute(() => {
134-
const textarea = document.querySelector('textarea[placeholder*="Type a message"]') as HTMLTextAreaElement;
139+
const textarea = document.querySelector(
140+
'textarea[placeholder*="Type a message"]'
141+
) as HTMLTextAreaElement;
135142
if (!textarea) return;
136-
textarea.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter', code: 'Enter', bubbles: true }));
143+
textarea.dispatchEvent(
144+
new KeyboardEvent('keydown', { key: 'Enter', code: 'Enter', bubbles: true })
145+
);
137146
});
138147
await browser.pause(1_000);
139148

‎app/test/e2e/specs/crypto-payment-flow.spec.ts‎

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,11 @@
1111
* 6.3.2 Coinbase API error handled gracefully
1212
*/
1313
import { waitForApp } from '../helpers/app-helpers';
14+
import { clickText, clickToggle, textExists } from '../helpers/element-helpers';
1415
import {
15-
clickText,
16-
clickToggle,
17-
textExists,
18-
} from '../helpers/element-helpers';
19-
import {
20-
performFullLogin,
21-
navigateToHome,
2216
navigateToBilling,
17+
navigateToHome,
18+
performFullLogin,
2319
waitForTextToDisappear,
2420
} from '../helpers/shared-flows';
2521
import {
@@ -103,7 +99,9 @@ describe('Crypto Payment Flow', () => {
10399
if (coinbaseCall) {
104100
console.log(`${LOG_PREFIX} 6.1.1 — Coinbase charge API called (crypto path)`);
105101
} else if (stripeCall) {
106-
console.log(`${LOG_PREFIX} 6.1.1 — Stripe API called (crypto toggle may not have taken effect)`);
102+
console.log(
103+
`${LOG_PREFIX} 6.1.1 — Stripe API called (crypto toggle may not have taken effect)`
104+
);
107105
}
108106
expect(coinbaseCall || stripeCall).toBeDefined();
109107

‎app/test/e2e/specs/gmail-flow.spec.ts‎

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ import {
3232
waitForText,
3333
} from '../helpers/element-helpers';
3434
import {
35-
performFullLogin,
3635
navigateToHome,
3736
navigateToIntelligence,
3837
navigateToSettings,
38+
performFullLogin,
3939
waitForHomePage,
4040
} from '../helpers/shared-flows';
4141
import {
@@ -79,31 +79,7 @@ async function waitForTextToDisappear(text, timeout = 10_000) {
7979
return false;
8080
}
8181

82-
/**
83-
* Wait until one of the candidate texts appears on screen (Home page markers).
84-
*/
85-
async function waitForHomePage(timeout = 15_000) {
86-
const candidates = [
87-
'Test',
88-
'Good morning',
89-
'Good afternoon',
90-
'Good evening',
91-
'Message OpenHuman',
92-
'Upgrade to Premium',
93-
];
94-
95-
const deadline = Date.now() + timeout;
96-
while (Date.now() < deadline) {
97-
for (const text of candidates) {
98-
if (await textExists(text)) return text;
99-
}
100-
await browser.pause(1_000);
101-
}
102-
return null;
103-
}
104-
105-
// clickFirstCandidate, navigateToHome, performFullLogin, waitForHomePage
106-
// are now imported from shared-flows
82+
// waitForHomePage, navigateToHome, performFullLogin are imported from shared-flows
10783

10884
/**
10985
* Counter for unique JWT suffixes.

0 commit comments

Comments
 (0)