Skip to content
This repository was archived by the owner on Dec 1, 2017. It is now read-only.

Latest commit

 

History

History
314 lines (232 loc) · 9.84 KB

File metadata and controls

314 lines (232 loc) · 9.84 KB

Installation

You'll need normal unix command-line utilities. Currently the build process has only been tested/maintained on Mac/Linux systems.

If you want to try it on Windows, then installing MozillaBuild will provide some tools for the command line.

Assuming you have the basic utilities, then you also need:

Building

You can simply run:

$ make build

You can also automatically rebuild whenever a file is changed. To do this you can use the command to run the standalone server:

$ make runserver

Running

You may wish to create a fresh profile in which to test and develop the add-on. To do this use the following command:

$ /path/to/firefox -createProfile <profilename>

(Replace with the name of the profile to create).

On Mac you need to reference the firefox executable within the application, e.g.

$ /Applications/FirefoxNightly.app/Contents/MacOS/firefox -createProfile <profilename>

You can then run the add-on with:

$ ./bin/runfx.js -b nightly -p <profilename>

One time only: When Firefox opens you must go to the URL about:config and look for the setting xpinstall.signatures.required. This must be set to false. Then go to Tools > Add-ons and find the Firefox Hello addon. You must manually re-enable the add-on.

Testing

To run all tests for the repository, you can use the command:

$ make test

Eslint

We use eslint to parse the Loop files and check them for correctness before landing. Eslint can be integrated into various editors to run the checks whilst making changes to the files.

You can run just eslint with

$ make eslint

Unit tests

Our unit tests aim to test each unit of code individually. The tests are written as HTML pages using mocha, chai and sinon.

The tests are run in the Karma harness which also measures code coverage. We aim for 100% test coverage on new code.

The add-on/panels tests are by default run in Firefox release only. The shared and standalone tests are run in Firefox and Chrome.

You can run just the karma tests with:

$ make karma

For developing and debugging, the tests can be loaded in a normal web browser. First make sure you have the standalone server running:

$ make runserver

Then load http://localhost:3000/test/ in your browser. This will give you links to the individual test suites.

UI Showcase

This is a very helpful development tool. It includes views of almost all the different possible layouts visible in the Loop code, in the desktop and standalone.

This means you can easily develop the layout of the views in a web context, before trying them within the panel and conversation window of the browser itself.

To view the ui-showcase, you can either visit the link from http://localhost:3000/test/ or visit http://localhost:3000/ui/ direct.

xpcshell and mochitest

These are tests for the chrome modules and files.

Test Export to Mozilla Central

The mozilla-central repo is cloned locally and is used as the xpcshell and mochitest test build. See [the simple Firefox build instructions] (https://developer.mozilla.org/docs/Mozilla/Developer_guide/Build_Instructions/Simple_Firefox_build) for setting up a repository for a Firefox build. There is also a git-cinnibar wrapper to allow using git for the repository.

Note: different integration branches may be used, e.g. most of the team develops against fx-team

Resetting mozilla-central repo for pull and export

If mozilla-central has already been cloned and was used for a previous export and build, you can reset the repo:

mozilla-central$ git checkout fx-team
mozilla-central$ git reset --hard HEAD
mozilla-central$ git clean -f
mozilla-central$ git status
mozilla-central$ hg pull
mozilla-central$ hg purge .
mozilla-central$ hg update -r default

Once reset, you should not see mozilla-central/browser/extensions/loop/ directory or files. You can now pull fx-team latest.

mozilla-central$ git pull
mozilla-central$ hg pull

Git export from loop repo

You can export from any branch of the repository, but it is generally advised for it to be based on latest master for running tests.

You can set your default export_mc location by setting the environment variable EXPORT_MC_LOCATION to the location of your repository. If you do not set the environment variable it defaults to ../gecko-dev

loop$ make export_mc

Run status to show the add-on extension directory and files now appear in the mozilla-central repo.

Building mozilla-central

It will take some time to build.

mozilla-central$ ./mach build

Running Tests

To run all the tests for both XPCShell and Mochitest

mozilla-central$ ./mach test browser/extensions/loop/chrome/test

You can run all tests for XPCShell, Mochitest and specific tests.

mozilla-central$ ./mach test browser/extensions/loop/chrome/test/xpcshell/
mozilla-central$ ./mach test browser/extensions/loop/chrome/test/xpcshell/loopservice_locales.js
mozilla-central$ ./mach test browser/extensions/loop/chrome/test/mochitest/
mozilla-central$ ./mach test browser/extensions/loop/chrome/test/mochitest/browser_toolbarbutton.js

Updating mozilla-central on code changes

To update mozilla-central tests from loop you must export_mc again after changes have been made.

loop$ make export_mc

If browser.ini for mochitest changes you must run this in mozilla-central then you can run tests:

mozilla-central$ ./mach build browser/extensions/loop

Run all tests relevant to Loop

If you are doing big changes, you might want to run all tests that are known that could be broken by Loop. To do that, run this command:

mozilla-central$ sh ./browser/extensions/loop/run-all-loop-tests.sh

Testing mochitests on the try server is necessary as some tests may fail on other platforms. Please see Push-To-Try.md for how to setup and push to Try server.

Functional Tests

These are tests that verify Loop at a higher level. The basic test is to set up a room, connect a remote standalone user to it, and check there is two-way video.

The functional tests by default will communicate with a development loop server.

To run the functional tests you can do:

$ make functional

By default the tests run against the dev server (hosted online), using Firefox Nightly build.

There are various options you can specify as environment variables, e.g.

$ TEST_BROWSER=aurora make functional

The options are:

  • TEST_BROWSER
    • A branch reference for the type of Firefox to run, e.g. nightly, aurora, beta or firefox
    • The path to the browser you wish to run the tests against.
  • TEST_SERVER
    • A reference to the loop-server to use for testing:
      • local - use a locally set-up loop-server. Use LOOP_SERVER to set the file location, it defaults to ../loop-server.
      • dev - use the dev server.
      • stage - use the staging server.
      • prod - use the production server. Please only use this setting for testing releases.
  • USE_LOCAL_STANDALONE
    • This is by default set to 1 and will use the files from the local repo for the standalone part of Loop.
    • If set to 0 this will cause the remote pages associated with the server to be tested, e.g. using stage with 0 will use the staging loop-server and the staging standalone pages.

Standalone UI

The standalone part of Loop (also known as the link-clicker UI) can be viewed in any web browser, and is hosted on a server. You can hook the development server up to talk to one of the servers to be able to test changes to the standalone UI.

To do this, setup the standalone server as described above, then rather than a simple make runserver, do:

$ LOOP_SERVER_URL=https://path/to/server make runserver

Replace the server path with one of:

(Generally its better to use the development server than the production one to avoid affecting the stats of production usage).

For the desktop side (also known as the link-generator) to use the development server:

You should now be able to join the room with that instance.