leak-inspector icon indicating copy to clipboard operation
leak-inspector copied to clipboard

Write tests for critical functionality

Open gunesacar opened this issue 2 years ago • 4 comments

We should have tests covering (at least) the basic functionality such as sniff detection and leaky request blocking. The simplest way could be to use Selenium, similar to Privacy Badger: https://github.com/EFForg/privacybadger/tree/master/tests

Unfortunately Playwright doesn't (yet) support Firefox add-ons: https://github.com/microsoft/playwright/issues/7297

gunesacar avatar May 23 '22 17:05 gunesacar

I've been working on an add-on to run tests ... check it out: leak-inspector-tests

grundt avatar Jun 10 '22 02:06 grundt

Thank you @grundt. Sorry for the delay due to holidays.

While I understand some of the advantages of using an add-on, I wonder if a fully automated solution is possible, so we can run CI tests against the repo. If you don't have the bandwidth, feel free to leave it as is. Your add-on code will already be very useful even if we choose to go another direction. Thanks so much.

gunesacar avatar Jun 30 '22 09:06 gunesacar

Maybe someone better adept at unit test frameworks can get the ball rolling in that direction.

On a different matter, can you @gunesacar comment on how you'd feel about making modifications to LeakInspector in the way proposed here (i.e. placing LeakInspector "state" somewhere that's accessible from the browser context, solely to support testing)

I could envision expanding beyond just the "badge" state, to also include "popup" state, plus the sniff and leak details, making all of those more easily testable.

grundt avatar Jun 30 '22 14:06 grundt

On a different matter, can you @gunesacar comment on how you'd feel about making modifications to LeakInspector in the way proposed here (i.e. placing LeakInspector "state" somewhere that's accessible from the browser context, solely to support testing)

I could envision expanding beyond just the "badge" state, to also include "popup" state, plus the sniff and leak details, making all of those more easily testable.

I like that it allows testing the badge state and has potential to do more. I've mixed feelings about exposing additional state -- even though I know that it'll only work on sites in the matches list (localtest.me?). I wonder how other extensions are testing similar features.

gunesacar avatar Jul 07 '22 21:07 gunesacar