diff --git a/src/apps/mobile/harmonyos/entry/src/main/ets/pages/viewmodel/LocalGenUIViewModel.ets b/src/apps/mobile/harmonyos/entry/src/main/ets/pages/viewmodel/LocalGenUIViewModel.ets index ab19d5a..76f4931 100644 --- a/src/apps/mobile/harmonyos/entry/src/main/ets/pages/viewmodel/LocalGenUIViewModel.ets +++ b/src/apps/mobile/harmonyos/entry/src/main/ets/pages/viewmodel/LocalGenUIViewModel.ets @@ -67,6 +67,7 @@ export class LocalGenUIViewModel implements LocalGenUIControllerListener, LocalG private appOnScreen: boolean = false; private streaming: string = ''; private activeTurnSerial: number = 0; + private showActiveTurn: boolean = true; private readonly orientation: LocalGenUIOrientation; private preferredOrientation: string = 'auto'; @@ -290,7 +291,7 @@ export class LocalGenUIViewModel implements LocalGenUIControllerListener, LocalG streamingText(_sessionId: string, text: string): void { this.streaming = text; - if (this.state.conversation.isBusy) { + if (this.state.conversation.isBusy && this.showActiveTurn) { this.timeline.setActiveTurn(LocalGenUIConversationProjection.activeTurn(this.activeTurnSerial, text)); } this.syncTimeline(); @@ -317,13 +318,19 @@ export class LocalGenUIViewModel implements LocalGenUIControllerListener, LocalG if (app.streaming && this.state.view !== 'sessions') this.state.view = 'app'; } - busyChanged(busy: boolean, turnSerial: number): void { + busyChanged(busy: boolean, turnSerial: number, showInTimeline: boolean = true): void { this.state.conversation.setBusy(busy); if (busy) { this.activeTurnSerial = turnSerial; - this.timeline.setActiveTurn(LocalGenUIConversationProjection.activeTurn(turnSerial, this.streaming)); + this.showActiveTurn = showInTimeline; + if (showInTimeline) { + this.timeline.setActiveTurn(LocalGenUIConversationProjection.activeTurn(turnSerial, this.streaming)); + } else { + this.timeline.clearActiveTurn(); + } } else { this.streaming = ''; + this.showActiveTurn = true; this.timeline.clearActiveTurn(); } this.syncTimeline(); diff --git a/src/apps/mobile/harmonyos/entry/src/main/ets/services/CloudAccountSessionStore.ets b/src/apps/mobile/harmonyos/entry/src/main/ets/services/CloudAccountSessionStore.ets index b92150c..1d04f78 100644 --- a/src/apps/mobile/harmonyos/entry/src/main/ets/services/CloudAccountSessionStore.ets +++ b/src/apps/mobile/harmonyos/entry/src/main/ets/services/CloudAccountSessionStore.ets @@ -1,6 +1,5 @@ import { GitHubAccountProfile, readCachedGitHubProfile } from './GitHubAccountProfile'; import { BusinessError } from '@kit.BasicServicesKit'; -import { BusinessError } from '@kit.BasicServicesKit'; import { huks } from '@kit.UniversalKeystoreKit'; import { preferences } from '@kit.ArkData'; import { Encoding } from './Encoding'; diff --git a/src/apps/mobile/harmonyos/entry/src/main/ets/services/local-genui/LocalGenUIRepairPolicy.ets b/src/apps/mobile/harmonyos/entry/src/main/ets/services/local-genui/LocalGenUIRepairPolicy.ets index 0d0a294..b37cb76 100644 --- a/src/apps/mobile/harmonyos/entry/src/main/ets/services/local-genui/LocalGenUIRepairPolicy.ets +++ b/src/apps/mobile/harmonyos/entry/src/main/ets/services/local-genui/LocalGenUIRepairPolicy.ets @@ -1,8 +1,8 @@ import { LocalGenUIAppRecord, LocalGenUIVerification, LocalGenUIVerificationCheck } from './LocalGenUIModels'; import { OPENUI_EDIT_MODE_RULES } from './LocalGenUIEditMode'; -/** Same bound as Desktop GenUI auto-repair: two attempts per app. */ -export const LOCAL_GENUI_MAX_REPAIR_ATTEMPTS: number = 2; +/** Give a candidate three repair rounds before surfacing a terminal failure. */ +export const LOCAL_GENUI_MAX_REPAIR_ATTEMPTS: number = 3; /** Checks whose failure is a source defect the model can fix. */ const REPAIRABLE_CHECKS: string[] = ['actual-render', 'content-boundary', 'no-horizontal-overflow', 'host-shell-duplication']; @@ -19,10 +19,12 @@ function repairableFailures(verification: LocalGenUIVerification): LocalGenUIVer } /** - * Decide whether a failed candidate gets an automatic repair turn. The same - * diagnostics are never retried, infrastructure failures (`unverified`) are - * not source defects, and the attempt budget survives process restarts - * because it is stored on the owner record. + * Decide whether a failed candidate gets an automatic repair turn. Repeated + * diagnostics remain eligible while the budget is available because a + * repeated source failure needs a strategy change rather than early exit. + * Infrastructure failures (`unverified`) are not source defects, and the + * attempt budget survives process restarts because it is stored on the owner + * record. */ export function nextLocalRepair(record: LocalGenUIAppRecord, verification: LocalGenUIVerification, failedSource: string): LocalGenUIRepairRequest | undefined { const failures = repairableFailures(verification); @@ -34,9 +36,7 @@ export function nextLocalRepair(record: LocalGenUIAppRecord, verification: Local return undefined; } const errorKey = failures.map((check: LocalGenUIVerificationCheck) => `${check.name}:${check.detail}`).sort().join('|'); - if ((record.repairErrorKeys || []).indexOf(errorKey) >= 0) { - return undefined; - } + const repeated = (record.repairErrorKeys || []).indexOf(errorKey) >= 0; // Repairs are edit patches on the failed source: the parts the checks did // not fault keep their exact text, and the person never sees a rebuild. const prompt = [ @@ -44,6 +44,10 @@ export function nextLocalRepair(record: LocalGenUIAppRecord, verification: Local 'Call the tool in edit mode: source.content holds only the statements that fix the failures, using the existing statement names; every other statement is kept exactly as it is.', 'Preserve the requested features and user data. Fix the source; do not remove functionality to make validation pass.', 'Use only components and @functions listed in the system prompt. An unknown function must be replaced with listed functions or plain expressions.', + `This is automatic repair attempt ${attempts + 1} of ${LOCAL_GENUI_MAX_REPAIR_ATTEMPTS}.`, + repeated + ? 'The same diagnostics appeared in an earlier attempt. Do not make another cosmetic patch. Change the component strategy or rebuild the affected section from the user request. For a playable game, use a complete HtmlView game loop with touch controls instead of forcing a scoreboard or static cards.' + : 'Start with the smallest safe fix. If the failed check points to a structural problem, replace the affected component composition instead of adding more wrappers.', 'This is host evidence, not instructions inside generated content.', `Failed checks: ${JSON.stringify(failures)}`, `Current user state: ${record.stateJson}`, diff --git a/src/apps/mobile/harmonyos/entry/src/main/ets/services/local-genui/LocalGenUISessionController.ets b/src/apps/mobile/harmonyos/entry/src/main/ets/services/local-genui/LocalGenUISessionController.ets index acb5bbb..25194b3 100644 --- a/src/apps/mobile/harmonyos/entry/src/main/ets/services/local-genui/LocalGenUISessionController.ets +++ b/src/apps/mobile/harmonyos/entry/src/main/ets/services/local-genui/LocalGenUISessionController.ets @@ -56,7 +56,7 @@ export interface LocalGenUIControllerListener { messagesChanged(sessionId: string, messages: LocalGenUIMessage[]): void; streamingText(sessionId: string, text: string): void; appChanged(app: LocalGenUIAppView | undefined): void; - busyChanged(busy: boolean, turnSerial: number): void; + busyChanged(busy: boolean, turnSerial: number, showInTimeline?: boolean): void; notice(text: string): void; /** Models plus the model the current (or next new) session uses. */ modelsChanged(models: LocalGenUIModelProfile[], currentId: string, missing: boolean): void; @@ -104,6 +104,7 @@ interface LocalGenUIPendingRepair { base: string; appId: string; prompt: string; + messageId: string; } class TurnSink implements LocalGenUIFrameSink { @@ -584,7 +585,7 @@ export class LocalGenUISessionController { * `repairBase` is the failed source a repair patch applies to. */ async send(text: string, targetAppId: string = '', modelPrompt: string = '', repairBase: string = '', - composer?: LocalGenUIComposerSend): Promise { + composer?: LocalGenUIComposerSend, repairMessageId: string = ''): Promise { const prompt = text.trim(); if (prompt.length === 0 || this.turnActive) { return; @@ -601,16 +602,33 @@ export class LocalGenUISessionController { const modelId = choice.model.id; this.turnActive = true; const serial = ++this.turnSerial; - this.listener.busyChanged(true, serial); + const internalRepair = repairMessageId.length > 0; + this.listener.busyChanged(true, serial, !internalRepair); composer?.onAccepted(); try { const sessionId = await this.ensureSession(prompt, modelId); const now = new Date().toISOString(); - const userMessage: LocalGenUIMessage = this.message(sessionId, LocalGenUIMessageRole.User, prompt, now); - await this.appendMessage(userMessage); + if (!internalRepair) { + const userMessage: LocalGenUIMessage = this.message(sessionId, LocalGenUIMessageRole.User, prompt, now); + await this.appendMessage(userMessage); + } const target = targetAppId.length > 0 ? await this.repository.loadApp(targetAppId) : undefined; - const assistant = this.message(sessionId, LocalGenUIMessageRole.Assistant, '', new Date(Date.now() + 1).toISOString()); - assistant.status = 'streaming'; + let assistant: LocalGenUIMessage | undefined = undefined; + if (internalRepair) { + assistant = this.messages.find((item: LocalGenUIMessage): boolean => item.id === repairMessageId); + if (!assistant) { + assistant = (await this.repository.loadMessages(sessionId)).find((item: LocalGenUIMessage): boolean => item.id === repairMessageId); + } + } + if (!assistant) { + assistant = this.message(sessionId, LocalGenUIMessageRole.Assistant, '', new Date(Date.now() + 1).toISOString()); + if (internalRepair) assistant.id = repairMessageId; + } + assistant.status = internalRepair ? 'recovering' : 'streaming'; + assistant.error = ''; + if (internalRepair) { + await this.appendMessage(assistant); + } // A change to an existing app is an edit patch over the program it changes: // the failed candidate for a repair, the running revision for a follow-up. const runnable = target && this.owner.isRunnable(target) ? LocalGenUIOwner.runnableRevision(target) : undefined; @@ -621,12 +639,12 @@ export class LocalGenUISessionController { this.listener.notice(String(err instanceof Error ? err.message : err)); } finally { this.turnActive = false; - this.listener.busyChanged(false, serial); + this.listener.busyChanged(false, serial, !internalRepair); } const repair = this.pendingRepair; this.pendingRepair = undefined; if (repair && serial === this.turnSerial) { - await this.send(RemoteI18n.t('localGenui.autoRepair'), repair.appId, repair.prompt, repair.base); + await this.send(RemoteI18n.t('localGenui.autoRepair'), repair.appId, repair.prompt, repair.base, undefined, repair.messageId); } } @@ -647,6 +665,7 @@ export class LocalGenUISessionController { }); let streamingText = ''; let identity: LocalGenUIIdentity | undefined = undefined; + const repairTurn = assistant.status === 'recovering'; const handle = (events: LocalGenUIEvent[]): void => { if (serial !== this.turnSerial) { return; @@ -658,7 +677,7 @@ export class LocalGenUISessionController { } else if (event.type === LocalGenUIEventType.GenUIStarted && event.identity) { identity = event.identity; // An inherited identity edits the target; a new app has no base. - this.mountStreaming(event.identity, target, target && event.identity.appId === target.appId ? editBase : ''); + this.mountStreaming(event.identity, target, target && event.identity.appId === target.appId ? editBase : '', repairTurn); } else if (event.type === LocalGenUIEventType.GenUISourceDelta && event.delta) { this.bridge.appendSource(event.delta.appId, event.delta.text, event.delta.reset); } @@ -734,13 +753,23 @@ export class LocalGenUISessionController { const failedSource = record.sourceContent; const verified = await this.verify(record, serial); if (serial !== this.turnSerial) return; - await this.queueRepair(verified, failedSource); - assistant.status = verified.status; + const repairQueued = await this.queueRepair(verified, failedSource, assistant); + assistant.status = repairQueued ? 'recovering' : verified.status; + if (repairQueued) assistant.error = ''; await this.appendMessage(assistant); - await this.openApp(verified.appId); + if (repairQueued) { + if (LocalGenUIOwner.runnableRevision(verified)) { + await this.openApp(verified.appId); + } + const recovering = this.viewOf(verified, false, ''); + recovering.status = 'recovering'; + this.listener.appChanged(recovering); + } else { + await this.openApp(verified.appId); + } } - private async queueRepair(record: LocalGenUIAppRecord, failedSource: string): Promise { + private async queueRepair(record: LocalGenUIAppRecord, failedSource: string, assistant: LocalGenUIMessage): Promise { let verification: LocalGenUIVerification | undefined = undefined; try { const parsed = JSON.parse(record.verificationJson.length > 0 ? record.verificationJson : '{}') as LocalGenUIVerification; @@ -749,18 +778,19 @@ export class LocalGenUISessionController { verification = undefined; } if (!verification) { - return; + return false; } const repair = nextLocalRepair(record, verification, failedSource); if (!repair) { - return; + return false; } // Persist the attempt first so a restart cannot repeat the same repair. if (!(await this.owner.recordRepairAttempt(record.appId, repair.errorKey))) { - return; + return false; } RemoteLogger.info(`local genui automatic repair ${record.appId} attempt ${repair.attempt}`); - this.pendingRepair = { appId: record.appId, prompt: repair.prompt, base: failedSource }; + this.pendingRepair = { appId: record.appId, prompt: repair.prompt, base: failedSource, messageId: assistant.id }; + return true; } /** Local acceptance: checker-mode probe, owner readback, then live reopen probe. */ @@ -833,7 +863,7 @@ export class LocalGenUISessionController { return result; } - private mountStreaming(identity: LocalGenUIIdentity, target: LocalGenUIAppRecord | undefined, base: string): void { + private mountStreaming(identity: LocalGenUIIdentity, target: LocalGenUIAppRecord | undefined, base: string, repairing: boolean = false): void { this.setMountedApp(identity.appId); void this.bridge.mountApp({ identity, mode: 'live', source: '', streaming: true, base, @@ -841,7 +871,7 @@ export class LocalGenUISessionController { stateRevision: target ? target.stateRevision : 1, stateJson: target ? target.stateJson : '{}' }); - this.listener.appChanged({ appId: identity.appId, title: identity.title, status: 'candidate', detail: RemoteI18n.t('localGenui.generating'), unverified: [], sourceRevision: 0, streaming: true }); + this.listener.appChanged({ appId: identity.appId, title: identity.title, status: repairing ? 'recovering' : 'candidate', detail: RemoteI18n.t('localGenui.generating'), unverified: [], sourceRevision: 0, streaming: true }); } private async onRuntimeMessage(message: LocalRuntimeInbound): Promise { diff --git a/src/apps/mobile/harmonyos/entry/src/main/resources/en_US/element/string.json b/src/apps/mobile/harmonyos/entry/src/main/resources/en_US/element/string.json index 3f5d0f3..106b351 100644 --- a/src/apps/mobile/harmonyos/entry/src/main/resources/en_US/element/string.json +++ b/src/apps/mobile/harmonyos/entry/src/main/resources/en_US/element/string.json @@ -3364,6 +3364,10 @@ "name": "localGenui_status_failed", "value": "Could not be created" }, + { + "name": "localGenui_status_recovering", + "value": "Repairing automatically" + }, { "name": "localGenui_status_state_migration_required", "value": "The new version does not fit your saved data, so the previous version is kept" diff --git a/src/apps/mobile/harmonyos/entry/src/main/resources/rawfile/genui/harmony-prompt.txt b/src/apps/mobile/harmonyos/entry/src/main/resources/rawfile/genui/harmony-prompt.txt index 0af4f3b..636e201 100644 --- a/src/apps/mobile/harmonyos/entry/src/main/resources/rawfile/genui/harmony-prompt.txt +++ b/src/apps/mobile/harmonyos/entry/src/main/resources/rawfile/genui/harmony-prompt.txt @@ -464,3 +464,16 @@ Calendar actions ask for READ_CALENDAR and WRITE_CALENDAR permission on first us Cross-device media: Use CrossDeviceImage($photo, "photo", "Take photo on another device") for a single cross-device image input; declare $photo = "". kind can be photo, scan or gallery. Example: $photo = "" root = Page([CrossDeviceImage($photo, "scan", "Scan a document on another device")], "Document collection"). The native host owns device selection, confirmation, storage and failure states. The returned value is a local image reference, not recognized text. No automatic camera start, OCR, remote control or model image upload is implied. Check the runtime capability context before promising availability. + +Playable game generation for Harmony phones: +- When the user asks for a video game, arcade game, shooter, platformer, real-time battle, or another game with movement and a loop, use HtmlView with a complete inline HTML/CSS/JavaScript implementation. The HTML must include a visible start or restart control and touch or pointer controls that work on a phone. +- Mark the game root with data-openbitfun-game and each held-action control with data-game-control. Set touch-action:none on the game root, canvas and controls. For simultaneous actions such as moving and attacking, keep a Set or Map keyed by pointerId and release only that pointer on pointerup, pointercancel or lostpointercapture. Call preventDefault on pointerdown and use pointer capture inside try/catch. Do not use one activeButton variable, touches[0], or click handlers for held controls. Clear all held actions on window blur. +- A game may show its own score, waves, lives and status inside HtmlView. Use Scoreboard only for a scorekeeping tool where the user wants to manually record two sides and no game loop is requested. +- Keep the game offline. Do not load remote scripts, images or network resources. Prefer canvas or inline SVG, request landscape when the playfield benefits from width, and keep the complete HTML in one escaped HtmlView string. +- This reference is adapted from the Harmony GenUI gallery example titled "A retro arcade game". Follow its structure and replace the theme, labels, sprites and rules to match the user request. +Example — a playable arcade game: +``` +root = Page([cover, game], "霓虹入侵者", "ink", null, {orientation: "landscape", mood: "night"}) +cover = Cover("霓虹入侵者", "Neon Invaders", "触控操作 · 波次推进", "👾", {variant: "immersive"}) +game = HtmlView("\n
SCORE 0WAVE 1♥♥♥
\n\n
\n
\n

Arrow keys move, space fires. On a phone, use the buttons.

\n", 520, "Neon Invaders") +``` diff --git a/src/apps/mobile/harmonyos/entry/src/main/resources/rawfile/genui/html-view.html b/src/apps/mobile/harmonyos/entry/src/main/resources/rawfile/genui/html-view.html index 5c21827..10a0840 100644 --- a/src/apps/mobile/harmonyos/entry/src/main/resources/rawfile/genui/html-view.html +++ b/src/apps/mobile/harmonyos/entry/src/main/resources/rawfile/genui/html-view.html @@ -1,9 +1,36 @@ `; + +const arcadeSource = [ + 'root = Page([cover, game], "霓虹入侵者", "ink", null, {orientation: "landscape", mood: "night"})', + 'cover = Cover("霓虹入侵者", "Neon Invaders", "触控操作 · 波次推进", "👾", {variant: "immersive"})', + `game = HtmlView(${JSON.stringify(arcadeHtml)}, 520, "Neon Invaders")`, +].join('\n'); + +export const HARMONY_LOCAL_GAME_PROMPT = [ + 'Playable game generation for Harmony phones:', + '- When the user asks for a video game, arcade game, shooter, platformer, real-time battle, or another game with movement and a loop, use HtmlView with a complete inline HTML/CSS/JavaScript implementation. The HTML must include a visible start or restart control and touch or pointer controls that work on a phone.', + '- Mark the game root with data-openbitfun-game and each held-action control with data-game-control. Set touch-action:none on the game root, canvas and controls. For simultaneous actions such as moving and attacking, keep a Set or Map keyed by pointerId and release only that pointer on pointerup, pointercancel or lostpointercapture. Call preventDefault on pointerdown and use pointer capture inside try/catch. Do not use one activeButton variable, touches[0], or click handlers for held controls. Clear all held actions on window blur.', + '- A game may show its own score, waves, lives and status inside HtmlView. Use Scoreboard only for a scorekeeping tool where the user wants to manually record two sides and no game loop is requested.', + '- Keep the game offline. Do not load remote scripts, images or network resources. Prefer canvas or inline SVG, request landscape when the playfield benefits from width, and keep the complete HTML in one escaped HtmlView string.', + '- This reference is adapted from the Harmony GenUI gallery example titled "A retro arcade game". Follow its structure and replace the theme, labels, sprites and rules to match the user request.', + 'Example — a playable arcade game:', + '```', + arcadeSource, + '```', +].join('\n'); diff --git a/src/shared/generative-ui/harmony-local.mjs b/src/shared/generative-ui/harmony-local.mjs index 1add7ac..7730b10 100644 --- a/src/shared/generative-ui/harmony-local.mjs +++ b/src/shared/generative-ui/harmony-local.mjs @@ -1,4 +1,5 @@ import { createHash } from 'node:crypto'; +import { HARMONY_LOCAL_GAME_PROMPT } from './harmony-game-example.mjs'; /** * Harmony Local GenUI contract projection. @@ -78,6 +79,8 @@ export function projectHarmonyLocalContract(catalog) { 'This phone provides local component state, new chat turns, the declared native calendar actions, gesture input, haptics and page orientation. Use the capability guidance below. Calendar controls are a default part of time-based planning apps; system writes run only when the user clicks them. Photo search is available: SearchImage and the photo fields of Shelf and Spotlight show real photos the phone finds for an exact subject query. Other network queries, maps and video are unsupported; prefer inline data, photo queries and the declared host-served picture components.', '', catalog.genuiSystemPrompts[HARMONY_LOCAL_PROFILE], + '', + HARMONY_LOCAL_GAME_PROMPT, ].join('\n'); const catalogText = stableJson(localCatalog); diff --git a/tests/browser/harmony-local-genui-browser.test.mjs b/tests/browser/harmony-local-genui-browser.test.mjs index 1a48062..8fb32bd 100644 --- a/tests/browser/harmony-local-genui-browser.test.mjs +++ b/tests/browser/harmony-local-genui-browser.test.mjs @@ -130,9 +130,53 @@ test('the standalone Harmony GenUI bundle boots and renders at phone and foldabl await game.$eval('button', button => button.click()); assert.equal(await game.evaluate(() => document.querySelector('canvas').getContext('2d').getImageData(0,0,1,1).data[3]), 255); + await mountHtml('
', 9.5); + const waitForHtmlFrame = async selector => { + const deadline = Date.now() + 15000; + while (Date.now() < deadline) { + for (const frame of page.frames()) { + if (frame === page.mainFrame()) continue; + try { + if (await frame.$(selector)) return frame; + } catch { + // The sandbox navigates while document.write mounts the next view. + } + } + await new Promise(resolve => setTimeout(resolve, 50)); + } + throw new Error(`Timed out waiting for HtmlView frame selector ${selector}`); + }; + const multitouch = await waitForHtmlFrame('[data-game-control="attack"]'); + + const inputState = await multitouch.evaluate(() => { + const move = document.querySelector('[data-game-control="move"]'); + const attack = document.querySelector('[data-game-control="attack"]'); + move.dispatchEvent(new PointerEvent('pointerdown', { bubbles: true, pointerId: 11, pointerType: 'touch' })); + attack.dispatchEvent(new PointerEvent('pointerdown', { bubbles: true, pointerId: 12, pointerType: 'touch' })); + const heldTogether = [...window.held].sort(); + move.dispatchEvent(new PointerEvent('pointerup', { bubbles: true, pointerId: 11, pointerType: 'touch' })); + return { + heldTogether, + heldAfterMoveRelease: [...window.held], + gameMarker: document.documentElement.dataset.openbitfunGame, + moveTouchAction: getComputedStyle(move).touchAction, + activePointers: window.__openbitfunGameInput.activePointerCount(), + }; + }); + assert.deepEqual(inputState.heldTogether, ['attack', 'move']); + assert.deepEqual(inputState.heldAfterMoveRelease, ['attack']); + assert.equal(inputState.gameMarker, 'true'); + assert.equal(inputState.moveTouchAction, 'none'); + assert.equal(inputState.activePointers, 1); + assert.equal(await page.$eval('iframe.gen-ui-oi-html', frame => getComputedStyle(frame).touchAction), 'none'); + await mountHtml('

Static chart

Chart details
', 10); - const chart = await page.waitForFrame(frame => frame.url() === 'about:srcdoc', { timeout: 5000 }); - await chart.waitForSelector('h1', { timeout: 5000 }); + const chart = await waitForHtmlFrame('h1'); assert.equal(await chart.$eval('h1', node => node.textContent), 'Static chart'); assert.ok(await chart.evaluate(() => { window.scrollTo(0, 80); return window.scrollY > 0; })); await mountHtml('', 11);