串口下拉框去掉电脑自带的 COM1,只留实训台上的 COM2–COM5;展开时每个串口后面用灰字标出接的设备(ADAM-4017+、ADAM-4150、ZigBee 协调器、LED 屏),选中后的值还是 COM2 这样的串口名,和真机一致。项目 5 任务 3 跳过 COM1 的写法照书保留,任务说明补一句;使用说明、设计方案同步;按位置选串口的测试下标跟着改
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
50946467f6
commit
50dced4d37
9 files changed
+26
-15
No files matched your search
@@ -214,7 +214,7 @@ try {
|
||||
async (s) => {
|
||||
const window = s.window!
|
||||
window.action('com_lamp', { action: 'dropDown' })
|
||||
window.action('com_lamp', { action: 'select', index: 3 })
|
||||
window.action('com_lamp', { action: 'select', index: 2 })
|
||||
window.action('btn_open', { action: 'click' })
|
||||
await Bun.sleep(300)
|
||||
// 设备消息由服务器记进实训台状态,再以 board 消息推给浏览器
|
||||
|
||||
+1
-1
@@ -80,7 +80,7 @@ const latencies = await Promise.all(
|
||||
const form = instance.form!
|
||||
const id = (name: string) => findId(form, name)!
|
||||
send(instance, { type: 'action', id: id('com_Port'), action: 'dropDown' })
|
||||
send(instance, { type: 'action', id: id('com_Port'), action: 'select', index: 4 })
|
||||
send(instance, { type: 'action', id: id('com_Port'), action: 'select', index: 3 })
|
||||
send(instance, { type: 'action', id: id('btn_Open'), action: 'click' })
|
||||
send(instance, { type: 'action', id: id('txt_SendText'), action: 'text', value: '压力测试' })
|
||||
await Bun.sleep(200)
|
||||
|
||||
@@ -196,7 +196,7 @@ test('项目2 任务2:温度读数来自实训台,滑块变化后再次获
|
||||
const { runner, id } = await startSample('p2-t2-模拟量采集')
|
||||
const port = id('com_port')
|
||||
// 串口列表在 Load 里就已填好
|
||||
runner.send({ type: 'action', id: port, action: 'select', index: 1 })
|
||||
runner.send({ type: 'action', id: port, action: 'select', index: 0 })
|
||||
runner.send({ type: 'action', id: id('btn_Open'), action: 'click' })
|
||||
const textOf = (name: string) =>
|
||||
runner
|
||||
@@ -224,7 +224,7 @@ test('项目3 任务1:单选按钮切换,事件顺序与 WinForms 一致,
|
||||
await runner.waitFor('patch', (m) => m.changes.some((c) => c.id === lamp && c.prop === 'IsOn' && c.value === true))
|
||||
expect(runner.messages.some((m) => m.type === 'device')).toBe(false)
|
||||
|
||||
runner.send({ type: 'action', id: id('com_port'), action: 'select', index: 3 })
|
||||
runner.send({ type: 'action', id: id('com_port'), action: 'select', index: 2 })
|
||||
runner.send({ type: 'action', id: id('btn_open'), action: 'click' })
|
||||
|
||||
// 选"关":先触发"开"的 CheckedChanged(又开一次),再触发"关"的 CheckedChanged,最终关灯
|
||||
@@ -241,8 +241,8 @@ test('项目3 任务1:单选按钮切换,事件顺序与 WinForms 一致,
|
||||
|
||||
test('项目3 任务2:勾选人体开关后,有人经过时 5 秒内路灯打开', async () => {
|
||||
const { runner, id } = await startSample('p3-t2-人体红外ZigBee联动')
|
||||
runner.send({ type: 'action', id: id('com_lamp'), action: 'select', index: 3 })
|
||||
runner.send({ type: 'action', id: id('com_environment'), action: 'select', index: 2 })
|
||||
runner.send({ type: 'action', id: id('com_lamp'), action: 'select', index: 2 })
|
||||
runner.send({ type: 'action', id: id('com_environment'), action: 'select', index: 1 })
|
||||
runner.send({ type: 'action', id: id('btn_open'), action: 'click' })
|
||||
|
||||
// 复选框的 Click 里读取 Checked:此时 Checked 必须已经是 true
|
||||
@@ -316,7 +316,7 @@ test('项目1 任务2:计算器(装箱拆箱)和多态', async () => {
|
||||
|
||||
/** 选 COM3、点"开启",等定时器读到实训台上的传感器 */
|
||||
async function openAdam4150(runner: Runner, id: (name: string) => string) {
|
||||
runner.send({ type: 'action', id: id('com_port'), action: 'select', index: 2 })
|
||||
runner.send({ type: 'action', id: id('com_port'), action: 'select', index: 1 })
|
||||
runner.send({ type: 'action', id: id('btn_open'), action: 'click' })
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user