fix(playwright): fix JSON parser to match real Playwright output format#193
Open
USerik wants to merge 1 commit intortk-ai:masterfrom
Open
fix(playwright): fix JSON parser to match real Playwright output format#193USerik wants to merge 1 commit intortk-ai:masterfrom
USerik wants to merge 1 commit intortk-ai:masterfrom
Conversation
Three bugs caused `rtk playwright test` to always fail with EXIT: 1: 1. **Wrong argument order**: `--reporter=json` was inserted before the subcommand (e.g. `playwright --reporter=json test`), but Playwright requires flags after the subcommand (`playwright test --reporter=json`). 2. **Float duration deserialization**: `PlaywrightStats.duration` was typed as `u64`, but real Playwright output emits a float (e.g. `3519.703...`), causing serde_json to fail with a type error. 3. **Wrong suite structure**: Suites contain `specs` (not `tests`). Each spec has `ok: bool` and `tests` (per-browser executions). The old struct used `tests: Vec<PlaywrightTest>` directly in suites, which never matched real output and always failed JSON parsing. Fixes: - Move `--reporter=json` to after the first arg (the subcommand) - Change `duration: u64` to `duration: f64` in `PlaywrightStats` - Rewrite `PlaywrightSuite` → `specs: Vec<PlaywrightSpec>` - Add `PlaywrightSpec` with `ok: bool` and `tests: Vec<PlaywrightExecution>` - Add `PlaywrightExecution` with `status` and `results: Vec<PlaywrightAttempt>` - Update `PlaywrightAttempt` to use `errors: Vec<PlaywrightError>` (array) - Add tests covering float duration, real suite structure, and failure details Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Collaborator
|
Thanks for this! Could you rebase on master? The branch is 2 commits behind. We'll review once it's up to date. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three bugs caused
rtk playwright testto always fail with EXIT: 1:Wrong argument order:
--reporter=jsonwas inserted before the subcommand (e.g.playwright --reporter=json test), but Playwright requires flags after the subcommand (playwright test --reporter=json).Float duration deserialization:
PlaywrightStats.durationwas typed asu64, but real Playwright output emits a float (e.g.3519.703...), causing serde_json to fail with a type error.Wrong suite structure: Suites contain
specs(nottests). Each spec hasok: boolandtests(per-browser executions). The old struct usedtests: Vec<PlaywrightTest>directly in suites, which never matched real output and always failed JSON parsing.Fixes:
--reporter=jsonto after the first arg (the subcommand)duration: u64toduration: f64inPlaywrightStatsPlaywrightSuite→specs: Vec<PlaywrightSpec>PlaywrightSpecwithok: boolandtests: Vec<PlaywrightExecution>PlaywrightExecutionwithstatusandresults: Vec<PlaywrightAttempt>PlaywrightAttemptto useerrors: Vec<PlaywrightError>(array)