Skip to content
Source
Sign inSign up
TanStack/devtools

feat(devtools): add hideInAutomation to keep devtools out of e2e tests #549

MergedAlemTuzlakmerged 5 commits intomain fromrefs/pull/549/headmerged by AlemTuzlak View on GitHub

Showing 9 changed files with 14 additions and 0 deletions (loading 6).

x
0 of 9 viewed, 9 left
5 additions and 0 deletions.changeset/hide-in-automation.mdAdded
View file
@@ -0,0 +1,5 @@
+---
+'@tanstack/devtools': minor
+---
+​
+Add the `hideInAutomation` config option. When it is `true`, the devtools do not render in a browser that automation drives (Playwright, Cypress, Selenium), detected by `navigator.webdriver`. This keeps the devtools out of end-to-end test selectors. The default is `false`.
6 additions and 0 deletionsdocs/configuration.mdModified
View file
@@ -71,6 +71,12 @@
{ requireUrlFlag: boolean }
```
​
+- `hideInAutomation` - Does not render the devtools when a browser is driven by automation (Playwright, Cypress, Selenium). This keeps the devtools out of your end-to-end test selectors. The check uses `navigator.webdriver`. The default is `false`.
+​
+```ts
+{ hideInAutomation: boolean }
+```
+​
- `openAsModal` - Moves the open panel on top of a modal dialog of your app. A dialog that you open with `dialog.showModal()` makes the rest of the page inert, the devtools included. While the panel is on top, your dialog is inert. Close the panel to use your dialog again. The trigger is inert while your dialog is open, so open the panel with the open hotkey. The default is `false`.
​
```ts
3 additions and 0 deletionse2e/apps/react-vite/src/main.tsxModified
View file
@@ -27,6 +27,9 @@
config={{
theme: 'dark',
requireUrlFlag: new URLSearchParams(location.search).has('gated'),
+ hideInAutomation: new URLSearchParams(location.search).has(