testing-library / testing-playground

Simple and complete DOM testing playground that encourage good testing practices.

Home Page:https://testing-playground.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Host Playground locally/on internal server

sztahanova opened this issue · comments

Summary 💡

I have found no information about how to host a testing playground locally during testing or on an internal server. As we are using React Testing Library in a company environment, it raises privacy and legal issues to send out code snippets to an external site. Is there any way to get around this? Or we should just stick to React Testing Library's screen.debug() and make do with it? Thanks!

Motivation 🔦

We would like to avoid any issues by sending out private code snippets to an external site and still be able to use the awesomeness of the Testing Playground.

@sztahanova thanks for raising this.

As long as I'm aware we don't keep any data, but rather react-testing-library will generate a string based on your markup (using https://www.npmjs.com/package/lz-string) and append it to the React Playground url. I don't think you need to be concerned on privacy as that string will only be available for you on your browser.

Hope that helps.

As @aganglada correctly mentions, your code will not leave your machine. And the way @testing-library/dom generates the playground links, are also client side. Even when opening them in de browser.

The url part after the # is always client side. Servers don't receive this data.

If your concern is about the implementation in dom-testing-library, you could file an issue there to make the url generation optional. But again, there is no communication between your code, testing lib, and the playground server.

Feel free to put a network logger at it, if you don't want to take my word for it. 😊

Closing the issue here, as it's out of the scope of testing-playground. It's the scope of https://github.com/testing-library/dom-testing-library

ps. Testing-playground.com is open source, so you could host your own server. It could be interesting to make the playground url in dom-testing-library configurable.

Alternatively, you could stick to the Chrome and Firefox extensions. Which are more suited for corporate projects anyway.

Feel free to keep the discussion going. I'm not closing it to silence you.

Cc @kentcdodds

Thank you both @aganglada and @smeijer for your quick and detailed responses, you've been of great help!