Skip to content

Testing the OptMeowt Analysis Extension

Sebastian Zimmeck edited this page Jun 21, 2024 · 3 revisions

After making modifications to the OptMeowt Analysis extension, it must be re-packed into an XPI file (instructions here). Then, it can be tested to ensure it is analyzing sites properly.

The extension can be tested either by running the crawler, where extension installation and site loading is done by Selenium, or by dragging and dropping the XPI file into a Firefox Nightly browser, where you have installed the extension and are loading sites. Regardless of the installation and site loading method, the extension will automatically start analysis after a site has loaded, and you must be running the REST API for analysis data to be added to the database. The advantage of installing the extension by dragging and dropping it into a Firefox Nightly browser is that you are not using Selenium to load the site. Many sites will block you if you use Selenium to load it too many times.

Visually, a proper analysis sequence will look like this: 1) site loads 2) after 7 seconds, the extension logo turns yellow 3) site reloads 4) after 7 seconds, extension logo turns back to blue 5) data for that site should be in the database. If this sequence doesn’t happen, it is useful to look at the logs in the debugging table to see where things went wrong. Any debugging logs are posted to the debugging table in analysis.js using the function post_to_debug.

Look to make sure that data was added to the database and that the REST API is still running. Then, you should verify that the data added to the database is correct. To do this, compare the data in the database to the data you manually collect for that site before and after a GPC signal is sent. GPC signals can be sent in Firefox Nightly by visiting about:config and toggling the two settings below to true:

Screenshot 2024-03-11 at 12 47 20 AM.

To collect manual data, open the Firefox developer tools by holding down the fn key and pressing f12 (on a Mac). You can manually check that correct data was collected for all database columns, but usually it suffices to just check the ones you have modified.

APIs: Check that the USPS and GPP data returned by their respective APIs in the console log matches the data logged in the database by the extension. Use the following commands:

  • __uspapi('getUSPData', 1, (data) => { console.log("USP Data: ", data); });
  • __gpp('ping', (data, success) => {console.log(data, success ); });
  • if the site has GPP version 1 and you can't see a GPP string from the ping result, use this command instead: __gpp('getGPPData', (data, success) => {console.log(data, success ); });.

Here's an example of what this looks like when the site has both implemented.

Screenshot 2024-03-11 at 12 19 40 AM

If a reference error is returned for an API call (like below), the database should have the value null for that column.

Screenshot 2024-03-11 at 12 42 12 AM

Cookies: Check that the values for the US privacy (named usprivacy or us_privacy), OptanonConsent, OneTrustWPCCPAGoogleOptOut, and OTGPPConsent cookies in the first party cookies under the Storage section of the browser developer tools matches the data logged in the database by the extension.

Here's an example of what this looks like when all cookies exist.

Screenshot 2024-03-11 at 12 30 27 AM

If a cookie does not exist, the database should have a value of null for that cookie.

Clone this wiki locally