ghostery / adblocker

Efficient embeddable adblocker library
https://www.ghostery.com
Mozilla Public License 2.0
752 stars 93 forks source link

Add E2E testing for adblockers #4050

Open seia-soto opened 1 week ago

seia-soto commented 1 week ago

Introduction

This PR adds E2E testing for adblockers: adblocker-puppeteer, adblocker-playwright, adblocker-electron, and adblocker-webextension. The motivation of adding E2E testing comes from the replace modifier support. I found that implementing an E2E test to adblocker library doesn't make sense because adblocker library itself doesn't represent or illustrates end-user environment.

The tests will end up same as unit tests. Note that not all of adblocker library is implemented due to some challenges:

adblocker-electron

adblocker-webextension This package itself doesn't represent the webextension. We'll need to prepare a complete adblocker implementation for this.

We may use adblocker-webextension-example but it's still at the open discussion.

Approach

Warning The discussion for the direction is not completed yet. The sort of things in this section is to describe the current approach.

  1. Setup a shared testing helper library that opens a server serves testing website.
  2. The script included in the testing website performs the actual test and report it to DOM.
  3. Each adblocker implementation visits the page and grabs the testing result from the DOM.