chore(tools): 新增页面结构与 UI 回归测试脚本

补齐 check-pages 与首页、预约记录、下单页的 node --test 用例,
并在 package.json 挂上对应命令,改动样式后可先跑脚本再进开发者工具。
This commit is contained in:
lik
2026-11-16 19:29:48 +08:00
parent 5a70b4d0e2
commit af666567c1
5 changed files with 579 additions and 0 deletions
+3
View File
@@ -4,6 +4,9 @@
"description": "暖橙陪诊用户端微信小程序",
"main": "app.js",
"scripts": {
"check:pages": "node tools/check-pages.js",
"test:booking-ui": "node --test tools/booking-ui.test.js",
"test:record-ui": "node --test tools/record-ui.test.js",
"dev": "echo '请在微信开发者工具中打开项目进行开发'"
},
"keywords": [
+245
View File
@@ -0,0 +1,245 @@
const { test } = require('node:test')
const assert = require('node:assert/strict')
const fs = require('node:fs')
const path = require('node:path')
const vm = require('node:vm')
const { withDuplicateNameHints } = require('../utils/booking-profiles.js')
const root = path.resolve(__dirname, '..')
function createHospitalSelector() {
let definition
let hidden = 0
vm.runInNewContext(fs.readFileSync(path.join(root, 'components/hospital-select/index.js'), 'utf8'), {
Component(value) { definition = value },
wx: { getWindowInfo: () => ({ windowHeight: 800 }), hideKeyboard() { hidden++ } }
})
const events = []
const instance = {
data: { ...definition.data, disabled: false, options: [], value: '' },
setData(value) { Object.assign(this.data, value) },
triggerEvent(name, detail) { events.push({ name, detail }) }
}
Object.assign(instance, definition.methods)
return { instance, events, hidden: () => hidden }
}
const hospitals = [
{ _id: 'a', name: '北京医院东院区', address: '东城区', entityName: '北京医院', pinyin: 'beijingyiyuan', pinyinFL: 'bjyy', nicknames: ['北医'] },
{ _id: 'b', name: '天津医院', address: '河西区', pinyin: 'tianjinyiyuan', pinyinFL: 'tjyy' }
]
test('医院搜索支持名称、主体、拼音、首字母及别名,不截断长名称', () => {
const { instance: c } = createHospitalSelector()
c.data.options = hospitals
c.onOpen()
assert.equal(c.data.filtered.length, 2)
for (const value of ['北京', '北京医院', 'BEIJING', ' bj yy ', '北医']) {
c.onKeywordInput({ detail: { value } })
assert.equal(c.data.filtered.length, 1)
assert.equal(c.data.filtered[0].name, hospitals[0].name)
}
c.onKeywordInput({ detail: { value: '不存在' } })
assert.equal(c.data.filtered.length, 0)
})
test('医院选择回传原记录,关闭后重开重置搜索及键盘', () => {
const { instance: c, events, hidden } = createHospitalSelector()
c.data.options = hospitals
c.onOpen()
assert.equal(c.data.panelHeight, 656)
c.onKeyboardHeightChange({ detail: { height: 320 } })
assert.equal(c.data.panelHeight, 480)
assert.equal(c.data.keyboardHeight, 320)
c.onSelect({ currentTarget: { dataset: { index: 1 } } })
assert.equal(c.data.open, false)
const change = events.find(event => event.name === 'change').detail
assert.equal(change.name, hospitals[1].name)
assert.equal(change.hospital, hospitals[1])
assert.equal(change.manual, false)
assert.equal(hidden(), 1)
c.onKeyboardHeightChange({ detail: { height: 320 } })
assert.equal(c.data.keyboardHeight, 0)
c.onOpen()
assert.equal(c.data.keyword, '')
assert.equal(c.data.filtered.length, 2)
assert.equal(c.data.panelHeight, 656)
})
test('手填沿用关键词、拒绝纯空格,取消可返回列表', () => {
const { instance: c, events } = createHospitalSelector()
c.onOpen()
c.onKeywordInput({ detail: { value: ' 新医院 ' } })
c.onStartManual()
assert.equal(c.data.manualName, '新医院')
c.onManualNameInput({ detail: { value: ' ' } })
c.onConfirmManual()
assert.equal(events.filter(event => event.name === 'change').length, 0)
c.onCancelManual()
assert.equal(c.data.manualEntry, false)
assert.equal(c.data.keyboardHeight, 0)
assert.equal(c.data.panelHeight, 656)
c.onStartManual()
c.onConfirmManual()
const change = events.find(event => event.name === 'change').detail
assert.equal(change.manual, true)
assert.equal(change.hospital, null)
assert.equal(change.name, '新医院')
})
test('禁用时不能打开医院选择;异常键盘高度不会产生负面板高度', () => {
const { instance: c } = createHospitalSelector()
c.data.disabled = true
c.onOpen()
assert.equal(c.data.open, false)
c.data.disabled = false
c.onOpen()
c.onKeyboardHeightChange({ detail: { height: -10 } })
assert.equal(c.data.keyboardHeight, 0)
c.onKeyboardHeightChange({ detail: { height: 1000 } })
assert.equal(c.data.panelHeight, 0)
})
test('同名就诊人补展示提示,不改 ID、姓名、电话或输入数据', () => {
const profiles = [
{ _id: '1', name: '李明', mobile: '13800001111', birth: '1960-01-01' },
{ _id: '2', name: '李明', mobile: '13800002222', birth: '1990-01-01' },
{ _id: '3', name: '王芳', mobile: '13800003333' }
]
const before = JSON.stringify(profiles)
const result = withDuplicateNameHints(profiles)
assert.equal(result[0].nameHint, '1960-01-01 · 尾号1111')
assert.equal(result[1].nameHint, '1990-01-01 · 尾号2222')
assert.equal(result[2].nameHint, '')
result.forEach((profile, index) => {
const { nameHint, ...fields } = profile
assert.deepEqual(fields, profiles[index])
})
assert.equal(JSON.stringify(profiles), before)
assert.deepEqual(withDuplicateNameHints([]), [])
})
test('两个预约入口仍按服务数据定价,协议、字段与提交入口保留', () => {
for (const page of ['itemorder', 'itemdetail']) {
const js = fs.readFileSync(path.join(root, `pages/escort/${page}.js`), 'utf8')
const wxml = fs.readFileSync(path.join(root, `pages/escort/${page}.wxml`), 'utf8')
assert.match(js, /totalPrice: service.price/)
assert.match(js, /patientName: (?:profile|first).name/)
assert.match(wxml, /bindtap="submitOrder"/)
assert.match(wxml, /bindtap="onToggleAgreement"/)
assert.match(wxml, /catchtap="onOpenAgreement"/)
assert.match(wxml, /bindchange="onHospitalChange"/)
assert.doesNotMatch(wxml, /<text class="order-label">就诊人姓名<\/text>/)
assert.match(wxml, /费用仅含人工服务费,不含就医、药品及快递费用/)
}
const home = fs.readFileSync(path.join(root, 'pages/home/index.wxml'), 'utf8')
assert.ok(home.indexOf('class="training-entry"') > home.indexOf('class="quick-list"'))
assert.doesNotMatch(home, /全程1对1陪同/)
})
test('浅色页面恢复深色导航文字', () => {
let colors
const context = { module: { exports: {} }, console, wx: { setNavigationBarColor(value) { colors = value } } }
vm.runInNewContext(fs.readFileSync(path.join(root, 'utils/navigation.js'), 'utf8'), context)
context.module.exports.restoreLightNavigation()
assert.equal(colors.frontColor, '#000000')
assert.equal(colors.backgroundColor, '#FAF8F5')
})
function createBookingPage(page, overrides = {}) {
let definition
const service = {
id: 1, title: '全天陪诊', price: '498.00', areas: ['北京市'], notices: ['请提前预约'],
booking: { advanceDays: 1, sessions: [{ start: '08:00' }] }
}
const app = {
globalData: { user: null },
loadServices: async () => [service],
loadDisclaimer: async () => null,
loadHospitals: async () => [],
getHospitalsByProvince: () => [],
waitForAuth: async () => false,
...overrides
}
vm.runInNewContext(fs.readFileSync(path.join(root, `pages/escort/${page}.js`), 'utf8'), {
Page(value) { definition = value },
getApp: () => app,
require(name) {
if (name === '../../utils/api.js') return {}
if (name === '../../utils/auth.js') return { ensureLogin: async () => false }
return require(path.resolve(root, 'pages/escort', name))
},
wx: { setNavigationBarTitle() {}, getSystemInfoSync: () => ({ windowWidth: 375, windowHeight: 800 }) },
console: { error() {}, log() {} }
})
const instance = {
...definition,
data: JSON.parse(JSON.stringify(definition.data)),
serviceId: 1,
setData(value, callback) {
Object.assign(this.data, value)
if (callback) callback()
}
}
return { instance, app }
}
for (const page of ['itemorder', 'itemdetail']) {
test(`${page}:正常初始化显示服务、价格及预约配置`, async () => {
const { instance } = createBookingPage(page)
await instance.initializePage()
assert.equal(instance.data.service.id, 1)
assert.equal(instance.data.totalPrice, '498.00')
assert.equal(instance.data.pageLoading, false)
assert.equal(instance.data.pageError, '')
assert.equal(instance.data.timeSlots[0], '08:00')
assert.equal(instance.data.timeSlots.at(-1), '23:30')
})
test(`${page}:请求或配置处理异常退出加载,重试可恢复`, async () => {
for (const loadServices of [
async () => { throw new Error('request:fail') },
async () => ({ invalid: true }),
async () => null,
async () => []
]) {
const { instance, app } = createBookingPage(page, { loadServices })
await instance.initializePage()
assert.equal(instance.data.pageLoading, false)
assert.ok(instance.data.pageError)
app.loadServices = async () => [{ id: 1, title: '全天陪诊', price: '498.00' }]
await instance.initializePage()
assert.equal(instance.data.pageError, '')
assert.equal(instance.data.service.id, 1)
}
})
test(`${page}:医院或协议加载失败不阻断服务正文`, async () => {
const { instance } = createBookingPage(page, {
loadDisclaimer: async () => { throw new Error('disclaimer unavailable') },
loadHospitals: async () => { throw new Error('hospitals unavailable') }
})
await instance.initializePage()
assert.equal(instance.data.service.id, 1)
assert.equal(instance.data.pageError, '')
assert.equal(instance.data.disclaimerLoading, false)
assert.equal(instance.data.disclaimerError, true)
})
test(`${page}:加载组件已注册,正文与加载/错误状态互斥`, () => {
const config = JSON.parse(fs.readFileSync(path.join(root, `pages/escort/${page}.json`), 'utf8'))
const wxml = fs.readFileSync(path.join(root, `pages/escort/${page}.wxml`), 'utf8')
assert.equal(config.usingComponents['t-loading'], 'tdesign-miniprogram/loading/loading')
assert.match(wxml, /wx:if="{{!pageLoading && !pageError && service.id}}"/)
assert.match(wxml, /bindtap="retryLoad"/)
})
}
test('立即预约:登录初始化失败仍保留可用表单', async () => {
const { instance } = createBookingPage('itemorder', {
waitForAuth: async () => { throw new Error('auth unavailable') }
})
await instance.initializePage()
assert.equal(instance.data.pageError, '')
assert.equal(instance.data.service.id, 1)
assert.equal(instance.data.pageLoading, false)
})
+114
View File
@@ -0,0 +1,114 @@
/* Static checks only; does not replace WeChat compilation or device testing. */
const fs = require('fs')
const path = require('path')
const { spawnSync } = require('child_process')
const root = path.resolve(__dirname, '..')
const app = JSON.parse(fs.readFileSync(path.join(root, 'app.json'), 'utf8'))
const errors = []
const fail = (file, message) => errors.push(`${file}: ${message}`)
const read = (file) => fs.readFileSync(path.join(root, file), 'utf8')
const stripComments = (text) => text.replace(/<!--[\s\S]*?-->/g, '')
const iconCss = read('miniprogram_npm/tdesign-miniprogram/icon/icon.wxss')
const baselineArg = process.argv.indexOf('--baseline')
const baseline = baselineArg >= 0
? JSON.parse(fs.readFileSync(process.argv[baselineArg + 1], 'utf8'))
: null
function checkWxml(file) {
const text = stripComments(read(file))
const configFile = file.replace(/\.wxml$/, '.json')
const config = JSON.parse(read(configFile))
const components = { ...app.usingComponents, ...config.usingComponents }
for (const match of text.matchAll(/<([a-z][\w]*-[\w-]+)\b/g)) {
const name = match[1]
if ((name.startsWith('t-') || name === 'hospital-select') && !components[name]) {
fail(file, `unregistered component ${name}`)
}
}
if (baseline && file.startsWith('pages/')) {
const page = file.replace(/\.wxml$/, '')
const before = baseline[page]
const after = [...text.matchAll(/\b((?:bind|catch|capture-bind|capture-catch)[\w:]*|data-[\w-]+|wx:(?:if|elif|else|for|for-item|for-index|key)|(?:value|disabled|open-type))\s*=\s*"([^"]*)"/g)]
.map(match => match[0]).sort()
const expected = page === 'pages/escort/recordlist'
? [...before, 'wx:if="{{statusFilter}}"'].sort()
: before
if (JSON.stringify(after) !== JSON.stringify(expected)) fail(file, 'bindings differ from baseline')
}
// Remove expressions before scanning tags: expressions may contain > and quotes.
const markup = text.replace(/\{\{[\s\S]*?\}\}/g, 'EXPRESSION')
const stack = []
for (const match of markup.matchAll(/<\/?[a-zA-Z][\w-]*(?:\s+(?:"[^"]*"|'[^']*'|[^'">])*)?\s*\/?>/g)) {
const tag = match[0]
const name = /^<\/?([\w-]+)/.exec(tag)[1]
if (tag.startsWith('</')) {
const opening = stack.pop()
if (opening !== name) fail(file, `closing ${name}, expected ${opening || 'no tag'}`)
} else if (!tag.endsWith('/>')) {
stack.push(name)
}
}
if (stack.length) fail(file, `unclosed tags: ${stack.join(', ')}`)
for (const match of text.matchAll(/<t-icon\b[^>]*\bname="([^"{}]+)"/g)) {
if (!iconCss.includes(`.t-icon-${match[1]}:`)) fail(file, `unknown icon ${match[1]}`)
}
for (const match of text.matchAll(/\bsrc="(\/images\/[^"{}]+)"/g)) {
if (!fs.existsSync(path.join(root, match[1].slice(1)))) fail(file, `missing image ${match[1]}`)
}
}
function checkWxss(file) {
const text = read(file).replace(/\/\*[\s\S]*?\*\//g, '')
const code = text.replace(/"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'/g, '')
let depth = 0
for (const char of code) {
if (char === '{') depth++
if (char === '}') depth--
if (depth < 0) break
}
if (depth !== 0) fail(file, 'unbalanced style braces')
for (const match of text.matchAll(/@import\s+["']([^"']+)["']/g)) {
if (!fs.existsSync(path.resolve(root, path.dirname(file), match[1]))) {
fail(file, `missing import ${match[1]}`)
}
}
}
for (const page of app.pages) {
for (const ext of ['.js', '.json', '.wxml', '.wxss']) {
const file = page + ext
if (!fs.existsSync(path.join(root, file))) {
fail(file, 'missing route file')
continue
}
try {
if (ext === '.json') JSON.parse(read(file))
if (ext === '.wxml') checkWxml(file)
if (ext === '.wxss') checkWxss(file)
if (ext === '.js') {
const result = spawnSync(process.execPath, ['--check', path.join(root, file)], { encoding: 'utf8' })
if (result.status !== 0) fail(file, result.stderr || String(result.error))
}
} catch (error) {
fail(file, error.message)
}
}
}
checkWxml('components/hospital-select/index.wxml')
checkWxss('components/hospital-select/index.wxss')
JSON.parse(read('components/hospital-select/index.json'))
for (const file of ['components/hospital-select/index.js', 'utils/booking-profiles.js', 'utils/navigation.js']) {
const result = spawnSync(process.execPath, ['--check', path.join(root, file)], { encoding: 'utf8' })
if (result.status !== 0) fail(file, result.stderr || String(result.error))
}
if (errors.length) {
console.error(errors.join('\n'))
process.exitCode = 1
} else {
console.log(`PASS: ${app.pages.length} pages — JS syntax, JSON, WXML nesting, WXSS braces/imports, icons and local images`)
if (baseline) console.log('PASS: events, data attributes, field values and render conditions match baseline; one intentional empty-state condition added.')
console.log('WeChat compilation, layout, keyboard and device interaction still require manual verification.')
}
+86
View File
@@ -0,0 +1,86 @@
const { test } = require('node:test')
const assert = require('node:assert/strict')
const fs = require('node:fs')
const path = require('node:path')
const vm = require('node:vm')
const root = path.resolve(__dirname, '..')
test('当前预约使用紧凑三行摘要,时间、服务及状态共用首行', () => {
const wxml = fs.readFileSync(path.join(root, 'pages/home/index.wxml'), 'utf8')
assert.match(wxml, /pending-heading">当前预约/)
assert.doesNotMatch(wxml, /pending-service-row/)
const summary = /<view class="pending-summary">([\s\S]*?)<\/view>/.exec(wxml)[1]
for (const field of ['whenText', 'timeText', 'serviceName', 'statusText']) {
assert.ok(summary.includes(`item.${field}`))
}
assert.match(wxml, /pending-hospital">{{item.hospitalName}}/)
assert.match(wxml, /pending-patient">就诊人:{{item.patientName}}/)
})
function createHome(wx = {}) {
let page
let restored = 0
vm.runInNewContext(fs.readFileSync(path.join(root, 'pages/home/index.js'), 'utf8'), {
Page(value) { page = value },
require(name) {
if (name === '../../utils/api.js') return {}
if (name === '../../utils/auth.js') return {}
if (name === '../../utils/navigation.js') return { restoreLightNavigation() { restored++ } }
return require(path.resolve(root, 'pages/home', name))
},
wx,
console: { warn() {} }
})
page.data = JSON.parse(JSON.stringify(page.data))
page.setData = function (data) { Object.assign(this.data, data) }
return { page, restored: () => restored }
}
test('首页品牌导航根据状态栏与胶囊尺寸布局,兼容系统信息旧接口', () => {
for (const method of ['getWindowInfo', 'getSystemInfoSync']) {
const { page } = createHome({
[method]: () => ({ statusBarHeight: 44 }),
getMenuButtonBoundingClientRect: () => ({ top: 50, height: 32, left: 280 })
})
page.updateNavigationLayout()
assert.equal(page.data.topbarStyle, 'padding-top: 44px; height: 88px;')
assert.equal(page.data.brandStyle, 'height: 44px; max-width: 248px;')
}
})
test('导航信息不可用时保留默认布局,视图就绪恢复深色文字', () => {
const { page, restored } = createHome()
page.updateNavigationLayout()
assert.equal(page.data.topbarStyle, '')
page.onReady()
assert.equal(restored(), 1)
})
test('预约预览显示具体时间、状态和完整医院名,缺值使用可读提示', () => {
const { page } = createHome()
const result = page.formatPendingRecord({
_id: '1', status: 'pending',
schedule: { date: '2026-11-15', startTime: '13:00' },
hospital: { name: '中国人民解放军总医院第九医学中心' }
})
assert.equal(result.whenText, '11-15')
assert.equal(result.timeText, '13:00')
assert.equal(result.statusText, '待确认')
assert.equal(result.hospitalName, '中国人民解放军总医院第九医学中心')
const empty = page.formatPendingRecord({})
assert.equal(empty.timeText, '时间待定')
assert.equal(empty.patientName, '待补充')
})
test('预约预览按日期时间排序、最多三条,不修改原数组', () => {
const { page } = createHome()
const records = ['15:00', '08:00', '13:00', '10:00'].map((startTime, index) => ({
_id: String(index), schedule: { date: '2026-11-15', startTime }
}))
const before = JSON.stringify(records)
const result = page.buildPendingPreview(records)
assert.equal(result.length, 3)
assert.equal(result[0].timeText, '08:00')
assert.equal(result[2].timeText, '13:00')
assert.equal(JSON.stringify(records), before)
})
+131
View File
@@ -0,0 +1,131 @@
const { test } = require('node:test')
const assert = require('node:assert/strict')
const fs = require('node:fs')
const path = require('node:path')
const vm = require('node:vm')
const root = path.resolve(__dirname, '..')
function createPage(name, api = {}, app = {}) {
let definition
const colors = []
vm.runInNewContext(fs.readFileSync(path.join(root, `pages/escort/${name}.js`), 'utf8'), {
Page(value) { definition = value },
require(module) {
if (module === '../../utils/api.js') return api
if (module === '../../utils/navigation.js') {
return { restoreLightNavigation() { colors.push('black') } }
}
return require(path.resolve(root, 'pages/escort', module))
},
getApp: () => app,
wx: { showToast() {} },
console
})
const instance = {
...definition,
data: JSON.parse(JSON.stringify(definition.data)),
setData(value) { Object.assign(this.data, value) }
}
return { instance, colors }
}
const pending = {
_id: 'order-1', status: 'pending',
patient: { name: '测试就诊人' },
hospital: { name: '中国人民解放军总医院第九医学中心' },
escort: { serviceId: 3, serviceName: '代问诊', sexRequirement: 'none' },
schedule: { date: '2026-11-15', startTime: '13:00' },
payment: { status: 'unpaid', payChannel: 'offline', totalFee: 280 }
}
test('列表和详情保留待确认、已取消退款的业务状态与操作权限', () => {
const list = createPage('recordlist').instance
const detail = createPage('recorddetail').instance
const active = list.formatRecord(pending)
assert.equal(active.isClosed, false)
assert.equal(active.hospital, pending.hospital.name)
assert.equal(active.paymentStatusText, '线下支付')
const activeDetail = detail.formatRecord(pending)
assert.equal(activeDetail.canCancel, true)
assert.equal(activeDetail.canEditBooking, true)
assert.equal(activeDetail.canPay, false)
assert.equal(activeDetail.scheduleDateText, '2026年11月15日')
assert.equal(activeDetail.scheduleWeekdayText, '周日')
assert.equal(activeDetail.scheduleTimeText, '13:00')
const cancelled = {
...pending, cancelStatus: 'cancelled',
payment: { status: 'refunded', method: 'online_wechat', totalFee: 0.1 }
}
assert.equal(list.formatRecord(cancelled).isClosed, true)
const closedDetail = detail.formatRecord(cancelled)
assert.equal(closedDetail.canEditBooking, false)
assert.equal(closedDetail.canCancel, false)
assert.equal(closedDetail.canRebook, true)
assert.equal(closedDetail.paymentStatusText, '已退款')
assert.match(closedDetail.refundNote, /原路退回微信/)
})
test('无效日期不生成错误星期,时间仍独立显示', () => {
const detail = createPage('recorddetail').instance
const meta = detail.buildScheduleMeta({ date: '2026-02-30', startTime: '08:00' })
assert.equal(meta.dateText, '')
assert.equal(meta.weekdayText, '')
assert.equal(meta.timeText, '08:00')
})
test('两个页面每次显示都恢复浅色背景的深色导航文字', () => {
for (const name of ['recordlist', 'recorddetail']) {
const { instance, colors } = createPage(name)
instance.loadRecords = () => {}
instance.onShow()
assert.deepEqual(colors, ['black'])
const config = JSON.parse(fs.readFileSync(path.join(root, `pages/escort/${name}.json`), 'utf8'))
assert.equal(config.navigationBarTextStyle, 'black')
}
})
test('手势被系统取消时清除拖动偏移,不遗留平移卡片', () => {
const { instance } = createPage('recordlist')
instance.data.dragX = 100
instance.data.dragging = true
instance.touchStart = { x: 0, y: 0 }
instance.onTouchCancel()
assert.equal(instance.data.dragX, 0)
assert.equal(instance.data.dragging, false)
assert.equal(instance.touchStart, null)
})
test('快速切换筛选后,过期请求不能覆盖新列表和数量', async () => {
const requests = []
const api = { escort: { getMyRecords(params) {
return new Promise(resolve => requests.push({ params, resolve }))
} } }
const { instance } = createPage('recordlist', api, {
waitForAuth: async () => true, globalData: { user: { _id: 'user' } }
})
const first = instance.loadRecords(true)
await new Promise(resolve => setImmediate(resolve))
instance.setData({ statusFilter: '' })
const second = instance.loadRecords(true)
await new Promise(resolve => setImmediate(resolve))
assert.equal(requests[0].params.status, 'pending,confirmed,in_progress')
assert.equal(requests[1].params.includeCancelled, 1)
requests[1].resolve({ code: 0, data: { records: [pending], total: 1, counts: { ongoing: 0, all: 1 } } })
await second
requests[0].resolve({ code: 0, data: { records: [], total: 0, counts: { ongoing: 0, all: 0 } } })
await first
assert.equal(instance.data.records.length, 1)
assert.equal(instance.data.statusTabs[1].count, 1)
assert.equal(instance.data.loading, false)
})
test('详情入口移至摘要底部,医院独占整行,零数量和手势取消均有绑定', () => {
const detail = fs.readFileSync(path.join(root, 'pages/escort/recorddetail.wxml'), 'utf8')
const list = fs.readFileSync(path.join(root, 'pages/escort/recordlist.wxml'), 'utf8')
assert.ok(detail.indexOf('class="details-expand"') > detail.indexOf('class="cancel-summary"'))
assert.match(detail, /class="appt-row hospital-row"/)
assert.match(detail, /scheduleWeekdayText/)
assert.match(list, /bindtouchcancel="onTouchCancel"/)
assert.match(list, /<text class="seg-count">{{item.count}}<\/text>/)
})