Files
hms/apps/miniprogram/test-sel.cjs
iven 50eae8b809 feat(miniprogram): 温润东方风全面 UI 重设计
73 文件变更,覆盖全部 40 个页面 SCSS + TabBar 图标 + 组件样式。
统一赤陶主色 #C4623A + 暖米背景 + 衬线标题字体 + 12px 圆角体系。
2026-04-28 00:19:52 +08:00

69 lines
2.0 KiB
JavaScript

const automator = require('miniprogram-automator');
(async () => {
const mp = await automator.connect({ wsEndpoint: 'ws://127.0.0.1:9420' });
await mp.switchTab('/pages/index/index');
await new Promise(r => setTimeout(r, 2000));
const page = await mp.currentPage();
// $$ selector
const titles = await page.$$('.section-title');
console.log('section-title count:', titles.length);
for (let i = 0; i < titles.length; i++) {
const text = await titles[i].textContent();
console.log(' title[' + i + ']:', text.trim());
}
// $ single selector
const hello = await page.$('.greeting-hello');
if (hello) {
const text = await hello.textContent();
console.log('greeting:', text.trim());
}
const gName = await page.$('.greeting-name');
if (gName) {
const text = await gName.textContent();
console.log('name:', text.trim());
}
const gDate = await page.$('.greeting-date');
if (gDate) {
const text = await gDate.textContent();
console.log('date:', text.trim());
}
// Health items
const healthItems = await page.$$('.health-item');
console.log('health items:', healthItems.length);
for (let i = 0; i < healthItems.length; i++) {
const text = await healthItems[i].textContent();
console.log(' health[' + i + ']:', text.trim().replace(/\s+/g, ' '));
}
// Service items
const services = await page.$$('.service-item');
console.log('service items:', services.length);
for (let i = 0; i < services.length; i++) {
const text = await services[i].textContent();
console.log(' service[' + i + ']:', text.trim().replace(/\s+/g, ' '));
}
// Empty state
const empty = await page.$('.empty-text');
if (empty) {
const text = await empty.textContent();
console.log('empty:', text.trim());
}
// Empty hint
const hint = await page.$('.empty-hint');
if (hint) {
const text = await hint.textContent();
console.log('hint:', text.trim().replace(/\s+/g, ' '));
}
await mp.close();
process.exit(0);
})()