|
@@ -135,7 +135,7 @@ try {
|
|
|
left: qa('.cockpit-shell__column[aria-label="左栏"]').length,
|
|
left: qa('.cockpit-shell__column[aria-label="左栏"]').length,
|
|
|
right: qa('.cockpit-shell__column[aria-label="右栏"]').length,
|
|
right: qa('.cockpit-shell__column[aria-label="右栏"]').length,
|
|
|
maps: qa('.cockpit-shell__map').length,
|
|
maps: qa('.cockpit-shell__map').length,
|
|
|
- mapTitle: q('.map-placeholder__title')?.textContent?.trim() || '',
|
|
|
|
|
|
|
+ mapTitle: q('.map-canvas__title')?.textContent?.trim() || '',
|
|
|
panels: qa('.cockpit-panel').length,
|
|
panels: qa('.cockpit-panel').length,
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
@@ -186,12 +186,13 @@ try {
|
|
|
JSON.stringify(initialActive),
|
|
JSON.stringify(initialActive),
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
- // 打标记:模式切换后这两个节点必须仍是同一实例,否则就是重建了外壳/地图。
|
|
|
|
|
- await page.evaluate(() => {
|
|
|
|
|
|
|
+ // 打标记:模式切换与面板收放之后,外壳与地图宿主必须仍是同一实例(票 02 的核心契约)。
|
|
|
|
|
+ const mapInstanceAtStart = await page.evaluate(() => {
|
|
|
document.querySelector('.cockpit-shell').__t01 = 'shell-instance'
|
|
document.querySelector('.cockpit-shell').__t01 = 'shell-instance'
|
|
|
document.querySelector('.cockpit-shell__map').__t01 = 'map-instance'
|
|
document.querySelector('.cockpit-shell__map').__t01 = 'map-instance'
|
|
|
- const m = document.querySelector('.map-placeholder')
|
|
|
|
|
- if (m) m.__t01 = 'map-inner'
|
|
|
|
|
|
|
+ const host = document.querySelector('.cockpit-shell__map .map-canvas')
|
|
|
|
|
+ if (host) host.__t01Map = 'map-host'
|
|
|
|
|
+ return host ? host.dataset.mapInstance || '' : ''
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
const snapshot = () =>
|
|
const snapshot = () =>
|
|
@@ -219,8 +220,9 @@ try {
|
|
|
.map((e) => e.textContent.trim()),
|
|
.map((e) => e.textContent.trim()),
|
|
|
shellTag: document.querySelector('.cockpit-shell').__t01 || null,
|
|
shellTag: document.querySelector('.cockpit-shell').__t01 || null,
|
|
|
mapTag: document.querySelector('.cockpit-shell__map').__t01 || null,
|
|
mapTag: document.querySelector('.cockpit-shell__map').__t01 || null,
|
|
|
- mapInnerTag: document.querySelector('.map-placeholder')?.__t01 || null,
|
|
|
|
|
- mapCount: document.querySelectorAll('.map-placeholder').length,
|
|
|
|
|
|
|
+ mapHostTag: document.querySelector('.cockpit-shell__map .map-canvas')?.__t01Map || null,
|
|
|
|
|
+ mapInstanceId: document.querySelector('.cockpit-shell__map .map-canvas')?.dataset.mapInstance || '',
|
|
|
|
|
+ mapCount: document.querySelectorAll('.cockpit-shell__map .map-canvas').length,
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
|
|
|
|
@@ -263,12 +265,14 @@ try {
|
|
|
)
|
|
)
|
|
|
check(
|
|
check(
|
|
|
'A7-persistent-nodes',
|
|
'A7-persistent-nodes',
|
|
|
- '外壳与中央地图占位未被重建(DOM 实例标记存活)',
|
|
|
|
|
|
|
+ '切换四个一级模式后外壳与地图宿主未被重建(DOM 实例标记与实例 id 均存活)',
|
|
|
after.shellTag === 'shell-instance' &&
|
|
after.shellTag === 'shell-instance' &&
|
|
|
after.mapTag === 'map-instance' &&
|
|
after.mapTag === 'map-instance' &&
|
|
|
- after.mapInnerTag === 'map-inner' &&
|
|
|
|
|
- after.mapCount === 1,
|
|
|
|
|
- `shell=${after.shellTag} map=${after.mapTag} inner=${after.mapInnerTag} mapCount=${after.mapCount}`,
|
|
|
|
|
|
|
+ after.mapHostTag === 'map-host' &&
|
|
|
|
|
+ after.mapCount === 1 &&
|
|
|
|
|
+ after.mapInstanceId !== '' &&
|
|
|
|
|
+ after.mapInstanceId === mapInstanceAtStart,
|
|
|
|
|
+ `shell=${after.shellTag} map=${after.mapTag} host=${after.mapHostTag} mapCount=${after.mapCount} instance=${after.mapInstanceId}(初始 ${mapInstanceAtStart})`,
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
// A8 点标题栏收起/展开。
|
|
// A8 点标题栏收起/展开。
|
|
@@ -467,6 +471,29 @@ try {
|
|
|
`before=${JSON.stringify(heightBefore)} collapsed=${JSON.stringify(heightCollapsed)} restored=${JSON.stringify(heightRestored)}`,
|
|
`before=${JSON.stringify(heightBefore)} collapsed=${JSON.stringify(heightCollapsed)} restored=${JSON.stringify(heightRestored)}`,
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
|
|
+ // A14 票 02 契约:走完「四模式切换 + 面板收放」之后,地图宿主仍是同一元素、实例 id 不变、全页只有一个。
|
|
|
|
|
+ // A7 覆盖模式切换、A13 覆盖面板收放,本条把两者合起来做最终兜底 —— 这是「不销毁、不重建」的可观测证据。
|
|
|
|
|
+ const mapAfterAll = await page.evaluate(() => {
|
|
|
|
|
+ const hosts = document.querySelectorAll('.cockpit-shell__map .map-canvas')
|
|
|
|
|
+ const host = hosts[0]
|
|
|
|
|
+ return {
|
|
|
|
|
+ count: hosts.length,
|
|
|
|
|
+ tag: host?.__t01Map || null,
|
|
|
|
|
+ instanceId: host?.dataset.mapInstance || '',
|
|
|
|
|
+ photoLayers: host ? host.querySelectorAll('.map-canvas__photo').length : 0,
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ check(
|
|
|
|
|
+ 'A14-map-instance-persistent',
|
|
|
|
|
+ '四模式切换 + 面板收放之后:地图宿主同一实例、实例 id 不变、全页只有一个地图',
|
|
|
|
|
+ mapAfterAll.count === 1 &&
|
|
|
|
|
+ mapAfterAll.tag === 'map-host' &&
|
|
|
|
|
+ mapAfterAll.instanceId !== '' &&
|
|
|
|
|
+ mapAfterAll.instanceId === mapInstanceAtStart &&
|
|
|
|
|
+ mapAfterAll.photoLayers === 1,
|
|
|
|
|
+ `after=${JSON.stringify(mapAfterAll)} 初始 instance=${mapInstanceAtStart}`,
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
// A11 运行期无错误。
|
|
// A11 运行期无错误。
|
|
|
check('A11-no-page-errors', '走查期间无页面级报错', pageErrors.length === 0, JSON.stringify(pageErrors.slice(0, 5)))
|
|
check('A11-no-page-errors', '走查期间无页面级报错', pageErrors.length === 0, JSON.stringify(pageErrors.slice(0, 5)))
|
|
|
|
|
|