完善 working6 gmoccapy 页面诊断边界
This commit is contained in:
@@ -310,6 +310,41 @@
|
||||
if (!doc.querySelector('[data-gmoccapy-comm="web-path"]')?.textContent.includes("store.dispatch")) {
|
||||
throw new Error("missing gmoccapy Web runtime mapping");
|
||||
}
|
||||
const filePageDiagnostic = doc.querySelector('[data-gmoccapy-page="file"]')?.textContent || "";
|
||||
if (
|
||||
!filePageDiagnostic.includes("file page partial") ||
|
||||
!filePageDiagnostic.includes("PROGRAM_PREFIX ../../nc_files/") ||
|
||||
!filePageDiagnostic.includes("native IconFileSelection") ||
|
||||
!filePageDiagnostic.includes("Web OPEN_FILE/staged-source")
|
||||
) {
|
||||
throw new Error(`missing gmoccapy file page diagnostic: ${filePageDiagnostic}`);
|
||||
}
|
||||
const macroPageDiagnostic = doc.querySelector('[data-gmoccapy-page="macros"]')?.textContent || "";
|
||||
if (
|
||||
!macroPageDiagnostic.includes("5 XYZAB macros") ||
|
||||
!macroPageDiagnostic.includes("MDI gate") ||
|
||||
!macroPageDiagnostic.includes("O-word call")
|
||||
) {
|
||||
throw new Error(`missing gmoccapy macro page diagnostic: ${macroPageDiagnostic}`);
|
||||
}
|
||||
const toolEditorDiagnostic = doc.querySelector('[data-gmoccapy-page="tool-editor"]')?.textContent || "";
|
||||
if (
|
||||
!toolEditorDiagnostic.includes("tool editor diagnostic-only") ||
|
||||
!toolEditorDiagnostic.includes("17 tools") ||
|
||||
!toolEditorDiagnostic.includes("writeback disabled") ||
|
||||
!toolEditorDiagnostic.includes("iocontrol-loopback preserved")
|
||||
) {
|
||||
throw new Error(`missing gmoccapy tool editor diagnostic: ${toolEditorDiagnostic}`);
|
||||
}
|
||||
const nativePageMatrixDiagnostic = doc.querySelector('[data-gmoccapy-page="matrix"]')?.textContent || "";
|
||||
if (
|
||||
!nativePageMatrixDiagnostic.includes("12 native pages") ||
|
||||
!nativePageMatrixDiagnostic.includes("5 diagnostic-only") ||
|
||||
!nativePageMatrixDiagnostic.includes("2 native-only") ||
|
||||
!nativePageMatrixDiagnostic.includes("hard-buttons diagnostic-only")
|
||||
) {
|
||||
throw new Error(`missing gmoccapy native page matrix diagnostic: ${nativePageMatrixDiagnostic}`);
|
||||
}
|
||||
if (!doc.querySelector('[data-gmoccapy-hal="postgui"]')?.textContent.includes("tool-change-loop")) {
|
||||
throw new Error("missing gmoccapy HAL postgui diagnostic");
|
||||
}
|
||||
@@ -349,6 +384,24 @@
|
||||
) {
|
||||
throw new Error(`missing gmoccapy HAL message diagnostic: ${messageInputDiagnostic}`);
|
||||
}
|
||||
const settingsInputDiagnostic = doc.querySelector('[data-gmoccapy-hal="settings-inputs"]')?.textContent || "";
|
||||
if (
|
||||
!settingsInputDiagnostic.includes("1 settings pins") ||
|
||||
!settingsInputDiagnostic.includes("unlock-settings level-driven") ||
|
||||
!settingsInputDiagnostic.includes("unlock-way use") ||
|
||||
!settingsInputDiagnostic.includes("setup sensitive")
|
||||
) {
|
||||
throw new Error(`missing gmoccapy HAL settings diagnostic: ${settingsInputDiagnostic}`);
|
||||
}
|
||||
const toolUserDiagnostic = doc.querySelector('[data-gmoccapy-hal="tool-user-inputs"]')?.textContent || "";
|
||||
if (
|
||||
!toolUserDiagnostic.includes("5 tool measurement HAL_OUT pins") ||
|
||||
!toolUserDiagnostic.includes("XYZAB no TOOLSENSOR") ||
|
||||
!toolUserDiagnostic.includes("0 user message pins") ||
|
||||
!toolUserDiagnostic.includes("no MESSAGE_*")
|
||||
) {
|
||||
throw new Error(`missing gmoccapy HAL tool/user diagnostic: ${toolUserDiagnostic}`);
|
||||
}
|
||||
const hardButtonDiagnostic = doc.querySelector('[data-gmoccapy-hal="hard-buttons"]')?.textContent || "";
|
||||
if (
|
||||
!hardButtonDiagnostic.includes("7 right v-button pins") ||
|
||||
@@ -1090,14 +1143,107 @@
|
||||
if (halJogGuiState.deletedMessageCount !== 1 || halJogGuiState.warningConfirm !== true) {
|
||||
throw new Error(`gmoccapy HAL message pins did not update state: ${JSON.stringify(halJogGuiState)}`);
|
||||
}
|
||||
win.webRtcp5AxisSimulation.dispatch({
|
||||
type: "GMOCAPY_HAL_PIN",
|
||||
pin: "gmoccapy.unlock-settings",
|
||||
value: false,
|
||||
});
|
||||
await wait(25);
|
||||
if (win.webRtcp5AxisSimulation.getState().gmoccapyGui.setupSensitive !== true) {
|
||||
throw new Error("gmoccapy HAL unlock-settings should be ignored while unlock_way is use");
|
||||
}
|
||||
win.webRtcp5AxisSimulation.dispatch({
|
||||
type: "GMOCAPY_HAL_PIN",
|
||||
pin: "gmoccapy.unlock-settings",
|
||||
value: false,
|
||||
halUnlockMode: true,
|
||||
});
|
||||
await wait(25);
|
||||
if (win.webRtcp5AxisSimulation.getState().gmoccapyGui.setupSensitive !== false) {
|
||||
throw new Error("gmoccapy HAL unlock-settings low did not lock setup in HAL unlock mode");
|
||||
}
|
||||
win.webRtcp5AxisSimulation.dispatch({
|
||||
type: "GMOCAPY_HAL_PIN",
|
||||
pin: "gmoccapy.unlock-settings",
|
||||
value: true,
|
||||
});
|
||||
win.webRtcp5AxisSimulation.dispatch({
|
||||
type: "GMOCAPY_HAL_PIN",
|
||||
pin: "gmoccapy.blockheight",
|
||||
value: 12.5,
|
||||
});
|
||||
await wait(50);
|
||||
const toolUserState = win.webRtcp5AxisSimulation.getState().gmoccapyGui;
|
||||
if (toolUserState.setupSensitive !== true || toolUserState.blockHeight !== 12.5) {
|
||||
throw new Error(`gmoccapy HAL settings/tool pins did not update state: ${JSON.stringify(toolUserState)}`);
|
||||
}
|
||||
win.webRtcp5AxisSimulation.dispatch({
|
||||
type: "GMOCAPY_HAL_PIN",
|
||||
pin: "gmoccapy.messages.test",
|
||||
value: true,
|
||||
});
|
||||
await wait(25);
|
||||
if (!win.webRtcp5AxisSimulation.getState().operatorMessage.includes("no MESSAGE_*")) {
|
||||
throw new Error("gmoccapy HAL user message pin should report no MESSAGE_* entries");
|
||||
}
|
||||
const updatedJogDiagnostic = doc.querySelector('[data-gmoccapy-hal="jog-inputs"]')?.textContent || "";
|
||||
const updatedMessageDiagnostic = doc.querySelector('[data-gmoccapy-hal="message-inputs"]')?.textContent || "";
|
||||
const updatedSettingsDiagnostic = doc.querySelector('[data-gmoccapy-hal="settings-inputs"]')?.textContent || "";
|
||||
const updatedToolUserDiagnostic = doc.querySelector('[data-gmoccapy-hal="tool-user-inputs"]')?.textContent || "";
|
||||
if (!updatedJogDiagnostic.includes("turtle level-driven") || !updatedJogDiagnostic.includes("increment 0.100 mm=0.1")) {
|
||||
throw new Error(`gmoccapy HAL jog diagnostic did not refresh: ${updatedJogDiagnostic}`);
|
||||
}
|
||||
if (!updatedMessageDiagnostic.includes("deleted 1") || !updatedMessageDiagnostic.includes("confirm on")) {
|
||||
throw new Error(`gmoccapy HAL message diagnostic did not refresh: ${updatedMessageDiagnostic}`);
|
||||
}
|
||||
if (!updatedSettingsDiagnostic.includes("unlock-way hal") || !updatedSettingsDiagnostic.includes("pin high")) {
|
||||
throw new Error(`gmoccapy HAL settings diagnostic did not refresh: ${updatedSettingsDiagnostic}`);
|
||||
}
|
||||
if (!updatedToolUserDiagnostic.includes("blockheight 12.5") || !updatedToolUserDiagnostic.includes("no MESSAGE_*")) {
|
||||
throw new Error(`gmoccapy HAL tool/user diagnostic did not refresh: ${updatedToolUserDiagnostic}`);
|
||||
}
|
||||
win.webRtcp5AxisSimulation.dispatch({
|
||||
type: "GMOCAPY_HARDWARE_BUTTON",
|
||||
pin: "gmoccapy.v-button.button-6",
|
||||
value: true,
|
||||
});
|
||||
await wait(25);
|
||||
if (
|
||||
win.webRtcp5AxisSimulation.getState().gmoccapyGui.activeNativePage !== "setup" ||
|
||||
!win.webRtcp5AxisSimulation.getState().operatorMessage.includes("diagnostic-only: setup")
|
||||
) {
|
||||
throw new Error("gmoccapy native setup page diagnostic did not update from hard-button");
|
||||
}
|
||||
win.webRtcp5AxisSimulation.dispatch({
|
||||
type: "GMOCAPY_PAGE_ACTION",
|
||||
pageId: "file-load",
|
||||
actionId: "open",
|
||||
});
|
||||
win.webRtcp5AxisSimulation.dispatch({
|
||||
type: "GMOCAPY_TOOL_EDITOR_ACTION",
|
||||
actionId: "save",
|
||||
});
|
||||
await wait(50);
|
||||
const nativePageState = win.webRtcp5AxisSimulation.getState().gmoccapyGui;
|
||||
if (nativePageState.filePageStatus !== "open" || nativePageState.toolEditorStatus !== "writeback-blocked") {
|
||||
throw new Error(`gmoccapy native page actions did not update state: ${JSON.stringify(nativePageState)}`);
|
||||
}
|
||||
win.webRtcp5AxisSimulation.dispatch({ type: "TOGGLE_POWER" });
|
||||
win.webRtcp5AxisSimulation.dispatch({ type: "HOME" });
|
||||
win.webRtcp5AxisSimulation.dispatch({ type: "SET_MODE", mode: "mdi" });
|
||||
win.webRtcp5AxisSimulation.dispatch({
|
||||
type: "GMOCAPY_RUN_MACRO",
|
||||
name: "increment",
|
||||
args: { xinc: 1.25, yinc: 2.5 },
|
||||
});
|
||||
await wait(50);
|
||||
const macroDiagnostic = doc.querySelector('[data-gmoccapy-page="macros"]')?.textContent || "";
|
||||
if (
|
||||
win.webRtcp5AxisSimulation.getState().gmoccapyGui.macroLastCommand !== "O<increment> call [1.25] [2.5]" ||
|
||||
!macroDiagnostic.includes("O<increment> call [1.25] [2.5]")
|
||||
) {
|
||||
throw new Error(`gmoccapy macro dispatch did not update diagnostics: ${macroDiagnostic}`);
|
||||
}
|
||||
doc.querySelector('[data-action="toggle-flood"]').click();
|
||||
doc.querySelector('[data-action="toggle-mist"]').click();
|
||||
await wait(50);
|
||||
|
||||
Reference in New Issue
Block a user