fix(server-v4): accept expect* options on /v4/page/click#2052
fix(server-v4): accept expect* options on /v4/page/click#2052BABTUNA wants to merge 1 commit intobrowserbase:mainfrom
Conversation
|
|
This PR is from an external contributor and must be approved by a stagehand team member with write access before CI can run. |
There was a problem hiding this comment.
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.
why
/v4/page/clickstill had a schema TODO for click expectation flags and rejected payloads containingexpectDownload,expectNavigation, orexpectPopup.Closes #2051.
what changed
PageClickParamsSchemato accept optional booleans:expectDownloadexpectNavigationexpectPopuppage.test.tsto assert/v4/page/clickacceptsexpect*options.packages/server-v4/openapi.v4.yamlso 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.tsnode node_modules/typescript/bin/tsc -p packages/server-v4/tsconfig.json --noEmitnode --import=tsx -e "...app.inject('/v4/page/click' with expect* params)..."(status200)node --import=tsx packages/server-v4/scripts/gen-openapi.tsSummary by cubic
Updated
/v4/page/clickto acceptexpectDownload,expectNavigation, andexpectPopupso clients can declare expected side-effects. This fixes rejected payloads and documents the new params.PageClickParamsSchemawith optional booleans:expectDownload,expectNavigation,expectPopup./v4/page/clickaccepts these options.packages/server-v4/openapi.v4.yamlto include the new params.Written for commit dd81cd4. Summary will update on new commits. Review in cubic