gregsadetsky / chrome-dont-add-custom-search-engines

Google Chrome extension that stops sites from adding custom search engines
https://chrome.google.com/webstore/detail/dont-add-custom-search-en/dnodlcololidkjgbpeoleabmkocdhacc
Other
118 stars 12 forks source link

Add tests #7

Open cxw42 opened 6 years ago

cxw42 commented 6 years ago

Per discussion with @gregsadetsky. It would be nice to have some!

It's tricky, though, since we can't access (or even navigate to!) the pertinent settings page (link here - go there and try clicking! see what happens).

We can, however, loop over a list of testcases (e.g., document.querySelector('.wiki-content table') in the wiki page) and, for each:

I have used Jasmine, which I believe would not have a problem with this type of test. It has asynchronous support, so we could bounce messages through the background between a Jasmine popup and the windows it creates.

Better ideas welcome!

snowbound commented 6 years ago

I briefly had this installed but noticed that it has issues with bleepingcomputer.com where if you search for anything on the site then bleepingcomputer.com is added to your search engines.

cxw42 commented 6 years ago

@snowbound Thanks for reporting! The branch from #6, or the current Chrome Web Store version (0.0.1)? The #6 version works for me on bleepingcomputer.

snowbound commented 6 years ago

I downloaded it via https://github.com/gregsadetsky/chrome-dont-add-custom-search-engines and loaded it via UnPacked extension in Chrome via Developer Mode. I went to Bleeping Computer, entered garbage in their search box. Went into Chrome's Search Engine list and bleepingconputer.com was in the list.

cxw42 commented 6 years ago

@snowbound OK - that's the old version, which is known to fail. Thanks for confirming! The pull-6 version (zip) should work if you unload the version you have, and then load the pull-6 version unpacked.

For the record, thanks to @gregsadetsky for finding this article showing that Selenium can access chrome://* pages. He says "we'd have to see if the automated testing sites out there (travis, circle ci, etc.) support this."

cxw42 commented 6 years ago

@gregsadetsky Any objection to a gh-pages branch to hold tests? I ran a combinatorial test suite here and would like to move it out of my personal site and put it in better condition to automate. Source.

gregsadetsky commented 6 years ago

@cxw42 great idea, go for it! thank you!

cxw42 commented 6 years ago

@gregsadetsky I added the gh-pages branch. Would you please turn it on in the settings? Thanks!

gregsadetsky commented 6 years ago

sorry, what do you mean by turn it on? I see that "Your GitHub Pages site is currently being built from the gh-pages branch" but I'm not sure which URL this repo would appear on

it's a bit of a mess, as my gregsadetsky.github.io points to another repo right now

thoughts?

cxw42 commented 6 years ago

OK - how about this different approach? A test extension so that pressing a button will perform searches on all the known problematic sites. After you press that button, you can visit chrome://settings/searchEngines to see if any were added.

Implementation outline:

cxw42 commented 5 years ago

I am updating the wiki page to list full Query URL rather than just site. That way we will have a database on which to run automated tests.