Skip to content

biancadanforth/price-tracker

 
 

Repository files navigation

Price Wise

Price Wise is a Firefox extension that tracks price changes to help you find the best time to buy.

Developer Setup

Prerequisites:

  • A recent version of Node.js and NPM
  1. Clone the repository:

    git clone https://github.com/mozilla/price-wise.git
    cd price-wise
  2. Install dependencies:

    npm install
  3. Build the extension:

    npm run build
  4. Run the built extension in a test browser:

    npm start

Running Tests

Automated tests are run in a Firefox browser instance using Marionette. We use the Python client for Marionette since there is no up-to-date JavaScript client.

To set up your environment for running the tests, you must have:

  • A Firefox binary. On MacOS, this can be found within the .app folder at Firefox.app/Contents/MacOS/firefox.
  • Python 2.7
  • Pipenv

With these installed, you can set up the test suite:

  1. Install Python dependencies:

    pipenv install
  2. Save the path to your Firefox binary with npm:

    npm config set price-wise:firefox_bin <PATH_TO_FIREFOX_BINARY>

After this, you can run pipenv run test to run the automated test suite.

Scripts

Command Description
npm start Launch Firefox with the extension temporarily installed
npm run lint Run linting checks
npm run build Compile source files with Webpack
npm run watch Watch for changes and rebuild
npm run package Package the extension into an XPI file
pipenv run test Run test suite (See "Running Tests" for setup)

Code Organization

  • src/background contains the background scripts that trigger UI elements (such as the page action) and periodically check for price updates.
  • src/browser_action contains the toolbar popup for managing the list of currently-tracked products and tracking new products.
  • src/extraction contains the content scripts that extract product information from product web pages.
  • src/state contains the Redux-based code for managing global extension state.
  • src/tests contains the automated test suite.

Data Storage

Global state for the add-on is managed via Redux. Any time the data is changed, it is persisted to the add-on local storage.

Reducers, action creators, etc. are organized into ducks inside the src/state directory.

License

The Commerce WebExtension is licensed under the MPL v2.0. See LICENSE for details.

About

WebExtension for the Commerce project

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • JavaScript 88.9%
  • CSS 6.9%
  • Shell 2.1%
  • Python 1.9%
  • HTML 0.2%