⚡️ 加速 GM_xhr E2E 测试 - #1749
Open
cyfung1031 wants to merge 1 commit into
Open
⚡️ 加速 GM_xhr E2E 测试#1749cyfung1031 wants to merge 1 commit into
cyfung1031 wants to merge 1 commit into
Conversation
Collaborator
Author
Before✓ e2e/gm-api.spec.ts:1010:3 › GM API › GM_xhr tests (gm_xhr_test.js) (39.8s) After✓ e2e/gm-api.spec.ts:1021:3 › GM API › GM_xhr tests (gm_xhr_test.js) (14.9s) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist / 检查清单
N/A — no issue was linked to this performance request.
背景
e2e/gm-api.spec.ts:1021:3runs 138 sequential GM request cases. The local mock already avoids ordinary external requests, but its timeout, abort, and streaming cases still waited for multi-second server delays, making the test take 38.8s locally.本次改动
/hangresponse that keeps a request in flight for timeout and abort assertions without sleeping for a real remote delay.example/tests/gm_xhr_test.jsand production code unchanged.实现考虑
The timeout and abort contracts require an unfinished request and the matching callback sequence, not a specific three-, five-, or ten-second wall-clock delay. The progress cases still send eight chunks and retain the
progressEvents >= 4assertion. Requests still cross the real browser → extension → local HTTP server boundary; only the mock server response timing is shortened.已知限制
The compressed timings apply only to this committed E2E harness patch. The example test keeps its original timings for manual or other callers.
建议审查重点
/hangmust remain an open local request until the extension timeout or explicit abort closes it.验证
time pnpm exec playwright test e2e/gm-api.spec.ts -g 'GM_xhr tests \(gm_xhr_test.js\)' --reporter=line— 138/138 passed, 38.8s wall time.time pnpm exec playwright test e2e/gm-api.spec.ts --reporter=line— 12/12 passed, 38.2s.pnpm run build— passed; existing bundle-size/Monaco warnings remain.pnpm run lint— passed (Prettier, TypeScript, i18n, issue-template checks, ESLint).