Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion e2e/binance-orderbook/fixtures/binance-futures.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ export function renderBinanceFuturesFixture(scenario) {
});
}

localStorage.setItem('jh_binance_ladder_expanded', scenario.ui.ladderExpanded ? 'true' : 'false');
localStorage.setItem('jh_binance_orderbook_precision_samples_v3:' + scenario.currentSymbol, '["81.0","81.01","81.02","81.03","81.04","81.05"]');

function renderOrdersRows() {
Expand Down
2 changes: 1 addition & 1 deletion e2e/binance-orderbook/helpers/userscript-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export async function openUserscriptScenario(page, scenario) {

await page.goto(`https://www.binance.com/zh-CN/futures/${scenario.currentSymbol}`);
await page.locator('#jh-binance-close-qty-multiplier-panel').waitFor({ state: 'visible' });
await page.locator('#jh-binance-ladder-toggle').waitFor({ state: 'visible' });
await page.locator('#jh-binance-ladder-body').waitFor({ state: 'visible' });
await page.evaluate(() => new Promise((resolve) => {
requestAnimationFrame(() => requestAnimationFrame(resolve));
}));
Expand Down
1 change: 0 additions & 1 deletion e2e/binance-orderbook/helpers/visual-contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export async function readPanelVisualContract(page) {
'#jh-binance-close-qty-multiplier-dec',
'#jh-binance-close-qty-multiplier-inc',
'[data-orderbook-precision-value]',
'#jh-binance-ladder-toggle',
'[data-ladder-group]',
'[data-ladder-action]',
'[data-ladder-stop]',
Expand Down
1 change: 0 additions & 1 deletion e2e/binance-orderbook/scenarios/cancel-current-symbol.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ export function createCancelScenario(overrides = {}) {
openOrdersSubTab: 'basic',
hideOtherSymbols: false,
showOrders: true,
ladderExpanded: true,
tradeMode: 'OPEN',
orderbookPrecision: '0.1',
leverage: 2,
Expand Down
2 changes: 1 addition & 1 deletion e2e/binance-orderbook/specs/cancel-covering-matrix.pw.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ for (const entry of CANCEL_COVERING_SCENARIOS) {
const { errors } = await openUserscriptScenario(page, scenario);
await installInteractionProbe(page, CANCEL_BUTTON_SELECTOR);

await page.getByRole('button', { name: '撤本币挂单' }).click();
await page.getByRole('button', { name: '撤单' }).click();
if (!hasCurrentOrders) {
await expect(page.getByRole('button', { name: '无挂单' })).toBeVisible();
} else {
Expand Down
28 changes: 14 additions & 14 deletions e2e/binance-orderbook/specs/cancel-current-symbol.pw.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ test('no position and no orders returns immediate stable no-order feedback', asy
const { errors } = await openUserscriptScenario(page, scenario);
await installInteractionProbe(page, CANCEL_BUTTON_SELECTOR);

await page.getByRole('button', { name: '撤本币挂单' }).click();
await page.getByRole('button', { name: '撤单' }).click();
await expect(page.getByRole('button', { name: '无挂单' })).toBeVisible();

const state = await readFixtureState(page);
Expand All @@ -66,7 +66,7 @@ test('other-symbol position and orders never open a current-symbol cancel dialog
});
const { errors } = await openUserscriptScenario(page, scenario);

await page.getByRole('button', { name: '撤本币挂单' }).click();
await page.getByRole('button', { name: '撤单' }).click();
await expect(page.getByRole('button', { name: '无挂单' })).toBeVisible();

const state = await readFixtureState(page);
Expand All @@ -90,7 +90,7 @@ test('cancelling the native dialog preserves current and other orders and restor
const { errors } = await openUserscriptScenario(page, scenario);
await installInteractionProbe(page, CANCEL_BUTTON_SELECTOR);

await page.getByRole('button', { name: '撤本币挂单' }).click();
await page.getByRole('button', { name: '撤单' }).click();
await expect(page.getByRole('dialog')).toBeVisible();
await expect.poll(async () => (await readFixtureState(page)).showOrders).toBe(false);
await page.getByRole('button', { name: '取消' }).click();
Expand All @@ -113,7 +113,7 @@ test('confirming with mixed-symbol orders clears only the current symbol', async
});
const { errors } = await openUserscriptScenario(page, scenario);

await page.getByRole('button', { name: '撤本币挂单' }).click();
await page.getByRole('button', { name: '撤单' }).click();
await expect(page.getByRole('dialog')).toBeVisible();
await page.getByRole('button', { name: '确认' }).click();
await expect(page.getByText('HYPEUSDT 撤单流程结束,已恢复筛选状态')).toBeVisible();
Expand All @@ -133,7 +133,7 @@ test('an originally enabled symbol filter remains enabled after confirmation', a
});
const { errors } = await openUserscriptScenario(page, scenario);

await page.getByRole('button', { name: '撤本币挂单' }).click();
await page.getByRole('button', { name: '撤单' }).click();
await expect(page.getByRole('dialog')).toBeVisible();
await page.getByRole('button', { name: '确认' }).click();
await expect(page.getByText('HYPEUSDT 撤单流程结束,已恢复筛选状态')).toBeVisible();
Expand Down Expand Up @@ -179,7 +179,7 @@ for (const closeMethod of ['Escape', 'backdrop']) {
});
const { errors } = await openUserscriptScenario(page, scenario);

await page.getByRole('button', { name: '撤本币挂单' }).click();
await page.getByRole('button', { name: '撤单' }).click();
await expect(page.getByRole('dialog')).toBeVisible();
if (closeMethod === 'Escape') {
await page.keyboard.press('Escape');
Expand All @@ -204,7 +204,7 @@ test('a BFCache pagehide does not abort the active native dialog', async ({ page
});
const { errors } = await openUserscriptScenario(page, scenario);

await page.getByRole('button', { name: '撤本币挂单' }).click();
await page.getByRole('button', { name: '撤单' }).click();
await expect(page.getByRole('dialog')).toBeVisible();
await page.evaluate(() => window.dispatchEvent(new PageTransitionEvent('pagehide', {
persisted: true,
Expand All @@ -224,7 +224,7 @@ test('a real pagehide aborts dialog tracking without mutating orders', async ({
});
const { errors } = await openUserscriptScenario(page, scenario);

await page.getByRole('button', { name: '撤本币挂单' }).click();
await page.getByRole('button', { name: '撤单' }).click();
await expect(page.getByRole('dialog')).toBeVisible();
await page.evaluate(() => window.dispatchEvent(new PageTransitionEvent('pagehide', {
persisted: false,
Expand All @@ -248,7 +248,7 @@ test('a missing native dialog stops cleanly and restores temporary UI state', as
});
const { errors } = await openUserscriptScenario(page, scenario);

await page.getByRole('button', { name: '撤本币挂单' }).click();
await page.getByRole('button', { name: '撤单' }).click();
await expect(page.getByText('HYPEUSDT 未识别到撤单确认弹窗,未继续撤单流程')).toBeVisible({
timeout: 3_000,
});
Expand All @@ -269,7 +269,7 @@ for (const dialogMode of ['extraAction', 'missingPrimary']) {
});
const { errors } = await openUserscriptScenario(page, scenario);

await page.getByRole('button', { name: '撤本币挂单' }).click();
await page.getByRole('button', { name: '撤单' }).click();
await expect(page.getByText(
'HYPEUSDT 撤单确认弹窗结构异常,图表当前委托保持隐藏',
)).toBeVisible();
Expand All @@ -291,7 +291,7 @@ test('a delayed confirmation keeps visible progress and clears only the current
});
const { errors } = await openUserscriptScenario(page, scenario);

await page.getByRole('button', { name: '撤本币挂单' }).click();
await page.getByRole('button', { name: '撤单' }).click();
await page.getByRole('button', { name: '确认' }).click();
await expect(page.getByText('HYPEUSDT 已确认撤单,等待当前币挂单清空')).toBeVisible();
await expect(page.getByText('HYPEUSDT 撤单流程结束,已恢复筛选状态')).toBeVisible();
Expand All @@ -311,7 +311,7 @@ test('dialog tracking survives React replacing the native dialog subtree', async
});
const { errors } = await openUserscriptScenario(page, scenario);

await page.getByRole('button', { name: '撤本币挂单' }).click();
await page.getByRole('button', { name: '撤单' }).click();
await expect.poll(async () => (
await readFixtureState(page)
).events.filter((event) => event.type === 'dialog-replaced').length).toBe(1);
Expand All @@ -334,7 +334,7 @@ test('a confirmed dialog that does not clear current orders reports incomplete c
});
const { errors } = await openUserscriptScenario(page, scenario);

await page.getByRole('button', { name: '撤本币挂单' }).click();
await page.getByRole('button', { name: '撤单' }).click();
await page.getByRole('button', { name: '确认' }).click();
await expect(page.getByText('HYPEUSDT 当前币挂单仍存在,撤单流程未完成')).toBeVisible({
timeout: 10_000,
Expand All @@ -354,7 +354,7 @@ test('a symbol change before the dialog decision stops the captured-symbol workf
});
const { errors } = await openUserscriptScenario(page, scenario);

await page.getByRole('button', { name: '撤本币挂单' }).click();
await page.getByRole('button', { name: '撤单' }).click();
await expect(page.getByRole('dialog')).toBeVisible();
await page.evaluate((symbol) => {
history.pushState({}, '', `/zh-CN/futures/${symbol}`);
Expand Down
14 changes: 7 additions & 7 deletions e2e/binance-orderbook/specs/control-flows.pw.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ test('a precision shortcut selects the exact native orderbook option once', asyn

test('starting a ladder disables every start action and exposes one stop control', async ({ page }) => {
const scenario = createCancelScenario({
ui: { tradeMode: 'OPEN', orderbookPrecision: '0.1', ladderExpanded: true },
ui: { tradeMode: 'OPEN', orderbookPrecision: '0.1' },
});
const { errors } = await openUserscriptScenario(page, scenario);
const panel = page.locator(PANEL_SELECTOR);
Expand All @@ -103,19 +103,19 @@ test('starting a ladder disables every start action and exposes one stop control

await expect(startLong).toBeEnabled();
await expect(startShort).toBeEnabled();
await expect(stop).toBeDisabled();
await expect(stop).toHaveCount(0);
await installInteractionProbe(page, '[data-ladder-action="OPEN_LONG"]');
await startLong.click();
await expect(startLong).toBeDisabled();
await expect(startShort).toBeDisabled();
await expect(startLong).toHaveCount(0);
await expect(startShort).toHaveCount(0);
await expect(stop).toBeEnabled();
const submissionsBeforeStop = (await readFixtureState(page)).events
.filter((event) => event.type === 'order-submitted').length;
await stop.click();
await expect(panel.locator('#jh-binance-ladder-status')).toContainText('已停止');
await expect(startLong).toBeEnabled();
await expect(startShort).toBeEnabled();
await expect(stop).toBeDisabled();
await expect(stop).toHaveCount(0);
const probe = await finishInteractionProbe(page);
assertResponsiveInteraction(expect, probe);

Expand All @@ -132,7 +132,7 @@ test('starting a ladder disables every start action and exposes one stop control
test('a complete ladder submits the planned five native orders and restores controls', async ({ page }) => {
test.setTimeout(15_000);
const scenario = createCancelScenario({
ui: { tradeMode: 'OPEN', orderbookPrecision: '0.1', ladderExpanded: true },
ui: { tradeMode: 'OPEN', orderbookPrecision: '0.1' },
});
const { errors } = await openUserscriptScenario(page, scenario);
const panel = page.locator(PANEL_SELECTOR);
Expand All @@ -144,7 +144,7 @@ test('a complete ladder submits the planned five native orders and restores cont
timeout: 12_000,
});
await expect(startLong).toBeEnabled();
await expect(stop).toBeDisabled();
await expect(stop).toHaveCount(0);

const submissions = (await readFixtureState(page)).events
.filter((event) => event.type === 'order-submitted');
Expand Down
14 changes: 7 additions & 7 deletions e2e/binance-orderbook/specs/live-performance-probe.pw.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ test('live probe captures a no-order run and destroys every listener', async ({
const secondArm = await armLivePerformanceProbe(page, 'cancel-current-symbol-no-orders');
expect(secondArm.sessionId).toBe(firstArm.sessionId);

await page.getByRole('button', { name: '撤本币挂单' }).click();
await expect(page.getByRole('button', { name: '撤本币挂单' })).toBeEnabled();
await page.getByRole('button', { name: '撤单' }).click();
await expect(page.getByRole('button', { name: '撤单' })).toBeEnabled();
const snapshot = await finishLivePerformanceProbe(page);
expect(() => validateLivePerformanceProbeSnapshot(snapshot)).not.toThrow();
expect(snapshot.events.map((event) => event.kind)).toContain('first-feedback');
Expand All @@ -39,7 +39,7 @@ test('live probe captures a no-order run and destroys every listener', async ({

const beforeDestroy = snapshot.events.length;
await destroyLivePerformanceProbe(page);
await page.getByRole('button', { name: '撤本币挂单' }).click();
await page.getByRole('button', { name: '撤单' }).click();
expect(await page.evaluate(() => window.__BINANCE_LIVE_PERFORMANCE_PROBE__)).toBeUndefined();
expect(snapshot.events).toHaveLength(beforeDestroy);
});
Expand All @@ -54,7 +54,7 @@ test('live probe has no user-decision deadline and follows a replaced portal dia
await installLivePerformanceProbe(page);
await armLivePerformanceProbe(page, 'cancel-dialog-cancel');

await page.getByRole('button', { name: '撤本币挂单' }).click();
await page.getByRole('button', { name: '撤单' }).click();
await expect(page.getByRole('dialog')).toBeVisible();
await page.waitForTimeout(1_000);
const waiting = await page.evaluate(() => window.__BINANCE_LIVE_PERFORMANCE_PROBE__.snapshot());
Expand All @@ -78,7 +78,7 @@ test('live probe serializes uncaught errors and unhandled rejections', async ({
await installLivePerformanceProbe(page);
await armLivePerformanceProbe(page, 'serializable-errors');

await page.getByRole('button', { name: '撤本币挂单' }).click();
await page.getByRole('button', { name: '撤单' }).click();
await page.evaluate(() => {
window.dispatchEvent(new ErrorEvent('error', { message: 'probe test error' }));
const rejection = new Event('unhandledrejection');
Expand Down Expand Up @@ -131,8 +131,8 @@ test('live probe reports overflow and supports raw Runtime.evaluate injection',
await page.evaluate(createLivePerformanceProbeExpression({ eventLimit: 1 }));
await page.evaluate(() => window.__BINANCE_LIVE_PERFORMANCE_PROBE__.arm('overflow'));

await page.getByRole('button', { name: '撤本币挂单' }).click();
await expect(page.getByRole('button', { name: '撤本币挂单' })).toBeEnabled();
await page.getByRole('button', { name: '撤单' }).click();
await expect(page.getByRole('button', { name: '撤单' })).toBeEnabled();
const snapshot = await page.evaluate(() => window.__BINANCE_LIVE_PERFORMANCE_PROBE__.finish());
expect(snapshot.dropped.events).toBeGreaterThan(0);
expect(() => validateLivePerformanceProbeSnapshot(snapshot)).toThrow(/events overflowed/);
Expand Down
20 changes: 6 additions & 14 deletions e2e/binance-orderbook/specs/panel-visual-contract.pw.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,22 @@ async function expectVisualContract(page, name) {
expect(`${JSON.stringify(contract, null, 2)}\n`).toMatchSnapshot(name);
}

test('open expanded panel matches the stable visual contract', async ({ page }) => {
test('open panel matches the fixed visual contract', async ({ page }) => {
await openUserscriptScenario(page, createCancelScenario({
ui: { tradeMode: 'OPEN', ladderExpanded: true },
ui: { tradeMode: 'OPEN' },
}));
await expectPrecisionReady(page);
await expectVisualContract(page, 'open-expanded.visual.json');
await expectVisualContract(page, 'open-fixed.visual.json');
});

test('close expanded panel matches the disabled-state visual contract', async ({ page }) => {
test('close panel matches the disabled-state visual contract', async ({ page }) => {
await openUserscriptScenario(page, createCancelScenario({
positions: POSITION_SETS.current,
ui: { tradeMode: 'CLOSE', ladderExpanded: true },
ui: { tradeMode: 'CLOSE' },
}));
const panel = page.locator(PANEL_SELECTOR);
await expect(panel.getByRole('radio', { name: '平多' })).toBeEnabled();
await expect(panel.getByRole('radio', { name: '平空' })).toBeDisabled();
await expectPrecisionReady(page);
await expectVisualContract(page, 'close-expanded.visual.json');
});

test('collapsed ladder keeps the compact panel visual contract', async ({ page }) => {
await openUserscriptScenario(page, createCancelScenario({
ui: { tradeMode: 'OPEN', ladderExpanded: false },
}));
await expectPrecisionReady(page);
await expectVisualContract(page, 'open-collapsed.visual.json');
await expectVisualContract(page, 'close-fixed.visual.json');
});
Loading
Loading