惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
美团技术团队
Last Week in AI
Last Week in AI
WordPress大学
WordPress大学
博客园 - 三生石上(FineUI控件)
博客园 - 聂微东
雷峰网
雷峰网
阮一峰的网络日志
阮一峰的网络日志
博客园 - 叶小钗
IT之家
IT之家
Google DeepMind News
Google DeepMind News
D
Docker
J
Java Code Geeks
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Apple Machine Learning Research
Apple Machine Learning Research
博客园 - 【当耐特】
V
V2EX
Hugging Face - Blog
Hugging Face - Blog
博客园 - Franky
月光博客
月光博客
宝玉的分享
宝玉的分享
酷 壳 – CoolShell
酷 壳 – CoolShell
aimingoo的专栏
aimingoo的专栏
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
test(ui): isolate mobile form control browser fixtures · ...
vincentkoc · 2026-06-19 · via Recent Commits to openclaw:main
11

// Control UI tests cover form controls behavior.

22

import { chromium, type Browser, type Page } from "playwright";

3-

import { afterAll, beforeAll, describe, expect, it } from "vitest";

3+

import { describe, expect, it } from "vitest";

44

import { readStyleSheet } from "../../../test/helpers/ui-style-fixtures.js";

55

import {

66

canRunPlaywrightChromium,

@@ -12,7 +12,10 @@ const describeBrowserLayout = canRunPlaywrightChromium(chromiumExecutablePath)

1212

? describe

1313

: describe.skip;

141415-

let browser: Browser;

15+

type MobileFixture = {

16+

browser: Browser;

17+

page: Page;

18+

};

16191720

function readUiCss(): string {

1821

const files = [

@@ -53,29 +56,35 @@ function controlsHtml() {

5356

`;

5457

}

555856-

async function openMobileFixture(): Promise<Page> {

57-

const page = await browser.newPage({

58-

hasTouch: true,

59-

isMobile: true,

60-

viewport: { width: 390, height: 844 },

61-

});

62-

await page.setContent(

63-

`<!doctype html><html data-theme-mode="light"><head><style>${readUiCss()}</style></head><body>${controlsHtml()}</body></html>`,

64-

);

65-

return page;

59+

async function openMobileFixture(): Promise<MobileFixture> {

60+

const browser = await chromium.launch({ executablePath: chromiumExecutablePath, headless: true });

61+

let page: Page | undefined;

62+

try {

63+

page = await browser.newPage({

64+

hasTouch: true,

65+

isMobile: true,

66+

viewport: { width: 390, height: 844 },

67+

});

68+

await page.setContent(

69+

`<!doctype html><html data-theme-mode="light"><head><style>${readUiCss()}</style></head><body>${controlsHtml()}</body></html>`,

70+

);

71+

return { browser, page };

72+

} catch (error) {

73+

await page?.close().catch(() => {});

74+

await browser.close().catch(() => {});

75+

throw error;

76+

}

6677

}

677868-

describeBrowserLayout("touch-primary form controls", () => {

69-

beforeAll(async () => {

70-

browser = await chromium.launch({ executablePath: chromiumExecutablePath, headless: true });

71-

});

72-73-

afterAll(async () => {

74-

await browser.close();

75-

});

79+

async function closeMobileFixture(fixture: MobileFixture): Promise<void> {

80+

await fixture.page.close().catch(() => {});

81+

await fixture.browser.close().catch(() => {});

82+

}

768384+

describeBrowserLayout("touch-primary form controls", () => {

7785

it("keeps text-entry controls large enough to avoid mobile focus zoom", async () => {

78-

const page = await openMobileFixture();

86+

const fixture = await openMobileFixture();

87+

const { page } = fixture;

7988

try {

8089

const metrics = await page.evaluate(() => {

8190

const selectors = [

@@ -119,12 +128,13 @@ describeBrowserLayout("touch-primary form controls", () => {

119128

expect(size.fontSize, size.selector).toBeGreaterThanOrEqual(16);

120129

}

121130

} finally {

122-

await page.close();

131+

await closeMobileFixture(fixture);

123132

}

124133

});

125134126135

it("keeps native select affordances visible in light mode", async () => {

127-

const page = await openMobileFixture();

136+

const fixture = await openMobileFixture();

137+

const { page } = fixture;

128138

try {

129139

const selects = await page.locator(".cfg-select, .field select").evaluateAll((nodes) =>

130140

nodes.map((node) => {

@@ -144,7 +154,7 @@ describeBrowserLayout("touch-primary form controls", () => {

144154

expect(select.repeat).toContain("no-repeat");

145155

}

146156

} finally {

147-

await page.close();

157+

await closeMobileFixture(fixture);

148158

}

149159

});

150160

});