fix(driver): reset command log nesting after grouped commands in cy.origin #33289
+184
−13
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.
Additional details
This PR fixes a bug where grouped commands (e.g. within) inside cy.origin() did not reset the Command Log nesting level, causing subsequent groups to appear nested under the previous one.
Root cause
Cross‑origin logs were mutating or inheriting the primary origin’s log group stack (logGroupIds), so the group level did not properly reset after a grouped command finished.
Fix
Prevent cross‑origin logs from mutating primary logGroupIds (ignore groupStart/groupEnd in primary).
Pass originLogGroupLevel/Id metadata from cy.origin to the spec bridge.
Only fill groupLevel/group when missing, preserving already computed values.
Impact
Grouped commands inside cy.origin() now exit correctly, so subsequent commands appear at the expected nesting level.
Steps to test
- Run:
yarn workspace @packages/driver cypress:run --spec cypress/e2e/e2e/origin/commands/log.cy.ts- (Optional, visual) Open mode:
yarn workspace @packages/driver cypress:open --e2eRun log.cy.ts and confirm the second 'within' is at the same level as the first.
How has the user experience changed?
Before
After the first grouped command finishes inside cy.origin(), the Command Log group level does not decrease.
Subsequent commands appear incorrectly nested as if still inside the previous group.
After
Grouped commands inside cy.origin() correctly exit their group.
Subsequent commands display at the correct log level.
(Screenshots/GIF: add before/after if available)
PR Tasks
cypress-documentation?type definitions?