Skip to content

test(query-devtools/Devtools): add tests for opening a picture-in-picture window#10760

Merged
sukvvon merged 1 commit into
mainfrom
test/query-devtools-devtools-pip-open
May 23, 2026
Merged

test(query-devtools/Devtools): add tests for opening a picture-in-picture window#10760
sukvvon merged 1 commit into
mainfrom
test/query-devtools-devtools-pip-open

Conversation

@sukvvon
Copy link
Copy Markdown
Collaborator

@sukvvon sukvvon commented May 23, 2026

🎯 Changes

Extend Devtools.test.tsx with tests that lock the entry points for the Devtools picture-in-picture window — clicking the inline PiP button opens a popup window with the expected target / features and persists pip_open, and a stored pip_open=true triggers the same auto-open on mount.

Added cases (picture-in-picture, 2):

  • should open a PiP window when the picture-in-picture button is clicked — stubs window.open with a fake PiP window, clicks the inline PiP button, and asserts the open call shape and the pip_open localStorage value.
  • should automatically open a PiP window when "pip_open" is "true" in "localStorage" — seeds pip_open=true in localStorage and asserts the pip_open reactive effect calls window.open on mount without any explicit click.

The new picture-in-picture describe ships a typed FakePipWindow (Pick<Window, ...>) and a stubPipWindow() helper so subsequent PiP scenarios (popup blocked, in-page panel toggle, pagehide) can reuse the same setup.

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm run test:pr.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

Summary by CodeRabbit

  • Tests
    • Added test coverage for Picture-in-Picture functionality in DevTools, verifying window opening behavior and state persistence through local storage.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 23, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a07a2c80-6e0d-47e5-b341-5cb122edd327

📥 Commits

Reviewing files that changed from the base of the PR and between b94b24e and 3bdac28.

📒 Files selected for processing (1)
  • packages/query-devtools/src/__tests__/Devtools.test.tsx

📝 Walkthrough

Walkthrough

This PR adds test coverage for Picture-in-Picture functionality in the query devtools. Tests verify that clicking the PiP button opens a window with the correct parameters and persists the pip_open flag to localStorage, and that the PiP window auto-opens on initial render when the flag is already enabled.

Changes

Picture-in-Picture Tests

Layer / File(s) Summary
PiP window and auto-open behavior tests
packages/query-devtools/src/__tests__/Devtools.test.tsx
Test suite stubs window.open to verify PiP opens with correct window name, width, height, and popup features; asserts localStorage persistence of pip_open state; and validates auto-open behavior when the flag is pre-set.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested labels

package: query-devtools

Poem

🐰 A window within a window opens wide,
PiP tests ensure it works with pride,
localStorage remembers the view,
Auto-open happens on cue,
DevTools now shines, unified! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding tests for picture-in-picture window functionality in the Devtools component.
Description check ✅ Passed The description follows the template structure with complete 🎯 Changes and ✅ Checklist sections, including detailed test case descriptions and Release Impact clarification.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/query-devtools-devtools-pip-open

Comment @coderabbitai help to get the list of available commands and usage tips.

@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented May 23, 2026

View your CI Pipeline Execution ↗ for commit 3bdac28

Command Status Duration Result
nx affected --targets=test:sherif,test:knip,tes... ✅ Succeeded 3m 43s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 26s View ↗

☁️ Nx Cloud last updated this comment at 2026-05-23 05:01:32 UTC

@github-actions
Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

No changeset entries found. Merging this PR will not cause a version bump for any packages.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 23, 2026

More templates

@tanstack/angular-query-experimental

npm i https://pkg.pr.new/@tanstack/angular-query-experimental@10760

@tanstack/eslint-plugin-query

npm i https://pkg.pr.new/@tanstack/eslint-plugin-query@10760

@tanstack/lit-query

npm i https://pkg.pr.new/@tanstack/lit-query@10760

@tanstack/preact-query

npm i https://pkg.pr.new/@tanstack/preact-query@10760

@tanstack/preact-query-devtools

npm i https://pkg.pr.new/@tanstack/preact-query-devtools@10760

@tanstack/preact-query-persist-client

npm i https://pkg.pr.new/@tanstack/preact-query-persist-client@10760

@tanstack/query-async-storage-persister

npm i https://pkg.pr.new/@tanstack/query-async-storage-persister@10760

@tanstack/query-broadcast-client-experimental

npm i https://pkg.pr.new/@tanstack/query-broadcast-client-experimental@10760

@tanstack/query-core

npm i https://pkg.pr.new/@tanstack/query-core@10760

@tanstack/query-devtools

npm i https://pkg.pr.new/@tanstack/query-devtools@10760

@tanstack/query-persist-client-core

npm i https://pkg.pr.new/@tanstack/query-persist-client-core@10760

@tanstack/query-sync-storage-persister

npm i https://pkg.pr.new/@tanstack/query-sync-storage-persister@10760

@tanstack/react-query

npm i https://pkg.pr.new/@tanstack/react-query@10760

@tanstack/react-query-devtools

npm i https://pkg.pr.new/@tanstack/react-query-devtools@10760

@tanstack/react-query-next-experimental

npm i https://pkg.pr.new/@tanstack/react-query-next-experimental@10760

@tanstack/react-query-persist-client

npm i https://pkg.pr.new/@tanstack/react-query-persist-client@10760

@tanstack/solid-query

npm i https://pkg.pr.new/@tanstack/solid-query@10760

@tanstack/solid-query-devtools

npm i https://pkg.pr.new/@tanstack/solid-query-devtools@10760

@tanstack/solid-query-persist-client

npm i https://pkg.pr.new/@tanstack/solid-query-persist-client@10760

@tanstack/svelte-query

npm i https://pkg.pr.new/@tanstack/svelte-query@10760

@tanstack/svelte-query-devtools

npm i https://pkg.pr.new/@tanstack/svelte-query-devtools@10760

@tanstack/svelte-query-persist-client

npm i https://pkg.pr.new/@tanstack/svelte-query-persist-client@10760

@tanstack/vue-query

npm i https://pkg.pr.new/@tanstack/vue-query@10760

@tanstack/vue-query-devtools

npm i https://pkg.pr.new/@tanstack/vue-query-devtools@10760

commit: 3bdac28

@github-actions
Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
react full 12.1 KB (0%)
react minimal 9.07 KB (0%)

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant