mirror of
https://github.com/Tencent/BrowserSkill.git
synced 2026-09-10 13:01:23 +08:00
fix(record): saftey policy and rebase bug fix
This commit is contained in:
1 parent
a74f5b136e
commit
ff084d7d31
4 files changed
+16
-4
No files matched your search
@@ -139,8 +139,10 @@ describe("RecordingObservationRuntime", () => {
|
|||||||
|
|
||||||
await recording.captureInitial(4);
|
await recording.captureInitial(4);
|
||||||
const transition = await recording.captureTabTransition(4, 5);
|
const transition = await recording.captureTabTransition(4, 5);
|
||||||
|
await recording.captureInitial(4);
|
||||||
|
await recording.captureInitial(5);
|
||||||
|
|
||||||
expect(transition).toMatchObject({
|
expect(transition).toEqual({
|
||||||
preStateId: "s1",
|
preStateId: "s1",
|
||||||
postStateId: "s2",
|
postStateId: "s2",
|
||||||
targetUrl: "https://example.com/second",
|
targetUrl: "https://example.com/second",
|
||||||
|
|||||||
@@ -26,4 +26,14 @@ describe("RecordingTabCoordinator", () => {
|
|||||||
tabs.commit(6);
|
tabs.commit(6);
|
||||||
expect(tabs.currentTabId).toBe(6);
|
expect(tabs.currentTabId).toBe(6);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("commits the freshly observed URL when returning to an existing tab", () => {
|
||||||
|
const tabs = new RecordingTabCoordinator(4);
|
||||||
|
tabs.navigation(5, "https://example.com/old");
|
||||||
|
|
||||||
|
tabs.commit(5, "https://example.com/new");
|
||||||
|
|
||||||
|
expect(tabs.currentTabId).toBe(5);
|
||||||
|
expect(tabs.navigation(5).currentUrl).toBe("https://example.com/new");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
@@ -40,7 +40,8 @@ export class RecordingTabCoordinator {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
commit(tabId: number): void {
|
commit(tabId: number, currentUrl?: string): void {
|
||||||
|
if (currentUrl !== undefined) this.navigation(tabId).currentUrl = currentUrl;
|
||||||
this.#currentTabId = tabId;
|
this.#currentTabId = tabId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -255,8 +255,7 @@ async function activateRecordingTab(
|
|||||||
};
|
};
|
||||||
recording.steps.push(draft);
|
recording.steps.push(draft);
|
||||||
recording.observation?.bindTabTransition(draft, recording.steps.length);
|
recording.observation?.bindTabTransition(draft, recording.steps.length);
|
||||||
recording.tabs.navigation(targetTabId, targetUrl);
|
recording.tabs.commit(targetTabId, targetUrl);
|
||||||
recording.tabs.commit(targetTabId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function processRecordedStep(
|
async function processRecordedStep(
|
||||||
|
|||||||
Reference in new issue
Block a user