Skip to content

Latest commit

 

History

History
267 lines (179 loc) · 8.03 KB

TESTING_GUIDE.md

File metadata and controls

267 lines (179 loc) · 8.03 KB

Testing Guide

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.

Formatting & Style

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.

Getting Started with ESLint

To Install

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.

Running ESLint

Run from the root directory where package.json is located.

To see options:

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.

To lint a js file:

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 */

Updating Dependencies

Github's Dependabot may alert potential security issues in dependencies.

To view and fix these issues:

npm audit
npm audit fix
npm update

(NOT) Updating build.js (optional)

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.

Old Info

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.

Automated Tests

To Install

To setup the testing environment, run npm install to install required packages. This should create directory node_modules and populate it with modules.

Running Tests

To run tests: npm test.

When writing a test for example.js create a new file in the test directory named example.spec.js.

Manual Tests

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.

Context Settings

Tests
Wayback Machine Count Any URL
Replace 404s, etc...

404 Page not found:

410 Page has gone:

Domain no longer exists:

Contextual Notices

Should display yellow dot, 'Show Context':

Should return data but NOT display yellow dot:

404 Not Found with Context Notice:

Wikipedia Resources

Should display blue 'R', 'Cited Books', 'Cited Papers':

Should display blue 'R' and 'Cited Papers', but No Books.

Should display blue 'R' and 'Cited Books', but No Papers.

Should not display 'R':

Other domains & languages:

Amazon Books

Should display blue 'R' and 'Read Book':

TV News Clips

Should display blue 'R' and 'TV News Clips':

List of websites checked:

General Settings

Tests
Auto Save Page TODO
Email Outlinks TODO
Show Resources During Save TODO
Show Features in Tab / Window TODO

General

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.