mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-09 15:59:30 +00:00
fix(mantis): crop telegram proof chat pane
This commit is contained in:
parent
880b39f061
commit
5fb9c0c937
3 changed files with 33 additions and 12 deletions
|
|
@ -65,8 +65,8 @@ proof_cmd="${OPENCLAW_TELEGRAM_USER_PROOF_CMD:-openclaw-telegram-user-crabbox-pr
|
|||
|
||||
This uses Telegram Desktop directly with `tg://privatepost`, not `xdg-open`.
|
||||
It also resizes Telegram to `650x1000` at the tested desktop position so
|
||||
Telegram switches to single-chat mode with no left chat list or right info
|
||||
pane. Do not press Escape after this; Escape can close the selected chat.
|
||||
the crop can isolate the chat pane even if Telegram keeps a split/sidebar
|
||||
layout. Do not press Escape after this; Escape can close the selected chat.
|
||||
|
||||
Bottom behavior matters:
|
||||
|
||||
|
|
@ -74,8 +74,8 @@ Bottom behavior matters:
|
|||
later messages appear live in the recording
|
||||
- deep-linking to an older message does not auto-scroll to new arrivals; link
|
||||
again to the newest/final marker instead of clicking the down-arrow
|
||||
- `650px` is the largest tested clean width; `660px` switches Telegram back to
|
||||
split/sidebar layout
|
||||
- the cropped GIF intentionally uses the chat pane, not the whole desktop or
|
||||
whole Telegram window
|
||||
|
||||
Send as the real Telegram user:
|
||||
|
||||
|
|
|
|||
|
|
@ -135,13 +135,19 @@ const DEFAULT_USER_DRIVER = "scripts/e2e/telegram-user-driver.py";
|
|||
const DEFAULT_OUTPUT_ROOT = ".artifacts/qa-e2e/telegram-user-crabbox";
|
||||
const REMOTE_ROOT = "/tmp/openclaw-telegram-user-crabbox";
|
||||
const CREDENTIAL_SCRIPT = fileURLToPath(new URL("./telegram-user-credential.ts", import.meta.url));
|
||||
const TELEGRAM_PROOF_VIEW = {
|
||||
cropWidth: 520,
|
||||
const TELEGRAM_PROOF_WINDOW = {
|
||||
height: 1000,
|
||||
width: 650,
|
||||
x: 635,
|
||||
y: 40,
|
||||
};
|
||||
const TELEGRAM_PROOF_CROP = {
|
||||
cropWidth: 430,
|
||||
height: TELEGRAM_PROOF_WINDOW.height,
|
||||
width: 430,
|
||||
x: TELEGRAM_PROOF_WINDOW.x + 220,
|
||||
y: TELEGRAM_PROOF_WINDOW.y,
|
||||
};
|
||||
|
||||
function usageText() {
|
||||
return [
|
||||
|
|
@ -165,7 +171,7 @@ function usageText() {
|
|||
" --output-dir <path> Artifact directory under the repo.",
|
||||
" --message-id <id> Telegram message id for proof-view deep link.",
|
||||
" --preview-crop telegram-window Create a side-by-side friendly Telegram-window GIF.",
|
||||
" --preview-crop-width <pixels> Cropped preview GIF width. Default: 520.",
|
||||
" --preview-crop-width <pixels> Cropped preview GIF width. Default: 430.",
|
||||
" --preview-fps <fps> Motion GIF frames per second. Default: 24.",
|
||||
" --preview-width <pixels> Motion GIF width. Default: 1920.",
|
||||
" --pr <number> Pull request number for publish.",
|
||||
|
|
@ -237,7 +243,7 @@ function parseArgs(argv: string[]): Options {
|
|||
mockResponseText: "OPENCLAW_E2E_OK",
|
||||
mockPort: 19_882,
|
||||
outputDir: path.join(DEFAULT_OUTPUT_ROOT, stamp),
|
||||
previewCropWidth: TELEGRAM_PROOF_VIEW.cropWidth,
|
||||
previewCropWidth: TELEGRAM_PROOF_CROP.cropWidth,
|
||||
previewFps: 24,
|
||||
previewWidth: 1920,
|
||||
provider: process.env.OPENCLAW_TELEGRAM_USER_CRABBOX_PROVIDER?.trim() || "aws",
|
||||
|
|
@ -939,12 +945,12 @@ async function createMotionPreview(params: {
|
|||
|
||||
function previewCrop(opts: Options) {
|
||||
return opts.previewCrop === "telegram-window"
|
||||
? { ...TELEGRAM_PROOF_VIEW, cropWidth: opts.previewCropWidth }
|
||||
? { ...TELEGRAM_PROOF_CROP, cropWidth: opts.previewCropWidth }
|
||||
: undefined;
|
||||
}
|
||||
|
||||
async function createCroppedMotionPreview(params: {
|
||||
crop: typeof TELEGRAM_PROOF_VIEW;
|
||||
crop: typeof TELEGRAM_PROOF_CROP;
|
||||
croppedGifPath: string;
|
||||
croppedVideoPath: string;
|
||||
opts: Options;
|
||||
|
|
@ -1811,7 +1817,7 @@ if [ -z "$win" ]; then
|
|||
exit 1
|
||||
fi
|
||||
wmctrl -ir "$win" -b remove,maximized_vert,maximized_horz,fullscreen
|
||||
wmctrl -ir "$win" -e 0,${TELEGRAM_PROOF_VIEW.x},${TELEGRAM_PROOF_VIEW.y},${TELEGRAM_PROOF_VIEW.width},${TELEGRAM_PROOF_VIEW.height}
|
||||
wmctrl -ir "$win" -e 0,${TELEGRAM_PROOF_WINDOW.x},${TELEGRAM_PROOF_WINDOW.y},${TELEGRAM_PROOF_WINDOW.width},${TELEGRAM_PROOF_WINDOW.height}
|
||||
telegram="$root/Telegram/Telegram"
|
||||
test -x "$telegram"
|
||||
set +e
|
||||
|
|
@ -1839,7 +1845,8 @@ async function viewSession(root: string, opts: Options, outputDir: string) {
|
|||
);
|
||||
fs.writeFileSync(logPath, `${result.stdout}${result.stderr}`);
|
||||
return {
|
||||
geometry: TELEGRAM_PROOF_VIEW,
|
||||
crop: TELEGRAM_PROOF_CROP,
|
||||
geometry: TELEGRAM_PROOF_WINDOW,
|
||||
link,
|
||||
log: path.relative(root, logPath),
|
||||
status: "pass",
|
||||
|
|
|
|||
|
|
@ -334,6 +334,20 @@ describe("Mantis Telegram Desktop proof workflow", () => {
|
|||
);
|
||||
});
|
||||
|
||||
it("crops the Telegram Desktop chat pane for PR proof GIFs", () => {
|
||||
const proofScript = readFileSync(PROOF_SCRIPT, "utf8");
|
||||
const skill = readFileSync(TELEGRAM_PROOF_SKILL, "utf8");
|
||||
|
||||
expect(proofScript).toContain("const TELEGRAM_PROOF_WINDOW =");
|
||||
expect(proofScript).toContain("const TELEGRAM_PROOF_CROP =");
|
||||
expect(proofScript).toContain("x: TELEGRAM_PROOF_WINDOW.x + 220");
|
||||
expect(proofScript).toContain("width: 430");
|
||||
expect(proofScript).toContain("geometry: TELEGRAM_PROOF_WINDOW");
|
||||
expect(proofScript).toContain("crop: TELEGRAM_PROOF_CROP");
|
||||
expect(skill).toContain("crop can isolate the chat pane");
|
||||
expect(skill).not.toContain("650px` is the largest tested clean width");
|
||||
});
|
||||
|
||||
it("does not pass the full workflow environment into the local Telegram SUT", () => {
|
||||
const proofScript = readFileSync(PROOF_SCRIPT, "utf8");
|
||||
expect(proofScript).toContain("function childProcessBaseEnv()");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue