Skip to content

fix(server-v4): accept expect* options on /v4/page/click#2052

Open
BABTUNA wants to merge 1 commit intobrowserbase:mainfrom
BABTUNA:feat-server-v4-click-expect
Open

fix(server-v4): accept expect* options on /v4/page/click#2052
BABTUNA wants to merge 1 commit intobrowserbase:mainfrom
BABTUNA:feat-server-v4-click-expect

Conversation

@BABTUNA
Copy link
Copy Markdown
Contributor

@BABTUNA BABTUNA commented Apr 25, 2026

why

/v4/page/click still had a schema TODO for click expectation flags and rejected payloads containing expectDownload, expectNavigation, or expectPopup.

Closes #2051.

what changed

  • Updated PageClickParamsSchema to accept optional booleans:
    • expectDownload
    • expectNavigation
    • expectPopup
  • Added integration coverage in page.test.ts to assert /v4/page/click accepts expect* options.
  • Regenerated packages/server-v4/openapi.v4.yaml so the new click params are documented.

validation

  • npm.cmd exec prettier -- --write packages/server-v4/src/schemas/v4/page.ts packages/server-v4/test/integration/v4/page.test.ts
  • node node_modules/typescript/bin/tsc -p packages/server-v4/tsconfig.json --noEmit
  • node --import=tsx -e "...app.inject('/v4/page/click' with expect* params)..." (status 200)
  • node --import=tsx packages/server-v4/scripts/gen-openapi.ts

Summary by cubic

Updated /v4/page/click to accept expectDownload, expectNavigation, and expectPopup so clients can declare expected side-effects. This fixes rejected payloads and documents the new params.

  • Bug Fixes
    • Extended PageClickParamsSchema with optional booleans: expectDownload, expectNavigation, expectPopup.
    • Added integration test to confirm /v4/page/click accepts these options.
    • Regenerated packages/server-v4/openapi.v4.yaml to include the new params.

Written for commit dd81cd4. Summary will update on new commits. Review in cubic

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 25, 2026

⚠️ No Changeset found

Latest commit: dd81cd4

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions
Copy link
Copy Markdown
Contributor

This PR is from an external contributor and must be approved by a stagehand team member with write access before CI can run.
Approving the latest commit mirrors it into an internal PR owned by the approver.
If new commits are pushed later, the internal PR stays open but is marked stale until someone approves the latest external commit and refreshes it.

@github-actions github-actions Bot added external-contributor Tracks PRs mirrored from external contributor forks. external-contributor:awaiting-approval Waiting for a stagehand team member to approve the latest external commit. labels Apr 25, 2026
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.
Architecture diagram
sequenceDiagram
    participant Client as Test/Client
    participant API as API Route (/v4/page/click)
    participant Zod as PageClickParamsSchema
    participant Driver as Browser Automation Driver

    Note over Client,Driver: Page Click Request Flow

    Client->>API: POST /v4/page/click
    Note right of Client: Body: { selector, expectNavigation: true, ... }

    API->>Zod: validate(requestBody)
    
    alt Valid Payload
        Zod-->>API: NEW: Returns params including expectDownload/Navigation/Popup
        API->>Driver: performClick(params)
        Note over Driver: Executes click and waits for<br/>specified side-effects
        Driver-->>API: Success
        API-->>Client: 200 OK
    else Invalid Payload (strict validation)
        Note over Zod: CHANGED: No longer rejects<br/>expect* keys
        Zod-->>API: Validation Error
        API-->>Client: 400 Bad Request
    end

    Note over API,Zod: Schema updated to permit optional booleans<br/>previously marked as TODO.
Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external-contributor:awaiting-approval Waiting for a stagehand team member to approve the latest external commit. external-contributor Tracks PRs mirrored from external contributor forks.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

server-v4: add expect* click params to /v4/page/click

1 participant