mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 07:07:39 +00:00
fix: wait for extension relay tab reconnects (#32461) (thanks @AaronWander)
This commit is contained in:
@@ -151,4 +151,29 @@ describe("browser server-context ensureTabAvailable", () => {
|
||||
vi.useRealTimers();
|
||||
}
|
||||
});
|
||||
|
||||
it("still fails after the extension-tab grace window expires", async () => {
|
||||
vi.useFakeTimers();
|
||||
try {
|
||||
const responses = [
|
||||
[{ id: "A", type: "page", url: "https://a.example", webSocketDebuggerUrl: "ws://x/a" }],
|
||||
[{ id: "A", type: "page", url: "https://a.example", webSocketDebuggerUrl: "ws://x/a" }],
|
||||
...Array.from({ length: 20 }, () => []),
|
||||
];
|
||||
stubChromeJsonList(responses);
|
||||
const state = makeBrowserState();
|
||||
|
||||
const ctx = createBrowserRouteContext({ getState: () => state });
|
||||
const chrome = ctx.forProfile("chrome");
|
||||
await chrome.ensureTabAvailable();
|
||||
|
||||
const pending = expect(chrome.ensureTabAvailable()).rejects.toThrow(
|
||||
/no attached Chrome tabs/i,
|
||||
);
|
||||
await vi.advanceTimersByTimeAsync(3_500);
|
||||
await pending;
|
||||
} finally {
|
||||
vi.useRealTimers();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -65,7 +65,9 @@ describe("git commit resolution", () => {
|
||||
const repoHead = execFileSync("git", ["rev-parse", "--short=7", "HEAD"], {
|
||||
cwd: repoRoot,
|
||||
encoding: "utf-8",
|
||||
}).trim();
|
||||
})
|
||||
.trim()
|
||||
.slice(0, 7);
|
||||
|
||||
const temp = await makeTempDir("git-commit-cwd");
|
||||
const otherRepo = path.join(temp, "other");
|
||||
@@ -81,7 +83,9 @@ describe("git commit resolution", () => {
|
||||
const otherHead = execFileSync("git", ["rev-parse", "--short=7", "HEAD"], {
|
||||
cwd: otherRepo,
|
||||
encoding: "utf-8",
|
||||
}).trim();
|
||||
})
|
||||
.trim()
|
||||
.slice(0, 7);
|
||||
|
||||
process.chdir(otherRepo);
|
||||
const { resolveCommitHash } = await import("./git-commit.js");
|
||||
@@ -95,7 +99,9 @@ describe("git commit resolution", () => {
|
||||
const repoHead = execFileSync("git", ["rev-parse", "--short=7", "HEAD"], {
|
||||
cwd: repoRoot,
|
||||
encoding: "utf-8",
|
||||
}).trim();
|
||||
})
|
||||
.trim()
|
||||
.slice(0, 7);
|
||||
|
||||
const { resolveCommitHash } = await import("./git-commit.js");
|
||||
const entryModuleUrl = pathToFileURL(path.join(repoRoot, "src", "entry.ts")).href;
|
||||
@@ -161,7 +167,9 @@ describe("git commit resolution", () => {
|
||||
const repoHead = execFileSync("git", ["rev-parse", "--short=7", "HEAD"], {
|
||||
cwd: repoRoot,
|
||||
encoding: "utf-8",
|
||||
}).trim();
|
||||
})
|
||||
.trim()
|
||||
.slice(0, 7);
|
||||
|
||||
const { resolveCommitHash } = await import("./git-commit.js");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user