You do not need to follow this guide if you only want to try out the extension.
This document covers steps to take for both Automated and Manual Tests. It's a good idea to check after making major code changes, prior to a Pull Request, and before submitting to the app stores.
This guide isn't complete. Please add additional tests. After fixing a bug, see if you can create an automated regression test, but if that isn't easy to do, please add a description for a manual test to try below.
After modifying code, run eslint to catch basic formatting and syntax issues. This will not catch everything in the Style Guide, so you should review that as well. Rules are defined in the .eslintrc.json
file.
If you haven't already set up your testing environment, run npm install
to install the required packages including eslint
which is listed in package.json
.
Run from the root directory where package.json
is located.
npx eslint
This runs the version of eslint located at node_modules/.bin/
. Some people install eslint globally on their system. If that is your case you may leave out the npx
part if you want.
npx eslint webextension/scripts/example.js
- Recommend not using the
--fix
option but first try to fix it manually.
To avoid no-undef
errors that may occur with external global variables or functions, add it to a comment around the top of the file, like so:
/* global fooVar, barFunc */
Github's Dependabot may alert potential security issues in dependencies.
To view and fix these issues:
npm audit
npm audit fix
npm update
We are no longer generating build.js, but instead using javascript frameworks directly. All code must be readable and non-minified to pass Firefox code review, so no longer using webpack for the main webextension code. Libraries such as jQuery and Bootstrap are to be located in the libs
directory.
This doesn't have to be done but once in a great while. We recommend doing so in it's own branch or Pull Request instead of in a bug or feature PR that you're working on.
Sometimes the npm modules need updating. Most are only used in the testing environment and are not used in the final extension. The few that are used in the extension should be packed into the file /webextension/scripts/build.js
To recreate build.js run npm run-script build
which will run webpack.
To setup the testing environment, run npm install
to install required packages. This should create directory node_modules
and populate it with modules.
To run tests: npm test
.
When writing a test for example.js
create a new file in the test directory named example.spec.js
.
Checklist of items to test through visual inspection.
While testing API calls, a couple of tools that I find useful is the Chrome browser's DevTools Network tab, and the desktop application Charles Proxy.
Tests | |
---|---|
Auto Save Page | TODO |
Email Outlinks | TODO |
Show Resources During Save | TODO |
Show Features in Tab / Window | TODO |
Tests | |
---|---|
URLs |
In Bulk Save, check that Import All Bookmarks will decode when adding URLs to list: #729
Test that SPN works on URLs containing percent-encodings: #279 Check above URLs work with Wayback (Oldest, Overview, Newest), Social Links, Copy to Clipboard. Test that URLs which are excluded from the Wayback Machine don't Auto-Save, buttons disabled, message shows. See issue #944 and PR #951 for screenshots.
|