Skip to content

Commit 374b4de

Browse files
Cover negative wait timeout normalization in script tests
Co-authored-by: Shri Sukhani <shrisukhani@users.noreply.github.com>
1 parent 53fab61 commit 374b4de

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

src/agent/shared/action-cache.test.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,27 @@ describe("action cache helpers", () => {
126126
expect(script).toContain("waitForTimeout(0)");
127127
});
128128

129+
it("normalizes negative wait durations to default timeout", () => {
130+
const waitEntry: ActionCacheEntry = {
131+
stepIndex: 8,
132+
instruction: "wait negative",
133+
elementId: null,
134+
method: null,
135+
arguments: ["-10"],
136+
actionType: "wait",
137+
success: true,
138+
message: "ok",
139+
frameIndex: null,
140+
xpath: null,
141+
};
142+
143+
const script = createScriptFromActionCache({
144+
steps: [waitEntry],
145+
});
146+
147+
expect(script).toContain("waitForTimeout(1000)");
148+
});
149+
129150
it("skips helper generation when xpath is missing", () => {
130151
const actElementEntry: ActionCacheEntry = {
131152
stepIndex: 3,

0 commit comments

Comments
 (0)