Skip to content

Commit bb43e9f

Browse files
AmyShang-altgithub-actions[bot]
authored andcommitted
fix(e2e): align packaged onboarding smoke selector (#6538)
* fix(e2e): align packaged onboarding smoke selector * test(e2e): guard packaged onboarding selector drift * fix(e2e): align platform onboarding probes Generated-By: looper 0.11.8 (runner=fixer, agent=codex) * fix(e2e): align packaged smoke with identity gate Generated-By: looper 0.11.8 (runner=fixer, agent=codex) (cherry picked from commit 5580736)
1 parent 5cc064e commit bb43e9f

4 files changed

Lines changed: 31 additions & 268 deletions

File tree

e2e/lib/vitest/packaged-app-shell.ts

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,9 @@ const PACKAGED_APP_SHELL_PROBE = `
2020
const home = doc.querySelector('[data-testid="entry-nav-home"]');
2121
const onboardingShell = doc.querySelector('.entry-shell--onboarding, .entry-onboarding-modal');
2222
const cloudSignIn = doc.querySelector('.onboarding-cloud__primary');
23-
const secondaryLinks = Array.from(doc.querySelectorAll('.onboarding-cloud__secondary'));
2423
return {
25-
byokLinkVisible: secondaryLinks[1] instanceof ElementCtor,
2624
cloudSignInVisible: cloudSignIn instanceof ElementCtor,
2725
homeVisible: home instanceof ElementCtor && home.getClientRects().length > 0,
28-
localLinkVisible: secondaryLinks[0] instanceof ElementCtor,
2926
onboardingVisible: onboardingShell instanceof ElementCtor,
3027
text: doc.body?.textContent?.trim().slice(0, 300) ?? '',
3128
title: doc.title,
@@ -36,10 +33,8 @@ const PACKAGED_APP_SHELL_PROBE = `
3633
export const packagedAppShellExpression = `(${PACKAGED_APP_SHELL_PROBE})(document, HTMLElement)`;
3734

3835
export type PackagedAppShellSnapshot = {
39-
byokLinkVisible: boolean;
4036
cloudSignInVisible: boolean;
4137
homeVisible: boolean;
42-
localLinkVisible: boolean;
4338
onboardingVisible: boolean;
4439
text: string;
4540
title: string;
@@ -81,10 +76,8 @@ export function asPackagedAppShellSnapshot(value: unknown): PackagedAppShellSnap
8176
if (typeof value !== 'object' || value == null || Array.isArray(value)) return null;
8277
const candidate = value as Partial<PackagedAppShellSnapshot>;
8378
if (
84-
typeof candidate.byokLinkVisible !== 'boolean' ||
8579
typeof candidate.cloudSignInVisible !== 'boolean' ||
8680
typeof candidate.homeVisible !== 'boolean' ||
87-
typeof candidate.localLinkVisible !== 'boolean' ||
8881
typeof candidate.onboardingVisible !== 'boolean' ||
8982
typeof candidate.text !== 'string' ||
9083
typeof candidate.title !== 'string'
@@ -107,21 +100,16 @@ export type PackagedAppShellState = 'home' | 'onboarding-landing';
107100
* neither — a blank window, a crashed renderer, a boot still on the loader, or
108101
* a half-rendered onboarding shell all fall through to `null`.
109102
*
110-
* The landing is recognised positively, from the same three affordances the
111-
* `[P0]` onboarding smoke asserts: the sign-in CTA plus both runtime links. A
103+
* The landing is recognised positively from the identity gate's sign-in CTA.
104+
* Local and BYOK are intentionally unavailable until identity completes, so a
112105
* bare `onboardingVisible` would degrade this into "anything that is not home"
113106
* and stop failing on a renderer that mounted the shell and then died.
114107
*/
115108
export function packagedAppShellState(value: unknown): PackagedAppShellState | null {
116109
const snapshot = asPackagedAppShellSnapshot(value);
117110
if (snapshot == null) return null;
118111
if (snapshot.homeVisible) return 'home';
119-
if (
120-
snapshot.onboardingVisible &&
121-
snapshot.cloudSignInVisible &&
122-
snapshot.localLinkVisible &&
123-
snapshot.byokLinkVisible
124-
) {
112+
if (snapshot.onboardingVisible && snapshot.cloudSignInVisible) {
125113
return 'onboarding-landing';
126114
}
127115
return null;

e2e/specs/mac.spec.ts

Lines changed: 4 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -141,26 +141,13 @@ const packagedOnboardingExpression = `
141141
(() => {
142142
const onboardingShell = document.querySelector('.entry-shell--onboarding');
143143
const onboardingModal = document.querySelector('.entry-onboarding-modal');
144-
// Redesigned connect step: a cloud sign-in landing (primary CTA + two
145-
// secondary runtime links) replaces the old selectable runtime cards.
144+
// Identity is the first gate; runtime selection follows Cloud sign-in.
146145
const cloudSignIn = document.querySelector('.onboarding-cloud__primary');
147-
const secondaryLinks = Array.from(
148-
document.querySelectorAll('.onboarding-cloud__secondary'),
149-
);
150-
const localLink = secondaryLinks[0] ?? null;
151-
const byokLink = secondaryLinks[1] ?? null;
152-
const backToCloud = document.querySelector('.onboarding-view__back-to-cloud');
153-
const setupPanel = document.querySelector('.onboarding-view__setup-panel');
154146
155147
return {
156-
backVisible: backToCloud instanceof HTMLElement,
157-
byokLinkVisible: byokLink instanceof HTMLElement,
158148
cloudSignInVisible: cloudSignIn instanceof HTMLElement,
159149
href: location.href,
160-
inputCount: setupPanel instanceof HTMLElement ? setupPanel.querySelectorAll('input').length : 0,
161-
localLinkVisible: localLink instanceof HTMLElement,
162150
onboardingVisible: onboardingShell instanceof HTMLElement && onboardingModal instanceof HTMLElement,
163-
setupPanelVisible: setupPanel instanceof HTMLElement,
164151
text: onboardingModal?.textContent?.trim().slice(0, 2000) ?? null,
165152
title: document.title,
166153
};
@@ -346,20 +333,10 @@ type UpdaterRecoverySummary = {
346333
recovered: NonNullable<MacInspectResult['update']>;
347334
};
348335

349-
// The redesigned connect step exposes the two alternative runtimes as
350-
// secondary links on the cloud sign-in landing (AMR is the primary cloud CTA,
351-
// not a selectable link).
352-
type OnboardingRuntime = 'local' | 'byok';
353-
354336
type PackagedOnboardingEvalValue = {
355-
backVisible: boolean;
356-
byokLinkVisible: boolean;
357337
cloudSignInVisible: boolean;
358338
href: string;
359-
inputCount: number;
360-
localLinkVisible: boolean;
361339
onboardingVisible: boolean;
362-
setupPanelVisible: boolean;
363340
text: string | null;
364341
title: string;
365342
};
@@ -1032,7 +1009,7 @@ macOnboardingDescribe('packaged mac onboarding AMR smoke', () => {
10321009
let installedAppPath: string | null = null;
10331010
let started = false;
10341011

1035-
test('[P0] @electron-smoke starts a fresh packaged app on onboarding with AMR, Local CLI, and BYOK visible', async () => {
1012+
test('[P0] @electron-smoke starts a fresh packaged app on the Cloud identity gate', async () => {
10361013
const report = await createPackagedSmokeReport('mac');
10371014
let passed = false;
10381015
try {
@@ -1058,41 +1035,11 @@ macOnboardingDescribe('packaged mac onboarding AMR smoke', () => {
10581035
expect(health.health.ok).toBe(true);
10591036

10601037
const initial = await waitForPackagedOnboarding((snapshot) =>
1061-
snapshot.onboardingVisible &&
1062-
snapshot.cloudSignInVisible &&
1063-
snapshot.localLinkVisible &&
1064-
snapshot.byokLinkVisible,
1065-
'fresh packaged onboarding cloud sign-in landing',
1038+
snapshot.onboardingVisible && snapshot.cloudSignInVisible,
1039+
'fresh packaged onboarding Cloud identity gate',
10661040
);
10671041
expect(initial.href).toMatch(/^(od:\/\/app\/|http:\/\/127\.0\.0\.1:\d+\/)/);
10681042
expect(initial.cloudSignInVisible).toBe(true);
1069-
expect(initial.localLinkVisible).toBe(true);
1070-
expect(initial.byokLinkVisible).toBe(true);
1071-
1072-
// Expand the BYOK panel from the landing, then collapse back via Back.
1073-
await clickPackagedOnboardingRuntime('byok');
1074-
const byok = await waitForPackagedOnboarding(
1075-
(snapshot) => snapshot.setupPanelVisible && snapshot.inputCount > 0,
1076-
'packaged onboarding BYOK setup panel',
1077-
);
1078-
expect(byok.setupPanelVisible).toBe(true);
1079-
1080-
// The secondary links only live on the landing, so Back before Local.
1081-
await clickPackagedOnboardingBack();
1082-
await clickPackagedOnboardingRuntime('local');
1083-
const local = await waitForPackagedOnboarding(
1084-
(snapshot) => snapshot.setupPanelVisible,
1085-
'packaged onboarding Local CLI setup panel',
1086-
);
1087-
expect(local.setupPanelVisible).toBe(true);
1088-
1089-
// Back once more lands on the cloud sign-in surface for the screenshot.
1090-
await clickPackagedOnboardingBack();
1091-
const landing = await waitForPackagedOnboarding(
1092-
(snapshot) => snapshot.cloudSignInVisible && !snapshot.setupPanelVisible,
1093-
'packaged onboarding cloud sign-in landing after Back',
1094-
);
1095-
expect(landing.cloudSignInVisible).toBe(true);
10961043

10971044
const onboardingScreenshotPath = join(toolsPackDir, 'screenshots', `${namespace}-onboarding.png`);
10981045
await mkdir(dirname(onboardingScreenshotPath), { recursive: true });
@@ -1101,11 +1048,8 @@ macOnboardingDescribe('packaged mac onboarding AMR smoke', () => {
11011048
expect(await fileSizeBytes(onboardingScreenshotPath)).toBeGreaterThan(0);
11021049
await report.report.save('screenshots/open-design-mac-onboarding-smoke.png', await readFile(onboardingScreenshotPath));
11031050
await report.report.json('onboarding-summary.json', {
1104-
byok,
11051051
health,
11061052
initial,
1107-
landing,
1108-
local,
11091053
namespace,
11101054
screenshot: 'screenshots/open-design-mac-onboarding-smoke.png',
11111055
start: {
@@ -2591,22 +2535,6 @@ async function waitForPackagedOnboarding(
25912535
throw new Error(`${label}: packaged onboarding timed out: ${formatUnknown(lastResult)}`);
25922536
}
25932537

2594-
async function clickPackagedOnboardingRuntime(runtime: OnboardingRuntime): Promise<void> {
2595-
const inspect = await runToolsPackJson<MacInspectResult>('inspect', ['--expr', clickPackagedOnboardingRuntimeExpression(runtime)]);
2596-
const value = inspect.eval?.value;
2597-
if (!isRecord(value) || value.clicked !== true) {
2598-
throw new Error(`failed to click packaged onboarding ${runtime} runtime: ${formatUnknown(value)}`);
2599-
}
2600-
}
2601-
2602-
async function clickPackagedOnboardingBack(): Promise<void> {
2603-
const inspect = await runToolsPackJson<MacInspectResult>('inspect', ['--expr', clickPackagedOnboardingBackExpression()]);
2604-
const value = inspect.eval?.value;
2605-
if (!isRecord(value) || value.clicked !== true) {
2606-
throw new Error(`failed to click packaged onboarding back: ${formatUnknown(value)}`);
2607-
}
2608-
}
2609-
26102538
async function waitForUpdaterStatus(
26112539
predicate: (inspect: MacInspectResult) => boolean,
26122540
label: string,
@@ -2937,39 +2865,6 @@ function assertUpdaterClickEvalValue(value: unknown): UpdaterClickEvalValue {
29372865
return normalized;
29382866
}
29392867

2940-
function clickPackagedOnboardingRuntimeExpression(runtime: OnboardingRuntime): string {
2941-
// Secondary runtime links on the cloud landing, in DOM order: [0] Local,
2942-
// [1] BYOK. Clicking one expands its setup panel.
2943-
const index = runtime === 'local' ? 0 : 1;
2944-
return `
2945-
(async () => {
2946-
const links = Array.from(document.querySelectorAll('.onboarding-cloud__secondary'));
2947-
const target = links[${index}] ?? null;
2948-
if (!(target instanceof HTMLElement)) {
2949-
return { clicked: false, reason: 'missing-runtime-link', runtime: ${JSON.stringify(runtime)} };
2950-
}
2951-
target.click();
2952-
await new Promise((resolve) => setTimeout(resolve, 250));
2953-
return { clicked: true, runtime: ${JSON.stringify(runtime)} };
2954-
})()
2955-
`;
2956-
}
2957-
2958-
function clickPackagedOnboardingBackExpression(): string {
2959-
// Collapse an expanded runtime setup panel back to the cloud sign-in landing.
2960-
return `
2961-
(async () => {
2962-
const target = document.querySelector('.onboarding-view__back-to-cloud');
2963-
if (!(target instanceof HTMLElement)) {
2964-
return { clicked: false, reason: 'missing-back' };
2965-
}
2966-
target.click();
2967-
await new Promise((resolve) => setTimeout(resolve, 250));
2968-
return { clicked: true };
2969-
})()
2970-
`;
2971-
}
2972-
29732868
function asHealthEvalValue(value: unknown): HealthEvalValue | null {
29742869
if (!isRecord(value)) return null;
29752870
if (typeof value.href !== 'string' || typeof value.status !== 'number' || typeof value.title !== 'string') return null;
@@ -2979,14 +2874,9 @@ function asHealthEvalValue(value: unknown): HealthEvalValue | null {
29792874

29802875
function asPackagedOnboardingEvalValue(value: unknown): PackagedOnboardingEvalValue | null {
29812876
if (!isRecord(value)) return null;
2982-
if (typeof value.backVisible !== 'boolean') return null;
2983-
if (typeof value.byokLinkVisible !== 'boolean') return null;
29842877
if (typeof value.cloudSignInVisible !== 'boolean') return null;
29852878
if (typeof value.href !== 'string') return null;
2986-
if (typeof value.inputCount !== 'number') return null;
2987-
if (typeof value.localLinkVisible !== 'boolean') return null;
29882879
if (typeof value.onboardingVisible !== 'boolean') return null;
2989-
if (typeof value.setupPanelVisible !== 'boolean') return null;
29902880
if (value.text != null && typeof value.text !== 'string') return null;
29912881
if (typeof value.title !== 'string') return null;
29922882
return value as PackagedOnboardingEvalValue;

0 commit comments

Comments
 (0)