-
-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Creating the core test suite #392
Comments
The biggest issue I am able to predict here is that we may not have a good way to test our ability to set DOM signals and send headers, our two most important functionalities. I am not sure if we are able to do this because Mocha likely doesn't provide a web page where we can test our code on. It is hard to tell if we can properly set the DOM signal if we can't check where we injected the script to see if it worked or not. The same goes for our headers. If we can find some way to test with a web page (possibly with a headless browser), this would instead be an issue of checking the As a workaround for Chrome, assuming we trust our dynamic rules and content scripts to do their jobs, we could instead test our abilities to register content scripts, modify content scripts, and create/ remove dynamic rules. Firefox does not make use of these and the basis on which it decides to apply DOM signals/headers are based on local variables which would be more difficult to test. |
To point us in a direction, I think that creating test suites to use the functions in |
That is the general limitation of all unit test frameworks. Some functionality, e.g., retrieving data from a database, client-server interaction, or pushing buttons on the UI, is difficult to test. For those it may be necessary to set up some fake data coming in, hardcode the signal of a button-push, etc. I am not familiar with Mocha in particular, but generally mocking and using test fixtures is the way to go in those cases. |
As @sophieeng and I discussed, I now believe it is possible to test the DOM signal. Specifically, I decided to look at unit tests made by Duckduckgo. They have two files that I believe will be helpful: |
Excellent! Let's do it! |
I am trying to replicate the same test as duckduckgo does in their test-canvas.js file involving opening a web page and scraping the needed information, but I am missing some information on two packages that they use, |
As discussed, let's try to finish the test suite by mid-February, at which point we also should make a new release. |
I've been able to create a test for the header and the gpc signal by using the 'https://global-privacy-control.glitch.me/' site. @sophieeng and I might look at some other aspects of the extension and see whether we can test them using puppeteer and mocha. |
@sophieeng and I tested a few other aspects with puppeteer and did not find them to be successful, but we are satisfied with testing the GPC Dom and Header signal. I will push the changes to main and close this issue. |
The Manual UI Testing Procedure which I Oliver and I are discussing how to add to the ReadMe. |
The merge conflicts are now resolved, but I had to make it so the puppeteer gpc test doesn't run with the continuous integration. This way, it will only run with |
I will create a checklist in this issue of the core tests for the test suite. This is referring to the most important functions to test and will give a basic skeleton that we can begin to add onto.
The text was updated successfully, but these errors were encountered: