From 9c63230b2d81b366f7c616630973703a9faef8e3 Mon Sep 17 00:00:00 2001 From: LiZhenhai-MBP14 <5935568+jackhai9@users.noreply.github.com> Date: Fri, 28 Aug 2026 14:49:52 +0800 Subject: [PATCH] fix: simplify cancelled order status --- .../helpers/live-performance-probe.js | 2 +- .../specs/cancel-covering-matrix.pw.js | 2 +- .../specs/cancel-current-symbol.pw.js | 10 +++++----- .../specs/live-performance-probe.pw.js | 2 +- scripts/binance-orderbook-trade.user.js | 6 +++--- src/binance-orderbook-trade/index.user.js | 6 +++--- .../binance-orderbook-trade/source-regressions.test.js | 2 ++ 7 files changed, 16 insertions(+), 14 deletions(-) diff --git a/e2e/binance-orderbook/helpers/live-performance-probe.js b/e2e/binance-orderbook/helpers/live-performance-probe.js index 9ab3869..0bdef78 100644 --- a/e2e/binance-orderbook/helpers/live-performance-probe.js +++ b/e2e/binance-orderbook/helpers/live-performance-probe.js @@ -127,7 +127,7 @@ export function waitForBinanceLivePerformanceCompletion(options = {}) { const expectsPrimary = kind === 'dialog-confirm'; if (dialogActions[0].detail?.primary !== expectsPrimary) return false; return kind === 'dialog-cancel' - ? /已取消撤单.*已恢复页面状态/.test(state.statusText) + ? state.statusText === '撤单已取消' : /撤单流程结束.*已恢复筛选状态/.test(state.statusText); }; diff --git a/e2e/binance-orderbook/specs/cancel-covering-matrix.pw.js b/e2e/binance-orderbook/specs/cancel-covering-matrix.pw.js index 764ee7b..47cb7ff 100644 --- a/e2e/binance-orderbook/specs/cancel-covering-matrix.pw.js +++ b/e2e/binance-orderbook/specs/cancel-covering-matrix.pw.js @@ -58,7 +58,7 @@ for (const entry of CANCEL_COVERING_SCENARIOS) { await expect(page.getByText( vector.dialogOutcome === 'confirm' ? '撤单流程结束,已恢复筛选状态' - : '已取消撤单,已恢复页面状态', + : '撤单已取消', )).toBeVisible(); } diff --git a/e2e/binance-orderbook/specs/cancel-current-symbol.pw.js b/e2e/binance-orderbook/specs/cancel-current-symbol.pw.js index 3fa1172..873be15 100644 --- a/e2e/binance-orderbook/specs/cancel-current-symbol.pw.js +++ b/e2e/binance-orderbook/specs/cancel-current-symbol.pw.js @@ -94,7 +94,7 @@ test('cancelling the native dialog preserves current and other orders and restor await expect(page.getByRole('dialog')).toBeVisible(); await expect.poll(async () => (await readFixtureState(page)).showOrders).toBe(false); await page.getByRole('button', { name: '取消' }).click(); - await expect(page.getByText('已取消撤单,已恢复页面状态')).toBeVisible(); + await expect(page.getByText('撤单已取消')).toBeVisible(); const state = await readFixtureState(page); expect(state.orders).toEqual(ORDER_SETS.both); @@ -125,7 +125,7 @@ test('a 70-order drawing burst split across tasks performs one full save per tog await expect(page.getByRole('dialog')).toBeVisible(); await expect.poll(async () => (await readFixtureState(page)).showOrders).toBe(false); await page.getByRole('button', { name: '取消' }).click(); - await expect(page.getByText('已取消撤单,已恢复页面状态')).toBeVisible(); + await expect(page.getByText('撤单已取消')).toBeVisible(); const state = await readFixtureState(page); expect(state.orders).toEqual(orders); @@ -269,7 +269,7 @@ for (const closeMethod of ['Escape', 'backdrop']) { } else { await page.locator('.bn-modal-root').click({ position: { x: 4, y: 4 } }); } - await expect(page.getByText('已取消撤单,已恢复页面状态')).toBeVisible(); + await expect(page.getByText('撤单已取消')).toBeVisible(); const state = await readFixtureState(page); expect(state.orders).toEqual(ORDER_SETS.both); @@ -294,7 +294,7 @@ test('a BFCache pagehide does not abort the active native dialog', async ({ page }))); await expect(page.getByRole('dialog')).toBeVisible(); await page.getByRole('button', { name: '取消' }).click(); - await expect(page.getByText('已取消撤单,已恢复页面状态')).toBeVisible(); + await expect(page.getByText('撤单已取消')).toBeVisible(); await expectRestoredState(page, scenario); expect(errors).toEqual([]); }); @@ -405,7 +405,7 @@ test('dialog tracking survives React replacing the native dialog subtree', async await readFixtureState(page) ).events.filter((event) => event.type === 'dialog-replaced').length).toBe(1); await page.getByRole('button', { name: '取消' }).click(); - await expect(page.getByText('已取消撤单,已恢复页面状态')).toBeVisible(); + await expect(page.getByText('撤单已取消')).toBeVisible(); const state = await readFixtureState(page); expect(state.orders).toEqual(ORDER_SETS.current); diff --git a/e2e/binance-orderbook/specs/live-performance-probe.pw.js b/e2e/binance-orderbook/specs/live-performance-probe.pw.js index fbea02e..7247313 100644 --- a/e2e/binance-orderbook/specs/live-performance-probe.pw.js +++ b/e2e/binance-orderbook/specs/live-performance-probe.pw.js @@ -75,7 +75,7 @@ test('live probe has no user-decision deadline and follows a replaced portal dia await page.getByRole('button', { name: '取消' }).click(); const snapshot = await finishLivePerformanceProbeWhenReady(page); - await expect(page.getByText('已取消撤单,已恢复页面状态')).toBeVisible(); + await expect(page.getByText('撤单已取消')).toBeVisible(); expect(() => validateLivePerformanceProbeSnapshot(snapshot)).not.toThrow(); expect(snapshot.events.map((event) => event.kind)).toEqual(expect.arrayContaining([ 'dialog-visible', diff --git a/scripts/binance-orderbook-trade.user.js b/scripts/binance-orderbook-trade.user.js index 1f1ead8..b9e497e 100644 --- a/scripts/binance-orderbook-trade.user.js +++ b/scripts/binance-orderbook-trade.user.js @@ -3,7 +3,7 @@ // @namespace binance.orderbook.trade // @icon data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2064%2064%22%3E%3Crect%20width%3D%2264%22%20height%3D%2264%22%20rx%3D%2214%22%20fill%3D%22%23f0b90b%22%2F%3E%3Ctext%20x%3D%2232%22%20y%3D%2249%22%20text-anchor%3D%22middle%22%20font-family%3D%22Arial%2C%20sans-serif%22%20font-size%3D%2242%22%20font-weight%3D%22800%22%20fill%3D%22%23111827%22%3EJ%3C%2Ftext%3E%3C%2Fsvg%3E // @icon64 data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2064%2064%22%3E%3Crect%20width%3D%2264%22%20height%3D%2264%22%20rx%3D%2214%22%20fill%3D%22%23f0b90b%22%2F%3E%3Ctext%20x%3D%2232%22%20y%3D%2249%22%20text-anchor%3D%22middle%22%20font-family%3D%22Arial%2C%20sans-serif%22%20font-size%3D%2242%22%20font-weight%3D%22800%22%20fill%3D%22%23111827%22%3EJ%3C%2Ftext%3E%3C%2Fsvg%3E -// @version 2.7.151 +// @version 2.7.152 // @author jackhai9 // @description 单击订单簿价格,按当前开仓/平仓 tab 自动填数量并执行下单,内置数量倍率面板 // @match https://www.binance.com/*/futures/* @@ -5707,8 +5707,8 @@ return { ok: false, status: "dialog_not_found", message }; } if (dialogDecision.status === "cancelled") { - const message = "已取消撤单"; - successStatusMessage = `${message},已恢复页面状态`; + const message = "撤单已取消"; + successStatusMessage = message; return { ok: false, status: "cancelled", message }; } waitForTradeUiMutation({ timeoutMs: 800 }); diff --git a/src/binance-orderbook-trade/index.user.js b/src/binance-orderbook-trade/index.user.js index 983b69c..fd1e150 100644 --- a/src/binance-orderbook-trade/index.user.js +++ b/src/binance-orderbook-trade/index.user.js @@ -3,7 +3,7 @@ // @namespace binance.orderbook.trade // @icon data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2064%2064%22%3E%3Crect%20width%3D%2264%22%20height%3D%2264%22%20rx%3D%2214%22%20fill%3D%22%23f0b90b%22%2F%3E%3Ctext%20x%3D%2232%22%20y%3D%2249%22%20text-anchor%3D%22middle%22%20font-family%3D%22Arial%2C%20sans-serif%22%20font-size%3D%2242%22%20font-weight%3D%22800%22%20fill%3D%22%23111827%22%3EJ%3C%2Ftext%3E%3C%2Fsvg%3E // @icon64 data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2064%2064%22%3E%3Crect%20width%3D%2264%22%20height%3D%2264%22%20rx%3D%2214%22%20fill%3D%22%23f0b90b%22%2F%3E%3Ctext%20x%3D%2232%22%20y%3D%2249%22%20text-anchor%3D%22middle%22%20font-family%3D%22Arial%2C%20sans-serif%22%20font-size%3D%2242%22%20font-weight%3D%22800%22%20fill%3D%22%23111827%22%3EJ%3C%2Ftext%3E%3C%2Fsvg%3E -// @version 2.7.151 +// @version 2.7.152 // @author jackhai9 // @description 单击订单簿价格,按当前开仓/平仓 tab 自动填数量并执行下单,内置数量倍率面板 // @match https://www.binance.com/*/futures/* @@ -4180,8 +4180,8 @@ import { return { ok: false, status: 'dialog_not_found', message }; } if (dialogDecision.status === 'cancelled') { - const message = '已取消撤单'; - successStatusMessage = `${message},已恢复页面状态`; + const message = '撤单已取消'; + successStatusMessage = message; return { ok: false, status: 'cancelled', message }; } waitForTradeUiMutation({ timeoutMs: 800 }); diff --git a/test/unit/binance-orderbook-trade/source-regressions.test.js b/test/unit/binance-orderbook-trade/source-regressions.test.js index 29c5060..514b34d 100644 --- a/test/unit/binance-orderbook-trade/source-regressions.test.js +++ b/test/unit/binance-orderbook-trade/source-regressions.test.js @@ -1105,6 +1105,8 @@ test('cancel current-symbol open orders are single-flight and follow the native assert.doesNotMatch(cancelRunBody, /查找 \$\{symbol\} 当前委托/); assert.doesNotMatch(cancelRunBody, /正在隐藏 \$\{symbol\} 图表当前委托/); assert.doesNotMatch(cancelRunBody, /正在恢复页面状态/); + assert.match(cancelRunBody, /const message = '撤单已取消';\s*successStatusMessage = message;/); + assert.doesNotMatch(cancelRunBody, /,已恢复页面状态/); assert.match(cancelRunBody, /撤单确认弹窗已打开/); assert.match(cancelRunBody, /已确认撤单,等待当前币挂单清空/); assert.match(cancelRunBody, /未能恢复隐藏其他合约状态/);