kamranayub / cypress-browser-permissions

A Cypress plugin to set launched browser preferences including permissions like Geolocation, Notifications, Microphone, etc.
https://kamranicus.com/cypress-browser-permissions
MIT License
64 stars 4 forks source link

feat: use per-site permissions instead of managed content #6

Open kamranayub opened 4 years ago

kamranayub commented 4 years ago

I have seen whispers of setting the specific site URLs to allow instead, which I think would ultimately be a better approach. managed_default_content_settings is a heavy hammer that works but probably isn't the idiomatic way to handle this in the Chrome profile. Somewhere, a site's individual settings are stored and we may be able to poke at that.

I think we could check this fairly easily by setting it in the Cypress browser UI under Site Settings, then spelunking into the Cypress profile file to determine where it gets saved. That location is available in chrome://version I think.

kamranayub commented 3 years ago

I noticed in Edge by viewing the Preferences file that it stores things in

profile.default.content_settings.exceptions

in this format:

"notifications": {
          "http://localhost:51631,*": {
            "expiration": "0",
            "last_modified": "13281503591035274",
            "model": 0,
            "setting": 1
          },
}

So that may be an option?