testing-library / testing-playground

Simple and complete DOM testing playground that encourage good testing practices.
https://testing-playground.com
MIT License
788 stars 62 forks source link

Chrome extension doesn't work when third-party cookies are blocked #284

Closed SebastienWae closed 3 years ago

SebastienWae commented 4 years ago

Bug Report πŸ›

When third-party cookies are blocked in Chrome the main "Testing Playground" tab for the testing-playground extension doesn't work. The tab is empty and the console return the error: Uncaught DOMException: Failed to read the 'localStorage' property from 'Window': Access is denied for this document

To Reproduce βœ”οΈ

  1. Install the testing-playground extension in Chrome
  2. Go to chrome://settings/cookies
  3. Select "Block third-party cookies"
  4. Re-load the extension
  5. The Elements tab is working but the main "Testing Playground" tab is empty.

Expected behavior πŸ€”

The extension should try to work without localStorage if possible and display an error message informing the user to enable third-party cookies if required.

Suggested solution πŸ”¦

Looking at issues from other extensions (like bvaughn/react-devtools-experimental#292) the only solution is to wrap all calls to localStorage or sessionStorage in a try/catch.

Your Environment πŸ’»

marcosvega91 commented 4 years ago

Hi @SebastienWae thanks for reaching us :).

You're right, localStorage is used to save user settings like testid attribute and auto-run option to make them persistent even if you refresh the page.

I think that we could simply check the navigator.cookieEnabled property and save only in the case the cookies are enabled

smeijer commented 4 years ago

We've fixed it in the current develop version. The chrome extension in the store will be updated asap.

julienvera commented 3 years ago

Hi ! It seems the chrome extension in the store is still not updated (latest release is from July). Can you eventually push a newer release ? It is frustrating to have a painful bug fixed but not deployed

smeijer commented 3 years ago

Sorry, this slipped my mind. I've submitted the new version to the Chrome store, and we're waiting for review by the Chrome team. Usually, this will happen in just a few days. I don't know how the holidays will affect this, but please ping me here if the update isn't available in a few days.

smeijer commented 3 years ago

The extension has been published! πŸŽ‰ Please let me know if the problem persists.

julienvera commented 3 years ago

Problem fixed, thanks a lot πŸ™