Skip to content
Open
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
12 changes: 12 additions & 0 deletions packages/server-v4/openapi.v4.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2715,6 +2715,12 @@ components:
enum:
- jsevent
- xy
expectDownload:
type: boolean
expectNavigation:
type: boolean
expectPopup:
type: boolean
required:
- selector
additionalProperties: false
Expand Down Expand Up @@ -6585,6 +6591,12 @@ components:
enum:
- jsevent
- xy
expectDownload:
type: boolean
expectNavigation:
type: boolean
expectPopup:
type: boolean
required:
- selector
- method
Expand Down
4 changes: 3 additions & 1 deletion packages/server-v4/src/schemas/v4/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,9 @@ export const PageClickParamsSchema = PageWithPageIdSchema.extend({
clickCount: z.number().int().lte(3).gte(1).optional(),
returnSelector: z.boolean().default(false).optional(),
method: z.enum(["jsevent", "xy"]).default("xy"),
// TODO: add expectDownload, expectNavigation, expectPopup OR expect: z.enum(...)
expectDownload: z.boolean().optional(),
expectNavigation: z.boolean().optional(),
expectPopup: z.boolean().optional(),
})
.strict()
.meta({ id: "PageClickParams" });
Expand Down
16 changes: 16 additions & 0 deletions packages/server-v4/test/integration/v4/page.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -932,6 +932,22 @@ describe("v4 page routes", { concurrency: false }, () => {
assertSuccessAction(jseventCtx, "click");
});

it("POST /v4/page/click accepts expect* options", async () => {
const gotoCtx = await postPageRoute("goto", sessionId, {
url: CLICK_TEST_URL,
waitUntil: "load",
});
assertSuccessAction(gotoCtx, "goto");

const clickCtx = await postPageRoute("click", sessionId, {
selector: { css: "#click-target" },
expectNavigation: true,
expectPopup: false,
expectDownload: false,
});
assertSuccessAction(clickCtx, "click");
});

it("POST /v4/page/dragAndDrop accepts mixed selector types (xpath from, coordinates to)", async () => {
const gotoCtx = await postPageRoute("goto", sessionId, {
url: METHODS_TEST_URL,
Expand Down
Loading